Title: [287717] branches/safari-612-branch

Diff

Modified: branches/safari-612-branch/LayoutTests/ChangeLog (287716 => 287717)


--- branches/safari-612-branch/LayoutTests/ChangeLog	2022-01-06 21:02:33 UTC (rev 287716)
+++ branches/safari-612-branch/LayoutTests/ChangeLog	2022-01-06 22:31:58 UTC (rev 287717)
@@ -1,19 +1,5 @@
 2022-01-06  Russell Epstein  <[email protected]>
 
-        Apply patch. rdar://problem/87124847
-
-    2022-01-06  Youenn Fablet  <[email protected]>
-
-            ReadableStream::lock should check whether there is an exception when getting ReadableStreamDefaultReader private constructor
-            https://bugs.webkit.org/show_bug.cgi?id=234890
-
-            Reviewed by Frédéric Wang.
-
-            * streams/readable-stream-lock-after-worker-terminates-crash-expected.txt: Added.
-            * streams/readable-stream-lock-after-worker-terminates-crash.html: Added.
-
-2022-01-06  Russell Epstein  <[email protected]>
-
         Apply patch. rdar://problem/87125345
 
     2022-01-06  Youenn Fablet  <[email protected]>

Deleted: branches/safari-612-branch/LayoutTests/streams/readable-stream-lock-after-worker-terminates-crash-expected.txt (287716 => 287717)


--- branches/safari-612-branch/LayoutTests/streams/readable-stream-lock-after-worker-terminates-crash-expected.txt	2022-01-06 21:02:33 UTC (rev 287716)
+++ branches/safari-612-branch/LayoutTests/streams/readable-stream-lock-after-worker-terminates-crash-expected.txt	2022-01-06 22:31:58 UTC (rev 287717)
@@ -1,2 +0,0 @@
-CONSOLE MESSAGE: This test PASS if it does not crash.
-

Deleted: branches/safari-612-branch/LayoutTests/streams/readable-stream-lock-after-worker-terminates-crash.html (287716 => 287717)


--- branches/safari-612-branch/LayoutTests/streams/readable-stream-lock-after-worker-terminates-crash.html	2022-01-06 21:02:33 UTC (rev 287716)
+++ branches/safari-612-branch/LayoutTests/streams/readable-stream-lock-after-worker-terminates-crash.html	2022-01-06 22:31:58 UTC (rev 287717)
@@ -1,30 +0,0 @@
-<script>
-function createWorker() {
-    function createRequest() {
-        setTimeout(() => {
-            const request = new Request("http://test.org", {"method": "POST", "body": "text" });
-            request.text();
-            request.body;
-        }, 0);
-        self.postMessage("");
-    };
-    const worker = new Worker('data:application/_javascript_;charset=utf-8,' + createRequest.toString() + ';createRequest()');
-    return new Promise(resolve => {
-        worker._onmessage_ = () => {
-            worker.terminate();
-            resolve();
-        }
-    });
-}
-
-_onload_ = () => {
-    if (window.testRunner)
-        testRunner.dumpAsText();
-    console.log('This test PASS if it does not crash.')
-    for (var i = 0; i < 100; ++i) {
-        const script = document.createElement('script');
-        script.src = ""
-        document.head.appendChild(script);
-    }
-};
-</script>

Modified: branches/safari-612-branch/Source/WebCore/ChangeLog (287716 => 287717)


--- branches/safari-612-branch/Source/WebCore/ChangeLog	2022-01-06 21:02:33 UTC (rev 287716)
+++ branches/safari-612-branch/Source/WebCore/ChangeLog	2022-01-06 22:31:58 UTC (rev 287717)
@@ -1,23 +1,5 @@
 2022-01-06  Russell Epstein  <[email protected]>
 
-        Apply patch. rdar://problem/87124847
-
-    2022-01-06  Youenn Fablet  <[email protected]>
-
-            ReadableStream::lock should check whether there is an exception when getting ReadableStreamDefaultReader private constructor
-            https://bugs.webkit.org/show_bug.cgi?id=234890
-
-            Reviewed by Frédéric Wang and Mark Lam.
-
-            Do in ReadableStream::lock like we are doing when getting ReadableStream private constructor in ReadableStream::create.
-            For that reason, introduce a invokeConstructor utility function.
-
-            Test: streams/readable-stream-lock-after-worker-terminates-crash.html
-
-            * bindings/js/ReadableStream.cpp:
-
-2022-01-06  Russell Epstein  <[email protected]>
-
         Apply patch. rdar://problem/87125345
 
     2022-01-06  Youenn Fablet  <[email protected]>

Modified: branches/safari-612-branch/Source/WebCore/bindings/js/ReadableStream.cpp (287716 => 287717)


