Title: [281808] trunk
Revision
281808
Author
[email protected]
Date
2021-08-31 09:52:46 -0700 (Tue, 31 Aug 2021)

Log Message

Implement self.structuredClone()
https://bugs.webkit.org/show_bug.cgi?id=228331
<rdar://problem/81468374>

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Import layout test coverage from WPT.

* web-platform-tests/html/webappapis/structured-clone/structured-clone.any-expected.txt: Added.
* web-platform-tests/html/webappapis/structured-clone/structured-clone.any.html: Added.
* web-platform-tests/html/webappapis/structured-clone/structured-clone.any.js: Added.
* web-platform-tests/html/webappapis/structured-clone/structured-clone.any.worker-expected.txt: Added.
* web-platform-tests/html/webappapis/structured-clone/structured-clone.any.worker.html: Added.
* web-platform-tests/html/webappapis/structured-clone/w3c-import.log:

Source/WebCore:

Implement self.structuredClone() as per:
- https://html.spec.whatwg.org/#dom-structuredclone

Tests: imported/w3c/web-platform-tests/html/webappapis/structured-clone/structured-clone.any.html
       imported/w3c/web-platform-tests/html/webappapis/structured-clone/structured-clone.any.worker.html

* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Headers.cmake:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* dom/MessagePort.cpp:
(WebCore::MessagePort::postMessage):
* dom/MessagePort.h:
* dom/MessagePort.idl:
* page/Base64Utilities.h:
* page/DOMWindow.h:
(WebCore::WindowPostMessageOptions::WindowPostMessageOptions):
* page/DOMWindow.idl:
* page/StructuredSerializeOptions.h: Renamed from Source/WebCore/page/PostMessageOptions.h.
(WebCore::StructuredSerializeOptions::StructuredSerializeOptions):
* page/StructuredSerializeOptions.idl: Renamed from Source/WebCore/page/PostMessageOptions.idl.
* page/WindowOrWorkerGlobalScope.cpp: Copied from Source/WebCore/workers/service/ServiceWorkerClient.h.
(WebCore::WindowOrWorkerGlobalScope::reportError):
(WebCore::WindowOrWorkerGlobalScope::structuredClone):
* page/WindowOrWorkerGlobalScope.h: Copied from Source/WebCore/page/Base64Utilities.h.
(WebCore::WindowOrWorkerGlobalScope::structuredClone):
* page/WindowOrWorkerGlobalScope.idl:
* workers/DedicatedWorkerGlobalScope.cpp:
(WebCore::DedicatedWorkerGlobalScope::postMessage):
* workers/DedicatedWorkerGlobalScope.h:
* workers/DedicatedWorkerGlobalScope.idl:
* workers/Worker.cpp:
(WebCore::Worker::postMessage):
* workers/Worker.h:
* workers/Worker.idl:
* workers/WorkerGlobalScope.h:
* workers/service/ServiceWorker.cpp:
(WebCore::ServiceWorker::postMessage):
* workers/service/ServiceWorker.h:
* workers/service/ServiceWorker.idl:
* workers/service/ServiceWorkerClient.cpp:
(WebCore::ServiceWorkerClient::postMessage):
* workers/service/ServiceWorkerClient.h:
* workers/service/ServiceWorkerClient.idl:

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (281807 => 281808)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-08-31 16:24:35 UTC (rev 281807)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-08-31 16:52:46 UTC (rev 281808)
@@ -1,5 +1,22 @@
 2021-08-31  Chris Dumez  <[email protected]>
 
