browser/base/content/test/general/browser_bug749738.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_bug749738.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,36 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     1.6 + * You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +"use strict";
     1.9 +
    1.10 +const DUMMY_PAGE = "http://example.org/browser/browser/base/content/test/general/dummy_page.html";
    1.11 +
    1.12 +function test() {
    1.13 +  waitForExplicitFinish();
    1.14 +
    1.15 +  let tab = gBrowser.addTab();
    1.16 +  gBrowser.selectedTab = tab;
    1.17 +
    1.18 +  load(tab, DUMMY_PAGE, function() {
    1.19 +    gFindBar.onFindCommand();
    1.20 +    EventUtils.sendString("Dummy");
    1.21 +    gBrowser.removeTab(tab);
    1.22 +
    1.23 +    try {
    1.24 +      gFindBar.close();
    1.25 +      ok(true, "findbar.close should not throw an exception");
    1.26 +    } catch(e) {
    1.27 +      ok(false, "findbar.close threw exception: " + e);
    1.28 +    }
    1.29 +    finish();
    1.30 +  });
    1.31 +}
    1.32 +
    1.33 +function load(aTab, aUrl, aCallback) {
    1.34 +  aTab.linkedBrowser.addEventListener("load", function onload(aEvent) {
    1.35 +    aEvent.currentTarget.removeEventListener("load", onload, true);
    1.36 +    waitForFocus(aCallback, content);
    1.37 +  }, true);
    1.38 +  aTab.linkedBrowser.loadURI(aUrl);
    1.39 +}

mercurial