--- branches/safari-612-branch/Source/WebCore/bindings/js/ReadableStream.cpp	2022-01-06 21:02:33 UTC (rev 287716)
+++ branches/safari-612-branch/Source/WebCore/bindings/js/ReadableStream.cpp	2022-01-06 22:31:58 UTC (rev 287717)
@@ -37,47 +37,30 @@
 namespace WebCore {
 using namespace JSC;
 
-static inline ExceptionOr<JSObject*> invokeConstructor(JSC::JSGlobalObject& lexicalGlobalObject, const JSC::Identifier& identifier, const Function<void(MarkedArgumentBuffer&, JSC::JSGlobalObject&, JSDOMGlobalObject&)>& buildArguments)
+ExceptionOr<Ref<ReadableStream>> ReadableStream::create(JSC::JSGlobalObject& lexicalGlobalObject, RefPtr<ReadableStreamSource>&& source)
 {
     VM& vm = lexicalGlobalObject.vm();
     auto scope = DECLARE_THROW_SCOPE(vm);
 
+    auto& clientData = *static_cast<JSVMClientData*>(vm.clientData);
     auto& globalObject = *JSC::jsCast<JSDOMGlobalObject*>(&lexicalGlobalObject);
 
-    auto constructorValue = globalObject.get(&lexicalGlobalObject, identifier);
-    EXCEPTION_ASSERT(!scope.exception() || vm.hasPendingTerminationException());
-    RETURN_IF_EXCEPTION(scope, Exception { ExistingExceptionError });
-    auto constructor = JSC::asObject(constructorValue);
+    auto* constructor = JSC::asObject(globalObject.get(&lexicalGlobalObject, clientData.builtinNames().ReadableStreamPrivateName()));
 
     auto constructData = getConstructData(vm, constructor);
     ASSERT(constructData.type != CallData::Type::None);
 
     MarkedArgumentBuffer args;
-    buildArguments(args, lexicalGlobalObject, globalObject);
+    args.append(source ? toJSNewlyCreated(&lexicalGlobalObject, &globalObject, source.releaseNonNull()) : JSC::jsUndefined());
     ASSERT(!args.hasOverflowed());
 
     JSObject* object = JSC::construct(&lexicalGlobalObject, constructor, constructData, args);
     ASSERT(!!scope.exception() == !object);
-    EXCEPTION_ASSERT(!scope.exception() || vm.hasPendingTerminationException());
     RETURN_IF_EXCEPTION(scope, Exception { ExistingExceptionError });
 
-    return object;
+    return create(globalObject, *jsCast<JSReadableStream*>(object));
 }
 
-ExceptionOr<Ref<ReadableStream>> ReadableStream::create(JSC::JSGlobalObject& lexicalGlobalObject, RefPtr<ReadableStreamSource>&& source)
-{
-    auto& clientData = *static_cast<JSVMClientData*>(lexicalGlobalObject.vm().clientData);
-
-    auto objectOrException = invokeConstructor(lexicalGlobalObject, clientData.builtinNames().ReadableStreamPrivateName(), [&source](auto& args, auto& lexicalGlobalObject, auto& globalObject) {
-        args.append(source ? toJSNewlyCreated(&lexicalGlobalObject, &globalObject, source.releaseNonNull()) : JSC::jsUndefined());
-    });
-
-    if (objectOrException.hasException())
-        return objectOrException.releaseException();
-
-    return create(*JSC::jsCast<JSDOMGlobalObject*>(&lexicalGlobalObject), *jsCast<JSReadableStream*>(objectOrException.releaseReturnValue()));
-}
-
 static inline std::optional<JSC::JSValue> invokeReadableStreamFunction(JSC::JSGlobalObject& lexicalGlobalObject, const JSC::Identifier& identifier, JSC::JSValue thisValue, const JSC::MarkedArgumentBuffer& arguments)
 {
     JSC::VM& vm = lexicalGlobalObject.vm();
@@ -130,10 +113,25 @@
 
 void ReadableStream::lock()
 {
-    auto& clientData = *static_cast<JSVMClientData*>(m_globalObject->vm().clientData);
-    invokeConstructor(*m_globalObject, clientData.builtinNames().ReadableStreamDefaultReaderPrivateName(), [this](auto& args, auto&, auto&) {
-        args.append(readableStream());
-    });
+    auto& lexicalGlobalObject = *m_globalObject;
+    auto& vm = lexicalGlobalObject.vm();
+#if ENABLE(EXCEPTION_SCOPE_VERIFICATION)
+    auto scope = DECLARE_CATCH_SCOPE(vm);
+#endif
+
+    auto& clientData = *static_cast<JSVMClientData*>(vm.clientData);
+
+    auto* constructor = JSC::asObject(m_globalObject->get(&lexicalGlobalObject, clientData.builtinNames().ReadableStreamDefaultReaderPrivateName()));
+
+    auto constructData = getConstructData(vm, constructor);
+    ASSERT(constructData.type != CallData::Type::None);
+
+    MarkedArgumentBuffer args;
+    args.append(readableStream());
+    ASSERT(!args.hasOverflowed());
+
+    JSC::construct(&lexicalGlobalObject, constructor, constructData, args);
+    EXCEPTION_ASSERT(!scope.exception() || vm.hasPendingTerminationException());
 }
 
 static inline bool checkReadableStream(JSDOMGlobalObject& globalObject, JSReadableStream* readableStream, JSC::JSValue function)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to