Bug 1525245 - Stabilize cookiePolicy/cookiePermission for live documents - part 6 - Tests for SharedWorker and cookie settings changing, r=Ehsan
☠☠ backed out by bc51c190590a ☠ ☠
authorAndrea Marchesini <amarchesini@mozilla.com>
Tue, 26 Feb 2019 17:37:48 +0000
changeset 519090 d8ee13b6a17d3cbfa50e721089ebd5e2360594bd
parent 519089 b79ec111bf41921912f9ab73091cbe093c7dd371
child 519091 20f336320ce183a102a8fc02f656425006022b5b
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.");
+    }
+  },
+});