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 /dom/tests/browser/browser_localStorage_privatestorageevent.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 'dom/tests/browser/browser_localStorage_privatestorageevent.js')
-rw-r--r-- | dom/tests/browser/browser_localStorage_privatestorageevent.js | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/dom/tests/browser/browser_localStorage_privatestorageevent.js b/dom/tests/browser/browser_localStorage_privatestorageevent.js new file mode 100644 index 000000000..83458a399 --- /dev/null +++ b/dom/tests/browser/browser_localStorage_privatestorageevent.js @@ -0,0 +1,76 @@ +add_task(function *() { + var privWin = OpenBrowserWindow({private: true}); + yield new privWin.Promise(resolve => { + privWin.addEventListener('load', function onLoad() { + privWin.removeEventListener('load', onLoad, false); + resolve(); + }); + }); + + var pubWin = OpenBrowserWindow({private: false}); + yield new pubWin.Promise(resolve => { + pubWin.addEventListener('load', function onLoad() { + pubWin.removeEventListener('load', onLoad, false); + resolve(); + }); + }); + + var URL = "http://mochi.test:8888/browser/dom/tests/browser/page_privatestorageevent.html"; + + var privTab = privWin.gBrowser.addTab(URL); + yield BrowserTestUtils.browserLoaded(privWin.gBrowser.getBrowserForTab(privTab)); + var privBrowser = gBrowser.getBrowserForTab(privTab); + + var pubTab = pubWin.gBrowser.addTab(URL); + yield BrowserTestUtils.browserLoaded(pubWin.gBrowser.getBrowserForTab(pubTab)); + var pubBrowser = gBrowser.getBrowserForTab(pubTab); + + // Check if pubWin can see privWin's storage events + yield ContentTask.spawn(pubBrowser, null, function(opts) { + content.window.gotStorageEvent = false; + content.window.addEventListener('storage', ev => { + content.window.gotStorageEvent = true; + }); + }); + + yield ContentTask.spawn(privBrowser, null, function(opts) { + content.window.localStorage['key'] = 'ablooabloo'; + }); + + let pubSaw = yield ContentTask.spawn(pubBrowser, null, function(opts) { + return content.window.gotStorageEvent; + }); + + ok(!pubSaw, "pubWin shouldn't be able to see privWin's storage events"); + + yield ContentTask.spawn(privBrowser, null, function(opts) { + content.window.gotStorageEvent = false; + content.window.addEventListener('storage', ev => { + content.window.gotStorageEvent = true; + }); + }); + + // Check if privWin can see pubWin's storage events + yield ContentTask.spawn(privBrowser, null, function(opts) { + content.window.gotStorageEvent = false; + content.window.addEventListener('storage', ev => { + content.window.gotStorageEvent = true; + }); + }); + + yield ContentTask.spawn(pubBrowser, null, function(opts) { + content.window.localStorage['key'] = 'ablooabloo'; + }); + + let privSaw = yield ContentTask.spawn(privBrowser, null, function(opts) { + return content.window.gotStorageEvent; + }); + + ok(!privSaw, "privWin shouldn't be able to see pubWin's storage events"); + + yield BrowserTestUtils.removeTab(privTab); + yield BrowserTestUtils.closeWindow(privWin); + + yield BrowserTestUtils.removeTab(pubTab); + yield BrowserTestUtils.closeWindow(pubWin); +}); |