2012-05-21 15:12:37 +04:00
|
|
|
/* 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/.
|
2007-05-31 01:52:47 +04:00
|
|
|
*/
|
|
|
|
|
2009-03-21 18:20:00 +03:00
|
|
|
var MANIFESTS = [do_get_file("data/test_bug380398.manifest")];
|
2007-05-31 01:52:47 +04:00
|
|
|
|
2008-04-11 17:39:43 +04:00
|
|
|
registerManifests(MANIFESTS);
|
2007-05-31 01:52:47 +04:00
|
|
|
|
2018-01-30 08:17:48 +03:00
|
|
|
ChromeUtils.import("resource://testing-common/AppInfo.jsm", this);
|
2016-03-16 10:58:29 +03:00
|
|
|
updateAppInfo({
|
2007-05-31 01:52:47 +04:00
|
|
|
name: "XPCShell",
|
2016-03-16 10:58:29 +03:00
|
|
|
id: "{39885e5f-f6b4-4e2a-87e5-6259ecf79011}",
|
2007-05-31 01:52:47 +04:00
|
|
|
version: "5",
|
|
|
|
platformVersion: "1.9",
|
2016-03-16 10:58:29 +03:00
|
|
|
});
|
2007-05-31 01:52:47 +04:00
|
|
|
|
|
|
|
var chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(
|
|
|
|
Ci.nsIChromeRegistry
|
|
|
|
);
|
|
|
|
chromeReg.checkForNewChrome();
|
|
|
|
|
2009-03-21 18:20:00 +03:00
|
|
|
var target = Services.io.newFileURI(do_get_file("data"));
|
2007-05-31 01:52:47 +04:00
|
|
|
target = target.spec + "test/test.xul";
|
|
|
|
|
2017-10-26 23:56:18 +03:00
|
|
|
function test_succeeded_mapping(namespace) {
|
2007-05-31 01:52:47 +04:00
|
|
|
var uri = Services.io.newURI("chrome://" + namespace + "/content/test.xul");
|
|
|
|
try {
|
|
|
|
var result = chromeReg.convertChromeURL(uri);
|
|
|
|
Assert.equal(result.spec, target);
|
2017-10-26 23:56:18 +03:00
|
|
|
} catch (ex) {
|
2007-05-31 01:52:47 +04:00
|
|
|
do_throw(namespace);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-10-26 23:56:18 +03:00
|
|
|
function test_failed_mapping(namespace) {
|
2007-05-31 01:52:47 +04:00
|
|
|
var uri = Services.io.newURI("chrome://" + namespace + "/content/test.xul");
|
|
|
|
try {
|
2017-10-26 23:56:18 +03:00
|
|
|
chromeReg.convertChromeURL(uri);
|
2007-05-31 01:52:47 +04:00
|
|
|
do_throw(namespace);
|
2017-10-26 23:56:18 +03:00
|
|
|
} catch (ex) {}
|
2007-05-31 01:52:47 +04:00
|
|
|
}
|
|
|
|
|
2017-10-26 23:56:18 +03:00
|
|
|
function run_test() {
|
2007-05-31 01:52:47 +04:00
|
|
|
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");
|
|
|
|
}
|