Bug 1322622 - Load form autofill JSMs from the built files and move JSMs out of content/. r=steveck
MozReview-Commit-ID: 4DDsDlw4Jr3
rename from browser/extensions/formautofill/content/FormAutofillContent.jsm
rename to browser/extensions/formautofill/FormAutofillContent.jsm
rename from browser/extensions/formautofill/content/FormAutofillParent.jsm
rename to browser/extensions/formautofill/FormAutofillParent.jsm
rename from browser/extensions/formautofill/content/ProfileStorage.jsm
rename to browser/extensions/formautofill/ProfileStorage.jsm
--- a/browser/extensions/formautofill/jar.mn
+++ b/browser/extensions/formautofill/jar.mn
@@ -1,7 +1,7 @@
# 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/.
[features/formautofill@mozilla.org] chrome.jar:
-% resource formautofill %content/
- content/ (content/*)
+% resource formautofill %res/
+ res/ (*.jsm)
--- a/browser/extensions/formautofill/test/unit/head.js
+++ b/browser/extensions/formautofill/test/unit/head.js
@@ -13,21 +13,28 @@ Cu.import("resource://gre/modules/Servic
Cu.import("resource://gre/modules/NetUtil.jsm");
Cu.import("resource://testing-common/MockDocument.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "DownloadPaths",
"resource://gre/modules/DownloadPaths.jsm");
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
// system. Thus, start from a new base number every time, to make a collision
// with a file that is still pending deletion highly unlikely.
let gFileCounter = Math.floor(Math.random() * 1000000);
/**
--- a/browser/extensions/formautofill/test/unit/tail.js
+++ b/browser/extensions/formautofill/test/unit/tail.js
@@ -1,10 +1,5 @@
/**
* Cleans up the testing environment.
*/
-/* global resHandler */
-
"use strict";
-
-// Unregister the resource path of formautofill.
-resHandler.setSubstitution("formautofill", null);
--- a/browser/extensions/formautofill/test/unit/xpcshell.ini
+++ b/browser/extensions/formautofill/test/unit/xpcshell.ini
@@ -1,12 +1,10 @@
[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]
[test_populateFieldValues.js]
[test_profileStorage.js]