1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/mozapps/extensions/test/xpinstall/browser_localfile.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,31 @@ 1.4 +// ---------------------------------------------------------------------------- 1.5 +// Tests installing an local file works when loading the url 1.6 +function test() { 1.7 + Harness.installEndedCallback = install_ended; 1.8 + Harness.installsCompletedCallback = finish_test; 1.9 + Harness.setup(); 1.10 + 1.11 + var cr = Components.classes["@mozilla.org/chrome/chrome-registry;1"] 1.12 + .getService(Components.interfaces.nsIChromeRegistry); 1.13 + 1.14 + var chromeroot = extractChromeRoot(gTestPath); 1.15 + try { 1.16 + var xpipath = cr.convertChromeURL(makeURI(chromeroot + "unsigned.xpi")).spec; 1.17 + } catch (ex) { 1.18 + var xpipath = chromeroot + "unsigned.xpi"; //scenario where we are running from a .jar and already extracted 1.19 + } 1.20 + gBrowser.selectedTab = gBrowser.addTab(); 1.21 + gBrowser.loadURI(xpipath); 1.22 +} 1.23 + 1.24 +function install_ended(install, addon) { 1.25 + install.cancel(); 1.26 +} 1.27 + 1.28 +function finish_test(count) { 1.29 + is(count, 1, "1 Add-on should have been successfully installed"); 1.30 + 1.31 + gBrowser.removeCurrentTab(); 1.32 + Harness.finish(); 1.33 +} 1.34 +// ----------------------------------------------------------------------------