Modern IDB (Workers): Start running a lot of the workers tests.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 May 2016 21:04:25 +0000 (21:04 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 May 2016 21:04:25 +0000 (21:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=157424

Reviewed by Sam Weinig.

Source/WebCore:

No new tests (Covered by enabling a whole bunch of existing tests).

* Modules/indexeddb/IDBDatabase.cpp:
(WebCore::IDBDatabase::stop): Call removeAllEventListeners() to clean up the Worker VM
  before it shuts down.

* Modules/indexeddb/IDBRequest.cpp:
(WebCore::IDBRequest::stop): Call removeAllEventListeners()

* Modules/indexeddb/IDBTransaction.cpp:
(WebCore::IDBTransaction::IDBTransaction): Initialize with the correct VM.
(WebCore::IDBTransaction::stop): Call removeAllEventListeners()
(WebCore::IDBTransaction::operationDidComplete):

* Modules/indexeddb/client/IDBConnectionProxy.cpp:
(WebCore::IDBClient::IDBConnectionProxy::takeIDBOpenDBRequest):
(WebCore::IDBClient::IDBConnectionProxy::completeOpenDBRequest): Don't take the request from
  the map, but rather let the request take itself from its appropriate thread.
* Modules/indexeddb/client/IDBConnectionProxy.h:

* Modules/indexeddb/client/TransactionOperation.h:
(WebCore::IDBClient::TransactionOperation::completed): Rework clearing out the completion
  handler, as the handler itself might hold the last reference to `this`.

* page/SecurityOrigin.h:
(WebCore::SecurityOrigin::hasUniversalAccess):

* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::WorkerGlobalScope): If the parent context's SecurityOrigin had
  universal access, grant it to this one.

LayoutTests:

Many tests that obviously pass need updated expectations for the details of error messages.

Others just work right out of the box.

* TestExpectations: Enable some tests, and categorize remaining failures.

* http/tests/security/cross-origin-worker-indexeddb-allowed-expected.txt:
* http/tests/security/cross-origin-worker-indexeddb-allowed.html:
* http/tests/security/cross-origin-worker-indexeddb-expected.txt:
* http/tests/security/cross-origin-worker-indexeddb.html:
* http/tests/security/resources/cross-origin-iframe-for-worker-indexeddb.html:
* http/tests/security/resources/document-for-cross-origin-worker-indexeddb.html:
* http/tests/security/resources/worker-for-indexeddb.js:
* storage/indexeddb/basics-workers.html:
* storage/indexeddb/cursor-advance-workers-expected.txt:
* storage/indexeddb/cursor-advance-workers.html:
* storage/indexeddb/deletedatabase-delayed-by-open-and-versionchange-workers.html:
* storage/indexeddb/dont-commit-on-blocked-private.html:
* storage/indexeddb/dont-commit-on-blocked.html:
* storage/indexeddb/factory-basics-workers.html:
* storage/indexeddb/index-basics-workers-expected.txt:
* storage/indexeddb/index-basics-workers.html:
* storage/indexeddb/modern/workers-disabled.html:
* storage/indexeddb/objectstore-basics-workers-expected.txt:
* storage/indexeddb/objectstore-basics-workers.html:
* storage/indexeddb/open-twice-workers.html:
* storage/indexeddb/pending-activity-workers.html:
* storage/indexeddb/pending-version-change-on-exit-private.html:
* storage/indexeddb/pending-version-change-on-exit.html:
* storage/indexeddb/pending-version-change-stuck-private.html:
* storage/indexeddb/pending-version-change-stuck-works-with-terminate-private.html:
* storage/indexeddb/pending-version-change-stuck-works-with-terminate.html:
* storage/indexeddb/pending-version-change-stuck.html:
* storage/indexeddb/transaction-complete-workers-expected.txt:
* storage/indexeddb/transaction-complete-workers-private-expected.txt:
* storage/indexeddb/transaction-complete-workers-private.html:
* storage/indexeddb/transaction-complete-workers.html:
* storage/indexeddb/unprefix-workers.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@200521 268f45cc-cd09-0410-ab3c-d52691b4dbfc

43 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/http/tests/security/cross-origin-worker-indexeddb-allowed-expected.txt
LayoutTests/http/tests/security/cross-origin-worker-indexeddb-allowed.html
LayoutTests/http/tests/security/cross-origin-worker-indexeddb-expected.txt
LayoutTests/http/tests/security/cross-origin-worker-indexeddb.html
LayoutTests/http/tests/security/resources/cross-origin-iframe-for-worker-indexeddb.html
LayoutTests/http/tests/security/resources/document-for-cross-origin-worker-indexeddb.html
LayoutTests/http/tests/security/resources/worker-for-indexeddb.js
LayoutTests/storage/indexeddb/basics-workers.html
LayoutTests/storage/indexeddb/cursor-advance-workers-expected.txt
LayoutTests/storage/indexeddb/cursor-advance-workers.html
LayoutTests/storage/indexeddb/deletedatabase-delayed-by-open-and-versionchange-workers.html
LayoutTests/storage/indexeddb/dont-commit-on-blocked-private.html
LayoutTests/storage/indexeddb/dont-commit-on-blocked.html
LayoutTests/storage/indexeddb/factory-basics-workers.html
LayoutTests/storage/indexeddb/index-basics-workers-expected.txt
LayoutTests/storage/indexeddb/index-basics-workers.html
LayoutTests/storage/indexeddb/modern/workers-disabled.html
LayoutTests/storage/indexeddb/objectstore-basics-workers-expected.txt
LayoutTests/storage/indexeddb/objectstore-basics-workers.html
LayoutTests/storage/indexeddb/open-twice-workers.html
LayoutTests/storage/indexeddb/pending-activity-workers.html
LayoutTests/storage/indexeddb/pending-version-change-on-exit-private.html
LayoutTests/storage/indexeddb/pending-version-change-on-exit.html
LayoutTests/storage/indexeddb/pending-version-change-stuck-private.html
LayoutTests/storage/indexeddb/pending-version-change-stuck-works-with-terminate-private.html
LayoutTests/storage/indexeddb/pending-version-change-stuck-works-with-terminate.html
LayoutTests/storage/indexeddb/pending-version-change-stuck.html
LayoutTests/storage/indexeddb/transaction-complete-workers-expected.txt
LayoutTests/storage/indexeddb/transaction-complete-workers-private-expected.txt
LayoutTests/storage/indexeddb/transaction-complete-workers-private.html
LayoutTests/storage/indexeddb/transaction-complete-workers.html
LayoutTests/storage/indexeddb/unprefix-workers.html
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/IDBDatabase.cpp
Source/WebCore/Modules/indexeddb/IDBRequest.cpp
Source/WebCore/Modules/indexeddb/IDBTransaction.cpp
Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.cpp
Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.h
Source/WebCore/Modules/indexeddb/client/TransactionOperation.h
Source/WebCore/page/SecurityOrigin.h
Source/WebCore/workers/WorkerGlobalScope.cpp

index e12e2e9..74d9654 100644 (file)
@@ -1,3 +1,49 @@
+2016-05-06  Brady Eidson  <beidson@apple.com>
+
+        Modern IDB (Workers): Start running a lot of the workers tests.
+        https://bugs.webkit.org/show_bug.cgi?id=157424
+
+        Reviewed by Sam Weinig.
+
+        Many tests that obviously pass need updated expectations for the details of error messages.
+
+        Others just work right out of the box.
+
+        * TestExpectations: Enable some tests, and categorize remaining failures.
+        
+        * http/tests/security/cross-origin-worker-indexeddb-allowed-expected.txt:
+        * http/tests/security/cross-origin-worker-indexeddb-allowed.html:
+        * http/tests/security/cross-origin-worker-indexeddb-expected.txt:
+        * http/tests/security/cross-origin-worker-indexeddb.html:
+        * http/tests/security/resources/cross-origin-iframe-for-worker-indexeddb.html:
+        * http/tests/security/resources/document-for-cross-origin-worker-indexeddb.html:
+        * http/tests/security/resources/worker-for-indexeddb.js:
+        * storage/indexeddb/basics-workers.html:
+        * storage/indexeddb/cursor-advance-workers-expected.txt:
+        * storage/indexeddb/cursor-advance-workers.html:
+        * storage/indexeddb/deletedatabase-delayed-by-open-and-versionchange-workers.html:
+        * storage/indexeddb/dont-commit-on-blocked-private.html:
+        * storage/indexeddb/dont-commit-on-blocked.html:
+        * storage/indexeddb/factory-basics-workers.html:
+        * storage/indexeddb/index-basics-workers-expected.txt:
+        * storage/indexeddb/index-basics-workers.html:
+        * storage/indexeddb/modern/workers-disabled.html:
+        * storage/indexeddb/objectstore-basics-workers-expected.txt:
+        * storage/indexeddb/objectstore-basics-workers.html:
+        * storage/indexeddb/open-twice-workers.html:
+        * storage/indexeddb/pending-activity-workers.html:
+        * storage/indexeddb/pending-version-change-on-exit-private.html:
+        * storage/indexeddb/pending-version-change-on-exit.html:
+        * storage/indexeddb/pending-version-change-stuck-private.html:
+        * storage/indexeddb/pending-version-change-stuck-works-with-terminate-private.html:
+        * storage/indexeddb/pending-version-change-stuck-works-with-terminate.html:
+        * storage/indexeddb/pending-version-change-stuck.html:
+        * storage/indexeddb/transaction-complete-workers-expected.txt:
+        * storage/indexeddb/transaction-complete-workers-private-expected.txt:
+        * storage/indexeddb/transaction-complete-workers-private.html:
+        * storage/indexeddb/transaction-complete-workers.html:
+        * storage/indexeddb/unprefix-workers.html:
+
 2016-05-06  Ryosuke Niwa  <rniwa@webkit.org>
 
         FKA: No way to get focus from DOM to shadow DOM components (Was: HTML5 media controls not keyboard accessible)
index 9393705..87ef5a5 100644 (file)
@@ -908,28 +908,19 @@ storage/indexeddb/request-leak.html [ Failure ]
 
 webkit.org/b/154619 storage/indexeddb/odd-strings.html [ Skip ]
 
-# No workers support in Modern IDB yet
-http/tests/security/cross-origin-worker-indexeddb-allowed.html
-http/tests/security/cross-origin-worker-indexeddb.html
-storage/indexeddb/basics-workers.html
-storage/indexeddb/cursor-advance-workers.html
-storage/indexeddb/deletedatabase-delayed-by-open-and-versionchange-workers.html
-storage/indexeddb/dont-commit-on-blocked-private.html
-storage/indexeddb/dont-commit-on-blocked.html
-storage/indexeddb/factory-basics-workers.html
-storage/indexeddb/index-basics-workers.html
-storage/indexeddb/objectstore-basics-workers.html
-storage/indexeddb/open-twice-workers.html
-storage/indexeddb/pending-activity-workers.html
-storage/indexeddb/pending-version-change-on-exit-private.html
-storage/indexeddb/pending-version-change-on-exit.html
+# IDB workers tests that fail
+storage/indexeddb/deletedatabase-delayed-by-open-and-versionchange-workers.html [ Failure ]
+storage/indexeddb/dont-commit-on-blocked-private.html [ Failure ]
+storage/indexeddb/dont-commit-on-blocked.html [ Failure ]
+storage/indexeddb/factory-basics-workers.html [ Failure ]
+storage/indexeddb/pending-activity-workers.html [ Failure ]
+storage/indexeddb/unprefix-workers.html [ Failure ]
+
+# IDB workers tests that timeout
+storage/indexeddb/pending-version-change-stuck.html
 storage/indexeddb/pending-version-change-stuck-private.html
-storage/indexeddb/pending-version-change-stuck-works-with-terminate-private.html
 storage/indexeddb/pending-version-change-stuck-works-with-terminate.html
-storage/indexeddb/pending-version-change-stuck.html
-storage/indexeddb/transaction-complete-workers-private.html
-storage/indexeddb/transaction-complete-workers.html
-storage/indexeddb/unprefix-workers.html
+storage/indexeddb/pending-version-change-stuck-works-with-terminate-private.html
 
 # Test's behavior specific to Legacy IDB with LevelDB backend
 # Modern IDB is spec-compliant without supporting this behavior
index 7ccc88b..055e184 100644 (file)
@@ -5,15 +5,13 @@ Both of these frames should successfully open the database:
 --------
 Frame: '<!--framePath //<!--frame0-->-->'
 --------
-Successfully called self.webkitIndexedDB.deleteDatabase().
-Successfully called self.webkitIndexedDB.open().
-Successfully called self.webkitIndexedDB.webkitGetDatabaseNames().
+Successfully called self.indexedDB.deleteDatabase().
+Successfully called self.indexedDB.open().
 
 
 --------
 Frame: '<!--framePath //<!--frame1-->-->'
 --------
-Successfully called self.webkitIndexedDB.deleteDatabase().
-Successfully called self.webkitIndexedDB.open().
-Successfully called self.webkitIndexedDB.webkitGetDatabaseNames().
+Successfully called self.indexedDB.deleteDatabase().
+Successfully called self.indexedDB.open().
 
index ff9050d..0874025 100644 (file)
@@ -1,22 +1,25 @@
 <!DOCTYPE html>
 <html>
 <head>
-    <script>
-        var frames = 2;
-        if (window.testRunner) {
-            testRunner.dumpAsText();
-            testRunner.dumpChildFramesAsText();
-            testRunner.waitUntilDone();
-        }
+<script>
+if (window.internals)
+    window.internals.settings.setIndexedDBWorkersEnabled(true);
 
-        function decrement() {
-            --frames;
-            if (!frames && window.testRunner)
-                testRunner.notifyDone();
-        }
+var frames = 2;
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.dumpChildFramesAsText();
+    testRunner.waitUntilDone();
+}
 