+        Implement self.structuredClone()
+        https://bugs.webkit.org/show_bug.cgi?id=228331
+        <rdar://problem/81468374>
+
+        Reviewed by Ryosuke Niwa.
+
+        Import layout test coverage from WPT.
+
+        * web-platform-tests/html/webappapis/structured-clone/structured-clone.any-expected.txt: Added.
+        * web-platform-tests/html/webappapis/structured-clone/structured-clone.any.html: Added.
+        * web-platform-tests/html/webappapis/structured-clone/structured-clone.any.js: Added.
+        * web-platform-tests/html/webappapis/structured-clone/structured-clone.any.worker-expected.txt: Added.
+        * web-platform-tests/html/webappapis/structured-clone/structured-clone.any.worker.html: Added.
+        * web-platform-tests/html/webappapis/structured-clone/w3c-import.log:
+
+2021-08-31  Chris Dumez  <[email protected]>
+
         [COOP] html/cross-origin-opener-policy/coop-same-origin-allow-popups-document-write.html WPT test is failing
         https://bugs.webkit.org/show_bug.cgi?id=229692
 

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/structured-clone/structured-clone.any-expected.txt (0 => 281808)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/structured-clone/structured-clone.any-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/structured-clone/structured-clone.any-expected.txt	2021-08-31 16:52:46 UTC (rev 281808)
@@ -0,0 +1,124 @@
+
+PASS primitive undefined
+PASS primitive null
+PASS primitive true
+PASS primitive false
+PASS primitive string, empty string
+PASS primitive string, lone high surrogate
+PASS primitive string, lone low surrogate
+PASS primitive string, NUL
+PASS primitive string, astral character
+PASS primitive number, 0.2
+PASS primitive number, 0
+PASS primitive number, -0
+PASS primitive number, NaN
+PASS primitive number, Infinity
+PASS primitive number, -Infinity
+PASS primitive number, 9007199254740992
+PASS primitive number, -9007199254740992
+PASS primitive number, 9007199254740994
+PASS primitive number, -9007199254740994
+PASS primitive BigInt, 0n
+PASS primitive BigInt, -0n
+PASS primitive BigInt, -9007199254740994000n
+PASS primitive BigInt, -9007199254740994000900719925474099400090071992547409940009007199254740994000n
+PASS Array primitives
+PASS Object primitives
+PASS Boolean true
+PASS Boolean false
+PASS Array Boolean objects
+PASS Object Boolean objects
+PASS String empty string
+PASS String lone high surrogate
+PASS String lone low surrogate
+PASS String NUL
+PASS String astral character
+PASS Array String objects
+PASS Object String objects
+PASS Number 0.2
+PASS Number 0
+PASS Number -0
+PASS Number NaN
+PASS Number Infinity
+PASS Number -Infinity
+PASS Number 9007199254740992
+PASS Number -9007199254740992
+PASS Number 9007199254740994
+PASS Number -9007199254740994
+PASS BigInt -9007199254740994n
+PASS Array Number objects
+PASS Object Number objects
+PASS Date 0
+PASS Date -0
+PASS Date -8.64e15
+PASS Date 8.64e15
+PASS Array Date objects
+PASS Object Date objects
+PASS RegExp flags and lastIndex
+PASS RegExp sticky flag
+PASS RegExp unicode flag
+PASS RegExp empty
+PASS RegExp slash
+PASS RegExp new line
+PASS Array RegExp object, RegExp flags and lastIndex
+PASS Array RegExp object, RegExp sticky flag
+PASS Array RegExp object, RegExp unicode flag
+PASS Array RegExp object, RegExp empty
+PASS Array RegExp object, RegExp slash
+PASS Array RegExp object, RegExp new line
+PASS Object RegExp object, RegExp flags and lastIndex
+PASS Object RegExp object, RegExp sticky flag
+PASS Object RegExp object, RegExp unicode flag
+PASS Object RegExp object, RegExp empty
+PASS Object RegExp object, RegExp slash
+PASS Object RegExp object, RegExp new line
+PASS Blob basic
+PASS Blob unpaired high surrogate (invalid utf-8)
+PASS Blob unpaired low surrogate (invalid utf-8)
+PASS Blob paired surrogates (invalid utf-8)
+PASS Blob empty
+PASS Blob NUL
+PASS Array Blob object, Blob basic
+PASS Array Blob object, Blob unpaired high surrogate (invalid utf-8)
+PASS Array Blob object, Blob unpaired low surrogate (invalid utf-8)
+PASS Array Blob object, Blob paired surrogates (invalid utf-8)
+PASS Array Blob object, Blob empty
+PASS Array Blob object, Blob NUL
+PASS Array Blob object, two Blobs
+PASS Object Blob object, Blob basic
+PASS Object Blob object, Blob unpaired high surrogate (invalid utf-8)
+PASS Object Blob object, Blob unpaired low surrogate (invalid utf-8)
+PASS Object Blob object, Blob paired surrogates (invalid utf-8)
+PASS Object Blob object, Blob empty
+PASS Object Blob object, Blob NUL
+PASS File basic
+PASS FileList empty
+PASS Array FileList object, FileList empty
+PASS Object FileList object, FileList empty
+PASS ImageData 1x1 transparent black
+PASS ImageData 1x1 non-transparent non-black
+PASS Array ImageData object, ImageData 1x1 transparent black
+PASS Array ImageData object, ImageData 1x1 non-transparent non-black
+PASS Object ImageData object, ImageData 1x1 transparent black
+PASS Object ImageData object, ImageData 1x1 non-transparent non-black
+PASS Array sparse
+PASS Array with non-index property
+PASS Object with index property and length
+PASS Array with circular reference
+PASS Object with circular reference
+PASS Array with identical property values
+PASS Object with identical property values
+PASS Object with property on prototype
+PASS Object with non-enumerable property
+PASS Object with non-writable property
+PASS Object with non-configurable property
+PASS ImageBitmap 1x1 transparent black
+PASS ImageBitmap 1x1 non-transparent non-black
+PASS Array ImageBitmap object, ImageBitmap 1x1 transparent black
+PASS Array ImageBitmap object, ImageBitmap 1x1 transparent non-black
+PASS Object ImageBitmap object, ImageBitmap 1x1 transparent black
+PASS Object ImageBitmap object, ImageBitmap 1x1 transparent non-black
+FAIL ObjectPrototype must lose its exotic-ness when cloned promise_test: Unhandled rejection with value: object "DataCloneError: The object can not be cloned."
+PASS ArrayBuffer
+PASS MessagePort
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/structured-clone/structured-clone.any.html (0 => 281808)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/structured-clone/structured-clone.any.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/structured-clone/structured-clone.any.html	2021-08-31 16:52:46 UTC (rev 281808)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/structured-clone/structured-clone.any.js (0 => 281808)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/structured-clone/structured-clone.any.js	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/structured-clone/structured-clone.any.js	2021-08-31 16:52:46 UTC (rev 281808)
@@ -0,0 +1,9 @@
+// META: title=structuredClone() tests
+// META: script=/html/webappapis/structured-clone/structured-clone-battery-of-tests.js
+// META: script=/html/webappapis/structured-clone/structured-clone-battery-of-tests-with-transferables.js
+// META: script=/html/webappapis/structured-clone/structured-clone-battery-of-tests-harness.js
+
+runStructuredCloneBatteryOfTests({
+  structuredClone: (obj, transfer) => self.structuredClone(obj, { transfer }),
+  hasDocument: typeof document !== "undefined",
+});

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/structured-clone/structured-clone.any.worker-expected.txt (0 => 281808)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/structured-clone/structured-clone.any.worker-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/structured-clone/structured-clone.any.worker-expected.txt	2021-08-31 16:52:46 UTC (rev 281808)
@@ -0,0 +1,109 @@
+
+PASS primitive undefined
+PASS primitive null
+PASS primitive true
+PASS primitive false
+PASS primitive string, empty string
+PASS primitive string, lone high surrogate
+PASS primitive string, lone low surrogate
+PASS primitive string, NUL
+PASS primitive string, astral character
+PASS primitive number, 0.2
+PASS primitive number, 0
+PASS primitive number, -0
+PASS primitive number, NaN
+PASS primitive number, Infinity
+PASS primitive number, -Infinity
+PASS primitive number, 9007199254740992
+PASS primitive number, -9007199254740992
+PASS primitive number, 9007199254740994
+PASS primitive number, -9007199254740994
+PASS primitive BigInt, 0n
+PASS primitive BigInt, -0n
+PASS primitive BigInt, -9007199254740994000n
+PASS primitive BigInt, -9007199254740994000900719925474099400090071992547409940009007199254740994000n
+PASS Array primitives
+PASS Object primitives
+PASS Boolean true
+PASS Boolean false
+PASS Array Boolean objects
+PASS Object Boolean objects
+PASS String empty string
+PASS String lone high surrogate
+PASS String lone low surrogate
+PASS String NUL
+PASS String astral character
+PASS Array String objects
+PASS Object String objects
+PASS Number 0.2
+PASS Number 0
+PASS Number -0
+PASS Number NaN
+PASS Number Infinity
+PASS Number -Infinity
+PASS Number 9007199254740992
+PASS Number -9007199254740992
+PASS Number 9007199254740994
+PASS Number -9007199254740994
+PASS BigInt -9007199254740994n
+PASS Array Number objects
+PASS Object Number objects
+PASS Date 0
+PASS Date -0
+PASS Date -8.64e15
+PASS Date 8.64e15
+PASS Array Date objects
+PASS Object Date objects
+PASS RegExp flags and lastIndex
+PASS RegExp sticky flag
+PASS RegExp unicode flag
+PASS RegExp empty
+PASS RegExp slash
+PASS RegExp new line
+PASS Array RegExp object, RegExp flags and lastIndex
+PASS Array RegExp object, RegExp sticky flag
+PASS Array RegExp object, RegExp unicode flag
+PASS Array RegExp object, RegExp empty
+PASS Array RegExp object, RegExp slash
+PASS Array RegExp object, RegExp new line
+PASS Object RegExp object, RegExp flags and lastIndex
+PASS Object RegExp object, RegExp sticky flag
+PASS Object RegExp object, RegExp unicode flag
+PASS Object RegExp object, RegExp empty
+PASS Object RegExp object, RegExp slash
+PASS Object RegExp object, RegExp new line
+PASS Blob basic
+PASS Blob unpaired high surrogate (invalid utf-8)
+PASS Blob unpaired low surrogate (invalid utf-8)
+PASS Blob paired surrogates (invalid utf-8)
+PASS Blob empty
+PASS Blob NUL
+PASS Array Blob object, Blob basic
+PASS Array Blob object, Blob unpaired high surrogate (invalid utf-8)
+PASS Array Blob object, Blob unpaired low surrogate (invalid utf-8)
+PASS Array Blob object, Blob paired surrogates (invalid utf-8)
+PASS Array Blob object, Blob empty
+PASS Array Blob object, Blob NUL
+PASS Array Blob object, two Blobs
+PASS Object Blob object, Blob basic
+PASS Object Blob object, Blob unpaired high surrogate (invalid utf-8)
+PASS Object Blob object, Blob unpaired low surrogate (invalid utf-8)
+PASS Object Blob object, Blob paired surrogates (invalid utf-8)
+PASS Object Blob object, Blob empty
+PASS Object Blob object, Blob NUL
+PASS File basic
+PASS Array sparse
+PASS Array with non-index property
+PASS Object with index property and length
+PASS Array with circular reference
+PASS Object with circular reference
+PASS Array with identical property values
+PASS Object with identical property values
+PASS Object with property on prototype
+PASS Object with non-enumerable property
+PASS Object with non-writable property
+PASS Object with non-configurable property
+FAIL ObjectPrototype must lose its exotic-ness when cloned promise_test: Unhandled rejection with value: object "DataCloneError: The object can not be cloned."
+PASS ArrayBuffer
+PASS MessagePort
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/structured-clone/structured-clone.any.worker.html (0 => 281808)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/structured-clone/structured-clone.any.worker.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/structured-clone/structured-clone.any.worker.html	2021-08-31 16:52:46 UTC (rev 281808)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/structured-clone/w3c-import.log (281807 => 281808)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/structured-clone/w3c-import.log	2021-08-31 16:24:35 UTC (rev 281807)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/structured-clone/w3c-import.log	2021-08-31 16:52:46 UTC (rev 281808)
@@ -17,3 +17,4 @@
 /LayoutTests/imported/w3c/web-platform-tests/html/webappapis/structured-clone/structured-clone-battery-of-tests-harness.js
 /LayoutTests/imported/w3c/web-platform-tests/html/webappapis/structured-clone/structured-clone-battery-of-tests-with-transferables.js
 /LayoutTests/imported/w3c/web-platform-tests/html/webappapis/structured-clone/structured-clone-battery-of-tests.js
+/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/structured-clone/structured-clone.any.js

Modified: trunk/Source/WebCore/CMakeLists.txt (281807 => 281808)


--- trunk/Source/WebCore/CMakeLists.txt	2021-08-31 16:24:35 UTC (rev 281807)
+++ trunk/Source/WebCore/CMakeLists.txt	2021-08-31 16:52:46 UTC (rev 281808)
@@ -1089,7 +1089,6 @@
     page/PerformanceResourceTiming.idl
     page/PerformanceServerTiming.idl
     page/PerformanceTiming.idl
-    page/PostMessageOptions.idl
     page/RemoteDOMWindow.idl
     page/ResizeObserver.idl
     page/ResizeObserverCallback.idl
@@ -1101,6 +1100,7 @@
     page/ScrollOptions.idl
     page/ScrollToOptions.idl
     page/ShareData.idl
+    page/StructuredSerializeOptions.idl
     page/UndoItem.idl
     page/UndoManager.idl
     page/VisualViewport.idl

Modified: trunk/Source/WebCore/ChangeLog (281807 => 281808)


