From ec367461438ff0c641ccc8efa360089621a5a608 Mon Sep 17 00:00:00 2001 From: Matthew Noorenberghe Date: Fri, 16 Dec 2016 01:23:48 -0500 Subject: [PATCH] Bug 1322622 - Load form autofill JSMs from the built files and move JSMs out of content/. r=steveck MozReview-Commit-ID: 4DDsDlw4Jr3 --HG-- rename : browser/extensions/formautofill/content/FormAutofillContent.jsm => browser/extensions/formautofill/FormAutofillContent.jsm rename : browser/extensions/formautofill/content/FormAutofillParent.jsm => browser/extensions/formautofill/FormAutofillParent.jsm rename : browser/extensions/formautofill/content/ProfileStorage.jsm => browser/extensions/formautofill/ProfileStorage.jsm extra : rebase_source : 87e6bee2cb6207138400e2f92f9cf8245394cbb4 --- .../{content => }/FormAutofillContent.jsm | 0 .../{content => }/FormAutofillParent.jsm | 0 .../{content => }/ProfileStorage.jsm | 0 browser/extensions/formautofill/jar.mn | 4 ++-- .../extensions/formautofill/test/unit/head.js | 17 ++++++++++++----- .../extensions/formautofill/test/unit/tail.js | 5 ----- .../formautofill/test/unit/xpcshell.ini | 4 +--- 7 files changed, 15 insertions(+), 15 deletions(-) rename browser/extensions/formautofill/{content => }/FormAutofillContent.jsm (100%) rename browser/extensions/formautofill/{content => }/FormAutofillParent.jsm (100%) rename browser/extensions/formautofill/{content => }/ProfileStorage.jsm (100%) diff --git a/browser/extensions/formautofill/content/FormAutofillContent.jsm b/browser/extensions/formautofill/FormAutofillContent.jsm similarity index 100% rename from browser/extensions/formautofill/content/FormAutofillContent.jsm rename to browser/extensions/formautofill/FormAutofillContent.jsm diff --git a/browser/extensions/formautofill/content/FormAutofillParent.jsm b/browser/extensions/formautofill/FormAutofillParent.jsm similarity index 100% rename from browser/extensions/formautofill/content/FormAutofillParent.jsm rename to browser/extensions/formautofill/FormAutofillParent.jsm diff --git a/browser/extensions/formautofill/content/ProfileStorage.jsm b/browser/extensions/formautofill/ProfileStorage.jsm similarity index 100% rename from browser/extensions/formautofill/content/ProfileStorage.jsm rename to browser/extensions/formautofill/ProfileStorage.jsm diff --git a/browser/extensions/formautofill/jar.mn b/browser/extensions/formautofill/jar.mn index 0cba721ef32b..97c612b99d32 100644 --- a/browser/extensions/formautofill/jar.mn +++ b/browser/extensions/formautofill/jar.mn @@ -3,5 +3,5 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. [features/formautofill@mozilla.org] chrome.jar: -% resource formautofill %content/ - content/ (content/*) +% resource formautofill %res/ + res/ (*.jsm) diff --git a/browser/extensions/formautofill/test/unit/head.js b/browser/extensions/formautofill/test/unit/head.js index 997c9221bf81..762c1b2d9739 100644 --- a/browser/extensions/formautofill/test/unit/head.js +++ b/browser/extensions/formautofill/test/unit/head.js @@ -18,11 +18,18 @@ XPCOMUtils.defineLazyModuleGetter(this, "DownloadPaths", XPCOMUtils.defineLazyModuleGetter(this, "FileUtils", "resource://gre/modules/FileUtils.jsm"); -// Register the resource path of formautofill -let resHandler = Services.io.getProtocolHandler("resource") - .QueryInterface(Ci.nsISubstitutingProtocolHandler); -let dataURI = NetUtil.newURI(do_get_file(".", true)); -resHandler.setSubstitution("formautofill", dataURI); +// Load our bootstrap extension manifest so we can access our chrome/resource URIs. +const EXTENSION_ID = "formautofill@mozilla.org"; +let extensionDir = Services.dirsvc.get("GreD", Ci.nsIFile); +extensionDir.append("browser"); +extensionDir.append("features"); +extensionDir.append(EXTENSION_ID); +// If the unpacked extension doesn't exist, use the packed version. +if (!extensionDir.exists()) { + extensionDir = extensionDir.parent; + extensionDir.append(EXTENSION_ID + ".xpi"); +} +Components.manager.addBootstrappedManifestLocation(extensionDir); // While the previous test file should have deleted all the temporary files it // used, on Windows these might still be pending deletion on the physical file diff --git a/browser/extensions/formautofill/test/unit/tail.js b/browser/extensions/formautofill/test/unit/tail.js index 96bdd89156c7..aa9bed451755 100644 --- a/browser/extensions/formautofill/test/unit/tail.js +++ b/browser/extensions/formautofill/test/unit/tail.js @@ -2,9 +2,4 @@ * Cleans up the testing environment. */ -/* global resHandler */ - "use strict"; - -// Unregister the resource path of formautofill. -resHandler.setSubstitution("formautofill", null); diff --git a/browser/extensions/formautofill/test/unit/xpcshell.ini b/browser/extensions/formautofill/test/unit/xpcshell.ini index 1a7ebfcf3fed..b007b6922691 100644 --- a/browser/extensions/formautofill/test/unit/xpcshell.ini +++ b/browser/extensions/formautofill/test/unit/xpcshell.ini @@ -1,10 +1,8 @@ [DEFAULT] +firefox-appdir = browser head = head.js tail = tail.js support-files = - ../../content/FormAutofillContent.jsm - ../../content/FormAutofillParent.jsm - ../../content/ProfileStorage.jsm [test_autofillFormFields.js] [test_collectFormFields.js]