docshell/test/browser/browser_bug554155.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 function test() {
michael@0 2 waitForExplicitFinish();
michael@0 3
michael@0 4 let tab = gBrowser.addTab("http://example.com");
michael@0 5
michael@0 6 tab.linkedBrowser.addEventListener("load", function() {
michael@0 7 tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
michael@0 8
michael@0 9 let numLocationChanges = 0;
michael@0 10
michael@0 11 let listener = {
michael@0 12 onLocationChange: function() {
michael@0 13 numLocationChanges++;
michael@0 14 }
michael@0 15 };
michael@0 16
michael@0 17 gBrowser.addTabsProgressListener(listener);
michael@0 18
michael@0 19 // pushState to a new URL (http://example.com/foo"). This should trigger
michael@0 20 // exactly one LocationChange event.
michael@0 21 tab.linkedBrowser.contentWindow.history.pushState(null, null, "foo");
michael@0 22
michael@0 23 executeSoon(function() {
michael@0 24 gBrowser.removeTab(tab);
michael@0 25 gBrowser.removeTabsProgressListener(listener);
michael@0 26 is(numLocationChanges, 1,
michael@0 27 "pushState should cause exactly one LocationChange event.");
michael@0 28 finish();
michael@0 29 });
michael@0 30
michael@0 31 }, true);
michael@0 32 }

mercurial