Title: [205729] trunk
Revision
205729
Author
[email protected]
Date
2016-09-09 02:47:55 -0700 (Fri, 09 Sep 2016)

Log Message

ASSERTION FAILED: promise.inherits(JSPromise::info())
https://bugs.webkit.org/show_bug.cgi?id=161632
<rdar://problem/28184743>

Patch by Youenn Fablet <[email protected]> on 2016-09-09
Reviewed by Mark Lam.

Source/_javascript_Core:

* runtime/JSPromiseDeferred.cpp:
(JSC::JSPromiseDeferred::create): Returning null if promise object is not created.

Source/WebCore:

Test: fetch/fetch-worker-crash.html

* bindings/js/JSDOMPromise.h:
(WebCore::callPromiseFunction): Returning early if created promise is null.
Passing directly a DeferredWrapper to the generated code.
* bindings/scripts/CodeGeneratorJS.pm: Updated to take a DeferredWrapper.
(GenerateImplementation):
(GenerateReturnParameters):
* bindings/scripts/test/JS/JSTestObj.cpp: Rebasing expectations.
(WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionPromise):
(WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgumentPromise):
(WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithExceptionPromise):
(WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgumentPromise):
(WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1Promise):
(WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2Promise):
(WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionPromise):
(WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionWithExceptionPromise):

LayoutTests:

* TestExpectations: Reenabling skipped tests.
* fetch/fetch-worker-crash-expected.txt: Added.
* fetch/fetch-worker-crash.html: Added.
* fetch/fetch-worker-crash.js: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (205728 => 205729)


--- trunk/LayoutTests/ChangeLog	2016-09-09 09:42:31 UTC (rev 205728)
+++ trunk/LayoutTests/ChangeLog	2016-09-09 09:47:55 UTC (rev 205729)
@@ -1,3 +1,16 @@
+2016-09-09  Youenn Fablet  <[email protected]>
+
+        ASSERTION FAILED: promise.inherits(JSPromise::info())
+        https://bugs.webkit.org/show_bug.cgi?id=161632
+        <rdar://problem/28184743>
+
+        Reviewed by Mark Lam.
+
+        * TestExpectations: Reenabling skipped tests.
+        * fetch/fetch-worker-crash-expected.txt: Added.
+        * fetch/fetch-worker-crash.html: Added.
+        * fetch/fetch-worker-crash.js: Added.
+
 2016-09-08  Yusuke Suzuki  <[email protected]>
 
         ScriptRunner should be driven by PendingScript rather than ScriptElement

Modified: trunk/LayoutTests/TestExpectations (205728 => 205729)


--- trunk/LayoutTests/TestExpectations	2016-09-09 09:42:31 UTC (rev 205728)
+++ trunk/LayoutTests/TestExpectations	2016-09-09 09:47:55 UTC (rev 205729)
@@ -979,8 +979,3 @@
 webkit.org/b/160017 js/regress-139548.html [ Slow ]
 
 webkit.org/b/161088 imported/w3c/web-platform-tests/resource-timing/resource-timing.html [ Pass Failure ]
-
-webkit.org/b/161632 [ Debug ] imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-redirect.html [ Skip ]
-webkit.org/b/161632 [ Debug ] imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-status.html [ Skip ]
-webkit.org/b/161632 [ Debug ] imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-status-worker.html [ Skip ]
-webkit.org/b/161632 [ Debug ] imported/w3c/web-platform-tests/fetch/api/redirect/redirect-count.html [ Skip ]

Added: trunk/LayoutTests/fetch/fetch-worker-crash-expected.txt (0 => 205729)


--- trunk/LayoutTests/fetch/fetch-worker-crash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fetch/fetch-worker-crash-expected.txt	2016-09-09 09:47:55 UTC (rev 205729)
@@ -0,0 +1 @@
+PASS if no crash... DONE

Added: trunk/LayoutTests/fetch/fetch-worker-crash.html (0 => 205729)


