toolkit/mozapps/extensions/test/xpinstall/browser_bug611242.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/mozapps/extensions/test/xpinstall/browser_bug611242.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,34 @@
     1.4 +// ----------------------------------------------------------------------------
     1.5 +// Test whether setting a new property in InstallTrigger then persists to other
     1.6 +// page loads
     1.7 +function loadURI(aUri, aCallback) {
     1.8 +  gBrowser.selectedBrowser.addEventListener("load", function() {
     1.9 +    if (gBrowser.selectedBrowser.currentURI.spec != aUri)
    1.10 +      return;
    1.11 +
    1.12 +    gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
    1.13 +
    1.14 +    aCallback();
    1.15 +  }, true);
    1.16 +
    1.17 +  gBrowser.loadURI(aUri);
    1.18 +}
    1.19 +
    1.20 +function test() {
    1.21 +  waitForExplicitFinish();
    1.22 +
    1.23 +  gBrowser.selectedTab = gBrowser.addTab();
    1.24 +
    1.25 +  loadURI(TESTROOT + "enabled.html", function() {
    1.26 +    window.content.wrappedJSObject.InstallTrigger.enabled.k = function() { };
    1.27 +
    1.28 +    loadURI(TESTROOT2 + "enabled.html", function() {
    1.29 +      is(window.content.wrappedJSObject.InstallTrigger.enabled.k, undefined, "Property should not be defined");
    1.30 +
    1.31 +      gBrowser.removeTab(gBrowser.selectedTab);
    1.32 +
    1.33 +      finish();
    1.34 +    });
    1.35 +  });
    1.36 +}
    1.37 +// ----------------------------------------------------------------------------

mercurial