-        window.onmessage = decrement;
-    </script>
+function decrement() {
+    --frames;
+    if (!frames && window.testRunner)
+        testRunner.notifyDone();
+}
+
+window.onmessage = decrement;
+</script>
 </head>
 <body>
     <p>Both of these frames should successfully open the database:</p>
index b850e51..ebb93ff 100644 (file)
@@ -5,15 +5,13 @@ The first iframe below should return a security error, and the second should suc
 --------
 Frame: '<!--framePath //<!--frame0-->-->'
 --------
-self.webkitIndexedDB.deleteDatabase() threw an exception: SecurityError
-self.webkitIndexedDB.open() threw an exception: SecurityError
-self.webkitIndexedDB.webkitGetDatabaseNames() threw an exception: SecurityError
+self.indexedDB.deleteDatabase() threw an exception: SecurityError
+self.indexedDB.open() threw an exception: SecurityError
 
 
 --------
 Frame: '<!--framePath //<!--frame1-->-->'
 --------
-Successfully called self.webkitIndexedDB.deleteDatabase().
-Successfully called self.webkitIndexedDB.open().
-Successfully called self.webkitIndexedDB.webkitGetDatabaseNames().
+Successfully called self.indexedDB.deleteDatabase().
+Successfully called self.indexedDB.open().
 
