1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/base/content/test/general/browser_bug521216.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,47 @@ 1.4 +var expected = ["TabOpen", "onStateChange", "onLocationChange", "onLinkIconAvailable"]; 1.5 +var actual = []; 1.6 +var tabIndex = -1; 1.7 +this.__defineGetter__("tab", function () gBrowser.tabs[tabIndex]); 1.8 + 1.9 +function test() { 1.10 + waitForExplicitFinish(); 1.11 + tabIndex = gBrowser.tabs.length; 1.12 + gBrowser.addTabsProgressListener(progressListener); 1.13 + gBrowser.tabContainer.addEventListener("TabOpen", TabOpen, false); 1.14 + gBrowser.addTab("data:text/html,<html><head><link href='about:logo' rel='shortcut icon'>"); 1.15 +} 1.16 + 1.17 +function record(aName) { 1.18 + info("got " + aName); 1.19 + if (actual.indexOf(aName) == -1) 1.20 + actual.push(aName); 1.21 + if (actual.length == expected.length) { 1.22 + is(actual.toString(), expected.toString(), 1.23 + "got events and progress notifications in expected order"); 1.24 + gBrowser.removeTab(tab); 1.25 + gBrowser.removeTabsProgressListener(progressListener); 1.26 + gBrowser.tabContainer.removeEventListener("TabOpen", TabOpen, false); 1.27 + finish(); 1.28 + } 1.29 +} 1.30 + 1.31 +function TabOpen(aEvent) { 1.32 + if (aEvent.target == tab) 1.33 + record(arguments.callee.name); 1.34 +} 1.35 + 1.36 +var progressListener = { 1.37 + onLocationChange: function onLocationChange(aBrowser) { 1.38 + if (aBrowser == tab.linkedBrowser) 1.39 + record(arguments.callee.name); 1.40 + }, 1.41 + onStateChange: function onStateChange(aBrowser) { 1.42 + if (aBrowser == tab.linkedBrowser) 1.43 + record(arguments.callee.name); 1.44 + }, 1.45 + onLinkIconAvailable: function onLinkIconAvailable(aBrowser, aIconURL) { 1.46 + if (aBrowser == tab.linkedBrowser && 1.47 + aIconURL == "about:logo") 1.48 + record(arguments.callee.name); 1.49 + } 1.50 +};