搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

Firefox 35 not recognizing user.js prefs

  • 12 个回答
  • 2 人有此问题
  • 2 次查看
  • 最后回复者为 JoeB

more options

I've used a user.js file for a long time. Until recently (Fx 35?) it always obeyed the prefs in user.js.

I created a new, clean (test) profile to use w/ Fx 35 & imported user.js from old profile. Then launched Fx w/ the new profile (no addons).

Browser behavior doesn't follow the prefs in user.js. I checked prefs.js & it shows the same prefs as in user.js, that's in the same profile.

Like, user.js has: "user_pref("browser.urlbar.trimURLs", false);. And prefs.js in the new profile shows that also, but Fx still trims the "http" off of URLs.

Same w/ the user.js entry: user_pref("browser.tabs.closeWindowWithLastTab", false);. It still closes Fx if last tab is closed (unless I change it in about:config).

I even created a new user.js file, copied contents from old one & saved into the new profile. No change.

Any ideas?

I've used a user.js file for a long time. Until recently (Fx 35?) it always obeyed the prefs in user.js. I created a new, <b>clean</b> (test) profile to use w/ Fx 35 & imported user.js from old profile. Then launched Fx w/ the new profile (no addons). Browser behavior doesn't follow the prefs in user.js. I checked prefs.js & it shows the <u>same prefs</u> as in user.js, that's in the same profile. Like, user.js has: "user_pref("browser.urlbar.trimURLs", false);. And prefs.js in the new profile shows that also, but Fx still trims the "http" off of URLs. Same w/ the user.js entry: user_pref("browser.tabs.closeWindowWithLastTab", false);. It still closes Fx if last tab is closed (unless I change it in about:config). I even created a new user.js file, copied contents from old one & saved into the new profile. No change. Any ideas?

由JoeB于修改

所有回复 (12)

more options

Can you post the full content of the user.js file?

Did you verify that the file is a .js file (likely JScript in Windows) and not a text file with a hidden .txt file extension?

more options

Thanks. I created (another) new, blank file & set it to javascript (using Notepad++ editor).

Then copied all entries from old user.js to new file. Saved it to a new profile - Notepad++ verified the ext. was *.js (under "save as type").

That replaced the existing user.js in this profile (in root folder of the profile, along w/ prefs.js).

Restarted Fx using the new profile & new user.js. Some of the same user.js prefs still aren't used by Fx (like: user_pref("browser.tabs.closeWindowWithLastTab", false);.

Because, the pref in about:config isn't being changed from True to False (& prefs.js isn't picking up the entry from user.js).

And, after starting Fx w/ the new(est) user.js, the prefs.js didn't have that entry from the user.js: user_pref("browser.tabs.closeWindowWithLastTab", false);.

Prefs.js should be picking up the user.js entries, once Fx is restarted - yes? Maybe I need to delete the prefs.js (from new profile), and just restart Fx - with only the user.js in it?

I assume Fx would then create a new prefs.js, and ? should also pick up entries from user.js?

Here's contents of newly created user.js (saved as a javascript file). * Do not remove the @namespace line -- it's required for correct functioning

*/

@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* set default namespace to XUL */

