Bug 1525245 - Stabilize cookiePolicy/cookiePermission for live documents - part 6 - Tests for SharedWorker and cookie settings changing, r=Ehsan
☠☠ backed out by ca64604d4b78 ☠ ☠
authorAndrea Marchesini <amarchesini@mozilla.com>
Thu, 07 Mar 2019 10:16:31 +0000
changeset 520726 c2a13a7480e1226f57fd4e3956547437efc3e6e1
parent 520725 abe4482fa1378d17d17534d1b18f7c4e2f86baef
child 520727 a91b7ebe8bdd6bd6017f6be530c0c805e23f8fee
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersEhsan
bugs1525245
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1525245 - Stabilize cookiePolicy/cookiePermission for live documents - part 6 - Tests for SharedWorker and cookie settings changing, r=Ehsan Differential Revision: https://phabricator.services.mozilla.com/D18954
netwerk/cookie/test/browser/browser.ini
netwerk/cookie/test/browser/browser_sharedWorker.js
--- a/netwerk/cookie/test/browser/browser.ini
+++ b/netwerk/cookie/test/browser/browser.ini
@@ -1,8 +1,9 @@
 [DEFAULT]
 support-files =
   file_empty.html
   head.js
 
 [browser_broadcastChannel.js]
 [browser_originattributes.js]
 [browser_storage.js]
+[browser_sharedWorker.js]
new file mode 100644
--- /dev/null
+++ b/netwerk/cookie/test/browser/browser_sharedWorker.js
@@ -0,0 +1,16 @@
+CookiePolicyHelper.runTest("SharedWorker", {
+  cookieJarAccessAllowed: async _ => {
+    new content.SharedWorker("a.js", "foo");
+    ok(true, "SharedWorker is allowed");
+  },
+
+  cookieJarAccessDenied: async _ => {
+    try {
+      new content.SharedWorker("a.js", "foo");
+      ok(false, "SharedWorker cannot be used!");
+    } catch (e) {
+      ok(true, "SharedWorker cannot be used!");
+      is(e.name, "SecurityError", "We want a security error message.");
+    }
+  },
+});