FireFox nsFormAutoComplete.js Where are the "settings" stored for getBoolPref()?
When I type text into various text boxes on pages using FireFox (3.6.3), I get the following error:
Error: [Exception... "Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIPrefBranch.getBoolPref]" nsresult: "0x8000ffff (NS_ERROR_UNEXPECTED)" location: "JS frame :: file:///C:/Program%20Files/Mozilla%20Firefox/components/nsFormAutoComplete.js :: anonymous :: line 97" data: no] Source File: file:///C:/Program%20Files/Mozilla%20Firefox/components/nsFormAutoComplete.js Line: 97
Seems to happen for a page I've developed as well as even typing text into the Google search bar.
When I look at nsFormAutoComplete.js, I see this:
init : function() {
// Preferences. Add observer so we get notified of changes.
this._prefBranch = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefService).getBranch("browser.formfill.");
this._prefBranch.QueryInterface(Ci.nsIPrefBranch2);
this._prefBranch.addObserver("", this.observer, false);
this.observer._self = this;
this._debug = this._prefBranch.getBoolPref("debug");
this._enabled = this._prefBranch.getBoolPref("enable");
this._agedWeight = this._prefBranch.getIntPref("agedWeight");
this._bucketSize = this._prefBranch.getIntPref("bucketSize");
this._maxTimeGroupings = this._prefBranch.getIntPref("maxTimeGroupings");
this._timeGroupingSize = this._prefBranch.getIntPref("timeGroupingSize") * 1000 * 1000;
this._expireDays = this._getFormExpiryDays();
this._dbStmts = [];
this._observerService.addObserver(this.observer, "xpcom-shutdown", false);
},
The problem appears to be occurring on this line:
this._debug = this._prefBranch.getBoolPref("debug");
Right now, my best guess is that the preference "debug" doesn't exist from wherever FireFox reads its preferences.
I don't know much about FireFox, and searching the web has not resulted in much information.
Question: Where does FireFox store/retrieve these preferences?
I figure if I place a "debug" 开发者_开发知识库preference into this location, I should eliminate the error. However, I'm open to other suggestions/more information.
Thanks! ---Dan---
Okay. I figured it out. Maybe this will help someone else. In the nsFormAutoComplete.js, there is that listing of preferences.
The prefs.js file is the key and it's located in C:\Documents and Settings\\application data\firefox\profiles\\prefs.js.
You don't want to edit this file directly. Instead, type about:config in the address bar of FireFox and add the preferences this way. The preferences will be as follows:
browser.formfill. and type.
so for the debug one, it's browswer.formfill.debug as a bool. I set it to false. After that, it failed on the next preference which was .agedWeight.
After adding all of the preferences found in nsFormAutoComplete.js, I found the errors disappeared.
精彩评论