index d3293d4..d456b89 100644 (file)
@@ -3,17 +3,20 @@
 <head>
 </head>
 <body>
-    <script>
-        if (window.testRunner) {
-            testRunner.dumpAsText();
-            testRunner.dumpChildFramesAsText();
-            testRunner.waitUntilDone();
-            testRunner.setCanOpenWindows(true);
-            testRunner.setCloseRemainingWindowsWhenComplete(true);
-            internals.settings.setStorageBlockingPolicy('BlockThirdParty');
-        }
+<script>
+if (window.internals)
+    window.internals.settings.setIndexedDBWorkersEnabled(true);
 
-        document.location = "resources/document-for-cross-origin-worker-indexeddb.html"
-    </script>
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.dumpChildFramesAsText();
+    testRunner.waitUntilDone();
+    testRunner.setCanOpenWindows(true);
+    testRunner.setCloseRemainingWindowsWhenComplete(true);
+    internals.settings.setStorageBlockingPolicy('BlockThirdParty');
+}
+
+document.location = "resources/document-for-cross-origin-worker-indexeddb.html"
+</script>
 </body>
 </html>
index 31c4ef6..e3426c7 100644 (file)
@@ -1,17 +1,20 @@
 <!DOCTYPE html>
 <html>
 <head>
-    <script>
-        window.onload = function() {
-            var worker = new Worker('worker-for-indexeddb.js');
-            worker.postMessage(true);
-            worker.onmessage = function(event) {
-                for (var i = 0; i < event.data.result.length; i++)
-                    document.write(event.data.result[i]);
-                window.parent.postMessage('DONE', '*');
-            };
-        };
-    </script>
+<script>
+if (window.internals)
+    window.internals.settings.setIndexedDBWorkersEnabled(true);
+
+window.onload = function() {
+    var worker = new Worker('worker-for-indexeddb.js');
+    worker.postMessage(true);
+    worker.onmessage = function(event) {
+        for (var i = 0; i < event.data.result.length; i++)
+            document.write(event.data.result[i]);
+        window.parent.postMessage('DONE', '*');
+    };
+};
+</script>
 </head>
 <body>
 </body>
index e61cc09..ebd0b27 100644 (file)
@@ -1,19 +1,22 @@
 <!DOCTYPE html>
 <html>
 <head>
-    <script>
-        var frames = 2;
+<script>
+if (window.internals)
+    window.internals.settings.setIndexedDBWorkersEnabled(true);
+    
+var frames = 2;
 
-        function decrement() {
-            --frames;
-            if (!frames && window.testRunner) {
-                internals.settings.setStorageBlockingPolicy('AllowAll');
-                testRunner.notifyDone();
-            }
-        }
+function decrement() {
+    --frames;
+    if (!frames && window.testRunner) {
+        internals.settings.setStorageBlockingPolicy('AllowAll');
+        testRunner.notifyDone();
+    }
+}
 
-        window.onmessage = decrement;
-    </script>
+window.onmessage = decrement;
+</script>
 </head>
 <body>
     <p>The first iframe below should return a security error, and the second should successfully open the database.</p>