--- trunk/LayoutTests/fetch/fetch-worker-crash.html	                        (rev 0)
+++ trunk/LayoutTests/fetch/fetch-worker-crash.html	2016-09-09 09:47:55 UTC (rev 205729)
@@ -0,0 +1,31 @@
+<!doctype html>
+<html>
+    <head>
+        <meta charset="utf-8">
+        <title>Fetch in worker: ensuring that no crash happens</title>
+    </head>
+    <body>
+        <p id="log">PASS if no crash... </p>
+        <script>
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+
+var numTerminated = 0;
+var numWorker = 50;
+for (var cptr = 0; cptr < numWorker; ++cptr) {
+    let worker = new Worker('fetch-worker-crash.js');
+    worker._onmessage_ = (event) => {
+        if (event.data == "starting")
+            worker.terminate();
+        if (++numTerminated == numWorker) {
+            document.getElementById('log').innerHTML += "DONE";
+            if (window.testRunner)
+                testRunner.notifyDone();
+        }
+    }
+}
+        </script>
+    </body>
+</html>

Added: trunk/LayoutTests/fetch/fetch-worker-crash.js (0 => 205729)


--- trunk/LayoutTests/fetch/fetch-worker-crash.js	                        (rev 0)
+++ trunk/LayoutTests/fetch/fetch-worker-crash.js	2016-09-09 09:47:55 UTC (rev 205729)
@@ -0,0 +1,6 @@
+var req = new Request("thisisatest");
+postMessage("starting");
+req.text().then(() => {
+    postMessage("finished");
+})
+postMessage("started");

Modified: trunk/Source/_javascript_Core/ChangeLog (205728 => 205729)


--- trunk/Source/_javascript_Core/ChangeLog	2016-09-09 09:42:31 UTC (rev 205728)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-09-09 09:47:55 UTC (rev 205729)
@@ -1,3 +1,14 @@
+2016-09-09  Youenn Fablet  <[email protected]>
+
+        ASSERTION FAILED: promise.inherits(JSPromise::info())
+        https://bugs.webkit.org/show_bug.cgi?id=161632
+        <rdar://problem/28184743>
+
+        Reviewed by Mark Lam.
+
+        * runtime/JSPromiseDeferred.cpp:
+        (JSC::JSPromiseDeferred::create): Returning null if promise object is not created.
+
 2016-09-08  Filip Pizlo  <[email protected]>
 
         Heap::isMarked() shouldn't pay the price of concurrent lazy flipping

Modified: trunk/Source/_javascript_Core/runtime/JSPromiseDeferred.cpp (205728 => 205729)


