2010-07-20 21:05:11 -07:00
|
|
|
var expected = ["TabOpen", "onStateChange", "onLocationChange", "onLinkIconAvailable"];
|
2009-10-09 11:36:06 -07:00
|
|
|
var actual = [];
|
|
|
|
var tabIndex = -1;
|
2010-03-22 09:04:18 -07:00
|
|
|
__defineGetter__("tab", function () gBrowser.tabs[tabIndex]);
|
2009-10-09 11:36:06 -07:00
|
|
|
|
|
|
|
function test() {
|
|
|
|
waitForExplicitFinish();
|
2010-03-22 09:04:18 -07:00
|
|
|
tabIndex = gBrowser.tabs.length;
|
2009-10-09 11:36:06 -07:00
|
|
|
gBrowser.addTabsProgressListener(progressListener);
|
|
|
|
gBrowser.tabContainer.addEventListener("TabOpen", TabOpen, false);
|
2009-10-14 10:37:29 -07:00
|
|
|
gBrowser.addTab("data:text/html,<html><head><link href='about:logo' rel='shortcut icon'>");
|
2009-10-09 11:36:06 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
function record(aName) {
|
|
|
|
info("got " + aName);
|
|
|
|
if (actual.indexOf(aName) == -1)
|
|
|
|
actual.push(aName);
|
|
|
|
if (actual.length == expected.length) {
|
|
|
|
is(actual.toString(), expected.toString(),
|
|
|
|
"got events and progress notifications in expected order");
|
|
|
|
gBrowser.removeTab(tab);
|
|
|
|
gBrowser.removeTabsProgressListener(progressListener);
|
|
|
|
gBrowser.tabContainer.removeEventListener("TabOpen", TabOpen, false);
|
|
|
|
finish();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function TabOpen(aEvent) {
|
|
|
|
if (aEvent.target == tab)
|
|
|
|
record(arguments.callee.name);
|
|
|
|
}
|
|
|
|
|
|
|
|
var progressListener = {
|
|
|
|
onLocationChange: function onLocationChange(aBrowser) {
|
|
|
|
if (aBrowser == tab.linkedBrowser)
|
|
|
|
record(arguments.callee.name);
|
|
|
|
},
|
|
|
|
onStateChange: function onStateChange(aBrowser) {
|
|
|
|
if (aBrowser == tab.linkedBrowser)
|
|
|
|
record(arguments.callee.name);
|
|
|
|
},
|
2010-09-24 00:29:50 -07:00
|
|
|
onLinkIconAvailable: function onLinkIconAvailable(aBrowser, aIconURL) {
|
|
|
|
if (aBrowser == tab.linkedBrowser &&
|
|
|
|
aIconURL == "about:logo")
|
2009-10-09 11:36:06 -07:00
|
|
|
record(arguments.callee.name);
|
|
|
|
}
|
|
|
|
};
|