--- trunk/Source/WebCore/ChangeLog	2021-08-31 16:24:35 UTC (rev 281807)
+++ trunk/Source/WebCore/ChangeLog	2021-08-31 16:52:46 UTC (rev 281808)
@@ -1,3 +1,59 @@
+2021-08-31  Chris Dumez  <[email protected]>
+
+        Implement self.structuredClone()
+        https://bugs.webkit.org/show_bug.cgi?id=228331
+        <rdar://problem/81468374>
+
+        Reviewed by Ryosuke Niwa.
+
+        Implement self.structuredClone() as per:
+        - https://html.spec.whatwg.org/#dom-structuredclone
+
+        Tests: imported/w3c/web-platform-tests/html/webappapis/structured-clone/structured-clone.any.html
+               imported/w3c/web-platform-tests/html/webappapis/structured-clone/structured-clone.any.worker.html
+
+        * CMakeLists.txt:
+        * DerivedSources-input.xcfilelist:
+        * DerivedSources-output.xcfilelist:
+        * DerivedSources.make:
+        * Headers.cmake:
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * dom/MessagePort.cpp:
+        (WebCore::MessagePort::postMessage):
+        * dom/MessagePort.h:
+        * dom/MessagePort.idl:
+        * page/Base64Utilities.h:
+        * page/DOMWindow.h:
+        (WebCore::WindowPostMessageOptions::WindowPostMessageOptions):
+        * page/DOMWindow.idl:
+        * page/StructuredSerializeOptions.h: Renamed from Source/WebCore/page/PostMessageOptions.h.
+        (WebCore::StructuredSerializeOptions::StructuredSerializeOptions):
+        * page/StructuredSerializeOptions.idl: Renamed from Source/WebCore/page/PostMessageOptions.idl.
+        * page/WindowOrWorkerGlobalScope.cpp: Copied from Source/WebCore/workers/service/ServiceWorkerClient.h.
+        (WebCore::WindowOrWorkerGlobalScope::reportError):
+        (WebCore::WindowOrWorkerGlobalScope::structuredClone):
+        * page/WindowOrWorkerGlobalScope.h: Copied from Source/WebCore/page/Base64Utilities.h.
+        (WebCore::WindowOrWorkerGlobalScope::structuredClone):
+        * page/WindowOrWorkerGlobalScope.idl:
+        * workers/DedicatedWorkerGlobalScope.cpp:
+        (WebCore::DedicatedWorkerGlobalScope::postMessage):
+        * workers/DedicatedWorkerGlobalScope.h:
+        * workers/DedicatedWorkerGlobalScope.idl:
+        * workers/Worker.cpp:
+        (WebCore::Worker::postMessage):
+        * workers/Worker.h:
+        * workers/Worker.idl:
+        * workers/WorkerGlobalScope.h:
+        * workers/service/ServiceWorker.cpp:
+        (WebCore::ServiceWorker::postMessage):
+        * workers/service/ServiceWorker.h:
+        * workers/service/ServiceWorker.idl:
+        * workers/service/ServiceWorkerClient.cpp:
+        (WebCore::ServiceWorkerClient::postMessage):
+        * workers/service/ServiceWorkerClient.h:
+        * workers/service/ServiceWorkerClient.idl:
+
 2021-08-31  Alan Bujtas  <[email protected]>
 
         [LFC][Integration] Remove unused LayoutIntegation::Run functions

Modified: trunk/Source/WebCore/DerivedSources-input.xcfilelist (281807 => 281808)


--- trunk/Source/WebCore/DerivedSources-input.xcfilelist	2021-08-31 16:24:35 UTC (rev 281807)
+++ trunk/Source/WebCore/DerivedSources-input.xcfilelist	2021-08-31 16:52:46 UTC (rev 281808)
@@ -1177,6 +1177,7 @@
 $(PROJECT_DIR)/page/ScrollToOptions.idl
 $(PROJECT_DIR)/page/Settings.yaml
 $(PROJECT_DIR)/page/ShareData.idl
+$(PROJECT_DIR)/page/StructuredSerializeOptions.idl
 $(PROJECT_DIR)/page/UndoItem.idl
 $(PROJECT_DIR)/page/UndoManager.idl
 $(PROJECT_DIR)/page/UserMessageHandler.idl

Modified: trunk/Source/WebCore/DerivedSources-output.xcfilelist (281807 => 281808)


--- trunk/Source/WebCore/DerivedSources-output.xcfilelist	2021-08-31 16:24:35 UTC (rev 281807)
+++ trunk/Source/WebCore/DerivedSources-output.xcfilelist	2021-08-31 16:52:46 UTC (rev 281808)
@@ -2201,6 +2201,8 @@
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSStorageEvent.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSStringCallback.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSStringCallback.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSStructuredSerializeOptions.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSStructuredSerializeOptions.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSStyleMedia.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSStyleMedia.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSStylePropertyMap.cpp

Modified: trunk/Source/WebCore/DerivedSources.make (281807 => 281808)


--- trunk/Source/WebCore/DerivedSources.make	2021-08-31 16:24:35 UTC (rev 281807)
+++ trunk/Source/WebCore/DerivedSources.make	2021-08-31 16:52:46 UTC (rev 281808)
@@ -1012,7 +1012,6 @@
     $(WebCore)/page/PerformanceResourceTiming.idl \
     $(WebCore)/page/PerformanceServerTiming.idl \
     $(WebCore)/page/PerformanceTiming.idl \
-    $(WebCore)/page/PostMessageOptions.idl \
     $(WebCore)/page/RemoteDOMWindow.idl \
     $(WebCore)/page/ResizeObserver.idl \
     $(WebCore)/page/ResizeObserverCallback.idl \
@@ -1024,6 +1023,7 @@
     $(WebCore)/page/ScrollOptions.idl \
     $(WebCore)/page/ScrollToOptions.idl \
     $(WebCore)/page/ShareData.idl \
+    $(WebCore)/page/StructuredSerializeOptions.idl \
     $(WebCore)/page/UndoItem.idl \
     $(WebCore)/page/UndoManager.idl \
     $(WebCore)/page/UserMessageHandler.idl \

Modified: trunk/Source/WebCore/Headers.cmake (281807 => 281808)


--- trunk/Source/WebCore/Headers.cmake	2021-08-31 16:24:35 UTC (rev 281807)
+++ trunk/Source/WebCore/Headers.cmake	2021-08-31 16:52:46 UTC (rev 281808)
@@ -935,7 +935,6 @@
     page/PointerCaptureController.h
     page/PointerCharacteristics.h
     page/PointerLockController.h
-    page/PostMessageOptions.h
     page/PrewarmInformation.h
     page/PrintContext.h
     page/ProcessWarming.h
@@ -960,6 +959,7 @@
     page/SpeechRecognitionProvider.h
     page/SpeechSynthesisClient.h
     page/StorageBlockingPolicy.h
+    page/StructuredSerializeOptions.h
     page/SuspendableTimer.h
     page/TextDirectionSubmenuInclusionBehavior.h
     page/TextIndicator.h
@@ -985,6 +985,7 @@
     page/WheelEventDeltaFilter.h
     page/WheelEventTestMonitor.h
     page/WindowFeatures.h
+    page/WindowOrWorkerGlobalScope.h
 
     page/csp/ContentSecurityPolicy.h
     page/csp/ContentSecurityPolicyClient.h

Modified: trunk/Source/WebCore/Sources.txt (281807 => 281808)


--- trunk/Source/WebCore/Sources.txt	2021-08-31 16:24:35 UTC (rev 281807)
+++ trunk/Source/WebCore/Sources.txt	2021-08-31 16:52:46 UTC (rev 281808)
@@ -1706,6 +1706,7 @@
 page/WheelEventTestMonitor.cpp
 page/WindowFeatures.cpp
 page/WindowFocusAllowedIndicator.cpp
+page/WindowOrWorkerGlobalScope.cpp
 page/WorkerNavigator.cpp
 page/csp/ContentSecurityPolicy.cpp
 page/csp/ContentSecurityPolicyClient.cpp
@@ -3290,7 +3291,6 @@
 JSPositionCallback.cpp
 JSPositionErrorCallback.cpp
 JSPositionOptions.cpp
-JSPostMessageOptions.cpp
 JSPredefinedColorSpace.cpp
 JSProcessingInstruction.cpp
 JSProgressEvent.cpp
@@ -3573,6 +3573,7 @@
 JSStorage.cpp
 JSStorageEvent.cpp
 JSStringCallback.cpp
+JSStructuredSerializeOptions.cpp
 JSStyleMedia.cpp
 JSStylePropertyMap.cpp
 JSStylePropertyMapReadOnly.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (281807 => 281808)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-08-31 16:24:35 UTC (rev 281807)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-08-31 16:52:46 UTC (rev 281808)