--- trunk/Source/_javascript_Core/runtime/JSPromiseDeferred.cpp	2016-09-09 09:42:31 UTC (rev 205728)
+++ trunk/Source/_javascript_Core/runtime/JSPromiseDeferred.cpp	2016-09-09 09:47:55 UTC (rev 205729)
@@ -54,8 +54,11 @@
 JSPromiseDeferred* JSPromiseDeferred::create(ExecState* exec, JSGlobalObject* globalObject)
 {
     VM& vm = exec->vm();
+    auto scope = DECLARE_THROW_SCOPE(vm);
 
     JSValue deferred = newPromiseCapability(exec, globalObject, globalObject->promiseConstructor());
+    if (UNLIKELY(scope.exception()))
+        return nullptr;
 
     JSValue promise = deferred.get(exec, vm.propertyNames->builtinNames().promisePrivateName());
     ASSERT(promise.inherits(JSPromise::info()));

Modified: trunk/Source/WebCore/ChangeLog (205728 => 205729)


--- trunk/Source/WebCore/ChangeLog	2016-09-09 09:42:31 UTC (rev 205728)
+++ trunk/Source/WebCore/ChangeLog	2016-09-09 09:47:55 UTC (rev 205729)
@@ -1,3 +1,29 @@
+2016-09-09  Youenn Fablet  <[email protected]>
+
+        ASSERTION FAILED: promise.inherits(JSPromise::info())
+        https://bugs.webkit.org/show_bug.cgi?id=161632
+        <rdar://problem/28184743>
+
+        Reviewed by Mark Lam.
+
+        Test: fetch/fetch-worker-crash.html
+
+        * bindings/js/JSDOMPromise.h:
+        (WebCore::callPromiseFunction): Returning early if created promise is null.
+        Passing directly a DeferredWrapper to the generated code.
+        * bindings/scripts/CodeGeneratorJS.pm: Updated to take a DeferredWrapper.
+        (GenerateImplementation):
+        (GenerateReturnParameters):
+        * bindings/scripts/test/JS/JSTestObj.cpp: Rebasing expectations.
+        (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionPromise):
+        (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgumentPromise):
+        (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithExceptionPromise):
+        (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgumentPromise):
+        (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1Promise):
+        (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2Promise):
+        (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionPromise):
+        (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionWithExceptionPromise):
+
 2016-09-09  Myles C. Maxfield  <[email protected]>
 
         [Cocoa] Improve performance of glyph advance metrics gathering

Modified: trunk/Source/WebCore/bindings/js/JSDOMPromise.h (205728 => 205729)


--- trunk/Source/WebCore/bindings/js/JSDOMPromise.h	2016-09-09 09:42:31 UTC (rev 205728)
+++ trunk/Source/WebCore/bindings/js/JSDOMPromise.h	2016-09-09 09:47:55 UTC (rev 205729)
@@ -98,6 +98,7 @@
 
 class DeferredWrapper : public RefCounted<DeferredWrapper>, public ActiveDOMCallback {
 public:
+    // FIXME: We should pass references here, not pointers, see bug 161787
     static Ref<DeferredWrapper> create(JSC::ExecState* state, JSDOMGlobalObject* globalObject, JSC::JSPromiseDeferred* deferred)
     {
         return adoptRef(*new DeferredWrapper(state, globalObject, deferred));
@@ -156,18 +157,23 @@
 void fulfillPromiseWithArrayBuffer(Ref<DeferredWrapper>&&, const void*, size_t);
 void rejectPromiseWithExceptionIfAny(JSC::ExecState&, JSDOMGlobalObject&, JSC::JSPromiseDeferred&);
 
-inline JSC::JSValue callPromiseFunction(JSC::ExecState& state, JSC::EncodedJSValue promiseFunction(JSC::ExecState*, JSC::JSPromiseDeferred*))
+inline JSC::JSValue callPromiseFunction(JSC::ExecState& state, JSC::EncodedJSValue promiseFunction(JSC::ExecState*, Ref<DeferredWrapper>&&))
 {
     JSC::VM& vm = state.vm();
     auto scope = DECLARE_CATCH_SCOPE(vm);
 
     JSDOMGlobalObject& globalObject = *JSC::jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject());
-    JSC::JSPromiseDeferred& promiseDeferred = *JSC::JSPromiseDeferred::create(&state, &globalObject);
-    promiseFunction(&state, &promiseDeferred);
+    JSC::JSPromiseDeferred* promiseDeferred = JSC::JSPromiseDeferred::create(&state, &globalObject);
 
-    rejectPromiseWithExceptionIfAny(state, globalObject, promiseDeferred);
+    // promiseDeferred can be null when terminating a Worker abruptly.
+    if (!promiseDeferred)
+        return JSC::jsUndefined();
+
+    promiseFunction(&state, DeferredWrapper::create(&state, &globalObject, promiseDeferred));
+
+    rejectPromiseWithExceptionIfAny(state, globalObject, *promiseDeferred);
     ASSERT_UNUSED(scope, !scope.exception());
-    return promiseDeferred.promise();
+    return promiseDeferred->promise();
 }
 
 // At the moment, Value cannot be a Ref<T> or RefPtr<T>, it should be a DOM class.

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (205728 => 205729)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-09-09 09:42:31 UTC (rev 205728)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-09-09 09:47:55 UTC (rev 205729)
@@ -3409,13 +3409,13 @@
                 AddToImplIncludes("JSDOMPromise.h");
 
                 push(@implContent, <<END);
-static EncodedJSValue ${functionName}Promise(ExecState*, JSPromiseDeferred*);
+static EncodedJSValue ${functionName}Promise(ExecState*, Ref<DeferredWrapper>&&);
 ${functionReturn} ${functionName}(ExecState* state)
 {
     return JSValue::encode(callPromiseFunction(*state, ${functionName}Promise));
 }
 
-static inline EncodedJSValue ${functionName}Promise(ExecState* state, JSPromiseDeferred* promiseDeferred)
+static inline EncodedJSValue ${functionName}Promise(ExecState* state, Ref<DeferredWrapper>&&  deferredWrapper)
 END
             }
             else {
@@ -4122,11 +4122,7 @@
     my @arguments;
 
     if (IsReturningPromise($function)) {
-        if ($function->isStatic) {
-            push(@arguments, "DeferredWrapper::create(state, jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject()), promiseDeferred)");
-        } else {
-            push(@arguments, "DeferredWrapper::create(state, castedThis->globalObject(), promiseDeferred)");
-        }
+        push(@arguments, "WTFMove(deferredWrapper)");
     }
     push(@arguments, "ec") if $function->signature->extendedAttributes->{"RaisesException"} || $function->signature->extendedAttributes->{"RaisesExceptionWithMessage"};
     return @arguments;

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (205728 => 205729)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2016-09-09 09:42:31 UTC (rev 205728)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2016-09-09 09:47:55 UTC (rev 205729)
@@ -7157,13 +7157,13 @@
     return JSValue::encode(jsUndefined());
 }
 
-static EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionPromise(ExecState*, JSPromiseDeferred*);
+static EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionPromise(ExecState*, Ref<DeferredWrapper>&&);
 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionTestPromiseFunction(ExecState* state)
 {
     return JSValue::encode(callPromiseFunction(*state, jsTestObjPrototypeFunctionTestPromiseFunctionPromise));
 }
 
-static inline EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionPromise(ExecState* state, JSPromiseDeferred* promiseDeferred)
+static inline EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionPromise(ExecState* state, Ref<DeferredWrapper>&&  deferredWrapper)
 {
     VM& vm = state->vm();
     auto throwScope = DECLARE_THROW_SCOPE(vm);
@@ -7174,17 +7174,17 @@
         return throwThisTypeError(*state, throwScope, "TestObject", "testPromiseFunction");
     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
     auto& impl = castedThis->wrapped();
-    impl.testPromiseFunction(DeferredWrapper::create(state, castedThis->globalObject(), promiseDeferred));
+    impl.testPromiseFunction(WTFMove(deferredWrapper));
     return JSValue::encode(jsUndefined());
 }
 
-static EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgumentPromise(ExecState*, JSPromiseDeferred*);
+static EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgumentPromise(ExecState*, Ref<DeferredWrapper>&&);
 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgument(ExecState* state)
 {
     return JSValue::encode(callPromiseFunction(*state, jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgumentPromise));
 }
 
-static inline EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgumentPromise(ExecState* state, JSPromiseDeferred* promiseDeferred)
+static inline EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgumentPromise(ExecState* state, Ref<DeferredWrapper>&&  deferredWrapper)
 {
     VM& vm = state->vm();
     auto throwScope = DECLARE_THROW_SCOPE(vm);
@@ -7200,17 +7200,17 @@
     auto a = convert<float>(*state, state->argument(0), ShouldAllowNonFinite::No);
     if (UNLIKELY(throwScope.exception()))
         return JSValue::encode(jsUndefined());
-    impl.testPromiseFunctionWithFloatArgument(WTFMove(a), DeferredWrapper::create(state, castedThis->globalObject(), promiseDeferred));
+    impl.testPromiseFunctionWithFloatArgument(WTFMove(a), WTFMove(deferredWrapper));
     return JSValue::encode(jsUndefined());
 }
 
-static EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionWithExceptionPromise(ExecState*, JSPromiseDeferred*);
+static EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionWithExceptionPromise(ExecState*, Ref<DeferredWrapper>&&);
 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionTestPromiseFunctionWithException(ExecState* state)
 {
     return JSValue::encode(callPromiseFunction(*state, jsTestObjPrototypeFunctionTestPromiseFunctionWithExceptionPromise));
 }
 
-static inline EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionWithExceptionPromise(ExecState* state, JSPromiseDeferred* promiseDeferred)
+static inline EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionWithExceptionPromise(ExecState* state, Ref<DeferredWrapper>&&  deferredWrapper)
 {
     VM& vm = state->vm();
     auto throwScope = DECLARE_THROW_SCOPE(vm);
@@ -7222,18 +7222,18 @@
     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
     auto& impl = castedThis->wrapped();
     ExceptionCode ec = 0;
-    impl.testPromiseFunctionWithException(DeferredWrapper::create(state, castedThis->globalObject(), promiseDeferred), ec);
+    impl.testPromiseFunctionWithException(WTFMove(deferredWrapper), ec);
     setDOMException(state, ec);
     return JSValue::encode(jsUndefined());
 }
 
-static EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgumentPromise(ExecState*, JSPromiseDeferred*);
+static EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgumentPromise(ExecState*, Ref<DeferredWrapper>&&);
 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgument(ExecState* state)
 {
     return JSValue::encode(callPromiseFunction(*state, jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgumentPromise));
 }
 
-static inline EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgumentPromise(ExecState* state, JSPromiseDeferred* promiseDeferred)
+static inline EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgumentPromise(ExecState* state, Ref<DeferredWrapper>&&  deferredWrapper)
 {
     VM& vm = state->vm();
     auto throwScope = DECLARE_THROW_SCOPE(vm);
@@ -7247,17 +7247,17 @@
     auto a = state->argument(0).isUndefined() ? Optional<int32_t>() : convert<int32_t>(*state, state->uncheckedArgument(0), NormalConversion);
     if (UNLIKELY(throwScope.exception()))
         return JSValue::encode(jsUndefined());
-    impl.testPromiseFunctionWithOptionalIntArgument(WTFMove(a), DeferredWrapper::create(state, castedThis->globalObject(), promiseDeferred));
+    impl.testPromiseFunctionWithOptionalIntArgument(WTFMove(a), WTFMove(deferredWrapper));
     return JSValue::encode(jsUndefined());
 }
 
-static EncodedJSValue jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1Promise(ExecState*, JSPromiseDeferred*);
+static EncodedJSValue jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1Promise(ExecState*, Ref<DeferredWrapper>&&);
 static inline EncodedJSValue jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1(ExecState* state)
 {
     return JSValue::encode(callPromiseFunction(*state, jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1Promise));
 }
 
-static inline EncodedJSValue jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1Promise(ExecState* state, JSPromiseDeferred* promiseDeferred)
+static inline EncodedJSValue jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1Promise(ExecState* state, Ref<DeferredWrapper>&&  deferredWrapper)
 {
     VM& vm = state->vm();
     auto throwScope = DECLARE_THROW_SCOPE(vm);
@@ -7273,17 +7273,17 @@
     auto a = convert<float>(*state, state->argument(0), ShouldAllowNonFinite::No);
     if (UNLIKELY(throwScope.exception()))
         return JSValue::encode(jsUndefined());
-    impl.testPromiseOverloadedFunction(WTFMove(a), DeferredWrapper::create(state, castedThis->globalObject(), promiseDeferred));
+    impl.testPromiseOverloadedFunction(WTFMove(a), WTFMove(deferredWrapper));
     return JSValue::encode(jsUndefined());
 }
 
-static EncodedJSValue jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2Promise(ExecState*, JSPromiseDeferred*);
+static EncodedJSValue jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2Promise(ExecState*, Ref<DeferredWrapper>&&);
 static inline EncodedJSValue jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2(ExecState* state)
 {
     return JSValue::encode(callPromiseFunction(*state, jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2Promise));
 }
 
-static inline EncodedJSValue jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2Promise(ExecState* state, JSPromiseDeferred* promiseDeferred)
+static inline EncodedJSValue jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2Promise(ExecState* state, Ref<DeferredWrapper>&&  deferredWrapper)
 {
     VM& vm = state->vm();
     auto throwScope = DECLARE_THROW_SCOPE(vm);
@@ -7299,7 +7299,7 @@
     auto request = JSFetchRequest::toWrapped(state->argument(0));
     if (UNLIKELY(!request))
         return throwArgumentTypeError(*state, throwScope, 0, "request", "TestObject", "testPromiseOverloadedFunction", "FetchRequest");
-    impl.testPromiseOverloadedFunction(*request, DeferredWrapper::create(state, castedThis->globalObject(), promiseDeferred));
+    impl.testPromiseOverloadedFunction(*request, WTFMove(deferredWrapper));
     return JSValue::encode(jsUndefined());
 }
 
@@ -7320,34 +7320,34 @@
     return argsCount < 1 ? throwVMError(state, throwScope, createNotEnoughArgumentsError(state)) : throwVMTypeError(state, throwScope);
 }
 
