Thu, 15 Jan 2015 15:55:04 +0100
Back out 97036ab72558 which inappropriately compared turds to third parties.
michael@0 | 1 | var expected = ["TabOpen", "onStateChange", "onLocationChange", "onLinkIconAvailable"]; |
michael@0 | 2 | var actual = []; |
michael@0 | 3 | var tabIndex = -1; |
michael@0 | 4 | this.__defineGetter__("tab", function () gBrowser.tabs[tabIndex]); |
michael@0 | 5 | |
michael@0 | 6 | function test() { |
michael@0 | 7 | waitForExplicitFinish(); |
michael@0 | 8 | tabIndex = gBrowser.tabs.length; |
michael@0 | 9 | gBrowser.addTabsProgressListener(progressListener); |
michael@0 | 10 | gBrowser.tabContainer.addEventListener("TabOpen", TabOpen, false); |
michael@0 | 11 | gBrowser.addTab("data:text/html,<html><head><link href='about:logo' rel='shortcut icon'>"); |
michael@0 | 12 | } |
michael@0 | 13 | |
michael@0 | 14 | function record(aName) { |
michael@0 | 15 | info("got " + aName); |
michael@0 | 16 | if (actual.indexOf(aName) == -1) |
michael@0 | 17 | actual.push(aName); |
michael@0 | 18 | if (actual.length == expected.length) { |
michael@0 | 19 | is(actual.toString(), expected.toString(), |
michael@0 | 20 | "got events and progress notifications in expected order"); |
michael@0 | 21 | gBrowser.removeTab(tab); |
michael@0 | 22 | gBrowser.removeTabsProgressListener(progressListener); |
michael@0 | 23 | gBrowser.tabContainer.removeEventListener("TabOpen", TabOpen, false); |
michael@0 | 24 | finish(); |
michael@0 | 25 | } |
michael@0 | 26 | } |
michael@0 | 27 | |
michael@0 | 28 | function TabOpen(aEvent) { |
michael@0 | 29 | if (aEvent.target == tab) |
michael@0 | 30 | record(arguments.callee.name); |
michael@0 | 31 | } |
michael@0 | 32 | |
michael@0 | 33 | var progressListener = { |
michael@0 | 34 | onLocationChange: function onLocationChange(aBrowser) { |
michael@0 | 35 | if (aBrowser == tab.linkedBrowser) |
michael@0 | 36 | record(arguments.callee.name); |
michael@0 | 37 | }, |
michael@0 | 38 | onStateChange: function onStateChange(aBrowser) { |
michael@0 | 39 | if (aBrowser == tab.linkedBrowser) |
michael@0 | 40 | record(arguments.callee.name); |
michael@0 | 41 | }, |
michael@0 | 42 | onLinkIconAvailable: function onLinkIconAvailable(aBrowser, aIconURL) { |
michael@0 | 43 | if (aBrowser == tab.linkedBrowser && |
michael@0 | 44 | aIconURL == "about:logo") |
michael@0 | 45 | record(arguments.callee.name); |
michael@0 | 46 | } |
michael@0 | 47 | }; |