summaryrefslogtreecommitdiffstats
path: root/chrome/test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /chrome/test
parentInitial commit. (diff)
downloadfirefox-upstream.tar.xz
firefox-upstream.zip
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'chrome/test')
-rw-r--r--chrome/test/.eslintrc.js5
-rw-r--r--chrome/test/moz.build10
-rw-r--r--chrome/test/unit/data/test_abi.manifest4
-rw-r--r--chrome/test/unit/data/test_bug292789.manifest4
-rw-r--r--chrome/test/unit/data/test_bug380398.manifest14
-rw-r--r--chrome/test/unit/data/test_bug397073.manifest6
-rw-r--r--chrome/test/unit/data/test_bug399707.manifest11
-rw-r--r--chrome/test/unit/data/test_bug401153.manifest11
-rw-r--r--chrome/test/unit/data/test_bug519468.manifest4
-rw-r--r--chrome/test/unit/data/test_bug564667.xpibin0 -> 569 bytes
-rw-r--r--chrome/test/unit/data/test_bug564667/chrome.manifest12
-rw-r--r--chrome/test/unit/data/test_bug564667/loaded.manifest2
-rw-r--r--chrome/test/unit/data/test_bug848297.manifest4
-rw-r--r--chrome/test/unit/data/test_crlf.manifest3
-rw-r--r--chrome/test/unit/data/test_data_protocol_registration.manifest5
-rw-r--r--chrome/test/unit/data/test_no_remote_registration.manifest32
-rw-r--r--chrome/test/unit/data/test_resolve_uris.manifest5
-rw-r--r--chrome/test/unit/head_crtestutils.js11
-rw-r--r--chrome/test/unit/test_abi.js26
-rw-r--r--chrome/test/unit/test_bug292789.js31
-rw-r--r--chrome/test/unit/test_bug380398.js56
-rw-r--r--chrome/test/unit/test_bug397073.js49
-rw-r--r--chrome/test/unit/test_bug399707.js53
-rw-r--r--chrome/test/unit/test_bug401153.js51
-rw-r--r--chrome/test/unit/test_bug415367.js47
-rw-r--r--chrome/test/unit/test_bug564667.js86
-rw-r--r--chrome/test/unit/test_crlf.js13
-rw-r--r--chrome/test/unit/test_data_protocol_registration.js121
-rw-r--r--chrome/test/unit/test_no_remote_registration.js235
-rw-r--r--chrome/test/unit/test_resolve_uris.js86
-rw-r--r--chrome/test/unit/xpcshell.ini17
-rw-r--r--chrome/test/unit_ipc/test_resolve_uris_ipc.js9
-rw-r--r--chrome/test/unit_ipc/xpcshell.ini9
33 files changed, 1032 insertions, 0 deletions
diff --git a/chrome/test/.eslintrc.js b/chrome/test/.eslintrc.js
new file mode 100644
index 0000000000..69e89d0054
--- /dev/null
+++ b/chrome/test/.eslintrc.js
@@ -0,0 +1,5 @@
+"use strict";
+
+module.exports = {
+ extends: ["plugin:mozilla/xpcshell-test"],
+};
diff --git a/chrome/test/moz.build b/chrome/test/moz.build
new file mode 100644
index 0000000000..148e5d5ad9
--- /dev/null
+++ b/chrome/test/moz.build
@@ -0,0 +1,10 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# 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/.
+
+XPCSHELL_TESTS_MANIFESTS += [
+ "unit/xpcshell.ini",
+ "unit_ipc/xpcshell.ini",
+]
diff --git a/chrome/test/unit/data/test_abi.manifest b/chrome/test/unit/data/test_abi.manifest
new file mode 100644
index 0000000000..6d265fc99f
--- /dev/null
+++ b/chrome/test/unit/data/test_abi.manifest
@@ -0,0 +1,4 @@
+category abitest test1 found ABI=XPCShell_noarch-spidermonkey
+category abitest test2 notfound ABI=WINNT_noarch-spidermonkey
+category abitest test3 found ABI!=WINNT_noarch-spidermonkey
+category abitest test4 notfound ABI!=XPCShell_noarch-spidermonkey
diff --git a/chrome/test/unit/data/test_bug292789.manifest b/chrome/test/unit/data/test_bug292789.manifest
new file mode 100644
index 0000000000..df67aa15c8
--- /dev/null
+++ b/chrome/test/unit/data/test_bug292789.manifest
@@ -0,0 +1,4 @@
+content test1 test/
+content test2 test/ contentaccessible=yes
+content test3 test/ contentaccessible=no
+content test4 test/ contentaccessible
diff --git a/chrome/test/unit/data/test_bug380398.manifest b/chrome/test/unit/data/test_bug380398.manifest
new file mode 100644
index 0000000000..a2349c793f
--- /dev/null
+++ b/chrome/test/unit/data/test_bug380398.manifest
@@ -0,0 +1,14 @@
+# Success cases
+content test1 test/ appversion=5
+content test2 test/ appversion<6
+content test3 test/ appversion>4
+content test4 test/ appversion>=5
+content test5 test/ appversion<=5
+
+# Failure cases
+content test6 test/ appversion>5
+content test7 test/ appversion<5
+content test8 test/ appversion>
+content test9 test/ appversion<
+content test10 test/ appversion=
+content test11 test/ appversion
diff --git a/chrome/test/unit/data/test_bug397073.manifest b/chrome/test/unit/data/test_bug397073.manifest
new file mode 100644
index 0000000000..a219e8c7eb
--- /dev/null
+++ b/chrome/test/unit/data/test_bug397073.manifest
@@ -0,0 +1,6 @@
+# Success cases
+content test1 test/ os=xpcshell
+content test2 test/ os=XPCshell
+
+# Failure cases
+content test3 test/ os=FOOshell
diff --git a/chrome/test/unit/data/test_bug399707.manifest b/chrome/test/unit/data/test_bug399707.manifest
new file mode 100644
index 0000000000..ac0d972039
--- /dev/null
+++ b/chrome/test/unit/data/test_bug399707.manifest
@@ -0,0 +1,11 @@
+# Success cases
+content test1 test/ application={39885e5f-f6b4-4e2a-87e5-6259ecf79011}
+content test2 test/ application!={d51eecae-eab5-4779-85cb-45f1ec8657c8}
+content test3 test/ application!=
+
+# Failure cases
+content test4 test/ application=
+content test5 test/ application={d51eecae-eab5-4779-85cb-45f1ec8657c8}
+content test6 test/ application!={39885e5f-f6b4-4e2a-87e5-6259ecf79011}
+content test7 test/ appversion=={39885e5f-f6b4-4e2a-87e5-6259ecf79011}
+content test8 test/ application!!{d51eecae-eab5-4779-85cb-45f1ec8657c8}
diff --git a/chrome/test/unit/data/test_bug401153.manifest b/chrome/test/unit/data/test_bug401153.manifest
new file mode 100644
index 0000000000..4fcba1bdc1
--- /dev/null
+++ b/chrome/test/unit/data/test_bug401153.manifest
@@ -0,0 +1,11 @@
+# Should work
+resource test1 test1/
+
+# Mapping into jar files should work
+resource test3 jar:test3.jar!/resources/
+
+# Invalid line
+resource test4
+
+# Check we made it through the whole manifest
+resource test5 test5/
diff --git a/chrome/test/unit/data/test_bug519468.manifest b/chrome/test/unit/data/test_bug519468.manifest
new file mode 100644
index 0000000000..36f0a18f2a
--- /dev/null
+++ b/chrome/test/unit/data/test_bug519468.manifest
@@ -0,0 +1,4 @@
+locale testmatchos en-US jar:en-US.jar!/locale/en-US/global/
+locale testmatchos fr-FR jar:en-US.jar!/locale/en-US/global/
+locale testmatchos de-DE jar:en-US.jar!/locale/en-US/global/
+locale testmatchos xx-AA jar:en-US.jar!/locale/en-US/global/
diff --git a/chrome/test/unit/data/test_bug564667.xpi b/chrome/test/unit/data/test_bug564667.xpi
new file mode 100644
index 0000000000..be1632d8ca
--- /dev/null
+++ b/chrome/test/unit/data/test_bug564667.xpi
Binary files differ
diff --git a/chrome/test/unit/data/test_bug564667/chrome.manifest b/chrome/test/unit/data/test_bug564667/chrome.manifest
new file mode 100644
index 0000000000..dd7fbd7796
--- /dev/null
+++ b/chrome/test/unit/data/test_bug564667/chrome.manifest
@@ -0,0 +1,12 @@
+# Locally defined URLs
+content test1 test/
+locale test1 en-US test/
+skin test1 test test/
+
+# Test Override
+content testOverride test/
+override chrome://testOverride/content file:///test1/override
+
+
+# Load external manifest
+manifest loaded.manifest
diff --git a/chrome/test/unit/data/test_bug564667/loaded.manifest b/chrome/test/unit/data/test_bug564667/loaded.manifest
new file mode 100644
index 0000000000..2f231856a4
--- /dev/null
+++ b/chrome/test/unit/data/test_bug564667/loaded.manifest
@@ -0,0 +1,2 @@
+content test2 test/
+locale test2 en-US test/
diff --git a/chrome/test/unit/data/test_bug848297.manifest b/chrome/test/unit/data/test_bug848297.manifest
new file mode 100644
index 0000000000..d9730a9ce7
--- /dev/null
+++ b/chrome/test/unit/data/test_bug848297.manifest
@@ -0,0 +1,4 @@
+locale basepack en-US jar:en-US.jar!/locale/en-US/global/
+locale basepack fr jar:en-US.jar!/locale/en-US/global/
+locale overpack en-US jar:en-US.jar!/locale/en-US/global/
+locale overpack de jar:en-US.jar!/locale/en-US/global/
diff --git a/chrome/test/unit/data/test_crlf.manifest b/chrome/test/unit/data/test_crlf.manifest
new file mode 100644
index 0000000000..0f3032112e
--- /dev/null
+++ b/chrome/test/unit/data/test_crlf.manifest
@@ -0,0 +1,3 @@
+# Note: the following lines begins/end with a CR
+
+ content test_crlf .
diff --git a/chrome/test/unit/data/test_data_protocol_registration.manifest b/chrome/test/unit/data/test_data_protocol_registration.manifest
new file mode 100644
index 0000000000..ceaa80c509
--- /dev/null
+++ b/chrome/test/unit/data/test_data_protocol_registration.manifest
@@ -0,0 +1,5 @@
+# package used only for valid override
+content good-package bar/
+
+# Local resource (should work)
+override chrome://good-package/content/test.xul data:application/xhtml+xml,
diff --git a/chrome/test/unit/data/test_no_remote_registration.manifest b/chrome/test/unit/data/test_no_remote_registration.manifest
new file mode 100644
index 0000000000..b677850ca2
--- /dev/null
+++ b/chrome/test/unit/data/test_no_remote_registration.manifest
@@ -0,0 +1,32 @@
+# package used only for valid overlaying and overrides
+content good-package bar/
+
+# UI Resource URIs (should not work)
+content moz-protocol-ui-resource moz-protocol-ui-resource://foo/
+locale moz-protocol-ui-resource en-us moz-protocol-ui-resource://foo/
+skin moz-protocol-ui-resource skin1 moz-protocol-ui-resource://foo/
+override chrome://good-package/content/override-moz-protocol-ui-resource.xul moz-protocol-ui-resource://foo/
+resource moz-protocol-ui-resource moz-protocol-ui-resource://foo/
+
+# Local file URIs (should not work)
+content moz-protocol-local-file moz-protocol-local-file://foo/
+locale moz-protocol-local-file en-us moz-protocol-local-file://foo/
+skin moz-protocol-local-file skin1 moz-protocol-local-file://foo/
+override chrome://good-package/content/override-moz-protocol-local-file.xul moz-protocol-local-file://foo/
+resource moz-protocol-local-file moz-protocol-local-file://foo/
+
+# Loadable by anyone URIs (should not work)
+content moz-protocol-loadable-by-anyone moz-protocol-loadable-by-anyone://foo/
+locale moz-protocol-loadable-by-anyone en-us moz-protocol-loadable-by-anyone://foo/
+skin moz-protocol-loadable-by-anyone skin1 moz-protocol-loadable-by-anyone://foo/
+override chrome://good-package/content/override-moz-protocol-loadable-by-anyone.xul moz-protocol-loadable-by-anyone://foo/
+resource moz-protocol-loadable-by-anyone moz-protocol-loadable-by-anyone://foo/
+
+# Working protocols should be after this point. Failing ones should be before.
+
+# Local resource (should work)
+content moz-protocol-local-resource moz-protocol-local-resource://foo/
+locale moz-protocol-local-resource en-us moz-protocol-local-resource://foo/
+skin moz-protocol-local-resource skin1 moz-protocol-local-resource://foo/
+override chrome://good-package/content/override-moz-protocol-local-resource.xul moz-protocol-local-resource://foo/
+resource moz-protocol-local-resource moz-protocol-local-resource://foo/
diff --git a/chrome/test/unit/data/test_resolve_uris.manifest b/chrome/test/unit/data/test_resolve_uris.manifest
new file mode 100644
index 0000000000..43b497e67d
--- /dev/null
+++ b/chrome/test/unit/data/test_resolve_uris.manifest
@@ -0,0 +1,5 @@
+resource foo .
+content foo resource://foo/foo-content/
+locale foo foo resource://foo/foo-locale/
+skin foo foo resource://foo/foo-skin/
+override chrome://good-package/content/override-me.xul resource://foo/foo-override/override-me.xul
diff --git a/chrome/test/unit/head_crtestutils.js b/chrome/test/unit/head_crtestutils.js
new file mode 100644
index 0000000000..e2c9567222
--- /dev/null
+++ b/chrome/test/unit/head_crtestutils.js
@@ -0,0 +1,11 @@
+const XULAPPINFO_CONTRACTID = "@mozilla.org/xre/app-info;1";
+const XULAPPINFO_CID = Components.ID("{4ba645d3-be6f-40d6-a42a-01b2f40091b8}");
+
+var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
+
+function registerManifests(manifests) {
+ var reg = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
+ for (var manifest of manifests) {
+ reg.autoRegister(manifest);
+ }
+}
diff --git a/chrome/test/unit/test_abi.js b/chrome/test/unit/test_abi.js
new file mode 100644
index 0000000000..1435bd04ad
--- /dev/null
+++ b/chrome/test/unit/test_abi.js
@@ -0,0 +1,26 @@
+ChromeUtils.import("resource://gre/modules/Services.jsm", this);
+ChromeUtils.import("resource://testing-common/AppInfo.jsm", this);
+updateAppInfo({
+ name: "XPCShell",
+ ID: "{39885e5f-f6b4-4e2a-87e5-6259ecf79011}",
+ version: "5",
+ platformVersion: "1.9",
+});
+
+registerManifests([do_get_file("data/test_abi.manifest")]);
+
+function is_registered(name) {
+ try {
+ var d = Services.catMan.getCategoryEntry("abitest", name);
+ return d == "found";
+ } catch (e) {
+ return false;
+ }
+}
+
+function run_test() {
+ Assert.ok(is_registered("test1"));
+ Assert.ok(!is_registered("test2"));
+ Assert.ok(is_registered("test3"));
+ Assert.ok(!is_registered("test4"));
+}
diff --git a/chrome/test/unit/test_bug292789.js b/chrome/test/unit/test_bug292789.js
new file mode 100644
index 0000000000..5bc6ac417d
--- /dev/null
+++ b/chrome/test/unit/test_bug292789.js
@@ -0,0 +1,31 @@
+/* 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/.
+ */
+
+const MANIFESTS = [do_get_file("data/test_bug292789.manifest")];
+
+registerManifests(MANIFESTS);
+
+var gCR;
+
+function check_accessibility(spec, desired) {
+ var uri = Services.io.newURI(spec);
+ var actual = gCR.allowContentToAccess(uri);
+ Assert.equal(desired, actual);
+}
+
+function run_test() {
+ gCR = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(
+ Ci.nsIXULChromeRegistry
+ );
+ gCR.checkForNewChrome();
+
+ check_accessibility("chrome://test1/content/", false);
+ check_accessibility("chrome://test1/content/foo.js", false);
+ check_accessibility("chrome://test2/content/", true);
+ check_accessibility("chrome://test2/content/foo.js", true);
+ check_accessibility("chrome://test3/content/", false);
+ check_accessibility("chrome://test3/content/foo.js", false);
+ check_accessibility("chrome://test4/content/", true);
+}
diff --git a/chrome/test/unit/test_bug380398.js b/chrome/test/unit/test_bug380398.js
new file mode 100644
index 0000000000..8278e89117
--- /dev/null
+++ b/chrome/test/unit/test_bug380398.js
@@ -0,0 +1,56 @@
+/* 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/.
+ */
+
+var MANIFESTS = [do_get_file("data/test_bug380398.manifest")];
+
+registerManifests(MANIFESTS);
+
+ChromeUtils.import("resource://testing-common/AppInfo.jsm", this);
+updateAppInfo({
+ name: "XPCShell",
+ id: "{39885e5f-f6b4-4e2a-87e5-6259ecf79011}",
+ version: "5",
+ platformVersion: "1.9",
+});
+
+var chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(
+ Ci.nsIChromeRegistry
+);
+chromeReg.checkForNewChrome();
+
+var target = Services.io.newFileURI(do_get_file("data"));
+target = target.spec + "test/test.xul";
+
+function test_succeeded_mapping(namespace) {
+ var uri = Services.io.newURI("chrome://" + namespace + "/content/test.xul");
+ try {
+ var result = chromeReg.convertChromeURL(uri);
+ Assert.equal(result.spec, target);
+ } catch (ex) {
+ do_throw(namespace);
+ }
+}
+
+function test_failed_mapping(namespace) {
+ var uri = Services.io.newURI("chrome://" + namespace + "/content/test.xul");
+ try {
+ chromeReg.convertChromeURL(uri);
+ do_throw(namespace);
+ } catch (ex) {}
+}
+
+function run_test() {
+ test_succeeded_mapping("test1");
+ test_succeeded_mapping("test2");
+ test_succeeded_mapping("test3");
+ test_succeeded_mapping("test4");
+ test_succeeded_mapping("test5");
+ test_failed_mapping("test6");
+ test_failed_mapping("test7");
+ test_failed_mapping("test8");
+ test_failed_mapping("test9");
+ test_failed_mapping("test10");
+ test_failed_mapping("test11");
+}
diff --git a/chrome/test/unit/test_bug397073.js b/chrome/test/unit/test_bug397073.js
new file mode 100644
index 0000000000..5b769c6bca
--- /dev/null
+++ b/chrome/test/unit/test_bug397073.js
@@ -0,0 +1,49 @@
+/* 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/.
+ */
+
+var MANIFESTS = [do_get_file("data/test_bug397073.manifest")];
+
+registerManifests(MANIFESTS);
+
+ChromeUtils.import("resource://testing-common/AppInfo.jsm", this);
+updateAppInfo({
+ name: "XPCShell",
+ ID: "{39885e5f-f6b4-4e2a-87e5-6259ecf79011}",
+ version: "5",
+ platformVersion: "1.9",
+});
+
+var chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(
+ Ci.nsIChromeRegistry
+);
+chromeReg.checkForNewChrome();
+
+var target = Services.io.newFileURI(do_get_file("data"));
+target = target.spec + "test/test.xul";
+
+function test_succeeded_mapping(namespace) {
+ var uri = Services.io.newURI("chrome://" + namespace + "/content/test.xul");
+ try {
+ var result = chromeReg.convertChromeURL(uri);
+ Assert.equal(result.spec, target);
+ } catch (ex) {
+ do_throw(namespace);
+ }
+}
+
+function test_failed_mapping(namespace) {
+ var uri = Services.io.newURI("chrome://" + namespace + "/content/test.xul");
+ try {
+ chromeReg.convertChromeURL(uri);
+ do_throw(namespace);
+ } catch (ex) {}
+}
+
+function run_test() {
+ test_succeeded_mapping("test1");
+ test_succeeded_mapping("test2");
+
+ test_failed_mapping("test3");
+}
diff --git a/chrome/test/unit/test_bug399707.js b/chrome/test/unit/test_bug399707.js
new file mode 100644
index 0000000000..1d3eb3d775
--- /dev/null
+++ b/chrome/test/unit/test_bug399707.js
@@ -0,0 +1,53 @@
+/* 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/.
+ */
+
+var MANIFESTS = [do_get_file("data/test_bug399707.manifest")];
+
+registerManifests(MANIFESTS);
+
+ChromeUtils.import("resource://testing-common/AppInfo.jsm", this);
+updateAppInfo({
+ name: "XPCShell",
+ ID: "{39885e5f-f6b4-4e2a-87e5-6259ecf79011}",
+ version: "5",
+ platformVersion: "1.9",
+});
+
+var chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(
+ Ci.nsIChromeRegistry
+);
+chromeReg.checkForNewChrome();
+
+var target = Services.io.newFileURI(do_get_file("data"));
+target = target.spec + "test/test.xul";
+
+function test_succeeded_mapping(namespace) {
+ var uri = Services.io.newURI("chrome://" + namespace + "/content/test.xul");
+ try {
+ var result = chromeReg.convertChromeURL(uri);
+ Assert.equal(result.spec, target);
+ } catch (ex) {
+ do_throw(namespace);
+ }
+}
+
+function test_failed_mapping(namespace) {
+ var uri = Services.io.newURI("chrome://" + namespace + "/content/test.xul");
+ try {
+ chromeReg.convertChromeURL(uri);
+ do_throw(namespace);
+ } catch (ex) {}
+}
+
+function run_test() {
+ test_succeeded_mapping("test1");
+ test_succeeded_mapping("test2");
+ test_succeeded_mapping("test3");
+ test_failed_mapping("test4");
+ test_failed_mapping("test5");
+ test_failed_mapping("test6");
+ test_failed_mapping("test7");
+ test_failed_mapping("test8");
+}
diff --git a/chrome/test/unit/test_bug401153.js b/chrome/test/unit/test_bug401153.js
new file mode 100644
index 0000000000..36b7d60e17
--- /dev/null
+++ b/chrome/test/unit/test_bug401153.js
@@ -0,0 +1,51 @@
+/* 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/.
+ */
+
+var MANIFESTS = [do_get_file("data/test_bug401153.manifest")];
+
+registerManifests(MANIFESTS);
+
+ChromeUtils.import("resource://testing-common/AppInfo.jsm", this);
+updateAppInfo({
+ name: "XPCShell",
+ ID: "{39885e5f-f6b4-4e2a-87e5-6259ecf79011}",
+ version: "5",
+ platformVersion: "1.9",
+});
+
+var chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(
+ Ci.nsIChromeRegistry
+);
+chromeReg.checkForNewChrome();
+
+var rph = Services.io
+ .getProtocolHandler("resource")
+ .QueryInterface(Ci.nsIResProtocolHandler);
+
+function test_succeeded_mapping(namespace, target) {
+ try {
+ Assert.ok(rph.hasSubstitution(namespace));
+ var uri = Services.io.newURI("resource://" + namespace);
+ dump(
+ "### checking for " + target + ", getting " + rph.resolveURI(uri) + "\n"
+ );
+ Assert.equal(rph.resolveURI(uri), target);
+ } catch (ex) {
+ dump(ex + "\n");
+ do_throw(namespace);
+ }
+}
+
+function test_failed_mapping(namespace) {
+ Assert.ok(!rph.hasSubstitution(namespace));
+}
+
+function run_test() {
+ var data = Services.io.newFileURI(do_get_file("data")).spec;
+ test_succeeded_mapping("test1", data + "test1/");
+ test_succeeded_mapping("test3", "jar:" + data + "test3.jar!/resources/");
+ test_failed_mapping("test4");
+ test_succeeded_mapping("test5", data + "test5/");
+}
diff --git a/chrome/test/unit/test_bug415367.js b/chrome/test/unit/test_bug415367.js
new file mode 100644
index 0000000000..7dfaa3a9b0
--- /dev/null
+++ b/chrome/test/unit/test_bug415367.js
@@ -0,0 +1,47 @@
+/* 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/.
+ */
+
+function test_uri(obj) {
+ var uri = null;
+ var failed = false;
+ var message = "";
+ try {
+ uri = Services.io.newURI(obj.uri);
+ if (!obj.result) {
+ failed = true;
+ message = obj.uri + " should not be accepted as a valid URI";
+ }
+ } catch (ex) {
+ if (obj.result) {
+ failed = true;
+ message = obj.uri + " should be accepted as a valid URI";
+ }
+ }
+ if (failed) {
+ do_throw(message);
+ }
+ if (obj.result) {
+ Assert.ok(uri != null);
+ Assert.equal(uri.spec, obj.uri);
+ }
+}
+
+function run_test() {
+ var tests = [
+ { uri: "chrome://blah/content/blah.xul", result: true },
+ { uri: "chrome://blah/content/:/blah/blah.xul", result: false },
+ { uri: "chrome://blah/content/%252e./blah/blah.xul", result: false },
+ { uri: "chrome://blah/content/%252e%252e/blah/blah.xul", result: false },
+ { uri: "chrome://blah/content/blah.xul?param=%252e./blah/", result: true },
+ { uri: "chrome://blah/content/blah.xul?param=:/blah/", result: true },
+ {
+ uri: "chrome://blah/content/blah.xul?param=%252e%252e/blah/",
+ result: true,
+ },
+ ];
+ for (var i = 0; i < tests.length; ++i) {
+ test_uri(tests[i]);
+ }
+}
diff --git a/chrome/test/unit/test_bug564667.js b/chrome/test/unit/test_bug564667.js
new file mode 100644
index 0000000000..7ee5229827
--- /dev/null
+++ b/chrome/test/unit/test_bug564667.js
@@ -0,0 +1,86 @@
+/* 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/.
+ */
+
+const UNPACKAGED_ADDON = do_get_file("data/test_bug564667");
+const PACKAGED_ADDON = do_get_file("data/test_bug564667.xpi");
+
+var gCR = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(
+ Ci.nsIChromeRegistry
+);
+
+/*
+ * Checks that a mapping was added
+ */
+function test_mapping(chromeURL, target) {
+ var uri = Services.io.newURI(chromeURL);
+
+ try {
+ var result = gCR.convertChromeURL(uri);
+ Assert.equal(result.spec, target);
+ } catch (ex) {
+ do_throw(chromeURL + " not Registered");
+ }
+}
+
+/*
+ * Checks that a mapping was removed
+ */
+function test_removed_mapping(chromeURL, target) {
+ var uri = Services.io.newURI(chromeURL);
+ try {
+ gCR.convertChromeURL(uri);
+ do_throw(chromeURL + " not removed");
+ } catch (ex) {
+ // This should throw
+ }
+}
+
+function testManifest(manifestPath, baseURI) {
+ // ------------------ Add manifest file ------------------------
+ Components.manager.addBootstrappedManifestLocation(manifestPath);
+
+ // Test Adding Content URL
+ test_mapping("chrome://test1/content", baseURI + "test/test1.xul");
+
+ // Test Adding Locale URL
+ test_mapping("chrome://test1/locale", baseURI + "test/test1.dtd");
+
+ // Test Adding Skin URL
+ test_mapping("chrome://test1/skin", baseURI + "test/test1.css");
+
+ // Test Adding Manifest URL
+ test_mapping("chrome://test2/content", baseURI + "test/test2.xul");
+ test_mapping("chrome://test2/locale", baseURI + "test/test2.dtd");
+
+ // Test Adding Override
+ test_mapping("chrome://testOverride/content", "file:///test1/override");
+
+ // ------------------ Remove manifest file ------------------------
+ Components.manager.removeBootstrappedManifestLocation(manifestPath);
+
+ // Test Removing Content URL
+ test_removed_mapping("chrome://test1/content", baseURI + "test/test1.xul");
+
+ // Test Removing Content URL
+ test_removed_mapping("chrome://test1/locale", baseURI + "test/test1.dtd");
+
+ // Test Removing Skin URL
+ test_removed_mapping("chrome://test1/skin", baseURI + "test/test1.css");
+
+ // Test Removing Manifest URL
+ test_removed_mapping("chrome://test2/content", baseURI + "test/test2.xul");
+ test_removed_mapping("chrome://test2/locale", baseURI + "test/test2.dtd");
+}
+
+function run_test() {
+ // Test an unpackaged addon
+ testManifest(UNPACKAGED_ADDON, Services.io.newFileURI(UNPACKAGED_ADDON).spec);
+
+ // Test a packaged addon
+ testManifest(
+ PACKAGED_ADDON,
+ "jar:" + Services.io.newFileURI(PACKAGED_ADDON).spec + "!/"
+ );
+}
diff --git a/chrome/test/unit/test_crlf.js b/chrome/test/unit/test_crlf.js
new file mode 100644
index 0000000000..73045d3201
--- /dev/null
+++ b/chrome/test/unit/test_crlf.js
@@ -0,0 +1,13 @@
+registerManifests([do_get_file("data/test_crlf.manifest")]);
+
+function run_test() {
+ let cr = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(
+ Ci.nsIChromeRegistry
+ );
+
+ let sourceURI = Services.io.newURI("chrome://test_crlf/content/");
+ // this throws for packages that are not registered
+ let file = cr.convertChromeURL(sourceURI).QueryInterface(Ci.nsIFileURL).file;
+
+ Assert.ok(file.equals(do_get_file("data/test_crlf.xul", true)));
+}
diff --git a/chrome/test/unit/test_data_protocol_registration.js b/chrome/test/unit/test_data_protocol_registration.js
new file mode 100644
index 0000000000..e6dfcf355c
--- /dev/null
+++ b/chrome/test/unit/test_data_protocol_registration.js
@@ -0,0 +1,121 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
+ * vim: sw=2 ts=2 sts=2 tw=78 expandtab :
+ * 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/. */
+
+var manifests = [do_get_file("data/test_data_protocol_registration.manifest")];
+registerManifests(manifests);
+
+function run_test() {
+ const uuidGenerator = Cc["@mozilla.org/uuid-generator;1"].getService(
+ Ci.nsIUUIDGenerator
+ );
+
+ let newAppInfo = ChromeUtils.import(
+ "resource://testing-common/AppInfo.jsm",
+ {}
+ ).newAppInfo;
+ let XULAppInfo = newAppInfo({
+ name: "XPCShell",
+ ID: "{39885e5f-f6b4-4e2a-87e5-6259ecf79011}",
+ version: "5",
+ platformVersion: "1.9",
+ });
+
+ let XULAppInfoFactory = {
+ // These two are used when we register all our factories (and unregister)
+ CID: uuidGenerator.generateUUID(),
+ scheme: "XULAppInfo",
+ contractID: XULAPPINFO_CONTRACTID,
+ createInstance(outer, iid) {
+ if (outer != null) {
+ throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
+ }
+ return XULAppInfo.QueryInterface(iid);
+ },
+ };
+
+ // Add our XULAppInfo factory
+ let factories = [XULAppInfoFactory];
+ let old_factories = [];
+ let old_factories_inds = [];
+
+ let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
+
+ // Register our factories
+ for (let i = 0; i < factories.length; i++) {
+ let factory = factories[i];
+
+ // Make sure the class ID has not already been registered
+ if (!registrar.isCIDRegistered(factory.CID)) {
+ // Check to see if a contract was already registered and
+ // register it if it is not. Otherwise, store the previous one
+ // to be restored later and register the new one.
+ if (registrar.isContractIDRegistered(factory.contractID)) {
+ dump(
+ factory.scheme +
+ " is already registered. Storing currently registered object for restoration later."
+ );
+ old_factories.push({
+ CID: registrar.contractIDToCID(factory.contractID),
+ factory: Components.manager.getClassObject(
+ Cc[factory.contractID],
+ Ci.nsIFactory
+ ),
+ });
+ old_factories_inds.push(true);
+ } else {
+ dump(factory.scheme + " has never been registered. Registering...");
+ old_factories.push({ CID: "", factory: null });
+ old_factories_inds.push(false);
+ }
+
+ registrar.registerFactory(
+ factory.CID,
+ "test-" + factory.scheme,
+ factory.contractID,
+ factory
+ );
+ } else {
+ do_throw("CID " + factory.CID + " has already been registered!");
+ }
+ }
+
+ // Check for new chrome
+ let cr = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(
+ Ci.nsIChromeRegistry
+ );
+ cr.checkForNewChrome();
+
+ // Check that our override worked
+ let expectedURI = "data:application/xhtml+xml,";
+ let sourceURI = "chrome://good-package/content/test.xul";
+ try {
+ sourceURI = Services.io.newURI(sourceURI);
+ // this throws for packages that are not registered
+ let uri = cr.convertChromeURL(sourceURI).spec;
+
+ Assert.equal(expectedURI, uri);
+ } catch (e) {
+ dump(e + "\n");
+ do_throw("Should have registered our URI!");
+ }
+
+ // Unregister our factories so we do not leak
+ for (let i = 0; i < factories.length; i++) {
+ let factory = factories[i];
+ let ind = old_factories_inds[i];
+ registrar.unregisterFactory(factory.CID, factory);
+
+ if (ind) {
+ let old_factory = old_factories[i];
+ registrar.registerFactory(
+ old_factory.CID,
+ factory.scheme,
+ factory.contractID,
+ null
+ );
+ }
+ }
+}
diff --git a/chrome/test/unit/test_no_remote_registration.js b/chrome/test/unit/test_no_remote_registration.js
new file mode 100644
index 0000000000..411c985779
--- /dev/null
+++ b/chrome/test/unit/test_no_remote_registration.js
@@ -0,0 +1,235 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
+ * vim: sw=2 ts=2 sts=2 tw=78 expandtab :
+ * 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/. */
+/* globals newAppInfo */
+
+var manifests = [do_get_file("data/test_no_remote_registration.manifest")];
+registerManifests(manifests);
+
+function ProtocolHandler(aScheme, aFlags) {
+ this.scheme = aScheme;
+ this.protocolFlags = aFlags;
+ this.contractID = "@mozilla.org/network/protocol;1?name=" + aScheme;
+}
+
+ProtocolHandler.prototype = {
+ defaultPort: -1,
+ allowPort: () => false,
+ newChannel() {
+ throw Components.Exception("", Cr.NS_ERROR_NOT_IMPLEMENTED);
+ },
+ QueryInterface: ChromeUtils.generateQI(["nsIProtocolHandler"]),
+};
+
+var testProtocols = [
+ // It doesn't matter if it has this flag - the only flag we accept is
+ // URI_IS_LOCAL_RESOURCE.
+ {
+ scheme: "moz-protocol-ui-resource",
+ flags: Ci.nsIProtocolHandler.URI_IS_UI_RESOURCE,
+ CID: Components.ID("{d6dedc93-558f-44fe-90f4-3b4bba8a0b14}"),
+ shouldRegister: false,
+ },
+ // It doesn't matter if it has this flag - the only flag we accept is
+ // URI_IS_LOCAL_RESOURCE.
+ {
+ scheme: "moz-protocol-local-file",
+ flags: Ci.nsIProtocolHandler.URI_IS_LOCAL_FILE,
+ CID: Components.ID("{ee30d594-0a2d-4f47-89cc-d4cde320ab69}"),
+ shouldRegister: false,
+ },
+ // This clearly is non-local
+ {
+ scheme: "moz-protocol-loadable-by-anyone",
+ flags: Ci.nsIProtocolHandler.URI_LOADABLE_BY_ANYONE,
+ CID: Components.ID("{c3735f23-3b0c-4a33-bfa0-79436dcd40b2}"),
+ shouldRegister: false,
+ },
+ // This should always be last (unless we add more flags that are OK)
+ {
+ scheme: "moz-protocol-local-resource",
+ flags: Ci.nsIProtocolHandler.URI_IS_LOCAL_RESOURCE,
+ CID: Components.ID("{b79e977c-f840-469a-b413-0125cc1b62a5}"),
+ shouldRegister: true,
+ },
+];
+function run_test() {
+ ChromeUtils.import("resource://testing-common/AppInfo.jsm", this);
+ let XULAppInfo = newAppInfo({
+ name: "XPCShell",
+ ID: "{39885e5f-f6b4-4e2a-87e5-6259ecf79011}",
+ version: "5",
+ platformVersion: "1.9",
+ });
+
+ const uuidGenerator = Cc["@mozilla.org/uuid-generator;1"].getService(
+ Ci.nsIUUIDGenerator
+ );
+
+ let XULAppInfoFactory = {
+ // These two are used when we register all our factories (and unregister)
+ CID: uuidGenerator.generateUUID(),
+ scheme: "XULAppInfo",
+ contractID: "@mozilla.org/xre/app-info;1",
+ createInstance(outer, iid) {
+ if (outer != null) {
+ throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
+ }
+ return XULAppInfo.QueryInterface(iid);
+ },
+ };
+
+ let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
+
+ // Create factories
+ let factories = [];
+ for (let i = 0; i < testProtocols.length; i++) {
+ factories[i] = {
+ scheme: testProtocols[i].scheme,
+ flags: testProtocols[i].flags,
+ CID: testProtocols[i].CID,
+ contractID:
+ "@mozilla.org/network/protocol;1?name=" + testProtocols[i].scheme,
+ createInstance(aOuter, aIID) {
+ if (aOuter != null) {
+ throw Components.Exception("", Cr.NS_ERROR_NO_AGGREGATION);
+ }
+ let handler = new ProtocolHandler(this.scheme, this.flags, this.CID);
+ return handler.QueryInterface(aIID);
+ },
+ };
+ }
+
+ // Register our factories
+ for (let i = 0; i < factories.length; i++) {
+ let factory = factories[i];
+ registrar.registerFactory(
+ factory.CID,
+ "test-" + factory.scheme,
+ factory.contractID,
+ factory
+ );
+ }
+
+ // Register the XULAppInfoFactory
+ // Make sure the class ID has not already been registered
+ let old_factory = { CID: "", factory: null };
+ if (!registrar.isCIDRegistered(XULAppInfoFactory.CID)) {
+ // Check to see if a contract was already registered and
+ // register it if it is not. Otherwise, store the previous one
+ // to be restored later and register the new one.
+ if (registrar.isContractIDRegistered(XULAppInfoFactory.contractID)) {
+ dump(
+ XULAppInfoFactory.scheme +
+ " is already registered. Storing currently registered object for restoration later."
+ );
+ old_factory.CID = registrar.contractIDToCID(XULAppInfoFactory.contractID);
+ old_factory.factory = Components.manager.getClassObject(
+ Cc[XULAppInfoFactory.contractID],
+ Ci.nsIFactory
+ );
+ } else {
+ dump(
+ XULAppInfoFactory.scheme + " has never been registered. Registering..."
+ );
+ }
+
+ registrar.registerFactory(
+ XULAppInfoFactory.CID,
+ "test-" + XULAppInfoFactory.scheme,
+ XULAppInfoFactory.contractID,
+ XULAppInfoFactory
+ );
+ } else {
+ do_throw("CID " + XULAppInfoFactory.CID + " has already been registered!");
+ }
+
+ // Check for new chrome
+ let cr = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(
+ Ci.nsIChromeRegistry
+ );
+ cr.checkForNewChrome();
+
+ // See if our various things were able to register
+ let registrationTypes = ["content", "locale", "skin", "override", "resource"];
+ for (let i = 0; i < testProtocols.length; i++) {
+ let protocol = testProtocols[i];
+ for (let j = 0; j < registrationTypes.length; j++) {
+ let type = registrationTypes[j];
+ dump(
+ "Testing protocol '" + protocol.scheme + "' with type '" + type + "'\n"
+ );
+ let expectedURI = protocol.scheme + "://foo/";
+ let sourceURI = "chrome://" + protocol.scheme + "/" + type + "/";
+ switch (type) {
+ case "content":
+ expectedURI += protocol.scheme + ".xul";
+ break;
+ case "locale":
+ expectedURI += protocol.scheme + ".dtd";
+ break;
+ case "skin":
+ expectedURI += protocol.scheme + ".css";
+ break;
+ case "override":
+ sourceURI =
+ "chrome://good-package/content/override-" +
+ protocol.scheme +
+ ".xul";
+ break;
+ case "resource":
+ sourceURI = "resource://" + protocol.scheme + "/";
+ break;
+ }
+ try {
+ sourceURI = Services.io.newURI(sourceURI);
+ let uri;
+ if (type == "resource") {
+ // resources go about a slightly different way than everything else
+ let rph = Services.io
+ .getProtocolHandler("resource")
+ .QueryInterface(Ci.nsIResProtocolHandler);
+ // this throws for packages that are not registered
+ uri = rph.resolveURI(sourceURI);
+ } else {
+ // this throws for packages that are not registered
+ uri = cr.convertChromeURL(sourceURI).spec;
+ }
+
+ if (protocol.shouldRegister) {
+ Assert.equal(expectedURI, uri);
+ } else {
+ // Overrides will not throw, so we'll get to here. We want to make
+ // sure that the two strings are not the same in this situation.
+ Assert.notEqual(expectedURI, uri);
+ }
+ } catch (e) {
+ if (protocol.shouldRegister) {
+ dump(e + "\n");
+ do_throw(
+ "Should have registered our URI for protocol " + protocol.scheme
+ );
+ }
+ }
+ }
+ }
+
+ // Unregister our factories so we do not leak
+ for (let i = 0; i < factories.length; i++) {
+ let factory = factories[i];
+ registrar.unregisterFactory(factory.CID, factory);
+ }
+
+ // Unregister XULAppInfoFactory
+ registrar.unregisterFactory(XULAppInfoFactory.CID, XULAppInfoFactory);
+ if (old_factory.factory != null) {
+ registrar.registerFactory(
+ old_factory.CID,
+ "",
+ XULAppInfoFactory.contractID,
+ null
+ );
+ }
+}
diff --git a/chrome/test/unit/test_resolve_uris.js b/chrome/test/unit/test_resolve_uris.js
new file mode 100644
index 0000000000..1aa9b17ee0
--- /dev/null
+++ b/chrome/test/unit/test_resolve_uris.js
@@ -0,0 +1,86 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
+ * 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/. */
+
+// head_crtestutils.js doesn't get included in the child by default
+if (typeof registerManifests === "undefined") {
+ load("../unit/head_crtestutils.js");
+}
+
+var manifestFile = do_get_file("../unit/data/test_resolve_uris.manifest");
+
+var manifests = [manifestFile];
+registerManifests(manifests);
+
+function do_run_test() {
+ let cr = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(
+ Ci.nsIChromeRegistry
+ );
+
+ // If we don't have libxul or e10s then we don't have process separation, so
+ // we don't need to worry about checking for new chrome.
+ var appInfo = Cc["@mozilla.org/xre/app-info;1"];
+ if (
+ !appInfo ||
+ // eslint-disable-next-line mozilla/use-services
+ appInfo.getService(Ci.nsIXULRuntime).processType ==
+ Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT
+ ) {
+ cr.checkForNewChrome();
+ }
+
+ // See if our various things were able to register
+ let registrationTypes = ["content", "locale", "skin", "override", "resource"];
+
+ for (let j = 0; j < registrationTypes.length; j++) {
+ let type = registrationTypes[j];
+ dump("Testing type '" + type + "'\n");
+ let expectedURI = "resource://foo/foo-" + type + "/";
+ let sourceURI = "chrome://foo/" + type + "/";
+ switch (type) {
+ case "content":
+ expectedURI += "foo.xul";
+ break;
+ case "locale":
+ expectedURI += "foo.dtd";
+ break;
+ case "skin":
+ expectedURI += "foo.css";
+ break;
+ case "override":
+ sourceURI = "chrome://good-package/content/override-me.xul";
+ expectedURI += "override-me.xul";
+ break;
+ case "resource":
+ expectedURI = Services.io.newFileURI(manifestFile.parent).spec;
+ sourceURI = "resource://foo/";
+ break;
+ }
+ try {
+ sourceURI = Services.io.newURI(sourceURI);
+ let uri;
+ if (type == "resource") {
+ // resources go about a slightly different way than everything else
+ let rph = Services.io
+ .getProtocolHandler("resource")
+ .QueryInterface(Ci.nsIResProtocolHandler);
+ uri = rph.resolveURI(sourceURI);
+ } else {
+ uri = cr.convertChromeURL(sourceURI).spec;
+ }
+
+ Assert.equal(expectedURI, uri);
+ } catch (e) {
+ dump(e + "\n");
+ do_throw("Should have registered a handler for type '" + type + "'\n");
+ }
+ }
+}
+
+if (typeof run_test === "undefined") {
+ // eslint-disable-next-line no-global-assign
+ run_test = function() {
+ do_run_test();
+ };
+}
diff --git a/chrome/test/unit/xpcshell.ini b/chrome/test/unit/xpcshell.ini
new file mode 100644
index 0000000000..ab7ee44ac4
--- /dev/null
+++ b/chrome/test/unit/xpcshell.ini
@@ -0,0 +1,17 @@
+[DEFAULT]
+head = head_crtestutils.js
+support-files = data/**
+
+[test_abi.js]
+[test_bug292789.js]
+[test_bug380398.js]
+[test_bug397073.js]
+[test_bug399707.js]
+[test_bug401153.js]
+[test_bug415367.js]
+[test_bug564667.js]
+tags = addons
+[test_crlf.js]
+[test_data_protocol_registration.js]
+[test_no_remote_registration.js]
+[test_resolve_uris.js]
diff --git a/chrome/test/unit_ipc/test_resolve_uris_ipc.js b/chrome/test/unit_ipc/test_resolve_uris_ipc.js
new file mode 100644
index 0000000000..35eef62d1c
--- /dev/null
+++ b/chrome/test/unit_ipc/test_resolve_uris_ipc.js
@@ -0,0 +1,9 @@
+//
+// Run test script in content process instead of chrome (xpcshell's default)
+//
+function run_test() {
+ /* globals do_run_test */
+ load("../unit/test_resolve_uris.js");
+ do_run_test();
+ run_test_in_child("../unit/test_resolve_uris.js");
+}
diff --git a/chrome/test/unit_ipc/xpcshell.ini b/chrome/test/unit_ipc/xpcshell.ini
new file mode 100644
index 0000000000..a3ad8861ea
--- /dev/null
+++ b/chrome/test/unit_ipc/xpcshell.ini
@@ -0,0 +1,9 @@
+[DEFAULT]
+head =
+skip-if = toolkit == 'android'
+support-files =
+ !/chrome/test/unit/data/**
+ !/chrome/test/unit/test_resolve_uris.js
+ !/chrome/test/unit/head_crtestutils.js
+
+[test_resolve_uris_ipc.js]