-static EncodedJSValue jsTestObjConstructorFunctionTestStaticPromiseFunctionPromise(ExecState*, JSPromiseDeferred*);
+static EncodedJSValue jsTestObjConstructorFunctionTestStaticPromiseFunctionPromise(ExecState*, Ref<DeferredWrapper>&&);
 EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionTestStaticPromiseFunction(ExecState* state)
 {
     return JSValue::encode(callPromiseFunction(*state, jsTestObjConstructorFunctionTestStaticPromiseFunctionPromise));
 }
 
-static inline EncodedJSValue jsTestObjConstructorFunctionTestStaticPromiseFunctionPromise(ExecState* state, JSPromiseDeferred* promiseDeferred)
+static inline EncodedJSValue jsTestObjConstructorFunctionTestStaticPromiseFunctionPromise(ExecState* state, Ref<DeferredWrapper>&&  deferredWrapper)
 {
     VM& vm = state->vm();
     auto throwScope = DECLARE_THROW_SCOPE(vm);
     UNUSED_PARAM(throwScope);
-    TestObj::testStaticPromiseFunction(DeferredWrapper::create(state, jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject()), promiseDeferred));
+    TestObj::testStaticPromiseFunction(WTFMove(deferredWrapper));
     return JSValue::encode(jsUndefined());
 }
 
