diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /docshell/test/browser/browser_bug655270.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'docshell/test/browser/browser_bug655270.js')
-rw-r--r-- | docshell/test/browser/browser_bug655270.js | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/docshell/test/browser/browser_bug655270.js b/docshell/test/browser/browser_bug655270.js new file mode 100644 index 000000000..275245df8 --- /dev/null +++ b/docshell/test/browser/browser_bug655270.js @@ -0,0 +1,60 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +/** + * Test for Bug 655273 + * + * Call pushState and then make sure that the favicon service associates our + * old favicon with the new URI. + */ + +function test() { + const testDir = "http://mochi.test:8888/browser/docshell/test/browser/"; + const origURL = testDir + "file_bug655270.html"; + const newURL = origURL + '?new_page'; + + const faviconURL = testDir + "favicon_bug655270.ico"; + + waitForExplicitFinish(); + + let tab = gBrowser.addTab(origURL); + + // The page at origURL has a <link rel='icon'>, so we should get a call into + // our observer below when it loads. Once we verify that we have the right + // favicon URI, we call pushState, which should trigger another onPageChange + // event, this time for the URI after pushState. + + let observer = { + onPageChanged: function(aURI, aWhat, aValue) { + if (aWhat != Ci.nsINavHistoryObserver.ATTRIBUTE_FAVICON) + return; + + if (aURI.spec == origURL) { + is(aValue, faviconURL, 'FaviconURL for original URI'); + // Ignore the promise returned here and wait for the next + // onPageChanged notification. + ContentTask.spawn(tab.linkedBrowser, null, function() { + content.history.pushState('', '', '?new_page'); + }); + } + + if (aURI.spec == newURL) { + is(aValue, faviconURL, 'FaviconURL for new URI'); + gBrowser.removeTab(tab); + PlacesUtils.history.removeObserver(this); + finish(); + } + }, + + onBeginUpdateBatch: function() { }, + onEndUpdateBatch: function() { }, + onVisit: function() { }, + onTitleChanged: function() { }, + onDeleteURI: function() { }, + onClearHistory: function() { }, + onDeleteVisits: function() { }, + QueryInterface: XPCOMUtils.generateQI([Ci.nsINavHistoryObserver]) + }; + + PlacesUtils.history.addObserver(observer, false); +} |