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