user_pref("accessibility.typeaheadfind.flashBar", 0); user_pref("app.update.auto", false); user_pref("browser.cache.disk.enable", false); user_pref("browser.cache.disk.smart_size.first_run", false); user_pref("browser.cache.disk.smart_size_cached_value", 573440); user_pref("browser.cache.disk_cache_ssl", false); user_pref("browser.cache.memory.capacity", 512000); user_pref("browser.cache.memory.max_entry_size", 51200); user_pref("browser.display.use_document_fonts", 0); user_pref("browser.download.dir", "E:\\DOWNLOADS"); user_pref("browser.download.manager.closeWhenDone", true); user_pref("browser.download.manager.retention", 0); user_pref("browser.download.panel.shown", true); user_pref("browser.download.save_converter_index", 0); user_pref("browser.download.useDownloadDir", false); user_pref("browser.formfill.enable", false); user_pref("browser.history_expire_days.mirror", 3); user_pref("browser.history_expire_days_min", 1); user_pref("browser.newtabpage.enabled", false); user_pref("browser.pagethumbnails.capturing_disabled", true); user_pref("browser.safebrowsing.enabled", false); user_pref("browser.safebrowsing.malware.enabled", false); user_pref("browser.search.openintab"; true); user_pref("browser.search.update", false); user_pref("browser.search.useDBForOrder", true); user_pref("browser.sessionstore.privacy_level", 2); user_pref("browser.sessionstore.resume_from_crash", false); user_pref("browser.startup.homepage", "about:blank"); user_pref("browser.tabs.closeWindowWithLastTab", false); user_pref("browser.tabs.loadInBackground", false); user_pref("browser.urlbar.autocomplete.enabled", false); user_pref("browser.urlbar.trimURLs", false); user_pref("config.trim_on_minimize; true"); user_pref("font.minimum-size.x-western", 15); user_pref("font.name.sans-serif.x-western", "DejaVu Sans"); user_pref("font.name.serif.x-western", "DejaVu Serif"); user_pref("font.size.fixed.x-western", 14); user_pref("geo.enabled", false); user_pref("layout.spellcheckDefault", 2); user_pref("network.cookie.cookieBehavior", 2); user_pref("network.cookie.prefsMigrated", true); user_pref("network.prefetch-next", false); user_pref("network.proxy.socks_remote_dns", true); user_pref("nglayout.initialpaint.delay", "2000"); user_pref("signon.rememberSignons", false); user_pref("ui.textSelectBackgroundAttention", "red"); user_pref(“general.useragent.override”, “Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:34.0) Gecko/20100101 Firefox/34.0“); user_pref(“pdfjs.disabled", true); user_pref("ui.SpellCheckerUnderlineStyle", 4);

more options

Can you figure out where in that list that Firefox stops reading that user.js file? That will tell you where you have a pref that is wrong or not used any longer.

I had it happen a few dozen times where a user.js only partially worked (or seemingly not at all) and a whole bunch of prefs weren't being recognized and sent to the prefs.js file. One mistake in one preference and Firefox will stop reading that file, leaving every pref after the mistake unusable, including the one with the error.

Although, the biggest problem I had was when I copied a user.js file to a different device and didn't have the same number of logical drives set up on that device as what I had to "contributing" device! And the pref that was expecting an E:\\ drive to be present was the second pref in the user.js file! DOH!

more options

I can use "Compare" plugin in Notepad ++. But, prefs.js has so many (other valid) entries, than the relatively few in user.js, not exactly sure how to tell "when it stopped reading user.js." Except maybe ? the 1st line (detected) in user.js that doesn't appear in prefs.js?

By "Firefox will stop reading that file" do you mean the line from user.js, that prefs.js stopped picking up user.js entries. OR... which user.js line stopped showing up as a "user set" pref in about:config? Or both?

BTW, I found a couple of syntax errors in the user.js. Dunno why - don't remember ever NOT just copy / pasting the pref(s) from a prefs.js into user.js. But maybe I did manually create a couple.

So, checking now if correcting those mistakes makes all prefs in user.js show up in prefs.js.

more options

Once Firefox reads an incorrect user_pref line in a user.js file it stops reading that file, so the incorrect line and all lines that follow won't make it into the prefs.js file. No alert is raised and no error log is generated - sometimes it is maddening to try to figure out which user_pref is the cause especially when it is near the bottom of a long user.js file.

more options

Thanks. There could be actual error(S) left in the user.js - that I didn't find & correct. But, Not that many entries & went over it well.

Did correct a couple & saved; restarted Fx (clean profile), but Fx / prefs.js still didn't pick up certain prefs from user.js, that I know are still valid (not deprecated). Like: "browser.tabs.closeWindowWithLastTab", false);.

That one still didn't show False in about:config (& still closed browser w/ last tab).

But, looking at the several lines just before that "closeWindowWithLastTab" (in user.js) for possible errors, can't find any. AND, when I changed that same pref to False - in about:config, then it showed up in prefs.js (& worked).

That "closeWindowWithLastTab" entry in the user.js was identical (in every detail) to what appeared in prefs.js, after manually editing about:config. Something obviously messed up (behind the scene).

Important! In user.js, would having these cause a problem in prefs.js picking up some things from user.js?: 1) deprecated prefs (but the entry(ies) & syntax was "correct" - before it was deprecated).

2) User.js prefs that are commented out, like: /* user_pref("ui.textSelectBackgroundAttention", "red"); */

In most files, commented out lines (even at 1st or middle of file) don't matter. Not sure about that in user.js & how prefs.js picks up from it.

more options

UPDATE: Still like opinions on my last questions - # 1 & 2 above. But, don't know what I did, but prefs.js now seems to be showing most of the user.js prefs.

