browser/base/content/test/general/browser_bug484315.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/base/content/test/general/browser_bug484315.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,23 @@
     1.4 +function test() {
     1.5 +  var contentWin = window.open("about:blank", "", "width=100,height=100");
     1.6 +  var enumerator = Services.wm.getEnumerator("navigator:browser");
     1.7 +
     1.8 +  while (enumerator.hasMoreElements()) {
     1.9 +    let win = enumerator.getNext();
    1.10 +    if (win.content == contentWin) {
    1.11 +      gPrefService.setBoolPref("browser.tabs.closeWindowWithLastTab", false);
    1.12 +      win.gBrowser.removeCurrentTab();
    1.13 +      ok(win.closed, "popup is closed");
    1.14 +
    1.15 +      // clean up
    1.16 +      if (!win.closed)
    1.17 +        win.close();
    1.18 +      if (gPrefService.prefHasUserValue("browser.tabs.closeWindowWithLastTab"))
    1.19 +        gPrefService.clearUserPref("browser.tabs.closeWindowWithLastTab");
    1.20 +
    1.21 +      return;
    1.22 +    }
    1.23 +  }
    1.24 +
    1.25 +  throw "couldn't find the content window";
    1.26 +}

mercurial