2 <?xml-stylesheet type=
"text/css" href=
"chrome://global/skin"?>
3 <?xml-stylesheet type=
"text/css" href=
"chrome://mochikit/content/tests/SimpleTest/test.css"?>
5 https://bugzilla.mozilla.org/show_bug.cgi?id=789773
7 <window title=
"Mozilla Bug 789773"
8 xmlns=
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
9 <script src=
"chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
11 <!-- test results are displayed in the html:body -->
12 <body xmlns=
"http://www.w3.org/1999/xhtml">
13 <a href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=789773"
14 target=
"_blank">Mozilla Bug
789773</a>
17 <!-- test code goes here -->
18 <script type=
"application/javascript">
20 /* Test for Bug
789773.
22 * See comment
50 for the situation we're testing against here.
24 * Note that the failure mode of this test is to hang, and hang the browser on quit.
25 * This is an unfortunate occurance, but that's why we're testing it.
27 SimpleTest.waitForExplicitFinish();
29 const {AppConstants} = ChromeUtils.importESModule(
30 "resource://gre/modules/AppConstants.sys.mjs"
33 var calledListenerForBrowserChromeURL = false;
34 var testProgressListener = {
35 START_DOC: Ci.nsIWebProgressListener.STATE_START | Ci.nsIWebProgressListener.STATE_IS_DOCUMENT,
36 onStateChange(wp, req, stateFlags) {
37 let browserChromeFileName = AppConstants.BROWSER_CHROME_URL.split(
"/").reverse()[
0];
38 if (req.name.includes(browserChromeFileName)) {
39 wp.DOMWindow; // Force the lazy creation of a DOM window.
40 calledListenerForBrowserChromeURL = true;
42 if (req.name.includes(
"mozilla.html") && (stateFlags & Ci.nsIWebProgressListener.STATE_STOP))
45 QueryInterface: ChromeUtils.generateQI([
46 "nsIWebProgressListener",
47 "nsISupportsWeakReference",
51 // Add our progress listener
52 var webProgress = Cc['@mozilla.org/docloaderservice;
1'].getService(Ci.nsIWebProgress);
53 webProgress.addProgressListener(testProgressListener, Ci.nsIWebProgress.NOTIFY_STATE_REQUEST);
56 var popup = window.open(
"about:mozilla",
"_blank",
"width=640,height=400");
58 // Wait for the window to load.
59 function finishTest() {
60 webProgress.removeProgressListener(testProgressListener);
61 ok(true,
"Loaded the popup window without spinning forever in the event loop!");
62 ok(calledListenerForBrowserChromeURL,
"Should have called the progress listener for browser.xhtml");