Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

Commit 693fb67

Browse files
IDB serialization of some DOM object types crashes the Networking process due to incorrect global object type (WPT IndexedDB/structured-clone.any tests fail)
https://bugs.webkit.org/show_bug.cgi?id=210735 <rdar://problem/62045703> Patch by Sihui Liu <[email protected]> on 2020-07-16 Reviewed by Yusuke Suzuki. Source/WebCore: In r239746, IDB went back to use JSGlobalObject for serialization and deserialization. However, in our current implementation, there is a strong assumption that DOM JS objects are tied to JSDOMGlobalObject, which is derived from JSGlobalObject. For example, in SerializedScriptValue.cpp, we cast the global object to JSDOMGlobalObject in many places. We recently notice this issue when we enable some wpt test, which has been disabled since it was imported as some types were not supported. The test fails as DOMMatrix object requires its global object to be JSDOMGlobalObject. To fix this, introduce a new Class JSIDBSerializationGlobalObject, derived from JSDOMGlobalObject, and use it for IDB serialization. Tests: LayoutTests/storage/indexeddb/structured-clone.html LayoutTests/storage/indexeddb/structured-clone-private.html * Modules/indexeddb/server/IDBSerializationContext.cpp: (WebCore::IDBServer::IDBSerializationContext::initializeVM): * Modules/indexeddb/server/IDBSerializationContext.h: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSDOMGlobalObject.cpp: (WebCore::JSDOMGlobalObject::scriptExecutionContext const): * bindings/js/JSIDBSerializationGlobalObject.cpp: Added. (WebCore::JSIDBSerializationGlobalObject::JSIDBSerializationGlobalObject): (WebCore::JSIDBSerializationGlobalObject::create): (WebCore::JSIDBSerializationGlobalObject::finishCreation): (WebCore::JSIDBSerializationGlobalObject::subspaceForImpl): (WebCore::JSIDBSerializationGlobalObject::destroy): * bindings/js/JSIDBSerializationGlobalObject.h: Added. * bindings/js/WebCoreJSClientData.cpp: (WebCore::JSVMClientData::JSVMClientData): * bindings/js/WebCoreJSClientData.h: (WebCore::JSVMClientData::idbSerializationSpace): * dom/EmptyScriptExecutionContext.h: Added. * worklets/WorkletScriptController.h: LayoutTests: * platform/ios/TestExpectations: * platform/wk2/TestExpectations: * storage/indexeddb/resources/structured-clone.js: (testPrimitiveValue): (testBoolean): (testBooleanObject): (testString): (testStringObject): (testNumber): (testNumberObject): (testBigInt): (testBigIntObject.testOneBigIntObject): (testBigIntObject): (testDateObject): (testTypedArray.testTypedArrayValue): (testArrays): (testGeometryTypes.testOneGeometryType): (testRTCCertificate.promise.then): (testRTCCertificate): (testCryptoKey.promise.then): (testBadTypes): Deleted. * storage/indexeddb/structured-clone-expected.txt: * storage/indexeddb/structured-clone-private-expected.txt: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@264486 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent d1ba651 commit 693fb67

18 files changed

+1016
-220
lines changed

LayoutTests/ChangeLog

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,35 @@
1+
2020-07-16 Sihui Liu <[email protected]>
2+
3+
IDB serialization of some DOM object types crashes the Networking process due to incorrect global object type (WPT IndexedDB/structured-clone.any tests fail)
4+
https://bugs.webkit.org/show_bug.cgi?id=210735
5+
<rdar://problem/62045703>
6+
7+
Reviewed by Yusuke Suzuki.
8+
9+
* platform/ios/TestExpectations:
10+
* platform/wk2/TestExpectations:
11+
* storage/indexeddb/resources/structured-clone.js:
12+
(testPrimitiveValue):
13+
(testBoolean):
14+
(testBooleanObject):
15+
(testString):
16+
(testStringObject):
17+
(testNumber):
18+
(testNumberObject):
19+
(testBigInt):
20+
(testBigIntObject.testOneBigIntObject):
21+
(testBigIntObject):
22+
(testDateObject):
23+
(testTypedArray.testTypedArrayValue):
24+
(testArrays):
25+
(testGeometryTypes.testOneGeometryType):
26+
(testRTCCertificate.promise.then):
27+
(testRTCCertificate):
28+
(testCryptoKey.promise.then):
29+
(testBadTypes): Deleted.
30+
* storage/indexeddb/structured-clone-expected.txt:
31+
* storage/indexeddb/structured-clone-private-expected.txt:
32+
133
2020-07-16 Hector Lopez <[email protected]>
234

335
[ macOS iOS ] imported/mozilla/svg/blend-saturation.svg is passing and need expectations removed

LayoutTests/platform/ios/TestExpectations

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,8 +1408,6 @@ webkit.org/b/181752 storage/indexeddb/removed-private.html [ Failure ]
14081408
webkit.org/b/181752 storage/indexeddb/removed.html [ Failure ]
14091409
webkit.org/b/181752 storage/indexeddb/request-leak-private.html [ Failure ]
14101410
webkit.org/b/181752 storage/indexeddb/request-leak.html [ Failure ]
1411-
webkit.org/b/181752 storage/indexeddb/structured-clone-private.html [ Failure ]
1412-
webkit.org/b/181752 storage/indexeddb/structured-clone.html [ Failure ]
14131411
webkit.org/b/181752 storage/indexeddb/wasm-exceptions.html [ Failure ]
14141412
webkit.org/b/181752 storage/indexeddb/database-quota-private.html [ Skip ]
14151413
webkit.org/b/181752 storage/indexeddb/database-quota.html [ Skip ]

LayoutTests/platform/wk2/TestExpectations

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -657,8 +657,6 @@ media/video-src-blob.html
657657
security/contentSecurityPolicy/image-with-blob-url-allowed-by-img-src-star-with-AllowContentSecurityPolicySourceStarToMatchAnyProtocol-enabled.html
658658
security/contentSecurityPolicy/image-with-blob-url-blocked-by-img-src-star.html
659659
security/contentSecurityPolicy/video-with-blob-url-allowed-by-media-src-star.html
660-
storage/indexeddb/structured-clone.html
661-
storage/indexeddb/structured-clone-private.html
662660

663661
# WebKitTestRunner doesn't have eventSender.fireKeyboardEventsToElement
664662
platform/mac/fast/events/objc-keyboard-event-creation.html

0 commit comments

Comments
 (0)