index 08a2919..2fa0bdc 100644 (file)
@@ -1,17 +1,16 @@
 self.onmessage = function() {
     function test(method, args) {
         try {
-            var request = self.webkitIndexedDB[method].call(self.webkitIndexedDB, args);
-            return 'Successfully called self.webkitIndexedDB.' + method + '().<br>';
+            var request = self.indexedDB[method].call(self.indexedDB, args);
+            return 'Successfully called self.indexedDB.' + method + '().<br>';
         } catch (exception) {
-            return 'self.webkitIndexedDB.' + method + '() threw an exception: ' + exception.name + '<br>';
+            return 'self.indexedDB.' + method + '() threw an exception: ' + exception.name + '<br>';
         }
     }
     self.postMessage({
         'result': [
             test('deleteDatabase', 'testDBName'),
             test('open', 'testDBName'),
-            test('webkitGetDatabaseNames')
         ]
     });
 };
index cac091b..249abfd 100644 (file)
@@ -4,6 +4,10 @@
 <script src="resources/shared.js"></script>
 </head>
 <body>
-<script>worker = startWorker('resources/basics.js');</script>
+<script>
+if (window.internals)
+    window.internals.settings.setIndexedDBWorkersEnabled(true);
+worker = startWorker('resources/basics.js');
+</script>
 </body>
 </html>
index 12e720e..7282193 100644 (file)
@@ -6,7 +6,6 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 Starting worker: resources/cursor-advance.js
 [Worker] indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
 [Worker] 
-[Worker] dbname = "cursor-advance.js"
 [Worker] indexedDB.deleteDatabase(dbname)
 [Worker] indexedDB.open(dbname)
 [Worker] 
@@ -182,13 +181,13 @@ PASS [Worker] Exception was thrown.
 PASS [Worker] cursor.advance(0) threw TypeError: Failed to execute 'advance' on 'IDBCursor': A count argument with value 0 (zero) was supplied, must be greater than 0.
 [Worker] Expecting TypeError exception from cursor.advance(-1)
 PASS [Worker] Exception was thrown.
-PASS [Worker] cursor.advance(-1) threw TypeError: Failed to execute 'advance' on 'IDBCursor': Value is outside the 'unsigned long' value range.
+PASS [Worker] cursor.advance(-1) threw TypeError: Value -1 is outside the range [0, 4294967295]
 [Worker] Expecting TypeError exception from cursor.advance(0x100000000)
 PASS [Worker] Exception was thrown.
-PASS [Worker] cursor.advance(0x100000000) threw TypeError: Failed to execute 'advance' on 'IDBCursor': Value is outside the 'unsigned long' value range.
+PASS [Worker] cursor.advance(0x100000000) threw TypeError: Value 4294967296 is outside the range [0, 4294967295]
 [Worker] Expecting TypeError exception from cursor.advance(0x20000000000000)
 PASS [Worker] Exception was thrown.
-PASS [Worker] cursor.advance(0x20000000000000) threw TypeError: Failed to execute 'advance' on 'IDBCursor': Value is outside the 'unsigned long' value range.
+PASS [Worker] cursor.advance(0x20000000000000) threw TypeError: Value 9007199254740992 is outside the range [0, 4294967295]
 [Worker] 
 [Worker] testEdges():
 [Worker] trans = db.transaction(objectStoreName, 'readonly')
index 2fe8736..f13eddf 100644 (file)
@@ -4,6 +4,10 @@
 <script src="resources/shared.js"></script>
 </head>
 <body>
-<script>worker = startWorker('resources/cursor-advance.js');</script>
+<script>
+if (window.internals)
+    window.internals.settings.setIndexedDBWorkersEnabled(true);
+worker = startWorker('resources/cursor-advance.js');
+</script>
 </body>
 </html>
index 23f900c..3519736 100644 (file)
@@ -4,6 +4,10 @@
 <script src="resources/shared.js"></script>
 </head>
 <body>
-<script>worker = startWorker('resources/deletedatabase-delayed-by-open-and-versionchange.js');</script>
+<script>
+if (window.internals)
+    window.internals.settings.setIndexedDBWorkersEnabled(true);
+worker = startWorker('resources/deletedatabase-delayed-by-open-and-versionchange.js');
+</script>
 </body>
 </html>
index ad0d02a..02ad308 100644 (file)
@@ -5,6 +5,8 @@
 </head>
 <body>
 <script>
+if (window.internals)
+    window.internals.settings.setIndexedDBWorkersEnabled(true);
 
 description("Regression test for WK82678 - don't commit after a blocked event");
 
index ad0d02a..7923c8c 100644 (file)
@@ -5,7 +5,9 @@
 </head>
 <body>
 <script>
-
+if (window.internals)
+    window.internals.settings.setIndexedDBWorkersEnabled(true);
+    
 description("Regression test for WK82678 - don't commit after a blocked event");
 
 indexedDBTest(prepareDatabase, holdConnection);
index eafa0ec..36b6e89 100644 (file)
@@ -4,6 +4,10 @@
 <script src="resources/shared.js"></script>
 </head>
 <body>
-<script>worker = startWorker('resources/factory-basics.js');</script>
+<script>
+if (window.internals)
+    window.internals.settings.setIndexedDBWorkersEnabled(true);
+worker = startWorker('resources/factory-basics.js');
+</script>
 </body>
 </html>
index 15e1220..0712cea 100644 (file)
@@ -6,7 +6,6 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 Starting worker: resources/index-basics.js
 [Worker] indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
 [Worker] 
-[Worker] dbname = "index-basics.js"
 [Worker] indexedDB.deleteDatabase(dbname)
 [Worker] indexedDB.open(dbname)
 [Worker] 
index 81b42fc..d2bf3af 100644 (file)
@@ -4,6 +4,10 @@
 <script src="resources/shared.js"></script>
 </head>
 <body>
-<script>worker = startWorker('resources/index-basics.js');</script>
+<script>
+if (window.internals)
+    window.internals.settings.setIndexedDBWorkersEnabled(true);
+worker = startWorker('resources/index-basics.js');
+</script>
 </body>
 </html>
index 853f304..3678826 100644 (file)
@@ -5,13 +5,9 @@
 </head>
 <body>
 <script>
-
-/*
-IndexedDB for workers is currently disabled by default.
-Once that changes, we'll need the following code to keep this test passing.
 if (window.internals)
     window.internals.settings.setIndexedDBWorkersEnabled(false);
-*/
+
 worker = startWorker('resources/workers-disabled.js');</script>
 </body>
 </html>
index 5360989..a11859b 100644 (file)
@@ -6,7 +6,6 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 Starting worker: resources/objectstore-basics.js
 [Worker] indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
 [Worker] 
