1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/mozapps/extensions/test/xpinstall/browser_badargs2.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,28 @@ 1.4 +// ---------------------------------------------------------------------------- 1.5 +// Test whether passing an undefined url InstallTrigger.install throws an 1.6 +// exception 1.7 +function test() { 1.8 + waitForExplicitFinish(); 1.9 + 1.10 + var triggers = encodeURIComponent(JSON.stringify({ 1.11 + "Unsigned XPI": { 1.12 + URL: undefined 1.13 + } 1.14 + })); 1.15 + gBrowser.selectedTab = gBrowser.addTab(); 1.16 + gBrowser.selectedBrowser.addEventListener("load", function() { 1.17 + gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true); 1.18 + // Allow the in-page load handler to run first 1.19 + executeSoon(page_loaded); 1.20 + }, true); 1.21 + expectUncaughtException(); 1.22 + gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers); 1.23 +} 1.24 + 1.25 +function page_loaded() { 1.26 + var doc = gBrowser.contentDocument; 1.27 + is(doc.getElementById("return").textContent, "exception", "installTrigger should have failed"); 1.28 + gBrowser.removeCurrentTab(); 1.29 + finish(); 1.30 +} 1.31 +// ----------------------------------------------------------------------------