nsBrowserContentHandler.js is gibberish
-
- Posts: 472
- Joined: July 5th, 2011, 6:32 am
nsBrowserContentHandler.js is gibberish
I'd like to modify some lines in nsBrowserContentHandler.js.
I've extracted omni.ja.
JS files in "omni\jsloader\resource\app\components" are gibberish (using Notepad++).
I have no problem opening JS files in omni\chrome\browser\content\browser.
Any idea?
Thank you.
I've extracted omni.ja.
JS files in "omni\jsloader\resource\app\components" are gibberish (using Notepad++).
I have no problem opening JS files in omni\chrome\browser\content\browser.
Any idea?
Thank you.
-
- Posts: 6421
- Joined: February 3rd, 2009, 6:29 pm
Re: nsBrowserContentHandler.js is gibberish
Dave Townsend wrote:Basically everything under the jsloader directory of omni.jar is a binary version of a shipped component or module.
https://bugzilla.mozilla.org/show_bug.cgi?id=691847#c50
Try deleting (1) and editing (2) in the browser/omni.ja archive.
1. jsloader/resource/app/components/nsBrowserContentHandler.js
2. components/nsBrowserContentHandler.js
And remember to purge the caches.
https://developer.mozilla.org/en/Extens ... _4#Caching
Override component - possible?
https://groups.google.com/forum/#!topic ... YEBviCniB8
Remember Passwords extension overrides components/nsLoginManager.js
https://addons.mozilla.org/firefox/addon/331315
-
- Posts: 472
- Joined: July 5th, 2011, 6:32 am
Re: nsBrowserContentHandler.js is gibberish
Thank you morat. I really appreciate your help.
I want to allow external links to open in a private window. I've changed the following lines in nsBrowserContentHandler.js ("omni\components"):
var allowPrivate = forcePrivate || PrivateBrowsingUtils.permanentPrivateBrowsing;
var navWin = RecentWindow.getMostRecentBrowserWindow({private: allowPrivate});
to:
// var allowPrivate = forcePrivate || PrivateBrowsingUtils.permanentPrivateBrowsing;
var navWin = RecentWindow.getMostRecentBrowserWindow({private: true});
***
If I delete the two files, how can I modify anything? I may have misunderstood you.
Purging the caches didn't help.
It seems that I have to modify the file in "omni\jsloader\resource\app\components" as well. I'm not a pro, and I don't know how to do that.
I'd appreciate your further assistance.
I want to allow external links to open in a private window. I've changed the following lines in nsBrowserContentHandler.js ("omni\components"):
var allowPrivate = forcePrivate || PrivateBrowsingUtils.permanentPrivateBrowsing;
var navWin = RecentWindow.getMostRecentBrowserWindow({private: allowPrivate});
to:
// var allowPrivate = forcePrivate || PrivateBrowsingUtils.permanentPrivateBrowsing;
var navWin = RecentWindow.getMostRecentBrowserWindow({private: true});
***
If I delete the two files, how can I modify anything? I may have misunderstood you.
Purging the caches didn't help.
It seems that I have to modify the file in "omni\jsloader\resource\app\components" as well. I'm not a pro, and I don't know how to do that.
I'd appreciate your further assistance.
- patrickjdempsey
- Posts: 23686
- Joined: October 23rd, 2008, 11:43 am
- Location: Asheville NC
- Contact:
Re: nsBrowserContentHandler.js is gibberish
Attempting to modify those files may be what has "scrambled" them, especially since you are running in a pre-release version that gets more updates than the release version.
Tip of the day: If it has "toolbar" in the name, it's crap.
What my avatar is about: https://addons.mozilla.org/en-US/seamonkey/addon/sea-fox/
What my avatar is about: https://addons.mozilla.org/en-US/seamonkey/addon/sea-fox/
-
- Posts: 6421
- Joined: February 3rd, 2009, 6:29 pm
Re: nsBrowserContentHandler.js is gibberish
You delete the binary file and edit the normal js file.
I edited the following line in the nsBrowserContentHandler.js file so that the preferences command line option opens the Page Info window instead of the Options dialog.
It works here.
Firefox ESR 24.5.0
Windows 7 SP1
I edited the following line in the nsBrowserContentHandler.js file so that the preferences command line option opens the Page Info window instead of the Options dialog.
Code: Select all
- var url = "chrome://browser/content/preferences/preferences.xul";
+ var url = "chrome://browser/content/pageinfo/pageInfo.xul";
Code: Select all
optimizejars.py --deoptimize "E:" "C:\Program Files\Mozilla Firefox\browser" "E:" > nul
unzip -l omni.ja | find "nsBrowserContentHandler.js"
zip -d omni.ja jsloader/resource/app/components/nsBrowserContentHandler.js
unzip omni.ja components/nsBrowserContentHandler.js
gvim components/nsBrowserContentHandler.js
zip omni.ja components/nsBrowserContentHandler.js
ren "C:\Program Files\Mozilla Firefox\browser\omni.ja" omni.old
optimizejars.py --optimize "E:" "E:" "C:\Program Files\Mozilla Firefox\browser" > nul
"C:\Program Files\Mozilla Firefox\firefox.exe" -purgecaches
"C:\Program Files\Mozilla Firefox\firefox.exe" -preferences
It works here.
Firefox ESR 24.5.0
Windows 7 SP1
-
- Posts: 472
- Joined: July 5th, 2011, 6:32 am
Re: nsBrowserContentHandler.js is gibberish
Thanks again morat. It's really kind of you.
Could you please elaborate on the second section?
I'm not familiar with the commands 'optimizejars.py' and 'gvim'.
And what's '-preferences'?
I'd appreciate it if you could explain to me the steps you've taken.
Regards.
Could you please elaborate on the second section?
I'm not familiar with the commands 'optimizejars.py' and 'gvim'.
And what's '-preferences'?
I'd appreciate it if you could explain to me the steps you've taken.
Regards.
-
- Posts: 6421
- Joined: February 3rd, 2009, 6:29 pm
Re: nsBrowserContentHandler.js is gibberish
I use the optimizejars.py python script to deoptimize and optimize the omni.ja file.
Usage: --optimize|--deoptimize JAR_LOG_DIR IN_JAR_DIR OUT_JAR_DIR
viewtopic.php?f=23&t=2752877
I use info-zip.org utilities to unzip and zip files.
unzip -l switch = list files in a zip file
zip -d switch = delete files in a zip file
http://www.info-zip.org/
Graphical Vim (i.e. gvim) is a text editor.
http://www.vim.org/
About omni.ja
https://developer.mozilla.org/en-US/docs/Mozilla/About_omni.ja_(formerly_omni.jar)
I just picked something at random to test...
Usage: --optimize|--deoptimize JAR_LOG_DIR IN_JAR_DIR OUT_JAR_DIR
viewtopic.php?f=23&t=2752877
I use info-zip.org utilities to unzip and zip files.
unzip -l switch = list files in a zip file
zip -d switch = delete files in a zip file
http://www.info-zip.org/
Graphical Vim (i.e. gvim) is a text editor.
http://www.vim.org/
About omni.ja
https://developer.mozilla.org/en-US/docs/Mozilla/About_omni.ja_(formerly_omni.jar)
Yaron10 wrote:And what's '-preferences'?
firefox.exe -help | more
Usage: firefox [ options ... ] [URL]
where options include:
-h or -help Print this message.
-v or -version Print Firefox version.
-P <profile> Start with <profile>.
-migration Start with migration wizard.
-ProfileManager Start with ProfileManager.
-no-remote Do not accept or send remote commands; implies -new-instance.
-new-instance Open new instance, not a new window in running instance.
-UILocale <locale> Start with <locale> resources as UI Locale.
-safe-mode Disables extensions and themes for this session.
-console Start Firefox with a debugging console.
-jsconsole Open the Error console.
-browser Open a browser window.
-new-window <url> Open <url> in a new window.
-new-tab <url> Open <url> in a new tab.
-preferences Open Options dialog.
-search <term> Search <term> with your default search engine.
-recording <file> Record drawing for a given URL.
-recording-output <file> Specify destination file for a drawing recording.
-setDefaultBrowser Set this app as the default browser.
I just picked something at random to test...
-
- Posts: 472
- Joined: July 5th, 2011, 6:32 am
Re: nsBrowserContentHandler.js is gibberish
Hi morat,
I appreciate your patience and apologize for the late reply (time zone).
With your permission, some more questions:
1) If I use optimizejars.py - should I delete the binary nsBrowserContentHandler.js file, or I get it as a text file and should modify it?
2) Is the following order correct? * deoptimize omni.ja * unzip omni.ja * modify the js files * optimize omni.ja * zip omni.ja *
3) I understand I should run optimizejars.py from the command line. What's the '> nul' parameter?
4) Should optimizejars.py work with FF 30?
Thanks again.
I appreciate your patience and apologize for the late reply (time zone).
With your permission, some more questions:
1) If I use optimizejars.py - should I delete the binary nsBrowserContentHandler.js file, or I get it as a text file and should modify it?
2) Is the following order correct? * deoptimize omni.ja * unzip omni.ja * modify the js files * optimize omni.ja * zip omni.ja *
3) I understand I should run optimizejars.py from the command line. What's the '> nul' parameter?
4) Should optimizejars.py work with FF 30?
Thanks again.
-
- Posts: 6421
- Joined: February 3rd, 2009, 6:29 pm
Re: nsBrowserContentHandler.js is gibberish
There are 2 nsBrowserContentHandler.js files in the browser/omni.ja archive in FF ESR 24.
gibberish file: jsloader/resource/app/components/nsBrowserContentHandler.js
text file: components/nsBrowserContentHandler.js
You need to delete the gibberish file and edit the text file in the browser/omni.ja archive. I assume it's the same for FF 30.
Batch How To
http://www.robvanderwoude.com/battech_redirection.php
I would think hacking an omni.ja archive is too difficult for someone who does not know how to use the command line.
I don't know. marty60 said it works with FF 27.
I get a warning if I list the files in an optimized omni.ja archive in FF ESR 24.
And no warning if I list the files in a deoptimized omni.ja archive in FF ESR 24.
If I deoptimize then optimize without deleting or editing a file in the archive then compare the archives - there would be no differences encountered in FF ESR 24.
FC command
http://www.computerhope.com/fchlp.htm
gibberish file: jsloader/resource/app/components/nsBrowserContentHandler.js
text file: components/nsBrowserContentHandler.js
You need to delete the gibberish file and edit the text file in the browser/omni.ja archive. I assume it's the same for FF 30.
What's the '> nul' parameter?
Batch How To
http://www.robvanderwoude.com/battech_redirection.php
I would think hacking an omni.ja archive is too difficult for someone who does not know how to use the command line.
Should optimizejars.py work with FF 30?
I don't know. marty60 said it works with FF 27.
I get a warning if I list the files in an optimized omni.ja archive in FF ESR 24.
Code: Select all
unzip -l omni.ja | find "nsBrowserContentHandler.js"
warning [omni.ja]: 4253366 extra bytes at beginning or within zipfile
(attempting to process anyway)
error [omni.ja]: reported length of central directory is
-4253366 bytes too long (Atari STZip zipfile? J.H.Holm ZIPSPLIT 1.1
zipfile?). Compensating...
31449 01/01/2010 00:00 jsloader/resource/app/components/nsBrowserContentHandler.js
30629 01/01/2010 00:00 components/nsBrowserContentHandler.js
And no warning if I list the files in a deoptimized omni.ja archive in FF ESR 24.
Code: Select all
unzip -l omni.ja | find "nsBrowserContentHandler.js"
31449 01/01/2010 00:00 jsloader/resource/app/components/nsBrowserContentHandler.js
30629 01/01/2010 00:00 components/nsBrowserContentHandler.js
If I deoptimize then optimize without deleting or editing a file in the archive then compare the archives - there would be no differences encountered in FF ESR 24.
FC command
http://www.computerhope.com/fchlp.htm
-
- Posts: 472
- Joined: July 5th, 2011, 6:32 am
Re: nsBrowserContentHandler.js is gibberish
Thanks again. I appreciate it.
I told you I wasn't a pro. But I can learn fast with a good teacher.
I deleted the binary file and edited the text file. I then re-zipped the files to omni.ja and placed the new file in the 'browser' folder.
It worked as I wanted and external links opened in a private window.
I didn't use optimizejars.py. I would have installed Python and used it, but meanwhile I found out that I could add '-private-window' to my Email Client and get what I want without modifying 'nsBrowserContentHandler.js'.
So - just for the knowledge - allow me to conclude with one last question:
If Firefox can work without the JS binary files, I assume that they're included in omni.ja for a better performance. Is that correct?
Best regards.
I told you I wasn't a pro. But I can learn fast with a good teacher.
I deleted the binary file and edited the text file. I then re-zipped the files to omni.ja and placed the new file in the 'browser' folder.
It worked as I wanted and external links opened in a private window.
I didn't use optimizejars.py. I would have installed Python and used it, but meanwhile I found out that I could add '-private-window' to my Email Client and get what I want without modifying 'nsBrowserContentHandler.js'.
So - just for the knowledge - allow me to conclude with one last question:
If Firefox can work without the JS binary files, I assume that they're included in omni.ja for a better performance. Is that correct?
Best regards.
-
- Posts: 6421
- Joined: February 3rd, 2009, 6:29 pm
Re: nsBrowserContentHandler.js is gibberish
I think omni.ja and jsloader exists solely to make Firefox start faster.
-
- Posts: 472
- Joined: July 5th, 2011, 6:32 am
Re: nsBrowserContentHandler.js is gibberish
Thank you. It's been a pleasure.
- Philip Chee
- Posts: 6475
- Joined: March 1st, 2005, 3:03 pm
- Contact:
Re: nsBrowserContentHandler.js is gibberish
morat wrote:I think omni.ja and jsloader exists solely to make Firefox start faster.
The jsloader files are pre-compiled Javascript byte-code. These allow Firefox to startup faster as the JS engine doesn't have to JIT compile the real .js files.
Phil
-
- Posts: 472
- Joined: July 5th, 2011, 6:32 am
Re: nsBrowserContentHandler.js is gibberish
Thank you Phil.