Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
4 /**
5 * Test for Bug 655273
6 *
7 * Call pushState and then make sure that the favicon service associates our
8 * old favicon with the new URI.
9 */
11 function test() {
12 const testDir = "http://mochi.test:8888/browser/docshell/test/browser/";
13 const origURL = testDir + "file_bug655270.html";
14 const newURL = origURL + '?new_page';
16 const faviconURL = testDir + "favicon_bug655270.ico";
18 waitForExplicitFinish();
20 let tab = gBrowser.addTab(origURL);
22 // The page at origURL has a <link rel='icon'>, so we should get a call into
23 // our observer below when it loads. Once we verify that we have the right
24 // favicon URI, we call pushState, which should trigger another onPageChange
25 // event, this time for the URI after pushState.
27 let observer = {
28 onPageChanged: function(aURI, aWhat, aValue) {
29 if (aWhat != Ci.nsINavHistoryObserver.ATTRIBUTE_FAVICON)
30 return;
32 if (aURI.spec == origURL) {
33 is(aValue, faviconURL, 'FaviconURL for original URI');
34 tab.linkedBrowser.contentWindow.history.pushState('', '', '?new_page');
35 }
37 if (aURI.spec == newURL) {
38 is(aValue, faviconURL, 'FaviconURL for new URI');
39 gBrowser.removeTab(tab);
40 PlacesUtils.history.removeObserver(this);
41 finish();
42 }
43 },
45 onBeginUpdateBatch: function() { },
46 onEndUpdateBatch: function() { },
47 onVisit: function() { },
48 onTitleChanged: function() { },
49 onDeleteURI: function() { },
50 onClearHistory: function() { },
51 onDeleteVisits: function() { },
52 QueryInterface: XPCOMUtils.generateQI([Ci.nsINavHistoryObserver])
53 };
55 PlacesUtils.history.addObserver(observer, false);
56 }