summaryrefslogtreecommitdiff
path: root/browser/base/content/test/browser_bug521216.js
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2014-05-21 11:38:25 +0200
committerwolfbeast <mcwerewolf@gmail.com>2014-05-21 11:38:25 +0200
commitd25ba7d760b017b038e5aa6c0a605b4a330eb68d (patch)
tree16ec27edc7d5f83986f16236d3a36a2682a0f37e /browser/base/content/test/browser_bug521216.js
parenta942906574671868daf122284a9c4689e6924f74 (diff)
downloadpalemoon-gre-d25ba7d760b017b038e5aa6c0a605b4a330eb68d.tar.gz
Recommit working copy to repo with proper line endings.
Diffstat (limited to 'browser/base/content/test/browser_bug521216.js')
-rw-r--r--browser/base/content/test/browser_bug521216.js47
1 files changed, 47 insertions, 0 deletions
diff --git a/browser/base/content/test/browser_bug521216.js b/browser/base/content/test/browser_bug521216.js
new file mode 100644
index 000000000..c39ff741f
--- /dev/null
+++ b/browser/base/content/test/browser_bug521216.js
@@ -0,0 +1,47 @@
+var expected = ["TabOpen", "onStateChange", "onLocationChange", "onLinkIconAvailable"];
+var actual = [];
+var tabIndex = -1;
+this.__defineGetter__("tab", function () gBrowser.tabs[tabIndex]);
+
+function test() {
+ waitForExplicitFinish();
+ tabIndex = gBrowser.tabs.length;
+ gBrowser.addTabsProgressListener(progressListener);
+ gBrowser.tabContainer.addEventListener("TabOpen", TabOpen, false);
+ gBrowser.addTab("data:text/html,<html><head><link href='about:logo' rel='shortcut icon'>");
+}
+
+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);
+ },
+ onLinkIconAvailable: function onLinkIconAvailable(aBrowser, aIconURL) {
+ if (aBrowser == tab.linkedBrowser &&
+ aIconURL == "about:logo")
+ record(arguments.callee.name);
+ }
+};