At 1st, problem could have been the couple of syntax errors in user.js. After fixing those & then, while comparing user.js & prefs.js - using the "Compare" plugin in Notepad++, it crashed. Not sure what that did.

But, after re-opening & comparing those files (from their folder) using WinMerge, closing files, then restarting Fx, the prefs in user.js now seem to (mostly) show in both prefs.js & about:config.

Before re-opening in WinMerge (didn't edit the files in WinMerge), it definitely wasn't picking up everything in user.js. Now I may never know how I "fixed" it. Unless WinMerge fixed file formatting that Notepad++ messed up.

more options

1) None of my prefs in user.js have been deprecated, so I haven't experienced ignored prefs due the being deprecated. For me it was always syntax errors.

2) That /* and */ is for comments in css files. For js it's // to start a comment line and the line is closed with  : [a colon].

Also, I just re-read all you postings in this thread - these lines apply only to a userChrome.css file - not userContent.css or user.js. /* Do not remove the @namespace line -- it's required for correct functioning */ @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* set default namespace to XUL */

Sorry that I didn't spot that earlier.

more options

As posted above, the lines at the beginning shouldn't be there, only user_pref() call should be in the user.js file. You also miss the leading '/', so Firefox might reject the file because of this.

* Do not remove the @namespace line -- it's required for correct functioning

*/

@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* set default namespace to XUL */ 

You shouldn't copy the full content of a prefs.js file to a user.js file as that will give serious problems because changes to prefs made by Firefox aren't carried over to the next session (they will be restored on every start to the state as saved in the user.js file).

You also include prefs that are no longer used in the current release. These two are an example:

user_pref("browser.history_expire_days.mirror", 3);
user_pref("browser.history_expire_days_min", 1);

You should only modify prefs if you understand the consequences of what you are doing, especially if you include them in a user.js file.

It is usually best to only use the user.js file once to initialize prefs in a new profile or have deleted the prefs.js file to reset all prefs by renaming the file after this has happened. You can use a second version of user.js to set prefs that you regularly change during a session and want to reset to a known default state on each Firefox start.

Do you have a particular reason to disable the phishing protection?

user_pref("browser.safebrowsing.enabled", false);
user_pref("browser.safebrowsing.malware.enabled", false);
more options

Thanks - yes, I knew the standard way to comment out lines in js was with double "//," but didn't do it in that file (another mistake).

However, that raises the question, why does Mozilla use "/*" & "*/" for the comments, at beginning of every Fx created prefs.js file? (As below).

Mozilla User Preferences. /* Do not edit this file. If you make changes to this file while the application is running, the changes will be overwritten when the application exits. To make a manual change to preferences, you can visit the URL about:config */

Every prefs.js has those comments w/ the leading "/*" & trailing " */ ." The "formatting" of the posted example comments are a bit messed up, by the forum's editor software, but the point is - they use "/*."

Are double slashes "//" intended for commenting out, in & among the actual lines of code? Versus the canned comments at beginning of every prefs.js file, that obviously don't use "//"?

I will correct syntax for any commented out prefs - or remove them.

But FWIW, my "final" user.js (the one that's working) - doesn't have any of the "@namespace url" line or any general comments, but DOES have a few prefs lines, "commented out" using " /* <pref> */ - as Mozilla's canned comments in prefs.js.

I checked every (non-deprecated) pref in that user.js - line by line - against the about:config values (& whether it showed "user set").

It apparently ignored the incorrect commenting out syntax. Every pref & value in the user.js file is in about:config. I won't use the incorrect syntax - just sayin'.

You can use a second version of user.js to set prefs that you regularly change during a session and want to reset to a known default state on each Firefox start.

Don't quite follow the specific application of that suggestion. How / when would you use a "2nd user.js?"

Do you have a particular reason to disable the phishing protection?

D*** skippy.  :D I use something else.

more options

You can use both methods in a JavaScript file. /* */ works across multiple lines and // is only meant to add a comment at the end of a line (it stops automatically)

What I do is to place important prefs in one file and others in a second file. Then I first start that profile with the second file copied to user.js. After closing Firefox I copy the first file with prefs that I want to reset on each start to user.js and use that on subsequent Firefox starts.

more options

Danke. But why 2 individual user.js files (or the equivalent of)? And do you only use the 2nd file - of other prefs - once? As in, for new profile or after resetting Fx to default, etc?

If you care enough about these prefs to put them in 1 of 2 user.js files, why not use one file & just leave it in the profile?

What types of prefs would be in the others category, that you don't see a need to leave them in a "permanent" user.js?