-[Worker] dbname = "objectstore-basics.js"
 [Worker] indexedDB.deleteDatabase(dbname)
 [Worker] indexedDB.open(dbname)
 [Worker] 
@@ -30,8 +29,6 @@ PASS [Worker] 'clear' in store is true
 PASS [Worker] typeof store.clear is "function"
 PASS [Worker] 'openCursor' in store is true
 PASS [Worker] typeof store.openCursor is "function"
-PASS [Worker] 'openKeyCursor' in store is true
-PASS [Worker] typeof store.openKeyCursor is "function"
 PASS [Worker] 'createIndex' in store is true
 PASS [Worker] typeof store.createIndex is "function"
 PASS [Worker] 'index' in store is true
@@ -98,7 +95,7 @@ PASS [Worker] store.indexNames.item(100) is null
 [Worker] Expecting exception from store.add({x: 'bar', y: self}, 'bar')
 PASS [Worker] Exception was thrown.
 PASS [Worker] code is DOMException.DATA_CLONE_ERR
-[Worker] Exception message: Failed to execute 'add' on 'IDBObjectStore': An object could not be cloned.
+[Worker] Exception message: Failed to store record in an IDBObjectStore: An object could not be cloned.
 [Worker] Try to insert data where key path yields a Date key:
 [Worker] store.add({x: testDateB, y: 'value'}, 'key')
 [Worker] addSuccess():
@@ -114,7 +111,7 @@ PASS [Worker] event.target.error.name is 'ConstraintError'
 PASS [Worker] Exception was thrown.
 PASS [Worker] code is 0
 PASS [Worker] ename is 'DataError'
-[Worker] Exception message: Failed to execute 'add' on 'IDBObjectStore': The parameter is not a valid key.
+[Worker] Exception message: Failed to store record in an IDBObjectStore: The parameter is not a valid key.
 [Worker] db.transaction(['storeName'], 'readwrite')
 [Worker] store = transaction.objectStore('storeName')
 [Worker] Ensure invalid key pointed at by index keyPath is ignored
@@ -152,13 +149,13 @@ PASS [Worker] ename is 'DataError'
 PASS [Worker] Exception was thrown.
 PASS [Worker] code is 0
 PASS [Worker] ename is 'DataError'
-[Worker] Exception message: Failed to execute 'add' on 'IDBObjectStore': The parameter is not a valid key.
+[Worker] Exception message: Failed to store record in an IDBObjectStore: The parameter is not a valid key.
 [Worker] Passing an invalid key into store.put().
 [Worker] Expecting exception from store.put(null, {})
 PASS [Worker] Exception was thrown.
 PASS [Worker] code is 0
 PASS [Worker] ename is 'DataError'
-[Worker] Exception message: Failed to execute 'put' on 'IDBObjectStore': The parameter is not a valid key.
+[Worker] Exception message: Failed to store record in an IDBObjectStore: The parameter is not a valid key.
 [Worker] 
 [Worker] testPreConditions():
 [Worker] indexedDB.open(dbname, 3)
@@ -175,31 +172,31 @@ PASS [Worker] ename is 'DataError'
 PASS [Worker] Exception was thrown.
 PASS [Worker] code is 0
 PASS [Worker] ename is 'DataError'
-[Worker] Exception message: Failed to execute 'put' on 'IDBObjectStore': The object store uses in-line keys and the key parameter was provided.
+[Worker] Exception message: Failed to store record in an IDBObjectStore: The object store uses in-line keys and the key parameter was provided.
 [Worker] The object store uses out-of-line keys and has no key generator and the key parameter was not provided.
 [Worker] Expecting exception from storeWithOutOfLineKeys.put({})
 PASS [Worker] Exception was thrown.
 PASS [Worker] code is 0
 PASS [Worker] ename is 'DataError'
-[Worker] Exception message: Failed to execute 'put' on 'IDBObjectStore': The object store uses out-of-line keys and has no key generator and the key parameter was not provided.
+[Worker] Exception message: Failed to store record in an IDBObjectStore: The object store uses out-of-line keys and has no key generator and the key parameter was not provided.
 [Worker] The object store uses in-line keys and the result of evaluating the object store's key path yields a value and that value is not a valid key.
 [Worker] Expecting exception from storeWithInLineKeys.put({key: null})
 PASS [Worker] Exception was thrown.
 PASS [Worker] code is 0
 PASS [Worker] ename is 'DataError'
-[Worker] Exception message: Failed to execute 'put' on 'IDBObjectStore': Evaluating the object store's key path yielded a value that is not a valid key.
+[Worker] Exception message: Failed to store record in an IDBObjectStore: Evaluating the object store's key path yielded a value that is not a valid key.
 [Worker] The object store uses in-line keys but no key generator and the result of evaluating the object store's key path does not yield a value.
 [Worker] Expecting exception from storeWithInLineKeys.put({})
 PASS [Worker] Exception was thrown.
 PASS [Worker] code is 0
 PASS [Worker] ename is 'DataError'
-[Worker] Exception message: Failed to execute 'put' on 'IDBObjectStore': Evaluating the object store's key path did not yield a value.
+[Worker] Exception message: Failed to store record in an IDBObjectStore: Evaluating the object store's key path did not yield a value.
 [Worker] The key parameter was provided but does not contain a valid key.
 [Worker] Expecting exception from storeWithOutOfLineKeys.put({}, null)
 PASS [Worker] Exception was thrown.
 PASS [Worker] code is 0
 PASS [Worker] ename is 'DataError'
-[Worker] Exception message: Failed to execute 'put' on 'IDBObjectStore': The parameter is not a valid key.
+[Worker] Exception message: Failed to store record in an IDBObjectStore: The parameter is not a valid key.
 [Worker] 
 [Worker] IDBObjectStore.add()
 [Worker] The object store uses in-line keys and the key parameter was provided.
@@ -207,31 +204,31 @@ PASS [Worker] ename is 'DataError'
 PASS [Worker] Exception was thrown.
 PASS [Worker] code is 0
 PASS [Worker] ename is 'DataError'