@@ -1276,6 +1276,7 @@
 		458FE40A1589DF0B005609E6 /* RenderSearchField.h in Headers */ = {isa = PBXBuildFile; fileRef = 458FE4081589DF0B005609E6 /* RenderSearchField.h */; };
 		45FEA5D0156DDE8C00654101 /* Decimal.h in Headers */ = {isa = PBXBuildFile; fileRef = 45FEA5CE156DDE8C00654101 /* Decimal.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		460BB6161D0A1BF000221812 /* Base64Utilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 460BB6141D0A1BEC00221812 /* Base64Utilities.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		460C745926DD69BB00427D3E /* WindowOrWorkerGlobalScope.h in Headers */ = {isa = PBXBuildFile; fileRef = 460C745826DD699D00427D3E /* WindowOrWorkerGlobalScope.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		460CBF361D4BCD0E0092E88E /* JSDOMWindowProperties.h in Headers */ = {isa = PBXBuildFile; fileRef = 460CBF341D4BCCFE0092E88E /* JSDOMWindowProperties.h */; };
 		460E3077222F4F03009A0606 /* DeviceOrientationOrMotionPermissionState.h in Headers */ = {isa = PBXBuildFile; fileRef = 465EDD9F222F4EC300B46E16 /* DeviceOrientationOrMotionPermissionState.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		46218ACB1F72D64E00574FBE /* DOMHighResTimeStamp.h in Headers */ = {isa = PBXBuildFile; fileRef = 46E016AD1F72D61E00282B2C /* DOMHighResTimeStamp.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -1284,7 +1285,6 @@
 		463521AD2081092A00C28922 /* WindowProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 463521AA2081090B00C28922 /* WindowProxy.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		463EB6231B8789E00096ED51 /* TagCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 463EB6211B8789CB0096ED51 /* TagCollection.h */; };
 		465307D01DB6EE4800E4137C /* JSUIEventInit.h in Headers */ = {isa = PBXBuildFile; fileRef = 83E045EF1DAA104F00B0D8B9 /* JSUIEventInit.h */; };
-		466172EC23A2AC1F003AB309 /* PostMessageOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 466172EB23A2ABFA003AB309 /* PostMessageOptions.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		46658DC91FA24B8700F7DD54 /* SWContextManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 4672413B1FA24B140088BD6D /* SWContextManager.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		466C2DAD26C73AFC00651931 /* PolicyContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = 466C2DAB26C73AFB00651931 /* PolicyContainer.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		466ED8D31EDE0144005E43F6 /* JSDOMRectList.h in Headers */ = {isa = PBXBuildFile; fileRef = 466ED8D21EDE0135005E43F6 /* JSDOMRectList.h */; };
@@ -1335,6 +1335,7 @@
 		46EFAF121E5FB9F100E7F34B /* LowPowerModeNotifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 46EFAF101E5FB9E100E7F34B /* LowPowerModeNotifier.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		46F02A1A23737F8300106A64 /* EventLoop.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B0ABCA123679AB300B45085 /* EventLoop.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		46FCB6181A70820E00C5A21E /* DiagnosticLoggingKeys.h in Headers */ = {isa = PBXBuildFile; fileRef = CD37B37515C1A7E1006DC898 /* DiagnosticLoggingKeys.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		46FEFBC826DD67A200B0C488 /* StructuredSerializeOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 46FEFBC626DD678200B0C488 /* StructuredSerializeOptions.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		475C89A42650AC3C00F3B456 /* FormattingGeometry.h in Headers */ = {isa = PBXBuildFile; fileRef = 475C89A32650AC3B00F3B456 /* FormattingGeometry.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		4786356526507A3800C5E2E0 /* BlockFormattingGeometry.h in Headers */ = {isa = PBXBuildFile; fileRef = 4786356426507A3700C5E2E0 /* BlockFormattingGeometry.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		47C4D57D26508BCB00C7AB1F /* InlineFormattingGeometry.h in Headers */ = {isa = PBXBuildFile; fileRef = 47C4D57C26508BCA00C7AB1F /* InlineFormattingGeometry.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -8299,6 +8300,8 @@
 		45FEA5CE156DDE8C00654101 /* Decimal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Decimal.h; sourceTree = "<group>"; };
 		460BB6131D0A1BEC00221812 /* Base64Utilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Base64Utilities.cpp; sourceTree = "<group>"; };
 		460BB6141D0A1BEC00221812 /* Base64Utilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Base64Utilities.h; sourceTree = "<group>"; };
+		460C745626DD699D00427D3E /* WindowOrWorkerGlobalScope.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WindowOrWorkerGlobalScope.cpp; sourceTree = "<group>"; };
+		460C745826DD699D00427D3E /* WindowOrWorkerGlobalScope.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WindowOrWorkerGlobalScope.h; sourceTree = "<group>"; };
 		460CBF331D4BCCFE0092E88E /* JSDOMWindowProperties.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMWindowProperties.cpp; sourceTree = "<group>"; };
 		460CBF341D4BCCFE0092E88E /* JSDOMWindowProperties.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMWindowProperties.h; sourceTree = "<group>"; };
 		460D19441FCE21DD00C3DB85 /* JSServiceWorkerGlobalScopeCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSServiceWorkerGlobalScopeCustom.cpp; sourceTree = "<group>"; };
@@ -8315,8 +8318,6 @@
 		465A8E781C8A24CE00E7D3E4 /* RuntimeApplicationChecksCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RuntimeApplicationChecksCocoa.mm; sourceTree = "<group>"; };
 		465EDD9F222F4EC300B46E16 /* DeviceOrientationOrMotionPermissionState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceOrientationOrMotionPermissionState.h; sourceTree = "<group>"; };
 		465EDDA0222F4EC400B46E16 /* DeviceOrientationOrMotionPermissionState.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DeviceOrientationOrMotionPermissionState.idl; sourceTree = "<group>"; };
-		466172E923A2ABFA003AB309 /* PostMessageOptions.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = PostMessageOptions.idl; sourceTree = "<group>"; };
-		466172EB23A2ABFA003AB309 /* PostMessageOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PostMessageOptions.h; sourceTree = "<group>"; };
 		466536FA264C8DD100AAD1D7 /* JSAudioNodeCustom.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSAudioNodeCustom.cpp; sourceTree = "<group>"; };
 		466C2DAB26C73AFB00651931 /* PolicyContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PolicyContainer.h; sourceTree = "<group>"; };
 		466DC6AB1EDE021D00746224 /* JSDOMRectList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMRectList.cpp; sourceTree = "<group>"; };
@@ -8412,6 +8413,8 @@
 		46EFAF0F1E5FB9E100E7F34B /* LowPowerModeNotifier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LowPowerModeNotifier.cpp; sourceTree = "<group>"; };
 		46EFAF101E5FB9E100E7F34B /* LowPowerModeNotifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LowPowerModeNotifier.h; sourceTree = "<group>"; };
 		46F91BC91FCDD0FE001599C3 /* JSWorkerNavigatorCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWorkerNavigatorCustom.cpp; sourceTree = "<group>"; };
+		46FEFBC626DD678200B0C488 /* StructuredSerializeOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StructuredSerializeOptions.h; sourceTree = "<group>"; };
+		46FEFBC726DD678300B0C488 /* StructuredSerializeOptions.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = StructuredSerializeOptions.idl; sourceTree = "<group>"; };
 		475C89A32650AC3B00F3B456 /* FormattingGeometry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FormattingGeometry.h; sourceTree = "<group>"; };
 		4786356426507A3700C5E2E0 /* BlockFormattingGeometry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlockFormattingGeometry.h; sourceTree = "<group>"; };
 		47C4D57C26508BCA00C7AB1F /* InlineFormattingGeometry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InlineFormattingGeometry.h; sourceTree = "<group>"; };
@@ -22152,8 +22155,6 @@
 				5CFC434E192406A900A0D3B5 /* PointerLockController.cpp */,
 				5CFC434F192406A900A0D3B5 /* PointerLockController.h */,
 				3772B09516535856000A49CA /* PopupOpeningObserver.h */,
-				466172EB23A2ABFA003AB309 /* PostMessageOptions.h */,
-				466172E923A2ABFA003AB309 /* PostMessageOptions.idl */,
 				E4605FEA2166480800E53046 /* PrewarmInformation.h */,
 				B776D43C1104527500BEB0EC /* PrintContext.cpp */,
 				B776D43A1104525D00BEB0EC /* PrintContext.h */,
@@ -22220,6 +22221,8 @@
 				93A0482625495500000AC462 /* SpeechRecognitionProvider.h */,
 				C149380522342719000CD707 /* SpeechSynthesisClient.h */,
 				BC4A533625605AE10028C592 /* StorageBlockingPolicy.h */,
+				46FEFBC626DD678200B0C488 /* StructuredSerializeOptions.h */,
+				46FEFBC726DD678300B0C488 /* StructuredSerializeOptions.idl */,
 				62C1217A11AB9E76003C462C /* SuspendableTimer.cpp */,
 				62C1217B11AB9E77003C462C /* SuspendableTimer.h */,
 				BC4A5324256055590028C592 /* TextDirectionSubmenuInclusionBehavior.h */,
@@ -22280,6 +22283,8 @@
 				7C67712B2527D75F00FDEF00 /* WindowLocalStorage.idl */,
 				7C6771372527DFF500FDEF00 /* WindowOrWorkerGlobalScope+Crypto.idl */,
 				7C6771362527DF4B00FDEF00 /* WindowOrWorkerGlobalScope+Performance.idl */,
+				460C745626DD699D00427D3E /* WindowOrWorkerGlobalScope.cpp */,
+				460C745826DD699D00427D3E /* WindowOrWorkerGlobalScope.h */,
 				9371080D1DB754550060744E /* WindowOrWorkerGlobalScope.idl */,
 				7C67712C2527D7C900FDEF00 /* WindowSessionStorage.idl */,
 				E1271A130EEEC80400F61213 /* WorkerNavigator.cpp */,
@@ -34122,7 +34127,6 @@
 				9746AF3014F4DDE6003E7A70 /* PositionErrorCallback.h in Headers */,
 				37919C240B7D188600A56998 /* PositionIterator.h in Headers */,
 				9746AF3214F4DDE6003E7A70 /* PositionOptions.h in Headers */,
-				466172EC23A2AC1F003AB309 /* PostMessageOptions.h in Headers */,
 				46DBB6501AB8C96F00D9A813 /* PowerObserverMac.h in Headers */,
 				CDC7470424BE2FC700C1868B /* PowerSourceNotifier.h in Headers */,
 				C0F2A44113869AAB0066C534 /* preprocessor.pm in Headers */,
@@ -34769,6 +34773,7 @@
 				ECA680C71E67724500731D20 /* StringUtilities.h in Headers */,
 				9B6C41531344949000085B62 /* StringWithDirection.h in Headers */,
 				414B82051D6DF0E50077EBE3 /* StructuredClone.h in Headers */,
+				46FEFBC826DD67A200B0C488 /* StructuredSerializeOptions.h in Headers */,
 				41E67A8325D16847007B0A4C /* STUNMessageParsing.h in Headers */,
 				713922BE2518AB77005DB3C2 /* Styleable.h in Headers */,
 				E45BA6B6237622A3004DFC07 /* StyleAdjuster.h in Headers */,
@@ -35450,6 +35455,7 @@
 				9B27FC60234D9ADB00394A46 /* WindowEventLoop.h in Headers */,
 				BC8243E90D0CFD7500460C8F /* WindowFeatures.h in Headers */,
 				7E99AF530B13846468FB01A5 /* WindowFocusAllowedIndicator.h in Headers */,
+				460C745926DD69BB00427D3E /* WindowOrWorkerGlobalScope.h in Headers */,
 				41D129CE1F3D0EF600D15E47 /* WindowOrWorkerGlobalScopeCaches.h in Headers */,
 				5185FCB41BB4C4E80012898F /* WindowOrWorkerGlobalScopeIndexedDatabase.h in Headers */,
 				463521AD2081092A00C28922 /* WindowProxy.h in Headers */,

Modified: trunk/Source/WebCore/dom/MessagePort.cpp (281807 => 281808)


--- trunk/Source/WebCore/dom/MessagePort.cpp	2021-08-31 16:24:35 UTC (rev 281807)
+++ trunk/Source/WebCore/dom/MessagePort.cpp	2021-08-31 16:52:46 UTC (rev 281808)
@@ -33,6 +33,7 @@
 #include "MessageEvent.h"
 #include "MessagePortChannelProvider.h"
 #include "MessageWithMessagePorts.h"
+#include "StructuredSerializeOptions.h"
 #include "WorkerGlobalScope.h"
 #include "WorkerThread.h"
 #include <wtf/CompletionHandler.h>
@@ -132,7 +133,7 @@
     MessagePortChannelProvider::fromContext(*m_scriptExecutionContext).entangleLocalPortInThisProcessToRemote(m_identifier, m_remoteIdentifier);
 }
 
-ExceptionOr<void> MessagePort::postMessage(JSC::JSGlobalObject& state, JSC::JSValue messageValue, PostMessageOptions&& options)
+ExceptionOr<void> MessagePort::postMessage(JSC::JSGlobalObject& state, JSC::JSValue messageValue, StructuredSerializeOptions&& options)
 {
     LOG(MessagePorts, "Attempting to post message to port %s (to be received by port %s)", m_identifier.logString().utf8().data(), m_remoteIdentifier.logString().utf8().data());
 

Modified: trunk/Source/WebCore/dom/MessagePort.h (281807 => 281808)


--- trunk/Source/WebCore/dom/MessagePort.h	2021-08-31 16:24:35 UTC (rev 281807)
+++ trunk/Source/WebCore/dom/MessagePort.h	2021-08-31 16:52:46 UTC (rev 281808)
@@ -32,7 +32,6 @@
 #include "MessagePortChannel.h"
 #include "MessagePortIdentifier.h"
 #include "MessageWithMessagePorts.h"
-#include "PostMessageOptions.h"
 #include <wtf/WeakPtr.h>
 
 namespace JSC {
@@ -45,6 +44,8 @@
 
 class Frame;
 
+struct StructuredSerializeOptions;
+
 class MessagePort final : public ActiveDOMObject, public EventTargetWithInlineData {
     WTF_MAKE_NONCOPYABLE(MessagePort);
     WTF_MAKE_ISO_ALLOCATED(MessagePort);
@@ -52,7 +53,7 @@
     static Ref<MessagePort> create(ScriptExecutionContext&, const MessagePortIdentifier& local, const MessagePortIdentifier& remote);
     virtual ~MessagePort();
 
-    ExceptionOr<void> postMessage(JSC::JSGlobalObject&, JSC::JSValue message, PostMessageOptions&&);
+    ExceptionOr<void> postMessage(JSC::JSGlobalObject&, JSC::JSValue message, StructuredSerializeOptions&&);
 
     void start();
     void close();

Modified: trunk/Source/WebCore/dom/MessagePort.idl (281807 => 281808)


--- trunk/Source/WebCore/dom/MessagePort.idl	2021-08-31 16:24:35 UTC (rev 281807)
+++ trunk/Source/WebCore/dom/MessagePort.idl	2021-08-31 16:52:46 UTC (rev 281808)
@@ -32,7 +32,7 @@
     JSCustomMarkFunction,
 ] interface MessagePort : EventTarget {
     [CallWith=GlobalObject] undefined postMessage(any message, sequence<object> transfer);
-    [CallWith=GlobalObject] undefined postMessage(any message, optional PostMessageOptions options);
+    [CallWith=GlobalObject] undefined postMessage(any message, optional StructuredSerializeOptions options);
     undefined start();
     undefined close();
 

Modified: trunk/Source/WebCore/page/Base64Utilities.h (281807 => 281808)


--- trunk/Source/WebCore/page/Base64Utilities.h	2021-08-31 16:24:35 UTC (rev 281807)
+++ trunk/Source/WebCore/page/Base64Utilities.h	2021-08-31 16:52:46 UTC (rev 281808)
@@ -29,6 +29,7 @@
 
 namespace WebCore {
 
+// FIXME: We should merge these into WindowOrWorkerGlobalScope.
 class Base64Utilities {
 public:
     static ExceptionOr<String> btoa(const String&);

Modified: trunk/Source/WebCore/page/DOMWindow.cpp (281807 => 281808)


--- trunk/Source/WebCore/page/DOMWindow.cpp	2021-08-31 16:24:35 UTC (rev 281807)
+++ trunk/Source/WebCore/page/DOMWindow.cpp	2021-08-31 16:52:46 UTC (rev 281808)
@@ -1802,17 +1802,6 @@
     page->chrome().setWindowRect(adjustWindowRect(*page, update));
 }
 
-void DOMWindow::reportError(JSC::JSGlobalObject& globalObject, JSC::JSValue error)
-{
-    auto& vm = globalObject.vm();
-    RELEASE_ASSERT(vm.currentThreadIsHoldingAPILock());
-    auto* exception = JSC::jsDynamicCast<JSC::Exception*>(vm, error);
-    if (!exception)
-        exception = JSC::Exception::create(vm, error);
-
-    reportException(&globalObject, exception);
-}
-
 ExceptionOr<int> DOMWindow::setTimeout(JSC::JSGlobalObject& state, std::unique_ptr<ScheduledAction> action, int timeout, Vector<JSC::Strong<JSC::Unknown>>&& arguments)
 {
     RefPtr context = scriptExecutionContext();

Modified: trunk/Source/WebCore/page/DOMWindow.h (281807 => 281808)


--- trunk/Source/WebCore/page/DOMWindow.h	2021-08-31 16:24:35 UTC (rev 281807)
+++ trunk/Source/WebCore/page/DOMWindow.h	2021-08-31 16:52:46 UTC (rev 281808)
@@ -33,11 +33,12 @@
 #include "Frame.h"
 #include "FrameDestructionObserver.h"
 #include "ImageBitmap.h"
-#include "PostMessageOptions.h"
 #include "ReducedResolutionSeconds.h"
 #include "ScrollToOptions.h"
 #include "ScrollTypes.h"
+#include "StructuredSerializeOptions.h"
 #include "Supplementable.h"
+#include "WindowOrWorkerGlobalScope.h"
 #include <_javascript_Core/HandleTypes.h>
 #include <_javascript_Core/Strong.h>
 #include <wtf/Function.h>
@@ -98,10 +99,10 @@
 enum SetLocationLocking { LockHistoryBasedOnGestureState, LockHistoryAndBackForwardList };
 enum class IncludeTargetOrigin { No, Yes };
 
-struct WindowPostMessageOptions : public PostMessageOptions {
+struct WindowPostMessageOptions : public StructuredSerializeOptions {
     WindowPostMessageOptions() = default;
     WindowPostMessageOptions(String&& targetOrigin, Vector<JSC::Strong<JSC::JSObject>>&& transfer)
-        : PostMessageOptions(WTFMove(transfer))
+        : StructuredSerializeOptions(WTFMove(transfer))
         , targetOrigin(WTFMove(targetOrigin))
     { }
 
@@ -113,6 +114,7 @@
     : public AbstractDOMWindow
     , public ContextDestructionObserver
     , public Base64Utilities
+    , public WindowOrWorkerGlobalScope
     , public Supplementable<DOMWindow> {
     WTF_MAKE_ISO_ALLOCATED(DOMWindow);
 public:
@@ -386,8 +388,6 @@
     WebKitNamespace* webkitNamespace();
 #endif
 
-    void reportError(JSC::JSGlobalObject&, JSC::JSValue);
-
     // FIXME: When this DOMWindow is no longer the active DOMWindow (i.e.,
     // when its document is no longer the document that is displayed in its
     // frame), we would like to zero out m_frame to avoid being confused

Modified: trunk/Source/WebCore/page/DOMWindow.idl (281807 => 281808)


--- trunk/Source/WebCore/page/DOMWindow.idl	2021-08-31 16:24:35 UTC (rev 281807)
+++ trunk/Source/WebCore/page/DOMWindow.idl	2021-08-31 16:52:46 UTC (rev 281808)
@@ -134,7 +134,7 @@
 
 [
     ImplementedAs=WindowPostMessageOptions
-] dictionary WindowPostMessageOptions : PostMessageOptions {
+] dictionary WindowPostMessageOptions : StructuredSerializeOptions {
     USVString targetOrigin = "/";
 };
 

Deleted: trunk/Source/WebCore/page/PostMessageOptions.h (281807 => 281808)


--- trunk/Source/WebCore/page/PostMessageOptions.h	2021-08-31 16:24:35 UTC (rev 281807)
+++ trunk/Source/WebCore/page/PostMessageOptions.h	2021-08-31 16:52:46 UTC (rev 281808)
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2019 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <_javascript_Core/JSObject.h>
-#include <_javascript_Core/Strong.h>
-#include <wtf/Vector.h>
-
-namespace WebCore {
-
-struct PostMessageOptions {
-    PostMessageOptions() = default;
-    PostMessageOptions(Vector<JSC::Strong<JSC::JSObject>>&& transfer)
-        : transfer(WTFMove(transfer))
-    { }
-
-    Vector<JSC::Strong<JSC::JSObject>> transfer;
-};
-
-}

Deleted: trunk/Source/WebCore/page/PostMessageOptions.idl (281807 => 281808)


--- trunk/Source/WebCore/page/PostMessageOptions.idl	2021-08-31 16:24:35 UTC (rev 281807)
+++ trunk/Source/WebCore/page/PostMessageOptions.idl	2021-08-31 16:52:46 UTC (rev 281808)
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2019 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-dictionary PostMessageOptions {
-  sequence<object> transfer = [];
-};

Copied: trunk/Source/WebCore/page/StructuredSerializeOptions.h (from rev 281807, trunk/Source/WebCore/page/PostMessageOptions.h) (0 => 281808)


--- trunk/Source/WebCore/page/StructuredSerializeOptions.h	                        (rev 0)
+++ trunk/Source/WebCore/page/StructuredSerializeOptions.h	2021-08-31 16:52:46 UTC (rev 281808)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2019-2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <_javascript_Core/JSObject.h>
+#include <_javascript_Core/Strong.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+struct StructuredSerializeOptions {
+    StructuredSerializeOptions() = default;
+    StructuredSerializeOptions(Vector<JSC::Strong<JSC::JSObject>>&& transfer)
+        : transfer(WTFMove(transfer))
+    { }
+
+    Vector<JSC::Strong<JSC::JSObject>> transfer;
+};
+
+} // namespace WebCore

Copied: trunk/Source/WebCore/page/StructuredSerializeOptions.idl (from rev 281807, trunk/Source/WebCore/page/PostMessageOptions.idl) (0 => 281808)


--- trunk/Source/WebCore/page/StructuredSerializeOptions.idl	                        (rev 0)
+++ trunk/Source/WebCore/page/StructuredSerializeOptions.idl	2021-08-31 16:52:46 UTC (rev 281808)
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2019-2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+dictionary StructuredSerializeOptions {
+  sequence<object> transfer = [];
+};

Added: trunk/Source/WebCore/page/WindowOrWorkerGlobalScope.cpp (0 => 281808)


--- trunk/Source/WebCore/page/WindowOrWorkerGlobalScope.cpp	                        (rev 0)
+++ trunk/Source/WebCore/page/WindowOrWorkerGlobalScope.cpp	2021-08-31 16:52:46 UTC (rev 281808)
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WindowOrWorkerGlobalScope.h"
+
+#include "ExceptionOr.h"
+#include "JSDOMExceptionHandling.h"
+#include "JSDOMGlobalObject.h"
+#include "MessagePort.h"
+#include "SerializedScriptValue.h"
+#include "StructuredSerializeOptions.h"
+
+namespace WebCore {
+
+void WindowOrWorkerGlobalScope::reportError(JSDOMGlobalObject& globalObject, JSC::JSValue error)
+{
+    auto& vm = globalObject.vm();
+    RELEASE_ASSERT(vm.currentThreadIsHoldingAPILock());
+    auto* exception = JSC::jsDynamicCast<JSC::Exception*>(vm, error);
+    if (!exception)
+        exception = JSC::Exception::create(vm, error);
+
+    reportException(&globalObject, exception);
+}
+
+ExceptionOr<JSC::JSValue> WindowOrWorkerGlobalScope::structuredClone(JSDOMGlobalObject& globalObject, JSC::JSValue value, StructuredSerializeOptions&& options)
+{
+    Vector<RefPtr<MessagePort>> ports;
+    auto messageData = SerializedScriptValue::create(globalObject, value, WTFMove(options.transfer), ports, SerializationContext::WindowPostMessage);
+    if (messageData.hasException())
+        return messageData.releaseException();
+
+    auto disentangledPorts = MessagePort::disentanglePorts(WTFMove(ports));
+    if (disentangledPorts.hasException())
+        return disentangledPorts.releaseException();
+
+    Vector<RefPtr<MessagePort>> entangledPorts;
+    if (auto* scriptExecutionContext = globalObject.scriptExecutionContext())
+        entangledPorts = MessagePort::entanglePorts(*scriptExecutionContext, disentangledPorts.releaseReturnValue());
+
+    return messageData.returnValue()->deserialize(globalObject, &globalObject, WTFMove(entangledPorts));
+}
+
+} // namespace WebCore

Copied: trunk/Source/WebCore/page/WindowOrWorkerGlobalScope.h (from rev 281807, trunk/Source/WebCore/page/Base64Utilities.h) (0 => 281808)


--- trunk/Source/WebCore/page/WindowOrWorkerGlobalScope.h	                        (rev 0)
+++ trunk/Source/WebCore/page/WindowOrWorkerGlobalScope.h	2021-08-31 16:52:46 UTC (rev 281808)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+namespace JSC {
+class JSValue;
+}
+
+namespace WebCore {
+
+class JSDOMGlobalObject;
+template<typename> class ExceptionOr;
+
+struct StructuredSerializeOptions;
+
+class WindowOrWorkerGlobalScope {
+public:
+    static void reportError(JSDOMGlobalObject&, JSC::JSValue);
+    static ExceptionOr<JSC::JSValue> structuredClone(JSDOMGlobalObject&, JSC::JSValue, StructuredSerializeOptions&&);
+};
+
+} // namespace WebCore
+

Modified: trunk/Source/WebCore/page/WindowOrWorkerGlobalScope.idl (281807 => 281808)


--- trunk/Source/WebCore/page/WindowOrWorkerGlobalScope.idl	2021-08-31 16:24:35 UTC (rev 281807)
+++ trunk/Source/WebCore/page/WindowOrWorkerGlobalScope.idl	2021-08-31 16:52:46 UTC (rev 281808)
@@ -69,4 +69,7 @@
     // ImageBitmap.
     [EnabledAtRuntime=ImageBitmap] Promise<ImageBitmap> createImageBitmap(ImageBitmapSource image, optional ImageBitmapOptions options);
     [EnabledAtRuntime=ImageBitmap] Promise<ImageBitmap> createImageBitmap(ImageBitmapSource image, long sx, long sy, long sw, long sh, optional ImageBitmapOptions options);
+
+    // structured cloning
+    [CallWith=GlobalObject] any structuredClone(any value, optional StructuredSerializeOptions options);
 };

Modified: trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.cpp (281807 => 281808)


--- trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.cpp	2021-08-31 16:24:35 UTC (rev 281807)
+++ trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.cpp	2021-08-31 16:52:46 UTC (rev 281808)
@@ -41,6 +41,7 @@
 #include "RTCTransformEvent.h"
 #include "RequestAnimationFrameCallback.h"
 #include "SecurityOrigin.h"
+#include "StructuredSerializeOptions.h"
 #include "Worker.h"
 #if ENABLE(OFFSCREEN_CANVAS)
 #include "WorkerAnimationController.h"
@@ -78,7 +79,7 @@
     WorkerGlobalScope::prepareForDestruction();
 }
 
-ExceptionOr<void> DedicatedWorkerGlobalScope::postMessage(JSC::JSGlobalObject& state, JSC::JSValue messageValue, PostMessageOptions&& options)
+ExceptionOr<void> DedicatedWorkerGlobalScope::postMessage(JSC::JSGlobalObject& state, JSC::JSValue messageValue, StructuredSerializeOptions&& options)
 {
     Vector<RefPtr<MessagePort>> ports;
     auto message = SerializedScriptValue::create(state, messageValue, WTFMove(options.transfer), ports, SerializationContext::WorkerPostMessage);

Modified: trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.h (281807 => 281808)


--- trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.h	2021-08-31 16:24:35 UTC (rev 281807)
+++ trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.h	2021-08-31 16:52:46 UTC (rev 281808)
@@ -32,7 +32,6 @@
 #pragma once
 
 #include "MessagePort.h"
-#include "PostMessageOptions.h"
 #include "WorkerGlobalScope.h"
 
 namespace JSC {
@@ -50,6 +49,8 @@
 class RequestAnimationFrameCallback;
 class SerializedScriptValue;
 
+struct StructuredSerializeOptions;
+
 #if ENABLE(OFFSCREEN_CANVAS_IN_WORKERS)
 class WorkerAnimationController;
 
@@ -66,7 +67,7 @@
 
     const String& name() const { return m_name; }
 
-    ExceptionOr<void> postMessage(JSC::JSGlobalObject&, JSC::JSValue message, PostMessageOptions&&);
+    ExceptionOr<void> postMessage(JSC::JSGlobalObject&, JSC::JSValue message, StructuredSerializeOptions&&);
 
     DedicatedWorkerThread& thread();
 

Modified: trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.idl (281807 => 281808)


--- trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.idl	2021-08-31 16:24:35 UTC (rev 281807)
+++ trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.idl	2021-08-31 16:52:46 UTC (rev 281808)
@@ -38,7 +38,7 @@
     [Replaceable] readonly attribute DOMString name;
 
     [CallWith=GlobalObject] undefined postMessage(any message, sequence<object> transfer);
-    [CallWith=GlobalObject] undefined postMessage(any message, optional PostMessageOptions options);
+    [CallWith=GlobalObject] undefined postMessage(any message, optional StructuredSerializeOptions options);
 
     undefined close();
 

Modified: trunk/Source/WebCore/workers/Worker.cpp (281807 => 281808)


--- trunk/Source/WebCore/workers/Worker.cpp	2021-08-31 16:24:35 UTC (rev 281807)
+++ trunk/Source/WebCore/workers/Worker.cpp	2021-08-31 16:52:46 UTC (rev 281808)
@@ -41,6 +41,7 @@
 #endif
 #include "ResourceResponse.h"
 #include "SecurityOrigin.h"
+#include "StructuredSerializeOptions.h"
 #include "WorkerGlobalScopeProxy.h"
 #include "WorkerScriptLoader.h"
 #include "WorkerThread.h"
@@ -136,7 +137,7 @@
     m_contextProxy.workerObjectDestroyed();
 }
 
-ExceptionOr<void> Worker::postMessage(JSC::JSGlobalObject& state, JSC::JSValue messageValue, PostMessageOptions&& options)
+ExceptionOr<void> Worker::postMessage(JSC::JSGlobalObject& state, JSC::JSValue messageValue, StructuredSerializeOptions&& options)
 {
     Vector<RefPtr<MessagePort>> ports;
     auto message = SerializedScriptValue::create(state, messageValue, WTFMove(options.transfer), ports, SerializationContext::WorkerPostMessage);

Modified: trunk/Source/WebCore/workers/Worker.h (281807 => 281808)


--- trunk/Source/WebCore/workers/Worker.h	2021-08-31 16:24:35 UTC (rev 281807)
+++ trunk/Source/WebCore/workers/Worker.h	2021-08-31 16:52:46 UTC (rev 281808)
@@ -31,7 +31,6 @@
 #include "EventTarget.h"
 #include "FetchRequestCredentials.h"
 #include "MessagePort.h"
-#include "PostMessageOptions.h"
 #include "WorkerScriptLoaderClient.h"
 #include "WorkerType.h"
 #include <_javascript_Core/RuntimeFlags.h>
@@ -52,6 +51,8 @@
 class WorkerGlobalScopeProxy;
 class WorkerScriptLoader;
 
+struct StructuredSerializeOptions;
+
 class Worker final : public AbstractWorker, public ActiveDOMObject, private WorkerScriptLoaderClient {
     WTF_MAKE_ISO_ALLOCATED(Worker);
 public:
@@ -63,7 +64,7 @@
     static ExceptionOr<Ref<Worker>> create(ScriptExecutionContext&, JSC::RuntimeFlags, const String& url, const Options&);
     virtual ~Worker();
 
-    ExceptionOr<void> postMessage(JSC::JSGlobalObject&, JSC::JSValue message, PostMessageOptions&&);
+    ExceptionOr<void> postMessage(JSC::JSGlobalObject&, JSC::JSValue message, StructuredSerializeOptions&&);
 
     void terminate();
     bool wasTerminated() const { return m_wasTerminated; }

Modified: trunk/Source/WebCore/workers/Worker.idl (281807 => 281808)


--- trunk/Source/WebCore/workers/Worker.idl	2021-08-31 16:24:35 UTC (rev 281807)
+++ trunk/Source/WebCore/workers/Worker.idl	2021-08-31 16:52:46 UTC (rev 281808)
@@ -33,7 +33,7 @@
     undefined terminate();
 
     [CallWith=GlobalObject] undefined postMessage(any message, sequence<object> transfer);
-    [CallWith=GlobalObject] undefined postMessage(any message, optional PostMessageOptions options);
+    [CallWith=GlobalObject] undefined postMessage(any message, optional StructuredSerializeOptions options);
     attribute EventHandler onmessage;
 };
 

Modified: trunk/Source/WebCore/workers/WorkerGlobalScope.cpp (281807 => 281808)


--- trunk/Source/WebCore/workers/WorkerGlobalScope.cpp	2021-08-31 16:24:35 UTC (rev 281807)
+++ trunk/Source/WebCore/workers/WorkerGlobalScope.cpp	2021-08-31 16:52:46 UTC (rev 281808)
@@ -548,17 +548,6 @@
 #endif
 }
 
-void WorkerGlobalScope::reportError(JSC::JSGlobalObject& globalObject, JSC::JSValue error)
-{
-    auto& vm = globalObject.vm();
-    RELEASE_ASSERT(vm.currentThreadIsHoldingAPILock());
-    auto* exception = JSC::jsDynamicCast<JSC::Exception*>(vm, error);
-    if (!exception)
-        exception = JSC::Exception::create(vm, error);
-
-    WebCore::reportException(&globalObject, exception);
-}
-
 void WorkerGlobalScope::releaseMemoryInWorkers(Synchronous synchronous)
 {
     Locker locker { allWorkerGlobalScopeIdentifiersLock };

Modified: trunk/Source/WebCore/workers/WorkerGlobalScope.h (281807 => 281808)


--- trunk/Source/WebCore/workers/WorkerGlobalScope.h	2021-08-31 16:24:35 UTC (rev 281807)
+++ trunk/Source/WebCore/workers/WorkerGlobalScope.h	2021-08-31 16:52:46 UTC (rev 281808)
@@ -32,6 +32,7 @@
 #include "ScriptBufferSourceProvider.h"
 #include "ScriptExecutionContext.h"
 #include "Supplementable.h"
+#include "WindowOrWorkerGlobalScope.h"
 #include "WorkerOrWorkletGlobalScope.h"
 #include "WorkerOrWorkletScriptController.h"
 #include "WorkerCacheStorageConnection.h"
@@ -63,7 +64,7 @@
 class IDBConnectionProxy;
 }
 
-class WorkerGlobalScope : public Supplementable<WorkerGlobalScope>, public Base64Utilities, public WorkerOrWorkletGlobalScope {
+class WorkerGlobalScope : public Supplementable<WorkerGlobalScope>, public Base64Utilities, public WindowOrWorkerGlobalScope, public WorkerOrWorkletGlobalScope {
     WTF_MAKE_ISO_ALLOCATED(WorkerGlobalScope);
 public:
     virtual ~WorkerGlobalScope();
@@ -130,8 +131,6 @@
     std::unique_ptr<FontLoadRequest> fontLoadRequest(String& url, bool isSVG, bool isInitiatingElementInUserAgentShadowTree, LoadedFromOpaqueSource) final;
     void beginLoadingFontSoon(FontLoadRequest&) final;
 
-    void reportError(JSC::JSGlobalObject&, JSC::JSValue);
-
     ReferrerPolicy referrerPolicy() const final;
 
     const Settings::Values& settingsValues() const final { return m_settingsValues; }

Modified: trunk/Source/WebCore/workers/service/ServiceWorker.cpp (281807 => 281808)


--- trunk/Source/WebCore/workers/service/ServiceWorker.cpp	2021-08-31 16:24:35 UTC (rev 281807)
+++ trunk/Source/WebCore/workers/service/ServiceWorker.cpp	2021-08-31 16:52:46 UTC (rev 281808)
@@ -40,6 +40,7 @@
 #include "ServiceWorkerGlobalScope.h"
 #include "ServiceWorkerProvider.h"
 #include "ServiceWorkerThread.h"
+#include "StructuredSerializeOptions.h"
 #include "WorkerSWClientConnection.h"
 #include <_javascript_Core/JSCJSValueInlines.h>
 #include <wtf/IsoMallocInlines.h>
@@ -99,7 +100,7 @@
     return ServiceWorkerProvider::singleton().serviceWorkerConnection();
 }
 
-ExceptionOr<void> ServiceWorker::postMessage(JSC::JSGlobalObject& globalObject, JSC::JSValue messageValue, PostMessageOptions&& options)
+ExceptionOr<void> ServiceWorker::postMessage(JSC::JSGlobalObject& globalObject, JSC::JSValue messageValue, StructuredSerializeOptions&& options)
 {
     if (m_isStopped)
         return Exception { InvalidStateError };

Modified: trunk/Source/WebCore/workers/service/ServiceWorker.h (281807 => 281808)


--- trunk/Source/WebCore/workers/service/ServiceWorker.h	2021-08-31 16:24:35 UTC (rev 281807)
+++ trunk/Source/WebCore/workers/service/ServiceWorker.h	2021-08-31 16:52:46 UTC (rev 281808)
@@ -30,7 +30,6 @@
 #include "ActiveDOMObject.h"
 #include "ContextDestructionObserver.h"
 #include "EventTarget.h"
-#include "PostMessageOptions.h"
 #include "ServiceWorkerData.h"
 #include <_javascript_Core/Strong.h>
 #include <wtf/RefCounted.h>
@@ -46,6 +45,8 @@
 class Frame;
 class SWClientConnection;
 
+struct StructuredSerializeOptions;
+
 class ServiceWorker final : public RefCounted<ServiceWorker>, public EventTargetWithInlineData, public ActiveDOMObject {
     WTF_MAKE_ISO_ALLOCATED(ServiceWorker);
 public:
@@ -60,7 +61,7 @@
     
     void updateState(State);
 
-    ExceptionOr<void> postMessage(JSC::JSGlobalObject&, JSC::JSValue message, PostMessageOptions&&);
+    ExceptionOr<void> postMessage(JSC::JSGlobalObject&, JSC::JSValue message, StructuredSerializeOptions&&);
 
     ServiceWorkerIdentifier identifier() const { return m_data.identifier; }
     ServiceWorkerRegistrationIdentifier registrationIdentifier() const { return m_data.registrationIdentifier; }

Modified: trunk/Source/WebCore/workers/service/ServiceWorker.idl (281807 => 281808)


--- trunk/Source/WebCore/workers/service/ServiceWorker.idl	2021-08-31 16:24:35 UTC (rev 281807)
+++ trunk/Source/WebCore/workers/service/ServiceWorker.idl	2021-08-31 16:52:46 UTC (rev 281808)
@@ -37,7 +37,7 @@
     readonly attribute USVString scriptURL;
     readonly attribute ServiceWorkerState state;
     [CallWith=GlobalObject] undefined postMessage(any message, sequence<object> transfer);
-    [CallWith=GlobalObject] undefined postMessage(any message, optional PostMessageOptions options);
+    [CallWith=GlobalObject] undefined postMessage(any message, optional StructuredSerializeOptions options);
 
     // event
     attribute EventHandler onstatechange;

Modified: trunk/Source/WebCore/workers/service/ServiceWorkerClient.cpp (281807 => 281808)


--- trunk/Source/WebCore/workers/service/ServiceWorkerClient.cpp	2021-08-31 16:24:35 UTC (rev 281807)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerClient.cpp	2021-08-31 16:52:46 UTC (rev 281808)
@@ -35,6 +35,7 @@
 #include "ServiceWorkerGlobalScope.h"
 #include "ServiceWorkerThread.h"
 #include "ServiceWorkerWindowClient.h"
+#include "StructuredSerializeOptions.h"
 
 namespace WebCore {
 
@@ -82,7 +83,7 @@
     return identifier().toString();
 }
 
-ExceptionOr<void> ServiceWorkerClient::postMessage(JSC::JSGlobalObject& globalObject, JSC::JSValue messageValue, PostMessageOptions&& options)
+ExceptionOr<void> ServiceWorkerClient::postMessage(JSC::JSGlobalObject& globalObject, JSC::JSValue messageValue, StructuredSerializeOptions&& options)
 {
     Vector<RefPtr<MessagePort>> ports;
     auto messageData = SerializedScriptValue::create(globalObject, messageValue, WTFMove(options.transfer), ports, SerializationContext::WorkerPostMessage);

Modified: trunk/Source/WebCore/workers/service/ServiceWorkerClient.h (281807 => 281808)


--- trunk/Source/WebCore/workers/service/ServiceWorkerClient.h	2021-08-31 16:24:35 UTC (rev 281807)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerClient.h	2021-08-31 16:52:46 UTC (rev 281808)
@@ -29,7 +29,6 @@
 
 #include "ContextDestructionObserver.h"
 #include "ExceptionOr.h"
-#include "PostMessageOptions.h"
 #include "ServiceWorkerClientData.h"
 #include <_javascript_Core/Strong.h>
 #include <wtf/RefCounted.h>
@@ -43,6 +42,8 @@
 
 class ServiceWorkerGlobalScope;
 
+struct StructuredSerializeOptions;
+
 class ServiceWorkerClient : public RefCounted<ServiceWorkerClient>, public ContextDestructionObserver {
 public:
     using Identifier = ServiceWorkerClientIdentifier;
@@ -61,7 +62,7 @@
 
     Identifier identifier() const { return m_data.identifier; }
 
-    ExceptionOr<void> postMessage(JSC::JSGlobalObject&, JSC::JSValue message, PostMessageOptions&&);
+    ExceptionOr<void> postMessage(JSC::JSGlobalObject&, JSC::JSValue message, StructuredSerializeOptions&&);
 
 protected:
     ServiceWorkerClient(ServiceWorkerGlobalScope&, ServiceWorkerClientData&&);

Modified: trunk/Source/WebCore/workers/service/ServiceWorkerClient.idl (281807 => 281808)


--- trunk/Source/WebCore/workers/service/ServiceWorkerClient.idl	2021-08-31 16:24:35 UTC (rev 281807)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerClient.idl	2021-08-31 16:52:46 UTC (rev 281808)
@@ -36,7 +36,7 @@
     readonly attribute DOMString id;
 
     [CallWith=GlobalObject] undefined postMessage(any message, sequence<object> transfer);
-    [CallWith=GlobalObject] undefined postMessage(any message, optional PostMessageOptions options);
+    [CallWith=GlobalObject] undefined postMessage(any message, optional StructuredSerializeOptions options);
 };
 
 enum FrameType {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to