forked from mirrors/gecko-dev
Backed out 3 changesets (bug 1449055) for multiple xpcshell failures on browser/extensions/formautofill/test/ . CLOSED TREE
Backed out changeset fc97f5b5e65d (bug 1449055) Backed out changeset 45306ff933fe (bug 1449055) Backed out changeset da3100049ef2 (bug 1449055) --HG-- rename : browser/extensions/formautofill/api.js => browser/extensions/formautofill/bootstrap.js rename : browser/extensions/formautofill/manifest.json => browser/extensions/formautofill/install.rdf.in rename : browser/extensions/formautofill/skin/shared/autocomplete-item-shared.css => browser/extensions/formautofill/skin/shared/autocomplete-item.css rename : browser/extensions/formautofill/skin/shared/editDialog-shared.css => browser/extensions/formautofill/skin/shared/editDialog.css
This commit is contained in:
parent
519c3a060a
commit
b0afa69be5
48 changed files with 296 additions and 472 deletions
|
|
@ -244,23 +244,13 @@ function getBaseUriForChromeUri(chromeUri) {
|
|||
return fileUri.resolve(".");
|
||||
}
|
||||
|
||||
function trackChromeUri(uri) {
|
||||
gChromeMap.set(getBaseUriForChromeUri(uri), uri);
|
||||
}
|
||||
|
||||
// formautofill registers resource://formautofill/ and
|
||||
// chrome://formautofill/content/ dynamically at runtime.
|
||||
// Bug 1480276 is about addressing this without this hard-coding.
|
||||
trackResourcePrefix("formautofill");
|
||||
trackChromeUri("chrome://formautofill/content/");
|
||||
|
||||
function parseManifest(manifestUri) {
|
||||
return fetchFile(manifestUri.spec).then(data => {
|
||||
for (let line of data.split("\n")) {
|
||||
let [type, ...argv] = line.split(/\s+/);
|
||||
if (type == "content" || type == "skin" || type == "locale") {
|
||||
let chromeUri = `chrome://${argv[0]}/${type}/`;
|
||||
trackChromeUri(chromeUri);
|
||||
gChromeMap.set(getBaseUriForChromeUri(chromeUri), chromeUri);
|
||||
} else if (type == "override" || type == "overlay") {
|
||||
// Overlays aren't really overrides, but behave the same in
|
||||
// that the overlay is only referenced if the original xul
|
||||
|
|
@ -281,35 +271,6 @@ function parseManifest(manifestUri) {
|
|||
});
|
||||
}
|
||||
|
||||
// If the given URI is a webextension manifest, extract the scripts
|
||||
// for any embedded APIs. Returns the passed in URI if the manifest
|
||||
// is not a webextension manifest, null otherwise.
|
||||
async function parseJsonManifest(uri) {
|
||||
let raw = await fetchFile(uri.spec);
|
||||
let data;
|
||||
try {
|
||||
data = JSON.parse(raw);
|
||||
} catch (ex) {
|
||||
return uri;
|
||||
}
|
||||
|
||||
// Simplistic test for whether this is a webextension manifest:
|
||||
if (data.manifest_version !== 2) {
|
||||
return uri;
|
||||
}
|
||||
|
||||
if (data.experiment_apis) {
|
||||
for (let api of Object.values(data.experiment_apis)) {
|
||||
if (api.parent && api.parent.script) {
|
||||
let script = uri.resolve(api.parent.script);
|
||||
gReferencesFromCode.set(script, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function addCodeReference(url, fromURI) {
|
||||
let from = convertToCodeURI(fromURI.spec);
|
||||
|
||||
|
|
@ -585,15 +546,11 @@ add_task(async function checkAllTheFiles() {
|
|||
// NOTE that this must be done before filtering out devtools paths
|
||||
// so that all chrome paths can be recorded.
|
||||
let manifestURIs = [];
|
||||
let jsonManifests = [];
|
||||
uris = uris.filter(uri => {
|
||||
let path = uri.pathQueryRef;
|
||||
if (path.endsWith(".manifest")) {
|
||||
manifestURIs.push(uri);
|
||||
return false;
|
||||
} else if (path.endsWith("/manifest.json")) {
|
||||
jsonManifests.push(uri);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -602,15 +559,6 @@ add_task(async function checkAllTheFiles() {
|
|||
// Wait for all manifest to be parsed
|
||||
await throttledMapPromises(manifestURIs, parseManifest);
|
||||
|
||||
// manifest.json is a common name, it is used for WebExtension manifests
|
||||
// but also for other things. To tell them apart, we have to actually
|
||||
// read the contents. This will populate gExtensionRoots with all
|
||||
// embedded extension APIs, and return any manifest.json files that aren't
|
||||
// webextensions.
|
||||
let nonWebextManifests = (await Promise.all(jsonManifests.map(parseJsonManifest)))
|
||||
.filter(uri => !!uri);
|
||||
uris.push(...nonWebextManifests);
|
||||
|
||||
addActorModules();
|
||||
|
||||
// We build a list of promises that get resolved when their respective
|
||||
|
|
|
|||
|
|
@ -2,10 +2,6 @@
|
|||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
"use strict";
|
||||
|
||||
// There are shutdown issues for which multiple rejections are left uncaught.
|
||||
// See bug 1018184 for resolving these issues.
|
||||
PromiseTestUtils.whitelistRejectionsGlobally(/File closed/);
|
||||
|
||||
ChromeUtils.defineModuleGetter(this, "BrowserToolboxProcess",
|
||||
"resource://devtools/client/framework/ToolboxProcess.jsm");
|
||||
|
||||
|
|
@ -115,8 +111,6 @@ add_task(async function test_addon_debugging_netmonitor_panel() {
|
|||
// Call a function defined in the target extension to make assertions
|
||||
// on the network requests collected by the netmonitor panel.
|
||||
await jsterm.execute(`testNetworkRequestReceived(${JSON.stringify(requests)});`);
|
||||
|
||||
await toolbox.destroy();
|
||||
/* eslint-enable no-undef */
|
||||
};
|
||||
|
||||
|
|
@ -125,8 +119,11 @@ add_task(async function test_addon_debugging_netmonitor_panel() {
|
|||
addonID: EXTENSION_ID,
|
||||
});
|
||||
|
||||
let onToolboxClose = browserToolboxProcess.once("close");
|
||||
await extension.awaitFinish("netmonitor_request_logged");
|
||||
|
||||
let onToolboxClose = browserToolboxProcess.once("close");
|
||||
await browserToolboxProcess.close();
|
||||
|
||||
await onToolboxClose;
|
||||
|
||||
info("Addon Toolbox closed");
|
||||
|
|
|
|||
|
|
@ -1790,10 +1790,6 @@ FormAutofillStorage.prototype = {
|
|||
_saveImmediately() {
|
||||
return this._store._save();
|
||||
},
|
||||
|
||||
_finalize() {
|
||||
return this._store.finalize();
|
||||
},
|
||||
};
|
||||
|
||||
// The singleton exposed by this module.
|
||||
|
|
|
|||
|
|
@ -1,145 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
/* globals ExtensionAPI */
|
||||
|
||||
const STYLESHEET_URI = "chrome://formautofill/content/formautofill.css";
|
||||
const CACHED_STYLESHEETS = new WeakMap();
|
||||
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
ChromeUtils.defineModuleGetter(this, "FormAutofill",
|
||||
"resource://formautofill/FormAutofill.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "formAutofillParent",
|
||||
"resource://formautofill/FormAutofillParent.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "resProto",
|
||||
"@mozilla.org/network/protocol;1?name=resource",
|
||||
"nsISubstitutingProtocolHandler");
|
||||
|
||||
const RESOURCE_HOST = "formautofill";
|
||||
|
||||
function insertStyleSheet(domWindow, url) {
|
||||
let doc = domWindow.document;
|
||||
let styleSheetAttr = `href="${url}" type="text/css"`;
|
||||
let styleSheet = doc.createProcessingInstruction("xml-stylesheet", styleSheetAttr);
|
||||
|
||||
doc.insertBefore(styleSheet, doc.documentElement);
|
||||
|
||||
if (CACHED_STYLESHEETS.has(domWindow)) {
|
||||
CACHED_STYLESHEETS.get(domWindow).push(styleSheet);
|
||||
} else {
|
||||
CACHED_STYLESHEETS.set(domWindow, [styleSheet]);
|
||||
}
|
||||
}
|
||||
|
||||
function onMaybeOpenPopup(evt) {
|
||||
let domWindow = evt.target.ownerGlobal;
|
||||
if (CACHED_STYLESHEETS.has(domWindow)) {
|
||||
// This window already has autofill stylesheets.
|
||||
return;
|
||||
}
|
||||
|
||||
insertStyleSheet(domWindow, STYLESHEET_URI);
|
||||
}
|
||||
|
||||
function isAvailable() {
|
||||
let availablePref = Services.prefs.getCharPref("extensions.formautofill.available");
|
||||
if (availablePref == "on") {
|
||||
return true;
|
||||
} else if (availablePref == "detect") {
|
||||
let locale = Services.locale.getRequestedLocale();
|
||||
let region = Services.prefs.getCharPref("browser.search.region", "");
|
||||
let supportedCountries = Services.prefs.getCharPref("extensions.formautofill.supportedCountries")
|
||||
.split(",");
|
||||
if (!Services.prefs.getBoolPref("extensions.formautofill.supportRTL") &&
|
||||
Services.locale.isAppLocaleRTL) {
|
||||
return false;
|
||||
}
|
||||
return locale == "en-US" && supportedCountries.includes(region);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
this.formautofill = class extends ExtensionAPI {
|
||||
onStartup() {
|
||||
// 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.
|
||||
let uri = Services.io.newURI("chrome/res/", null, this.extension.rootURI);
|
||||
resProto.setSubstitution(RESOURCE_HOST, uri);
|
||||
|
||||
let aomStartup = Cc["@mozilla.org/addons/addon-manager-startup;1"]
|
||||
.getService(Ci.amIAddonManagerStartup);
|
||||
const manifestURI = Services.io.newURI("manifest.json", null, this.extension.rootURI);
|
||||
this.chromeHandle = aomStartup.registerChrome(manifestURI, [
|
||||
["content", "formautofill", "chrome/content/"],
|
||||
["locale", "formautofill", "en-US", "en-US/locale/en-US/"],
|
||||
]);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// This pref is used for web contents to detect the autocomplete feature.
|
||||
// When it's true, "element.autocomplete" will return tokens we currently
|
||||
// support -- otherwise it'll return an empty string.
|
||||
Services.prefs.setBoolPref("dom.forms.autocomplete.formautofill", true);
|
||||
Services.telemetry.scalarSet("formautofill.availability", true);
|
||||
|
||||
// This pref determines whether the "addresses"/"creditcards" sync engine is
|
||||
// available (ie, whether it is shown in any UI etc) - it *does not* determine
|
||||
// whether the engine is actually enabled or not.
|
||||
Services.prefs.setBoolPref("services.sync.engine.addresses.available", true);
|
||||
if (FormAutofill.isAutofillCreditCardsAvailable) {
|
||||
Services.prefs.setBoolPref("services.sync.engine.creditcards.available", true);
|
||||
} else {
|
||||
Services.prefs.clearUserPref("services.sync.engine.creditcards.available");
|
||||
}
|
||||
|
||||
// Listen for the autocomplete popup message to lazily append our stylesheet related to the popup.
|
||||
Services.mm.addMessageListener("FormAutoComplete:MaybeOpenPopup", onMaybeOpenPopup);
|
||||
|
||||
formAutofillParent.init().catch(Cu.reportError);
|
||||
/* eslint-disable no-unused-vars */
|
||||
Services.ppmm.loadProcessScript("data:,new " + function() {
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillContent.jsm");
|
||||
}, true);
|
||||
/* eslint-enable no-unused-vars */
|
||||
Services.mm.loadFrameScript("chrome://formautofill/content/FormAutofillFrameScript.js", true, true);
|
||||
}
|
||||
|
||||
onShutdown() {
|
||||
resProto.setSubstitution(RESOURCE_HOST, null);
|
||||
|
||||
this.chromeHandle.destruct();
|
||||
this.chromeHandle = null;
|
||||
|
||||
Services.mm.removeMessageListener("FormAutoComplete:MaybeOpenPopup", onMaybeOpenPopup);
|
||||
|
||||
let enumerator = Services.wm.getEnumerator("navigator:browser");
|
||||
while (enumerator.hasMoreElements()) {
|
||||
let win = enumerator.getNext();
|
||||
let domWindow = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindow);
|
||||
let cachedStyleSheets = CACHED_STYLESHEETS.get(domWindow);
|
||||
|
||||
if (!cachedStyleSheets) {
|
||||
continue;
|
||||
}
|
||||
|
||||
while (cachedStyleSheets.length !== 0) {
|
||||
cachedStyleSheets.pop().remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
/* eslint-env webextensions */
|
||||
|
||||
"use strict";
|
||||
|
||||
browser.runtime.onUpdateAvailable.addListener(details => {
|
||||
// By listening to but ignoring this event, any updates will
|
||||
// be delayed until the next browser restart.
|
||||
});
|
||||
159
browser/extensions/formautofill/bootstrap.js
vendored
Normal file
159
browser/extensions/formautofill/bootstrap.js
vendored
Normal file
|
|
@ -0,0 +1,159 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
/* exported startup, shutdown, install, uninstall */
|
||||
|
||||
const STYLESHEET_URI = "chrome://formautofill/content/formautofill.css";
|
||||
const CACHED_STYLESHEETS = new WeakMap();
|
||||
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
ChromeUtils.defineModuleGetter(this, "AddonManager", "resource://gre/modules/AddonManager.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "AddonManagerPrivate",
|
||||
"resource://gre/modules/AddonManager.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "FormAutofill",
|
||||
"resource://formautofill/FormAutofill.jsm");
|
||||
ChromeUtils.defineModuleGetter(this, "formAutofillParent",
|
||||
"resource://formautofill/FormAutofillParent.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "resProto",
|
||||
"@mozilla.org/network/protocol;1?name=resource",
|
||||
"nsISubstitutingProtocolHandler");
|
||||
|
||||
const RESOURCE_HOST = "formautofill";
|
||||
|
||||
function insertStyleSheet(domWindow, url) {
|
||||
let doc = domWindow.document;
|
||||
let styleSheetAttr = `href="${url}" type="text/css"`;
|
||||
let styleSheet = doc.createProcessingInstruction("xml-stylesheet", styleSheetAttr);
|
||||
|
||||
doc.insertBefore(styleSheet, doc.documentElement);
|
||||
|
||||
if (CACHED_STYLESHEETS.has(domWindow)) {
|
||||
CACHED_STYLESHEETS.get(domWindow).push(styleSheet);
|
||||
} else {
|
||||
CACHED_STYLESHEETS.set(domWindow, [styleSheet]);
|
||||
}
|
||||
}
|
||||
|
||||
function onMaybeOpenPopup(evt) {
|
||||
let domWindow = evt.target.ownerGlobal;
|
||||
if (CACHED_STYLESHEETS.has(domWindow)) {
|
||||
// This window already has autofill stylesheets.
|
||||
return;
|
||||
}
|
||||
|
||||
insertStyleSheet(domWindow, STYLESHEET_URI);
|
||||
}
|
||||
|
||||
function addUpgradeListener(instanceID) {
|
||||
AddonManager.addUpgradeListener(instanceID, upgrade => {
|
||||
// don't install the upgrade by doing nothing here.
|
||||
// The upgrade will be installed upon next restart.
|
||||
});
|
||||
}
|
||||
|
||||
function isAvailable() {
|
||||
let availablePref = Services.prefs.getCharPref("extensions.formautofill.available");
|
||||
if (availablePref == "on") {
|
||||
return true;
|
||||
} else if (availablePref == "detect") {
|
||||
let locale = Services.locale.getRequestedLocale();
|
||||
let region = Services.prefs.getCharPref("browser.search.region", "");
|
||||
let supportedCountries = Services.prefs.getCharPref("extensions.formautofill.supportedCountries")
|
||||
.split(",");
|
||||
if (!Services.prefs.getBoolPref("extensions.formautofill.supportRTL") &&
|
||||
Services.locale.isAppLocaleRTL) {
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
}, "xpi-database-loaded");
|
||||
}
|
||||
} else {
|
||||
throw Error("no instanceID passed to bootstrap startup");
|
||||
}
|
||||
|
||||
// This pref is used for web contents to detect the autocomplete feature.
|
||||
// When it's true, "element.autocomplete" will return tokens we currently
|
||||
// support -- otherwise it'll return an empty string.
|
||||
Services.prefs.setBoolPref("dom.forms.autocomplete.formautofill", true);
|
||||
Services.telemetry.scalarSet("formautofill.availability", true);
|
||||
|
||||
// This pref determines whether the "addresses"/"creditcards" sync engine is
|
||||
// available (ie, whether it is shown in any UI etc) - it *does not* determine
|
||||
// whether the engine is actually enabled or not.
|
||||
Services.prefs.setBoolPref("services.sync.engine.addresses.available", true);
|
||||
if (FormAutofill.isAutofillCreditCardsAvailable) {
|
||||
Services.prefs.setBoolPref("services.sync.engine.creditcards.available", true);
|
||||
} else {
|
||||
Services.prefs.clearUserPref("services.sync.engine.creditcards.available");
|
||||
}
|
||||
|
||||
// Listen for the autocomplete popup message to lazily append our stylesheet related to the popup.
|
||||
Services.mm.addMessageListener("FormAutoComplete:MaybeOpenPopup", onMaybeOpenPopup);
|
||||
|
||||
formAutofillParent.init().catch(Cu.reportError);
|
||||
/* eslint-disable no-unused-vars */
|
||||
Services.ppmm.loadProcessScript("data:,new " + function() {
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillContent.jsm");
|
||||
}, true);
|
||||
/* eslint-enable no-unused-vars */
|
||||
Services.mm.loadFrameScript("chrome://formautofill/content/FormAutofillFrameScript.js", true, true);
|
||||
}
|
||||
|
||||
function shutdown() {
|
||||
resProto.setSubstitution(RESOURCE_HOST, null);
|
||||
|
||||
Services.mm.removeMessageListener("FormAutoComplete:MaybeOpenPopup", onMaybeOpenPopup);
|
||||
|
||||
let enumerator = Services.wm.getEnumerator("navigator:browser");
|
||||
while (enumerator.hasMoreElements()) {
|
||||
let win = enumerator.getNext();
|
||||
let domWindow = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindow);
|
||||
let cachedStyleSheets = CACHED_STYLESHEETS.get(domWindow);
|
||||
|
||||
if (!cachedStyleSheets) {
|
||||
continue;
|
||||
}
|
||||
|
||||
while (cachedStyleSheets.length !== 0) {
|
||||
cachedStyleSheets.pop().remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function install() {}
|
||||
function uninstall() {}
|
||||
|
|
@ -9,9 +9,9 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title data-localization="addNewAddressTitle"/>
|
||||
<link rel="stylesheet" href="resource://formautofill/editDialog-shared.css"/>
|
||||
<link rel="stylesheet" href="resource://formautofill/editAddress.css"/>
|
||||
<link rel="stylesheet" href="resource://formautofill/editDialog.css"/>
|
||||
<link rel="stylesheet" href="chrome://formautofill-shared/skin/editDialog.css"/>
|
||||
<link rel="stylesheet" href="chrome://formautofill-shared/skin/editAddress.css"/>
|
||||
<link rel="stylesheet" href="chrome://formautofill/skin/editDialog.css"/>
|
||||
<script src="chrome://formautofill/content/l10n.js"></script>
|
||||
<script src="chrome://formautofill/content/editDialog.js"></script>
|
||||
<script src="chrome://formautofill/content/autofillEditForms.js"></script>
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title data-localization="addNewCreditCardTitle"/>
|
||||
<link rel="stylesheet" href="resource://formautofill/editDialog-shared.css"/>
|
||||
<link rel="stylesheet" href="resource://formautofill/editCreditCard.css"/>
|
||||
<link rel="stylesheet" href="resource://formautofill/editDialog.css"/>
|
||||
<link rel="stylesheet" href="chrome://formautofill-shared/skin/editDialog.css"/>
|
||||
<link rel="stylesheet" href="chrome://formautofill-shared/skin/editCreditCard.css"/>
|
||||
<link rel="stylesheet" href="chrome://formautofill/skin/editDialog.css"/>
|
||||
<script src="chrome://formautofill/content/l10n.js"></script>
|
||||
<script src="chrome://formautofill/content/editDialog.js"></script>
|
||||
<script src="chrome://formautofill/content/autofillEditForms.js"></script>
|
||||
|
|
|
|||
32
browser/extensions/formautofill/install.rdf.in
Normal file
32
browser/extensions/formautofill/install.rdf.in
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
#filter substitution
|
||||
|
||||
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
|
||||
|
||||
<Description about="urn:mozilla:install-manifest">
|
||||
<em:id>formautofill@mozilla.org</em:id>
|
||||
<em:version>1.0</em:version>
|
||||
<em:type>2</em:type>
|
||||
<em:bootstrap>true</em:bootstrap>
|
||||
<em:multiprocessCompatible>true</em:multiprocessCompatible>
|
||||
|
||||
<!-- Target Application this extension can install into,
|
||||
with minimum and maximum supported versions. -->
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
|
||||
<em:minVersion>@MOZ_APP_VERSION@</em:minVersion>
|
||||
<em:maxVersion>@MOZ_APP_MAXVERSION@</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
<!-- Front End MetaData -->
|
||||
<em:name>Form Autofill</em:name>
|
||||
<em:description>Autofill forms with saved profiles</em:description>
|
||||
</Description>
|
||||
</RDF>
|
||||
|
|
@ -3,9 +3,16 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
[features/formautofill@mozilla.org] chrome.jar:
|
||||
% resource formautofill %res/
|
||||
res/ (*.jsm)
|
||||
res/phonenumberutils/ (phonenumberutils/*.jsm)
|
||||
res/addressmetadata/ (addressmetadata/*)
|
||||
res/ (skin/shared/*)
|
||||
|
||||
% content formautofill %content/
|
||||
content/ (content/*)
|
||||
|
||||
% skin formautofill classic/1.0 %skin/linux/ os=LikeUnix
|
||||
% skin formautofill classic/1.0 %skin/osx/ os=Darwin
|
||||
% skin formautofill classic/1.0 %skin/windows/ os=WINNT
|
||||
% skin formautofill-shared classic/1.0 %skin/shared/
|
||||
skin/ (skin/*)
|
||||
|
|
|
|||
|
|
@ -1,26 +0,0 @@
|
|||
{
|
||||
"manifest_version": 2,
|
||||
"name": "Form Autofill",
|
||||
"version": "1.0",
|
||||
|
||||
"applications": {
|
||||
"gecko": {
|
||||
"id": "formautofill@mozilla.org"
|
||||
}
|
||||
},
|
||||
|
||||
"background": {
|
||||
"scripts": ["background.js"]
|
||||
},
|
||||
|
||||
"experiment_apis": {
|
||||
"formautofill": {
|
||||
"schema": "schema.json",
|
||||
"parent": {
|
||||
"scopes": ["addon_parent"],
|
||||
"script": "api.js",
|
||||
"events": ["startup"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -10,27 +10,12 @@ DEFINES['MOZ_APP_MAXVERSION'] = CONFIG['MOZ_APP_MAXVERSION']
|
|||
DIRS += ['locales']
|
||||
|
||||
FINAL_TARGET_FILES.features['formautofill@mozilla.org'] += [
|
||||
'api.js',
|
||||
'background.js',
|
||||
'manifest.json',
|
||||
'schema.json',
|
||||
'bootstrap.js'
|
||||
]
|
||||
|
||||
if CONFIG['OS_ARCH'] == 'Linux':
|
||||
FINAL_TARGET_FILES.features['formautofill@mozilla.org'].chrome.res += [
|
||||
'skin/linux/autocomplete-item.css',
|
||||
'skin/linux/editDialog.css',
|
||||
]
|
||||
elif CONFIG['OS_ARCH'] == 'Darwin':
|
||||
FINAL_TARGET_FILES.features['formautofill@mozilla.org'].chrome.res += [
|
||||
'skin/osx/autocomplete-item.css',
|
||||
'skin/osx/editDialog.css',
|
||||
]
|
||||
elif CONFIG['OS_ARCH'] == 'WINNT':
|
||||
FINAL_TARGET_FILES.features['formautofill@mozilla.org'].chrome.res += [
|
||||
'skin/windows/autocomplete-item.css',
|
||||
'skin/windows/editDialog.css',
|
||||
]
|
||||
FINAL_TARGET_PP_FILES.features['formautofill@mozilla.org'] += [
|
||||
'install.rdf.in'
|
||||
]
|
||||
|
||||
BROWSER_CHROME_MANIFESTS += ['test/browser/browser.ini']
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -8,8 +8,6 @@ ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
|||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/ObjectUtils.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/FormLikeFactory.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/AddonManager.jsm");
|
||||
ChromeUtils.import("resource://testing-common/AddonTestUtils.jsm");
|
||||
ChromeUtils.import("resource://testing-common/FileTestUtils.jsm");
|
||||
ChromeUtils.import("resource://testing-common/MockDocument.jsm");
|
||||
ChromeUtils.import("resource://testing-common/TestUtils.jsm");
|
||||
|
|
@ -19,8 +17,9 @@ ChromeUtils.defineModuleGetter(this, "DownloadPaths",
|
|||
ChromeUtils.defineModuleGetter(this, "FileUtils",
|
||||
"resource://gre/modules/FileUtils.jsm");
|
||||
|
||||
ChromeUtils.defineModuleGetter(this, "ExtensionParent",
|
||||
"resource://gre/modules/ExtensionParent.jsm");
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "resProto",
|
||||
"@mozilla.org/network/protocol;1?name=resource",
|
||||
"nsISubstitutingProtocolHandler");
|
||||
|
||||
do_get_profile();
|
||||
|
||||
|
|
@ -32,38 +31,26 @@ Services.scriptloader.loadSubScript("resource://testing-common/sinon-2.3.2.js",
|
|||
/* globals sinon */
|
||||
// ================================================
|
||||
|
||||
// Load our bootstrap extension manifest so we can access our chrome/resource URIs.
|
||||
const EXTENSION_ID = "formautofill@mozilla.org";
|
||||
|
||||
AddonTestUtils.init(this);
|
||||
|
||||
async function loadExtension() {
|
||||
AddonTestUtils.createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
|
||||
await AddonTestUtils.promiseStartupManager();
|
||||
|
||||
let extensionPath = Services.dirsvc.get("GreD", Ci.nsIFile);
|
||||
extensionPath.append("browser");
|
||||
extensionPath.append("features");
|
||||
extensionPath.append(EXTENSION_ID);
|
||||
|
||||
if (!extensionPath.exists()) {
|
||||
extensionPath.leafName = `${EXTENSION_ID}.xpi`;
|
||||
}
|
||||
|
||||
let startupPromise = new Promise(resolve => {
|
||||
const {apiManager} = ExtensionParent;
|
||||
function onReady(event, extension) {
|
||||
if (extension.id == EXTENSION_ID) {
|
||||
apiManager.off("ready", onReady);
|
||||
resolve();
|
||||
}
|
||||
}
|
||||
|
||||
apiManager.on("ready", onReady);
|
||||
});
|
||||
|
||||
await AddonManager.installTemporaryAddon(extensionPath);
|
||||
await startupPromise;
|
||||
let extensionDir = Services.dirsvc.get("GreD", Ci.nsIFile);
|
||||
extensionDir.append("browser");
|
||||
extensionDir.append("features");
|
||||
extensionDir.append(EXTENSION_ID);
|
||||
let bootstrapFile = extensionDir.clone();
|
||||
bootstrapFile.append("bootstrap.js");
|
||||
let bootstrapURI = Services.io.newFileURI(bootstrapFile).spec;
|
||||
// If the unpacked extension doesn't exist, use the packed version.
|
||||
if (!extensionDir.exists()) {
|
||||
extensionDir = extensionDir.parent;
|
||||
extensionDir.append(EXTENSION_ID + ".xpi");
|
||||
let jarURI = Services.io.newFileURI(extensionDir);
|
||||
bootstrapURI = "jar:" + jarURI.spec + "!/bootstrap.js";
|
||||
}
|
||||
Components.manager.addBootstrappedManifestLocation(extensionDir);
|
||||
|
||||
let resURI = Services.io.newURI("chrome/res/", null, Services.io.newURI(bootstrapURI));
|
||||
resProto.setSubstitution("formautofill", resURI);
|
||||
|
||||
// Returns a reference to a temporary file that is guaranteed not to exist and
|
||||
// is cleaned up later. See FileTestUtils.getTempFile for details.
|
||||
|
|
@ -77,15 +64,6 @@ async function initProfileStorage(fileName, records, collectionName = "addresses
|
|||
let profileStorage = new FormAutofillStorage(path);
|
||||
await profileStorage.initialize();
|
||||
|
||||
// AddonTestUtils inserts its own directory provider that manages TmpD.
|
||||
// It removes that directory at shutdown, which races with shutdown
|
||||
// handing in JSONFile/DeferredTask (which is used by FormAutofillStorage).
|
||||
// Avoid the race by explicitly finalizing any formautofill JSONFile
|
||||
// instances created manually by individual tests when the test finishes.
|
||||
registerCleanupFunction(function finalizeAutofillStorage() {
|
||||
return profileStorage._finalize();
|
||||
});
|
||||
|
||||
if (!records || !Array.isArray(records)) {
|
||||
return profileStorage;
|
||||
}
|
||||
|
|
@ -121,11 +99,9 @@ function verifySectionFieldDetails(sections, expectedResults) {
|
|||
});
|
||||
}
|
||||
|
||||
async function runHeuristicsTest(patterns, fixturePathPrefix) {
|
||||
add_task(async function setup() {
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillHeuristics.jsm");
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillUtils.jsm");
|
||||
});
|
||||
function runHeuristicsTest(patterns, fixturePathPrefix) {
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillHeuristics.jsm");
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillUtils.jsm");
|
||||
|
||||
patterns.forEach(testPattern => {
|
||||
add_task(async function() {
|
||||
|
|
@ -218,6 +194,4 @@ add_task(async function head_initialize() {
|
|||
Services.prefs.clearUserPref("extensions.formautofill.section.enabled");
|
||||
Services.prefs.clearUserPref("dom.forms.autocomplete.formautofill");
|
||||
});
|
||||
|
||||
await loadExtension();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,11 +4,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
let FormAutofillParent;
|
||||
|
||||
add_task(async function setup() {
|
||||
({FormAutofillParent} = ChromeUtils.import("resource://formautofill/FormAutofillParent.jsm", {}));
|
||||
});
|
||||
let {FormAutofillParent} = ChromeUtils.import("resource://formautofill/FormAutofillParent.jsm", {});
|
||||
|
||||
add_task(async function test_activeStatus_init() {
|
||||
let formAutofillParent = new FormAutofillParent();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
"use strict";
|
||||
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillUtils.jsm");
|
||||
|
||||
const SUPPORT_COUNTRIES_TESTCASES = [
|
||||
{
|
||||
country: "US",
|
||||
|
|
@ -15,10 +17,6 @@ const SUPPORT_COUNTRIES_TESTCASES = [
|
|||
},
|
||||
];
|
||||
|
||||
add_task(async function setup() {
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillUtils.jsm");
|
||||
});
|
||||
|
||||
add_task(async function test_initalState() {
|
||||
// addressData should not exist
|
||||
Assert.equal(AddressDataLoader._addressData, undefined);
|
||||
|
|
|
|||
|
|
@ -5,11 +5,8 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
let MasterPassword;
|
||||
add_task(async function setup() {
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillHandler.jsm");
|
||||
({MasterPassword} = ChromeUtils.import("resource://formautofill/MasterPassword.jsm", {}));
|
||||
});
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillHandler.jsm");
|
||||
let {MasterPassword} = ChromeUtils.import("resource://formautofill/MasterPassword.jsm", {});
|
||||
|
||||
const TESTCASES = [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,9 +4,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
add_task(async function setup() {
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillHandler.jsm");
|
||||
});
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillHandler.jsm");
|
||||
|
||||
const TESTCASES = [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,9 +4,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
add_task(async function seutp() {
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillHandler.jsm");
|
||||
});
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillHandler.jsm");
|
||||
|
||||
const TESTCASES = [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,15 +4,11 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const {FormAutofillStorage} = ChromeUtils.import("resource://formautofill/FormAutofillStorage.jsm", {});
|
||||
ChromeUtils.defineModuleGetter(this, "Preferences",
|
||||
"resource://gre/modules/Preferences.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/CreditCard.jsm");
|
||||
|
||||
let FormAutofillStorage;
|
||||
add_task(async function setup() {
|
||||
({FormAutofillStorage} = ChromeUtils.import("resource://formautofill/FormAutofillStorage.jsm", {}));
|
||||
});
|
||||
|
||||
const TEST_STORE_FILE_NAME = "test-credit-card.json";
|
||||
const COLLECTION_NAME = "creditCards";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
"use strict";
|
||||
|
||||
add_task(async function() {
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillHeuristics.jsm");
|
||||
});
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillHeuristics.jsm");
|
||||
|
||||
const TESTCASES = [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
"use strict";
|
||||
|
||||
add_task(async function() {
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillHeuristics.jsm");
|
||||
});
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillHeuristics.jsm");
|
||||
|
||||
const TESTCASES = [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,9 +4,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
add_task(async function() {
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillHandler.jsm");
|
||||
});
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillHandler.jsm");
|
||||
|
||||
const DEFAULT_ADDRESS_RECORD = {
|
||||
"guid": "123",
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
add_task(async function() {
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillUtils.jsm");
|
||||
});
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillUtils.jsm");
|
||||
|
||||
add_task(async function test_isAddressField_isCreditCardField() {
|
||||
const TEST_CASES = {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
"use strict";
|
||||
|
||||
add_task(async function() {
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillContent.jsm");
|
||||
});
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillContent.jsm");
|
||||
|
||||
const TESTCASES = [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
"use strict";
|
||||
|
||||
add_task(async function() {
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillHeuristics.jsm");
|
||||
});
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillHeuristics.jsm");
|
||||
|
||||
const TESTCASES = [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,14 +4,10 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
let {FormAutofillParent} = ChromeUtils.import("resource://formautofill/FormAutofillParent.jsm", {});
|
||||
ChromeUtils.import("resource://formautofill/MasterPassword.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/CreditCard.jsm");
|
||||
|
||||
let FormAutofillParent;
|
||||
add_task(async function setup() {
|
||||
({FormAutofillParent} = ChromeUtils.import("resource://formautofill/FormAutofillParent.jsm", {}));
|
||||
ChromeUtils.import("resource://formautofill/MasterPassword.jsm");
|
||||
});
|
||||
|
||||
const TEST_ADDRESS_1 = {
|
||||
"given-name": "Timothy",
|
||||
"additional-name": "John",
|
||||
|
|
|
|||
|
|
@ -4,10 +4,13 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const DOM_ENABLED_PREF = "dom.forms.autocomplete.formautofill";
|
||||
// Load bootstrap.js into a sandbox to be able to test `isAvailable`
|
||||
let sandbox = {};
|
||||
Services.scriptloader.loadSubScript(bootstrapURI, sandbox, "utf-8");
|
||||
info("bootstrapURI: " + bootstrapURI);
|
||||
|
||||
add_task(async function test_defaultTestEnvironment() {
|
||||
Assert.ok(Services.prefs.getBoolPref(DOM_ENABLED_PREF));
|
||||
Assert.ok(sandbox.isAvailable());
|
||||
});
|
||||
|
||||
add_task(async function test_unsupportedRegion() {
|
||||
|
|
@ -16,11 +19,7 @@ add_task(async function test_unsupportedRegion() {
|
|||
registerCleanupFunction(function cleanupRegion() {
|
||||
Services.prefs.clearUserPref("browser.search.region");
|
||||
});
|
||||
|
||||
let addon = await AddonManager.getAddonByID(EXTENSION_ID);
|
||||
await addon.reload();
|
||||
|
||||
Assert.ok(!Services.prefs.getBoolPref(DOM_ENABLED_PREF));
|
||||
Assert.ok(!sandbox.isAvailable());
|
||||
});
|
||||
|
||||
add_task(async function test_supportedRegion() {
|
||||
|
|
@ -29,9 +28,5 @@ add_task(async function test_supportedRegion() {
|
|||
registerCleanupFunction(function cleanupRegion() {
|
||||
Services.prefs.clearUserPref("browser.search.region");
|
||||
});
|
||||
|
||||
let addon = await AddonManager.getAddonByID(EXTENSION_ID);
|
||||
await addon.reload();
|
||||
|
||||
Assert.ok(Services.prefs.getBoolPref(DOM_ENABLED_PREF));
|
||||
Assert.ok(sandbox.isAvailable());
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,9 +4,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
add_task(async function setup() {
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillNameUtils.jsm");
|
||||
});
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillNameUtils.jsm");
|
||||
|
||||
// Test cases is initially copied from
|
||||
// https://cs.chromium.org/chromium/src/components/autofill/core/browser/autofill_data_util_unittest.cc
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
"use strict";
|
||||
|
||||
add_task(async function seutp() {
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillUtils.jsm");
|
||||
});
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillUtils.jsm");
|
||||
|
||||
const TESTCASES = [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
"use strict";
|
||||
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillContent.jsm");
|
||||
|
||||
const TESTCASES = [
|
||||
{
|
||||
description: "Form containing 8 fields with autocomplete attribute.",
|
||||
|
|
@ -59,14 +61,9 @@ const TESTCASES = [
|
|||
];
|
||||
|
||||
let markedFieldId = [];
|
||||
|
||||
add_task(async function setup() {
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillContent.jsm");
|
||||
|
||||
FormAutofillContent._markAsAutofillField = function(field) {
|
||||
markedFieldId.push(field.id);
|
||||
};
|
||||
});
|
||||
FormAutofillContent._markAsAutofillField = function(field) {
|
||||
markedFieldId.push(field.id);
|
||||
};
|
||||
|
||||
TESTCASES.forEach(testcase => {
|
||||
add_task(async function() {
|
||||
|
|
|
|||
|
|
@ -5,11 +5,7 @@
|
|||
"use strict";
|
||||
const {MockRegistrar} =
|
||||
ChromeUtils.import("resource://testing-common/MockRegistrar.jsm", {});
|
||||
|
||||
let MasterPassword;
|
||||
add_task(async function setup() {
|
||||
({MasterPassword} = ChromeUtils.import("resource://formautofill/MasterPassword.jsm", {}));
|
||||
});
|
||||
let {MasterPassword} = ChromeUtils.import("resource://formautofill/MasterPassword.jsm", {});
|
||||
|
||||
const TESTCASES = [{
|
||||
description: "With master password set",
|
||||
|
|
@ -71,10 +67,10 @@ registerCleanupFunction(() => {
|
|||
});
|
||||
|
||||
TESTCASES.forEach(testcase => {
|
||||
let token = MasterPassword._token;
|
||||
|
||||
add_task(async function test_encrypt_decrypt() {
|
||||
info("Starting testcase: " + testcase.description);
|
||||
|
||||
let token = MasterPassword._token;
|
||||
token.initPassword(testcase.masterPassword);
|
||||
|
||||
// Test only: Force the token login without asking for master password
|
||||
|
|
|
|||
|
|
@ -4,11 +4,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
let FormAutofillStorage;
|
||||
|
||||
add_task(async function setup() {
|
||||
({FormAutofillStorage} = ChromeUtils.import("resource://formautofill/FormAutofillStorage.jsm", {}));
|
||||
});
|
||||
const {FormAutofillStorage} = ChromeUtils.import("resource://formautofill/FormAutofillStorage.jsm", {});
|
||||
|
||||
const TEST_STORE_FILE_NAME = "test-profile.json";
|
||||
|
||||
|
|
|
|||
|
|
@ -4,9 +4,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
add_task(async function() {
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillNameUtils.jsm");
|
||||
});
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillNameUtils.jsm");
|
||||
|
||||
// Test cases initially copied from
|
||||
// https://cs.chromium.org/chromium/src/components/autofill/core/browser/autofill_data_util_unittest.cc
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
"use strict";
|
||||
|
||||
add_task(async function setup() {
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillContent.jsm");
|
||||
});
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillContent.jsm");
|
||||
|
||||
const MOCK_DOC = MockDocument.createTestDocument("http://localhost:8080/test/",
|
||||
`<form id="form1">
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
"use strict";
|
||||
|
||||
add_task(async function setup() {
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillUtils.jsm");
|
||||
});
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillUtils.jsm");
|
||||
|
||||
add_task(async function test_parseAddressFormat() {
|
||||
const TEST_CASES = [
|
||||
|
|
|
|||
|
|
@ -4,10 +4,8 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
add_task(async function setup() {
|
||||
ChromeUtils.import("resource://formautofill/phonenumberutils/PhoneNumber.jsm");
|
||||
ChromeUtils.import("resource://formautofill/phonenumberutils/PhoneNumberNormalizer.jsm");
|
||||
});
|
||||
ChromeUtils.import("resource://formautofill/phonenumberutils/PhoneNumber.jsm");
|
||||
ChromeUtils.import("resource://formautofill/phonenumberutils/PhoneNumberNormalizer.jsm");
|
||||
|
||||
function IsPlain(dial, expected) {
|
||||
let result = PhoneNumber.IsPlain(dial);
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
"use strict";
|
||||
|
||||
/* global AddressResult, CreditCardResult */
|
||||
add_task(async function setup() {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
ChromeUtils.import("resource://formautofill/ProfileAutoCompleteResult.jsm");
|
||||
});
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
ChromeUtils.import("resource://formautofill/ProfileAutoCompleteResult.jsm");
|
||||
|
||||
let matchingProfiles = [{
|
||||
guid: "test-guid-1",
|
||||
|
|
@ -343,15 +341,15 @@ let creditCardTestCases = [{
|
|||
},
|
||||
}];
|
||||
|
||||
add_task(async function test_all_patterns() {
|
||||
let testSets = [{
|
||||
collectionConstructor: AddressResult,
|
||||
testCases: addressTestCases,
|
||||
}, {
|
||||
collectionConstructor: CreditCardResult,
|
||||
testCases: creditCardTestCases,
|
||||
}];
|
||||
let testSets = [{
|
||||
collectionConstructor: AddressResult,
|
||||
testCases: addressTestCases,
|
||||
}, {
|
||||
collectionConstructor: CreditCardResult,
|
||||
testCases: creditCardTestCases,
|
||||
}];
|
||||
|
||||
add_task(async function test_all_patterns() {
|
||||
testSets.forEach(({collectionConstructor, testCases}) => {
|
||||
testCases.forEach(testCase => {
|
||||
info("Starting testcase: " + testCase.description);
|
||||
|
|
|
|||
|
|
@ -4,11 +4,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
let FormAutofillParent;
|
||||
|
||||
add_task(async function setup() {
|
||||
({FormAutofillParent} = ChromeUtils.import("resource://formautofill/FormAutofillParent.jsm", {}));
|
||||
});
|
||||
let {FormAutofillParent} = ChromeUtils.import("resource://formautofill/FormAutofillParent.jsm", {});
|
||||
|
||||
add_task(async function test_profileSavedFieldNames_init() {
|
||||
let formAutofillParent = new FormAutofillParent();
|
||||
|
|
|
|||
|
|
@ -4,10 +4,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
let FormAutofillStorage;
|
||||
add_task(async function setup() {
|
||||
({FormAutofillStorage} = ChromeUtils.import("resource://formautofill/FormAutofillStorage.jsm", {}));
|
||||
});
|
||||
const {FormAutofillStorage} = ChromeUtils.import("resource://formautofill/FormAutofillStorage.jsm", {});
|
||||
|
||||
const TEST_STORE_FILE_NAME = "test-tombstones.json";
|
||||
|
||||
|
|
|
|||
|
|
@ -4,10 +4,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
let FormAutofillStorage;
|
||||
add_task(async function setup() {
|
||||
({FormAutofillStorage} = ChromeUtils.import("resource://formautofill/FormAutofillStorage.jsm", {}));
|
||||
});
|
||||
const {FormAutofillStorage} = ChromeUtils.import("resource://formautofill/FormAutofillStorage.jsm", {});
|
||||
|
||||
const TEST_STORE_FILE_NAME = "test-tombstones.json";
|
||||
|
||||
|
|
|
|||
|
|
@ -13,11 +13,8 @@ ChromeUtils.import("resource://services-sync/service.js");
|
|||
ChromeUtils.import("resource://services-sync/constants.js");
|
||||
ChromeUtils.import("resource://testing-common/services/sync/utils.js");
|
||||
|
||||
let sanitizeStorageObject, AutofillRecord, AddressesEngine;
|
||||
add_task(async function() {
|
||||
({sanitizeStorageObject, AutofillRecord, AddressesEngine} =
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillSync.jsm", {}));
|
||||
});
|
||||
let {sanitizeStorageObject, AutofillRecord, AddressesEngine} =
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillSync.jsm", {});
|
||||
|
||||
|
||||
Services.prefs.setCharPref("extensions.formautofill.loglevel", "Trace");
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
add_task(async function setup() {
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillUtils.jsm");
|
||||
});
|
||||
ChromeUtils.import("resource://formautofill/FormAutofillUtils.jsm");
|
||||
|
||||
add_task(async function test_getCategoriesFromFieldNames() {
|
||||
const TEST_CASES = [
|
||||
|
|
|
|||
|
|
@ -4,10 +4,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
let FormAutofillStorage;
|
||||
add_task(async function setup() {
|
||||
({FormAutofillStorage} = ChromeUtils.import("resource://formautofill/FormAutofillStorage.jsm", {}));
|
||||
});
|
||||
const {FormAutofillStorage} = ChromeUtils.import("resource://formautofill/FormAutofillStorage.jsm", {});
|
||||
|
||||
const TEST_STORE_FILE_NAME = "test-profile.json";
|
||||
|
||||
|
|
@ -904,8 +901,6 @@ add_task(async function test_computeAddressFields() {
|
|||
|
||||
profileStorage.addresses.remove(guid);
|
||||
});
|
||||
|
||||
await profileStorage._finalize();
|
||||
});
|
||||
|
||||
add_task(async function test_normalizeAddressFields() {
|
||||
|
|
@ -923,8 +918,6 @@ add_task(async function test_normalizeAddressFields() {
|
|||
|
||||
profileStorage.addresses.remove(guid);
|
||||
});
|
||||
|
||||
await profileStorage._finalize();
|
||||
});
|
||||
|
||||
add_task(async function test_computeCreditCardFields() {
|
||||
|
|
@ -942,8 +935,6 @@ add_task(async function test_computeCreditCardFields() {
|
|||
|
||||
profileStorage.creditCards.remove(guid);
|
||||
});
|
||||
|
||||
await profileStorage._finalize();
|
||||
});
|
||||
|
||||
add_task(async function test_normalizeCreditCardFields() {
|
||||
|
|
@ -961,6 +952,4 @@ add_task(async function test_normalizeCreditCardFields() {
|
|||
|
||||
profileStorage.creditCards.remove(guid);
|
||||
});
|
||||
|
||||
await profileStorage._finalize();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -118,11 +118,6 @@ XPCOMUtils.defineLazyGetter(FileTestUtils, "_globalTemporaryDirectory",
|
|||
for (let path of gPathsToRemove) {
|
||||
await this.tolerantRemove(path);
|
||||
}
|
||||
|
||||
if (!(await OS.File.exists(dir.path))) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Detect any extra files, like the ".part" files of downloads.
|
||||
let iterator = new OS.File.DirectoryIterator(dir.path);
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
@import url("chrome://global/content/autocomplete.css");
|
||||
@import url("chrome://global/skin/autocomplete.css");
|
||||
@import url("resource://formautofill/autocomplete-item-shared.css");
|
||||
@import url("resource://formautofill/autocomplete-item.css");
|
||||
@import url("chrome://formautofill-shared/skin/autocomplete-item.css");
|
||||
@import url("chrome://formautofill/skin/autocomplete-item.css");
|
||||
@import url("chrome://global/skin/dialog.css");
|
||||
@import url("chrome://global/skin/dropmarker.css");
|
||||
@import url("chrome://global/skin/groupbox.css");
|
||||
|
|
|
|||
Loading…
Reference in a new issue