-[Worker] Exception message: Failed to execute 'add' on 'IDBObjectStore': The object store uses in-line keys and the key parameter was provided.
+[Worker] Exception message: Failed to store record in an IDBObjectStore: The object store uses in-line keys and the key parameter was provided.
 [Worker] The object store uses out-of-line keys and has no key generator and the key parameter was not provided.
 [Worker] Expecting exception from storeWithOutOfLineKeys.add({})
 PASS [Worker] Exception was thrown.
 PASS [Worker] code is 0
 PASS [Worker] ename is 'DataError'
-[Worker] Exception message: Failed to execute 'add' on 'IDBObjectStore': The object store uses out-of-line keys and has no key generator and the key parameter was not provided.
+[Worker] Exception message: Failed to store record in an IDBObjectStore: The object store uses out-of-line keys and has no key generator and the key parameter was not provided.
 [Worker] The object store uses in-line keys and the result of evaluating the object store's key path yields a value and that value is not a valid key.
 [Worker] Expecting exception from storeWithInLineKeys.add({key: null})
 PASS [Worker] Exception was thrown.
 PASS [Worker] code is 0
 PASS [Worker] ename is 'DataError'
-[Worker] Exception message: Failed to execute 'add' on 'IDBObjectStore': Evaluating the object store's key path yielded a value that is not a valid key.
+[Worker] Exception message: Failed to store record in an IDBObjectStore: Evaluating the object store's key path yielded a value that is not a valid key.
 [Worker] The object store uses in-line keys but no key generator and the result of evaluating the object store's key path does not yield a value.
 [Worker] Expecting exception from storeWithInLineKeys.add({})
 PASS [Worker] Exception was thrown.
 PASS [Worker] code is 0
 PASS [Worker] ename is 'DataError'
-[Worker] Exception message: Failed to execute 'add' on 'IDBObjectStore': Evaluating the object store's key path did not yield a value.
+[Worker] Exception message: Failed to store record in an IDBObjectStore: Evaluating the object store's key path did not yield a value.
 [Worker] The key parameter was provided but does not contain a valid key.
 [Worker] Expecting exception from storeWithOutOfLineKeys.add({}, null)
 PASS [Worker] Exception was thrown.
 PASS [Worker] code is 0
 PASS [Worker] ename is 'DataError'
-[Worker] Exception message: Failed to execute 'add' on 'IDBObjectStore': The parameter is not a valid key.
+[Worker] Exception message: Failed to store record in an IDBObjectStore: The parameter is not a valid key.
 PASS successfullyParsed is true
 
 TEST COMPLETE
index eb578f6..0b26c3e 100644 (file)
@@ -4,6 +4,10 @@
 <script src="resources/shared.js"></script>
 </head>
 <body>
-<script>worker = startWorker('resources/objectstore-basics.js');</script>
+<script>
+if (window.internals)
+    window.internals.settings.setIndexedDBWorkersEnabled(true);
+worker = startWorker('resources/objectstore-basics.js');
+</script>
 </body>
 </html>
index 7a8138f..84d78c5 100644 (file)
@@ -4,6 +4,10 @@
 <script src="resources/shared.js"></script>
 </head>
 <body>
-<script>worker = startWorker('resources/open-twice.js');</script>
+<script>
+if (window.internals)
+    window.internals.settings.setIndexedDBWorkersEnabled(true);
+worker = startWorker('resources/open-twice.js');
+</script>
 </body>
 </html>
index 6bb222d..52e5890 100644 (file)
@@ -2,5 +2,9 @@
 <script src="../../resources/js-test.js"></script>
 <script src="resources/shared.js"></script>
 <body>
-<script>worker = startWorker('resources/pending-activity.js');</script>
+<script>
+if (window.internals)
+    window.internals.settings.setIndexedDBWorkersEnabled(true);
+worker = startWorker('resources/pending-activity.js');
+</script>
 </body>
index 63b124f..94226c9 100644 (file)
@@ -5,6 +5,8 @@
 </head>
 <body>
 <script>
+if (window.internals)
+    window.internals.settings.setIndexedDBWorkersEnabled(true);
 
 description("No crashes when there are event listeners in a worker on shutdown");
 
index 63b124f..94226c9 100644 (file)
@@ -5,6 +5,8 @@
 </head>
 <body>
 <script>
+if (window.internals)
+    window.internals.settings.setIndexedDBWorkersEnabled(true);
 
 description("No crashes when there are event listeners in a worker on shutdown");
 
index bc32be5..1f01283 100644 (file)
@@ -5,6 +5,8 @@
 </head>
 <body>
 <script>
+if (window.internals)
+    window.internals.settings.setIndexedDBWorkersEnabled(true);
 
 description("Implicitly terminating worker with blocked setVersion call should allow later open calls to proceed");
 
index f7932f8..48ede6d 100644 (file)
@@ -5,6 +5,8 @@
 </head>
 <body>
 <script>
+if (window.internals)
+    window.internals.settings.setIndexedDBWorkersEnabled(true);
 
 description("Explicitly terminating worker with blocked call should allow later open calls to proceed");
 
index f7932f8..48ede6d 100644 (file)
@@ -5,6 +5,8 @@
 </head>
 <body>
 <script>
+if (window.internals)
+    window.internals.settings.setIndexedDBWorkersEnabled(true);
 
 description("Explicitly terminating worker with blocked call should allow later open calls to proceed");
 
index bc32be5..1f01283 100644 (file)
@@ -5,6 +5,8 @@
 </head>
 <body>
 <script>
+if (window.internals)
+    window.internals.settings.setIndexedDBWorkersEnabled(true);
 
 description("Implicitly terminating worker with blocked setVersion call should allow later open calls to proceed");
 
index 91fda64..17594fa 100644 (file)
@@ -6,7 +6,6 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 Starting worker: resources/transaction-complete-workers.js
 [Worker] indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
 [Worker] 
-[Worker] dbname = "transaction-complete-workers.js"
 [Worker] indexedDB.deleteDatabase(dbname)
 [Worker] indexedDB.open(dbname)
 [Worker] 
@@ -21,7 +20,7 @@ PASS [Worker] Transaction completed
 PASS [Worker] Exception was thrown.
 PASS [Worker] code is 0
 PASS [Worker] ename is 'TransactionInactiveError'
-[Worker] Exception message: Failed to execute 'get' on 'IDBObjectStore': The transaction has finished.
+[Worker] Exception message: Failed to execute 'get' on 'IDBObjectStore': The transaction is inactive or finished.
 [Worker] 
 [Worker] recursionTest():
 [Worker] transaction = db.transaction('store')