-static EncodedJSValue jsTestObjConstructorFunctionTestStaticPromiseFunctionWithExceptionPromise(ExecState*, JSPromiseDeferred*);
+static EncodedJSValue jsTestObjConstructorFunctionTestStaticPromiseFunctionWithExceptionPromise(ExecState*, Ref<DeferredWrapper>&&);
 EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionTestStaticPromiseFunctionWithException(ExecState* state)
 {
     return JSValue::encode(callPromiseFunction(*state, jsTestObjConstructorFunctionTestStaticPromiseFunctionWithExceptionPromise));
 }
 
-static inline EncodedJSValue jsTestObjConstructorFunctionTestStaticPromiseFunctionWithExceptionPromise(ExecState* state, JSPromiseDeferred* promiseDeferred)
+static inline EncodedJSValue jsTestObjConstructorFunctionTestStaticPromiseFunctionWithExceptionPromise(ExecState* state, Ref<DeferredWrapper>&&  deferredWrapper)
 {
     VM& vm = state->vm();
     auto throwScope = DECLARE_THROW_SCOPE(vm);
     UNUSED_PARAM(throwScope);
     ExceptionCode ec = 0;
-    TestObj::testStaticPromiseFunctionWithException(DeferredWrapper::create(state, jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject()), promiseDeferred), ec);
+    TestObj::testStaticPromiseFunctionWithException(WTFMove(deferredWrapper), ec);
     setDOMException(state, ec);
     return JSValue::encode(jsUndefined());
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to