Bug 1464405 - Register FormAutofill resource URIs before checking if the feature should be enabled. r?MattN
MozReview-Commit-ID: JU93hA0NBgL
--- a/browser/extensions/formautofill/bootstrap.js
+++ b/browser/extensions/formautofill/bootstrap.js
@@ -71,29 +71,32 @@ function isAvailable() {
return false;
}
return locale == "en-US" && supportedCountries.includes(region);
}
return false;
}
function startup(data) {
+ // We have to do this before actually determining if we're enabled, since
+ // there are scripts inside of the core browser code that depend on the
+ // FormAutofill JSMs being registered.
+ resProto.setSubstitution(RESOURCE_HOST,
+ Services.io.newURI("chrome/res/", null, data.resourceURI));
+
if (!isAvailable()) {
Services.prefs.clearUserPref("dom.forms.autocomplete.formautofill");
// reset the sync related prefs incase the feature was previously available
// but isn't now.
Services.prefs.clearUserPref("services.sync.engine.addresses.available");
Services.prefs.clearUserPref("services.sync.engine.creditcards.available");
Services.telemetry.scalarSet("formautofill.availability", false);
return;
}
- resProto.setSubstitution(RESOURCE_HOST,
- Services.io.newURI("chrome/res/", null, data.resourceURI));
-
if (data.hasOwnProperty("instanceID") && data.instanceID) {
if (AddonManagerPrivate.isDBLoaded()) {
addUpgradeListener(data.instanceID);
} else {
// Wait for the extension database to be loaded so we don't cause its init.
Services.obs.addObserver(function xpiDatabaseLoaded() {
Services.obs.removeObserver(xpiDatabaseLoaded, "xpi-database-loaded");
addUpgradeListener(data.instanceID);