@@ -51,7 +50,7 @@ PASS [Worker] transaction completed
 PASS [Worker] Exception was thrown.
 PASS [Worker] code is 0
 PASS [Worker] ename is 'TransactionInactiveError'
-[Worker] Exception message: Failed to execute 'get' on 'IDBObjectStore': The transaction has finished.
+[Worker] Exception message: Failed to execute 'get' on 'IDBObjectStore': The transaction is inactive or finished.
 [Worker] 
 [Worker] trying a timeout callback:
 [Worker] setTimeout(timeoutTest, 0)
@@ -64,7 +63,7 @@ PASS [Worker] transaction started in setTimeout() callback completed
 PASS [Worker] Exception was thrown.
 PASS [Worker] code is 0
 PASS [Worker] ename is 'TransactionInactiveError'
-[Worker] Exception message: Failed to execute 'get' on 'IDBObjectStore': The transaction has finished.
+[Worker] Exception message: Failed to execute 'get' on 'IDBObjectStore': The transaction is inactive or finished.
 [Worker] 
 [Worker] errorTest():
 [Worker] self.old_onerror = self.onerror
@@ -81,7 +80,7 @@ PASS [Worker] Transaction completed
 PASS [Worker] Exception was thrown.
 PASS [Worker] code is 0
 PASS [Worker] ename is 'TransactionInactiveError'
-[Worker] Exception message: Failed to execute 'get' on 'IDBObjectStore': The transaction has finished.
+[Worker] Exception message: Failed to execute 'get' on 'IDBObjectStore': The transaction is inactive or finished.
 PASS successfullyParsed is true
 
 TEST COMPLETE
index 2cb7bf7..17594fa 100644 (file)
@@ -20,7 +20,7 @@ PASS [Worker] Transaction completed
 PASS [Worker] Exception was thrown.
 PASS [Worker] code is 0
 PASS [Worker] ename is 'TransactionInactiveError'
-[Worker] Exception message: Failed to execute 'get' on 'IDBObjectStore': The transaction has finished.
+[Worker] Exception message: Failed to execute 'get' on 'IDBObjectStore': The transaction is inactive or finished.
 [Worker] 
 [Worker] recursionTest():
 [Worker] transaction = db.transaction('store')
@@ -50,7 +50,7 @@ PASS [Worker] transaction completed
 PASS [Worker] Exception was thrown.
 PASS [Worker] code is 0
 PASS [Worker] ename is 'TransactionInactiveError'
-[Worker] Exception message: Failed to execute 'get' on 'IDBObjectStore': The transaction has finished.
+[Worker] Exception message: Failed to execute 'get' on 'IDBObjectStore': The transaction is inactive or finished.
 [Worker] 
 [Worker] trying a timeout callback:
 [Worker] setTimeout(timeoutTest, 0)
@@ -63,7 +63,7 @@ PASS [Worker] transaction started in setTimeout() callback completed
 PASS [Worker] Exception was thrown.
 PASS [Worker] code is 0
 PASS [Worker] ename is 'TransactionInactiveError'
-[Worker] Exception message: Failed to execute 'get' on 'IDBObjectStore': The transaction has finished.
+[Worker] Exception message: Failed to execute 'get' on 'IDBObjectStore': The transaction is inactive or finished.
 [Worker] 
 [Worker] errorTest():
 [Worker] self.old_onerror = self.onerror
@@ -80,7 +80,7 @@ PASS [Worker] Transaction completed
 PASS [Worker] Exception was thrown.
 PASS [Worker] code is 0
 PASS [Worker] ename is 'TransactionInactiveError'
-[Worker] Exception message: Failed to execute 'get' on 'IDBObjectStore': The transaction has finished.
+[Worker] Exception message: Failed to execute 'get' on 'IDBObjectStore': The transaction is inactive or finished.
 PASS successfullyParsed is true
 
 TEST COMPLETE
index 72042de..1f20b3e 100644 (file)
@@ -5,6 +5,8 @@
 </head>
 <body>
 <script>
+if (window.internals)
+    window.internals.settings.setIndexedDBWorkersEnabled(true);
 
 worker = startWorker('resources/transaction-complete-workers.js');
 
index 72042de..1f20b3e 100644 (file)
@@ -5,6 +5,8 @@
 </head>
 <body>
 <script>
+if (window.internals)
+    window.internals.settings.setIndexedDBWorkersEnabled(true);
 
 worker = startWorker('resources/transaction-complete-workers.js');
 
index d473980..ec47b25 100644 (file)
@@ -5,6 +5,10 @@
 <script src="resources/shared.js"></script>
 </head>
 <body>
-<script>worker = startWorker('resources/unprefix.js');</script>
+<script>
+if (window.internals)
+    window.internals.settings.setIndexedDBWorkersEnabled(true);
+worker = startWorker('resources/unprefix.js');
+</script>
 </body>
 </html>
index 098088b..be3e670 100644 (file)
@@ -1,3 +1,41 @@
+2016-05-06  Brady Eidson  <beidson@apple.com>
+
+        Modern IDB (Workers): Start running a lot of the workers tests.
+        https://bugs.webkit.org/show_bug.cgi?id=157424
+
+        Reviewed by Sam Weinig.
+
+        No new tests (Covered by enabling a whole bunch of existing tests).
+
+        * Modules/indexeddb/IDBDatabase.cpp:
+        (WebCore::IDBDatabase::stop): Call removeAllEventListeners() to clean up the Worker VM
+          before it shuts down.
+
+        * Modules/indexeddb/IDBRequest.cpp:
+        (WebCore::IDBRequest::stop): Call removeAllEventListeners()
+
+        * Modules/indexeddb/IDBTransaction.cpp:
+        (WebCore::IDBTransaction::IDBTransaction): Initialize with the correct VM.
+        (WebCore::IDBTransaction::stop): Call removeAllEventListeners()
+        (WebCore::IDBTransaction::operationDidComplete):
+
+        * Modules/indexeddb/client/IDBConnectionProxy.cpp:
+        (WebCore::IDBClient::IDBConnectionProxy::takeIDBOpenDBRequest):
+        (WebCore::IDBClient::IDBConnectionProxy::completeOpenDBRequest): Don't take the request from
+          the map, but rather let the request take itself from its appropriate thread.
+        * Modules/indexeddb/client/IDBConnectionProxy.h:
+
+        * Modules/indexeddb/client/TransactionOperation.h:
+        (WebCore::IDBClient::TransactionOperation::completed): Rework clearing out the completion 
+          handler, as the handler itself might hold the last reference to `this`.
+
+        * page/SecurityOrigin.h:
+        (WebCore::SecurityOrigin::hasUniversalAccess):
+
+        * workers/WorkerGlobalScope.cpp:
+        (WebCore::WorkerGlobalScope::WorkerGlobalScope): If the parent context's SecurityOrigin had
+          universal access, grant it to this one.
+
 2016-05-06  Ryosuke Niwa  <rniwa@webkit.org>
 
         FKA: No way to get focus from DOM to shadow DOM components (Was: HTML5 media controls not keyboard accessible)
