Bug 1525245 - Stabilize cookiePolicy/cookiePermission for live documents - part 6 - Tests for SharedWorker and cookie settings changing, r=Ehsan
authorAndrea Marchesini <amarchesini@mozilla.com>
Fri, 08 Mar 2019 09:01:55 +0000
changeset 520985 174b0477055a
parent 520984 e3309d98e9bd
child 520986 5f8af0d132c8
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.");
+    }
+  },
+});