Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 // ----------------------------------------------------------------------------
2 // Test whether an install fails if the url is a local file when requested from
3 // web content
4 function test() {
5 waitForExplicitFinish();
7 var cr = Components.classes["@mozilla.org/chrome/chrome-registry;1"]
8 .getService(Components.interfaces.nsIChromeRegistry);
10 var chromeroot = getChromeRoot(gTestPath);
11 try {
12 var xpipath = cr.convertChromeURL(makeURI(chromeroot + "unsigned.xpi")).spec;
13 } catch (ex) {
14 var xpipath = chromeroot + "unsigned.xpi"; //scenario where we are running from a .jar and already extracted
15 }
17 var triggers = encodeURIComponent(JSON.stringify({
18 "Unsigned XPI": xpipath
19 }));
20 gBrowser.selectedTab = gBrowser.addTab();
21 gBrowser.selectedBrowser.addEventListener("load", function() {
22 gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
23 // Allow the in-page load handler to run first
24 executeSoon(page_loaded);
25 }, true);
26 expectUncaughtException();
27 gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
28 }
30 function page_loaded() {
31 var doc = gBrowser.contentDocument;
32 is(doc.getElementById("return").textContent, "exception", "installTrigger should have failed");
33 gBrowser.removeCurrentTab();
34 finish();
35 }
36 // ----------------------------------------------------------------------------