index 4ce754a..8b3d4b2 100644 (file)
@@ -285,6 +285,8 @@ void IDBDatabase::stop()
 
     ASSERT(currentThread() == m_originThreadID);
 
+    removeAllEventListeners();
+
     Vector<IDBResourceIdentifier> transactionIdentifiers;
     transactionIdentifiers.reserveInitialCapacity(m_activeTransactions.size());
 
index 32b7e7b..860ea48 100644 (file)
@@ -241,6 +241,9 @@ void IDBRequest::stop()
 {
     ASSERT(currentThread() == m_originThreadID);
     ASSERT(!m_contextStopped);
+
+    removeAllEventListeners();
+
     m_contextStopped = true;
 }
 
index 7de3806..129f4c6 100644 (file)
@@ -140,8 +140,11 @@ IDBTransaction::IDBTransaction(IDBDatabase& database, const IDBTransactionInfo&
     } else {
         activate();
 
+        auto* context = scriptExecutionContext();
+        ASSERT(context);
+
         RefPtr<IDBTransaction> self;
-        JSC::VM& vm = JSDOMWindowBase::commonVM();
+        JSC::VM& vm = context->vm();
         vm.whenIdle([self, this]() {
             deactivate();
         });
@@ -333,6 +336,8 @@ void IDBTransaction::stop()
     if (m_contextStopped)
         return;
 
+    removeAllEventListeners();
+
     m_contextStopped = true;
 
     if (isFinishedOrFinishing())
@@ -1030,6 +1035,7 @@ void IDBTransaction::operationDidComplete(IDBClient::TransactionOperation& opera
 {
     ASSERT(m_transactionOperationMap.get(operation.identifier()) == &operation);
     ASSERT(currentThread() == m_database->originThreadID());
+    ASSERT(currentThread() == operation.originThreadID());
 
     m_transactionOperationMap.remove(operation.identifier());
 
index a23f5bf..8204dba 100644 (file)
@@ -117,14 +117,26 @@ void IDBConnectionProxy::didDeleteDatabase(const IDBResultData& resultData)
     completeOpenDBRequest(resultData);
 }
 
+RefPtr<IDBOpenDBRequest> IDBConnectionProxy::takeIDBOpenDBRequest(IDBOpenDBRequest& request)
+{
+    ASSERT(request.originThreadID() == currentThread());
+
+    Locker<Lock> locker(m_openDBRequestMapLock);
+
+    auto mappedRequest = m_openDBRequestMap.take(request.resourceIdentifier());
+    ASSERT(mappedRequest.get() == &request);
+
+    return mappedRequest;
+}
+
 void IDBConnectionProxy::completeOpenDBRequest(const IDBResultData& resultData)
 {
     ASSERT(isMainThread());
 
-    RefPtr<IDBOpenDBRequest> request;
+    IDBOpenDBRequest* request;
     {
         Locker<Lock> locker(m_openDBRequestMapLock);
-        request = m_openDBRequestMap.take(resultData.requestIdentifier());
+        request = m_openDBRequestMap.get(resultData.requestIdentifier());
         ASSERT(request);
     }
 
index 9eca8e2..16688a6 100644 (file)
@@ -106,6 +106,8 @@ public:
     void registerDatabaseConnection(IDBDatabase&);
     void unregisterDatabaseConnection(IDBDatabase&);
 
+    RefPtr<IDBOpenDBRequest> takeIDBOpenDBRequest(IDBOpenDBRequest&);
+
 private:
     void completeOpenDBRequest(const IDBResultData&);
     bool hasRecordOfTransaction(const IDBTransaction&) const;
index b5f9989..90cb648 100644 (file)
@@ -66,7 +66,11 @@ public:
         ASSERT(m_completeFunction);
         m_completeFunction(data);
         m_transaction->operationDidComplete(*this);
-        m_completeFunction = { };
+
+        // m_completeFunction might be holding the last ref to this TransactionOperation,
+        // so we need to do this trick to null it out without first destroying it.
+        std::function<void (const IDBResultData&)> oldCompleteFunction;
+        std::swap(m_completeFunction, oldCompleteFunction);
     }
 
     const IDBResourceIdentifier& identifier() const { return m_identifier; }
index f1108d5..84dece3 100644 (file)
@@ -143,6 +143,7 @@ public:
     //
     // WARNING: This is an extremely powerful ability. Use with caution!
     void grantUniversalAccess();
+    bool hasUniversalAccess() const { return m_universalAccess; }
 
     void setStorageBlockingPolicy(StorageBlockingPolicy policy) { m_storageBlockingPolicy = policy; }
 
index d464ddb..84c6fb7 100644 (file)
@@ -76,7 +76,11 @@ WorkerGlobalScope::WorkerGlobalScope(const URL& url, const String& userAgent, Wo
     , m_connectionProxy(connectionProxy)
 #endif
 {
-    setSecurityOriginPolicy(SecurityOriginPolicy::create(SecurityOrigin::create(url)));
+    auto origin = SecurityOrigin::create(url);
+    if (m_topOrigin->hasUniversalAccess())
+        origin->grantUniversalAccess();
+
+    setSecurityOriginPolicy(SecurityOriginPolicy::create(WTFMove(origin)));
     setContentSecurityPolicy(std::make_unique<ContentSecurityPolicy>(*this));
 }