зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1322622 - Make form autofill handler a frame script and load from bootstrap.js. r=steveck
MozReview-Commit-ID: DeIjzMytVxJ --HG-- rename : browser/extensions/formautofill/FormAutofillContent.jsm => browser/extensions/formautofill/content/FormAutofillContent.js extra : rebase_source : 5e62eb24e76bf58436e73267ebb8e872e42a71d2
This commit is contained in:
Родитель
ec36746143
Коммит
877c8752a1
|
@ -1555,3 +1555,6 @@ pref("browser.crashReports.unsubmittedCheck.autoSubmit", false);
|
|||
// controlling validation are located in /services/sync/services-sync.js
|
||||
pref("services.sync.validation.enabled", true);
|
||||
#endif
|
||||
|
||||
// Preferences for the form autofill system extension
|
||||
pref("browser.formautofill.enabled", false);
|
||||
|
|
|
@ -6,7 +6,25 @@
|
|||
|
||||
/* exported startup, shutdown, install, uninstall */
|
||||
|
||||
function startup() {}
|
||||
const {classes: Cc, interfaces: Ci, results: Cr, utils: Cu} = Components;
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "FormAutofillParent",
|
||||
"resource://formautofill/FormAutofillParent.jsm");
|
||||
|
||||
function startup() {
|
||||
// Besides this pref, we'll need dom.forms.autocomplete.experimental enabled
|
||||
// as well to make sure form autocomplete works correctly.
|
||||
if (!Services.prefs.getBoolPref("browser.formautofill.enabled")) {
|
||||
return;
|
||||
}
|
||||
|
||||
FormAutofillParent.init();
|
||||
Services.mm.loadFrameScript("chrome://formautofill/content/FormAutofillContent.js", true);
|
||||
}
|
||||
|
||||
function shutdown() {}
|
||||
function install() {}
|
||||
function uninstall() {}
|
||||
|
|
|
@ -3,13 +3,14 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/*
|
||||
* Implements a service used by DOM content to request Form Autofill.
|
||||
* Form Autofill frame script.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
|
||||
|
||||
|
||||
/**
|
||||
* Handles profile autofill for a DOM Form element.
|
||||
* @param {HTMLFormElement} form Form that need to be auto filled
|
||||
|
@ -130,5 +131,3 @@ FormAutofillHandler.prototype = {
|
|||
}
|
||||
},
|
||||
};
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["FormAutofillHandler"];
|
|
@ -5,3 +5,6 @@
|
|||
[features/formautofill@mozilla.org] chrome.jar:
|
||||
% resource formautofill %res/
|
||||
res/ (*.jsm)
|
||||
|
||||
% content formautofill %content/
|
||||
content/ (content/*)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* Provides infrastructure for automated formautofill components tests.
|
||||
*/
|
||||
|
||||
/* exported importAutofillModule, getTempFile */
|
||||
/* exported getTempFile */
|
||||
|
||||
"use strict";
|
||||
|
||||
|
@ -37,6 +37,17 @@ Components.manager.addBootstrappedManifestLocation(extensionDir);
|
|||
// with a file that is still pending deletion highly unlikely.
|
||||
let gFileCounter = Math.floor(Math.random() * 1000000);
|
||||
|
||||
function loadFormAutofillContent() {
|
||||
let facGlobal = {};
|
||||
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"]
|
||||
.getService(Ci.mozIJSSubScriptLoader);
|
||||
loader.loadSubScriptWithOptions("chrome://formautofill/content/FormAutofillContent.js", {
|
||||
target: facGlobal,
|
||||
});
|
||||
|
||||
return facGlobal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a reference to a temporary file, that is guaranteed not to exist, and
|
||||
* to have never been created before.
|
||||
|
@ -71,10 +82,13 @@ function getTempFile(leafName) {
|
|||
}
|
||||
|
||||
add_task(function* test_common_initialize() {
|
||||
Services.prefs.setBoolPref("browser.formautofill.enabled", true);
|
||||
Services.prefs.setBoolPref("dom.forms.autocomplete.experimental", true);
|
||||
loadFormAutofillContent();
|
||||
|
||||
// Clean up after every test.
|
||||
do_register_cleanup(() => {
|
||||
Services.prefs.setBoolPref("dom.forms.autocomplete.experimental", false);
|
||||
Services.prefs.clearUserPref("browser.formautofill.enabled");
|
||||
Services.prefs.clearUserPref("dom.forms.autocomplete.experimental");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
/**
|
||||
* Cleans up the testing environment.
|
||||
*/
|
||||
|
||||
"use strict";
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
let {FormAutofillHandler} = Cu.import("resource://formautofill/FormAutofillContent.jsm");
|
||||
let {FormAutofillHandler} = loadFormAutofillContent();
|
||||
|
||||
const TESTCASES = [
|
||||
{
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
let {FormAutofillHandler} = Cu.import("resource://formautofill/FormAutofillContent.jsm");
|
||||
let {FormAutofillHandler} = loadFormAutofillContent();
|
||||
|
||||
const TESTCASES = [
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[DEFAULT]
|
||||
firefox-appdir = browser
|
||||
head = head.js
|
||||
tail = tail.js
|
||||
tail =
|
||||
support-files =
|
||||
|
||||
[test_autofillFormFields.js]
|
||||
|
|
Загрузка…
Ссылка в новой задаче