Diff
Modified: trunk/LayoutTests/ChangeLog (206010 => 206011)
--- trunk/LayoutTests/ChangeLog 2016-09-16 07:41:49 UTC (rev 206010)
+++ trunk/LayoutTests/ChangeLog 2016-09-16 07:51:37 UTC (rev 206011)
@@ -1,5 +1,16 @@
2016-09-16 Youenn Fablet <[email protected]>
+ Custom promise-returning functions should not throw if callee has not the expected type
+ https://bugs.webkit.org/show_bug.cgi?id=162011
+
+ Reviewed by Sam Weinig.
+
+ * fast/mediastream/MediaDevices-getUserMedia-expected.txt:
+ * fast/mediastream/MediaDevices-getUserMedia.html: Enusing calling getUserMedia on something else than MediaDevices does not throw.
+ * http/tests/media/media-stream/disconnected-frame-already-expected.txt:
+
+2016-09-16 Youenn Fablet <[email protected]>
+
Link loader should use FetchOptions::mode according its crossOrigin attribute
https://bugs.webkit.org/show_bug.cgi?id=161859
Modified: trunk/LayoutTests/fast/mediastream/MediaDevices-getUserMedia-expected.txt (206010 => 206011)
--- trunk/LayoutTests/fast/mediastream/MediaDevices-getUserMedia-expected.txt 2016-09-16 07:41:49 UTC (rev 206010)
+++ trunk/LayoutTests/fast/mediastream/MediaDevices-getUserMedia-expected.txt 2016-09-16 07:51:37 UTC (rev 206011)
@@ -7,6 +7,7 @@
PASS navigator.mediaDevices.getUserMedia({audio:true}).then(gotStream1); did not throw exception.
PASS navigator.mediaDevices.getUserMedia() rejected with error: TypeError: Not enough arguments
PASS navigator.mediaDevices.getUserMedia({}) rejected with error: TypeError: Type error
+PASS navigator.mediaDevices.getUserMedia.apply(undefined) rejected with error: TypeError: Can only call MediaDevices.getUserMedia on instances of MediaDevices
PASS Stream generated.
PASS stream.getAudioTracks().length is 1
PASS stream.getVideoTracks().length is 0
Modified: trunk/LayoutTests/fast/mediastream/MediaDevices-getUserMedia.html (206010 => 206011)
--- trunk/LayoutTests/fast/mediastream/MediaDevices-getUserMedia.html 2016-09-16 07:41:49 UTC (rev 206010)
+++ trunk/LayoutTests/fast/mediastream/MediaDevices-getUserMedia.html 2016-09-16 07:51:37 UTC (rev 206011)
@@ -145,6 +145,9 @@
shouldBe("typeof navigator.mediaDevices.webkitGetUserMedia", "'undefined'");
setUserMediaPermission(true);
shouldNotThrow("navigator.mediaDevices.getUserMedia({audio:true}).then(gotStream1);");
+ navigator.mediaDevices.getUserMedia.apply(undefined, {audio:true}).then(invalidGotStream, function(error) {
+ testPassed("navigator.mediaDevices.getUserMedia.apply(undefined) rejected with error: " + error);
+ });
window.jsTestIsAsync = true;
window.successfullyParsed = true;
Modified: trunk/LayoutTests/http/tests/media/media-stream/disconnected-frame-already-expected.txt (206010 => 206011)
--- trunk/LayoutTests/http/tests/media/media-stream/disconnected-frame-already-expected.txt 2016-09-16 07:41:49 UTC (rev 206010)
+++ trunk/LayoutTests/http/tests/media/media-stream/disconnected-frame-already-expected.txt 2016-09-16 07:51:37 UTC (rev 206011)
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: line 24: TypeError: The implementation did not support the requested type of object or operation.
+CONSOLE MESSAGE: line 24: TypeError: Can only call Navigator.webkitGetUserMedia on instances of Navigator
Tests that when a getUserMedia request is made after its frame has been disconnected, no callbacks are made and no crash occurs.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Modified: trunk/Source/_javascript_Core/ChangeLog (206010 => 206011)
--- trunk/Source/_javascript_Core/ChangeLog 2016-09-16 07:41:49 UTC (rev 206010)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-09-16 07:51:37 UTC (rev 206011)
@@ -1,3 +1,12 @@
+2016-09-16 Youenn Fablet <[email protected]>
+
+ Custom promise-returning functions should not throw if callee has not the expected type
+ https://bugs.webkit.org/show_bug.cgi?id=162011
+
+ Reviewed by Sam Weinig.
+
+ * _javascript_Core.xcodeproj/project.pbxproj: Making JSPromiseConstructor.h private
+
2016-09-15 Filip Pizlo <[email protected]>
REGRESSION (r205462): Lot of leaks
Modified: trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (206010 => 206011)
--- trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2016-09-16 07:41:49 UTC (rev 206010)
+++ trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2016-09-16 07:51:37 UTC (rev 206011)
@@ -1350,7 +1350,7 @@
7C184E1E17BEE22E007CB63A /* JSPromisePrototype.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C184E1C17BEE22E007CB63A /* JSPromisePrototype.cpp */; };
7C184E1F17BEE22E007CB63A /* JSPromisePrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C184E1D17BEE22E007CB63A /* JSPromisePrototype.h */; };
7C184E2217BEE240007CB63A /* JSPromiseConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C184E2017BEE240007CB63A /* JSPromiseConstructor.cpp */; };
- 7C184E2317BEE240007CB63A /* JSPromiseConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C184E2117BEE240007CB63A /* JSPromiseConstructor.h */; };
+ 7C184E2317BEE240007CB63A /* JSPromiseConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C184E2117BEE240007CB63A /* JSPromiseConstructor.h */; settings = {ATTRIBUTES = (Private, ); }; };
7E4EE7090EBB7963005934AA /* StructureChain.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E4EE7080EBB7963005934AA /* StructureChain.h */; settings = {ATTRIBUTES = (Private, ); }; };
7E4EE70F0EBB7A5B005934AA /* StructureChain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7E4EE70E0EBB7A5B005934AA /* StructureChain.cpp */; };
840480131021A1D9008E7F01 /* JSAPIValueWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = BC0894D60FAFBA2D00001865 /* JSAPIValueWrapper.h */; settings = {ATTRIBUTES = (Private, ); }; };
Modified: trunk/Source/WebCore/CMakeLists.txt (206010 => 206011)
--- trunk/Source/WebCore/CMakeLists.txt 2016-09-16 07:41:49 UTC (rev 206010)
+++ trunk/Source/WebCore/CMakeLists.txt 2016-09-16 07:51:37 UTC (rev 206011)
@@ -3658,7 +3658,6 @@
${WEBCORE_DIR}/Modules/fetch/FetchRequest.js
${WEBCORE_DIR}/Modules/fetch/FetchResponse.js
${WEBCORE_DIR}/Modules/fetch/WorkerGlobalScopeFetch.js
- ${WEBCORE_DIR}/Modules/mediastream/MediaDevices.js
${WEBCORE_DIR}/Modules/mediastream/NavigatorUserMedia.js
${WEBCORE_DIR}/Modules/mediastream/RTCPeerConnection.js
${WEBCORE_DIR}/Modules/mediastream/RTCPeerConnectionInternals.js
Modified: trunk/Source/WebCore/ChangeLog (206010 => 206011)
--- trunk/Source/WebCore/ChangeLog 2016-09-16 07:41:49 UTC (rev 206010)
+++ trunk/Source/WebCore/ChangeLog 2016-09-16 07:51:37 UTC (rev 206011)
@@ -1,5 +1,35 @@
2016-09-16 Youenn Fablet <[email protected]>
+ Custom promise-returning functions should not throw if callee has not the expected type
+ https://bugs.webkit.org/show_bug.cgi?id=162011
+
+ Reviewed by Sam Weinig.
+
+ Covered by added test.
+
+ Updating code generator to handle this case.
+ Cleaning related getUserMedia implementation.
+
+ * CMakeLists.txt: Removing Modules/mediastream/MediaDevices.js.
+ * DerivedSources.make: Removing Modules/mediastream/MediaDevices.js.
+ * Modules/mediastream/MediaDevices.idl: Cleaning IDL definition
+ * Modules/mediastream/MediaDevices.js: Removing error throwing and so removing file.
+ * Modules/mediastream/NavigatorUserMedia.js: getUsermMediaFromJS to getUserMedia.
+ * WebCore.xcodeproj/project.pbxproj: Removing Modules/mediastream/MediaDevices.js.
+ * bindings/js/JSDOMPromise.cpp:
+ (WebCore::createRejectedPromiseWithTypeError): Helper routine.
+ * bindings/js/JSDOMPromise.h:
+ * bindings/js/WebCoreBuiltinNames.h: getUsermMediaFromJS to getUserMedia.
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateImplementation): Rejecting promise in case of failing castedThis, but only for custom functions since
+ they are handled differently for non custom methods.
+ (GenerateFunctionCastedThis):
+ * bindings/scripts/test/JS/JSTestObj.cpp:
+ * bindings/scripts/test/JS/JSTestObj.h:
+ * bindings/scripts/test/TestObj.idl: Adding custom promise test.
+
+2016-09-16 Youenn Fablet <[email protected]>
+
Link loader should use FetchOptions::mode according its crossOrigin attribute
https://bugs.webkit.org/show_bug.cgi?id=161859
Modified: trunk/Source/WebCore/DerivedSources.make (206010 => 206011)
--- trunk/Source/WebCore/DerivedSources.make 2016-09-16 07:41:49 UTC (rev 206010)
+++ trunk/Source/WebCore/DerivedSources.make 2016-09-16 07:51:37 UTC (rev 206011)
@@ -1284,7 +1284,6 @@
$(WebCore)/Modules/fetch/FetchRequest.js \
$(WebCore)/Modules/fetch/FetchResponse.js \
${WebCore}/Modules/fetch/WorkerGlobalScopeFetch.js \
- $(WebCore)/Modules/mediastream/MediaDevices.js \
$(WebCore)/Modules/mediastream/NavigatorUserMedia.js \
$(WebCore)/Modules/mediastream/RTCPeerConnection.js \
$(WebCore)/Modules/mediastream/RTCPeerConnectionInternals.js \
Added: trunk/Source/WebCore/ForwardingHeaders/runtime/JSPromiseConstructor.h (0 => 206011)
--- trunk/Source/WebCore/ForwardingHeaders/runtime/JSPromiseConstructor.h (rev 0)
+++ trunk/Source/WebCore/ForwardingHeaders/runtime/JSPromiseConstructor.h 2016-09-16 07:51:37 UTC (rev 206011)
@@ -0,0 +1,2 @@
+#pragma once
+#include <_javascript_Core/JSPromiseConstructor.h>
Modified: trunk/Source/WebCore/Modules/mediastream/MediaDevices.idl (206010 => 206011)
--- trunk/Source/WebCore/Modules/mediastream/MediaDevices.idl 2016-09-16 07:41:49 UTC (rev 206010)
+++ trunk/Source/WebCore/Modules/mediastream/MediaDevices.idl 2016-09-16 07:51:37 UTC (rev 206011)
@@ -34,8 +34,6 @@
] interface MediaDevices {
MediaTrackSupportedConstraints getSupportedConstraints();
- [JSBuiltin] Promise getUserMedia(Dictionary options);
+ [Custom, PrivateIdentifier, PublicIdentifier] Promise getUserMedia(Dictionary options);
[RaisesException] Promise enumerateDevices();
-
- [PrivateIdentifier, RaisesException, ImplementedAs=getUserMedia, Custom] Promise getUserMediaFromJS(Dictionary options);
};
Deleted: trunk/Source/WebCore/Modules/mediastream/MediaDevices.js (206010 => 206011)
--- trunk/Source/WebCore/Modules/mediastream/MediaDevices.js 2016-09-16 07:41:49 UTC (rev 206010)
+++ trunk/Source/WebCore/Modules/mediastream/MediaDevices.js 2016-09-16 07:51:37 UTC (rev 206011)
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2015 Canon Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted, provided that the following conditions
- * are required to be 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.
- * 3. Neither the name of Canon Inc. nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY CANON 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 CANON INC. AND 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.
- */
-
-// @conditional=ENABLE(MEDIA_STREAM)
-
-function getUserMedia(options)
-{
- if (!this.@getUserMediaFromJS)
- throw new @TypeError("Function should be called on a MediaDevices");
- return this.@getUserMediaFromJS.@apply(this, arguments);
-}
Modified: trunk/Source/WebCore/Modules/mediastream/NavigatorUserMedia.js (206010 => 206011)
--- trunk/Source/WebCore/Modules/mediastream/NavigatorUserMedia.js 2016-09-16 07:41:49 UTC (rev 206010)
+++ trunk/Source/WebCore/Modules/mediastream/NavigatorUserMedia.js 2016-09-16 07:51:37 UTC (rev 206011)
@@ -30,8 +30,8 @@
"use strict";
// FIXME: We should raise a DOM unsupported exception if there is no navigator and properly detect whether method is not called on a Navigator object.
- if (!(this.mediaDevices && this.mediaDevices.@getUserMediaFromJS))
- throw new @TypeError("The implementation did not support the requested type of object or operation.");
+ if (!(this.mediaDevices && this.mediaDevices.@getUserMedia))
+ throw @makeThisTypeError("Navigator", "webkitGetUserMedia");
if (arguments.length < 3)
throw new @TypeError("Not enough arguments");
@@ -44,5 +44,5 @@
if (typeof errorCallback !== "function")
throw new @TypeError("Argument 3 ('errorCallback') to Navigator.webkitGetUserMedia must be a function");
- this.mediaDevices.@getUserMediaFromJS(options).@then(successCallback, errorCallback);
+ this.mediaDevices.@getUserMedia(options).@then(successCallback, errorCallback);
}
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (206010 => 206011)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-09-16 07:41:49 UTC (rev 206010)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-09-16 07:51:37 UTC (rev 206011)
@@ -10826,7 +10826,6 @@
9908B0FF1BCAD07D00ED0F65 /* ReadableStreamDefaultReaderBuiltins.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReadableStreamDefaultReaderBuiltins.h; sourceTree = "<group>"; };
9920398018B95BC600B39AF9 /* UserInputBridge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserInputBridge.cpp; sourceTree = "<group>"; };
9920398118B95BC600B39AF9 /* UserInputBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserInputBridge.h; sourceTree = "<group>"; };
- 9994E5D81BD843A300F2D835 /* MediaDevices.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = MediaDevices.js; sourceTree = "<group>"; };
99C7CCB218C663E40032E413 /* MemoizedDOMResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoizedDOMResult.h; sourceTree = "<group>"; };
99C7CCB418C6B8990032E413 /* MemoizedDOMResult.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MemoizedDOMResult.cpp; sourceTree = "<group>"; };
99CC0B3818BE9849006CEBCC /* AllReplayInputs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AllReplayInputs.h; sourceTree = "<group>"; };
@@ -14478,7 +14477,6 @@
5EA725CD1ACABCD900EAD17B /* MediaDevices.cpp */,
5EA725CE1ACABCD900EAD17B /* MediaDevices.h */,
5EA725CF1ACABCD900EAD17B /* MediaDevices.idl */,
- 9994E5D81BD843A300F2D835 /* MediaDevices.js */,
07394EC71BAB2CCD00BE99CD /* MediaDevicesRequest.cpp */,
07394EC91BAB2CD700BE99CD /* MediaDevicesRequest.h */,
5E16A2E21BFA64FB0029A21E /* MediaEndpointPeerConnection.cpp */,
Modified: trunk/Source/WebCore/bindings/js/JSDOMPromise.cpp (206010 => 206011)
--- trunk/Source/WebCore/bindings/js/JSDOMPromise.cpp 2016-09-16 07:41:49 UTC (rev 206010)
+++ trunk/Source/WebCore/bindings/js/JSDOMPromise.cpp 2016-09-16 07:51:37 UTC (rev 206011)
@@ -28,8 +28,10 @@
#include "ExceptionCode.h"
#include "JSDOMError.h"
+#include <builtins/BuiltinNames.h>
#include <runtime/Exception.h>
#include <runtime/JSONObject.h>
+#include <runtime/JSPromiseConstructor.h>
using namespace JSC;
@@ -112,6 +114,25 @@
DeferredWrapper::create(&state, &globalObject, &promiseDeferred)->reject(error);
}
+JSC::EncodedJSValue createRejectedPromiseWithTypeError(JSC::ExecState& state, const String& errorMessage)
+{
+ ASSERT(state.lexicalGlobalObject());
+ auto& globalObject = *state.lexicalGlobalObject();
+
+ auto promiseConstructor = globalObject.promiseConstructor();
+ auto rejectFunction = promiseConstructor->get(&state, state.vm().propertyNames->builtinNames().rejectPrivateName());
+ auto rejectionValue = createTypeError(&state, errorMessage);
+
+ CallData callData;
+ auto callType = getCallData(rejectFunction, callData);
+ ASSERT(callType != CallType::None);
+
+ MarkedArgumentBuffer arguments;
+ arguments.append(rejectionValue);
+
+ return JSValue::encode(call(&state, rejectFunction, callType, callData, promiseConstructor, arguments));
+}
+
static inline JSC::JSValue parseAsJSON(JSC::ExecState* state, const String& data)
{
JSC::JSLockHolder lock(state);
Modified: trunk/Source/WebCore/bindings/js/JSDOMPromise.h (206010 => 206011)
--- trunk/Source/WebCore/bindings/js/JSDOMPromise.h 2016-09-16 07:41:49 UTC (rev 206010)
+++ trunk/Source/WebCore/bindings/js/JSDOMPromise.h 2016-09-16 07:51:37 UTC (rev 206011)
@@ -156,6 +156,7 @@
void fulfillPromiseWithArrayBuffer(Ref<DeferredWrapper>&&, ArrayBuffer*);
void fulfillPromiseWithArrayBuffer(Ref<DeferredWrapper>&&, const void*, size_t);
void rejectPromiseWithExceptionIfAny(JSC::ExecState&, JSDOMGlobalObject&, JSC::JSPromiseDeferred&);
+JSC::EncodedJSValue createRejectedPromiseWithTypeError(JSC::ExecState&, const String&);
using PromiseFunction = void(JSC::ExecState&, Ref<DeferredWrapper>&&);
Modified: trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h (206010 => 206011)
--- trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h 2016-09-16 07:41:49 UTC (rev 206010)
+++ trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h 2016-09-16 07:51:37 UTC (rev 206011)
@@ -48,7 +48,7 @@
macro(fillFromJS) \
macro(finishConsumingStream) \
macro(firstReadCallback) \
- macro(getUserMediaFromJS) \
+ macro(getUserMedia) \
macro(getRemoteStreams) \
macro(getSenders) \
macro(getTracks) \
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (206010 => 206011)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2016-09-16 07:41:49 UTC (rev 206010)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2016-09-16 07:51:37 UTC (rev 206011)
@@ -3418,8 +3418,10 @@
my $functionImplementationName = $function->signature->extendedAttributes->{"ImplementedAs"} || $codeGenerator->WK_lcfirst($function->signature->name);
+ if (IsReturningPromise($function)) {
+ AddToImplIncludes("JSDOMPromise.h");
+ }
if (IsReturningPromise($function) && !$isCustom) {
- AddToImplIncludes("JSDOMPromise.h");
my $scope = $interface->extendedAttributes->{"Exposed"} ? "WindowOrWorker" : "WindowOnly";
push(@implContent, <<END);
@@ -3470,7 +3472,8 @@
GenerateImplementationFunctionCall($function, $functionString, " ", $svgPropertyType, $interface);
}
} else {
- GenerateFunctionCastedThis($interface, $className, $function);
+ my $shouldRejectCastedThis = $isCustom && IsReturningPromise($function);
+ GenerateFunctionCastedThis($interface, $className, $function, $shouldRejectCastedThis);
if ($interface->extendedAttributes->{"CheckSecurity"} and !$function->signature->extendedAttributes->{"DoNotCheckSecurity"}) {
if ($interfaceName eq "DOMWindow") {
@@ -3760,7 +3763,7 @@
sub GenerateFunctionCastedThis
{
- my ($interface, $className, $function) = @_;
+ my ($interface, $className, $function, $shouldRejectPromise) = @_;
if ($interface->extendedAttributes->{"CustomProxyToJSObject"}) {
push(@implContent, " $className* castedThis = to${className}(state->thisValue().toThis(state, NotStrictMode));\n");
@@ -3781,7 +3784,11 @@
my $visibleInterfaceName = $codeGenerator->GetVisibleInterfaceName($interface);
my $domFunctionName = $function->signature->name;
push(@implContent, " if (UNLIKELY(!castedThis))\n");
- push(@implContent, " return throwThisTypeError(*state, throwScope, \"$visibleInterfaceName\", \"$domFunctionName\");\n");
+ if ($shouldRejectPromise) {
+ push(@implContent, " return createRejectedPromiseWithTypeError(*state, makeThisTypeErrorMessage(\"$visibleInterfaceName\", \"$domFunctionName\"));\n");
+ } else {
+ push(@implContent, " return throwThisTypeError(*state, throwScope, \"$visibleInterfaceName\", \"$domFunctionName\");\n");
+ }
}
push(@implContent, " ASSERT_GC_OBJECT_INHERITS(castedThis, ${className}::info());\n") unless $interface->name eq "EventTarget";
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (206010 => 206011)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2016-09-16 07:41:49 UTC (rev 206010)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2016-09-16 07:51:37 UTC (rev 206011)
@@ -809,6 +809,7 @@
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionTestPromiseOverloadedFunction(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionTestStaticPromiseFunction(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionTestStaticPromiseFunctionWithException(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionTestCustomPromiseFunction(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNeedsCustomElementReactionStack(JSC::ExecState*);
#if ENABLE(CONDITION1) || ENABLE(CONDITION2)
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionConditionalOverload(JSC::ExecState*);
@@ -1411,6 +1412,7 @@
{ "testPromiseFunctionWithException", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionTestPromiseFunctionWithException), (intptr_t) (0) } },
{ "testPromiseFunctionWithOptionalIntArgument", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgument), (intptr_t) (0) } },
{ "testPromiseOverloadedFunction", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionTestPromiseOverloadedFunction), (intptr_t) (1) } },
+ { "testCustomPromiseFunction", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionTestCustomPromiseFunction), (intptr_t) (0) } },
{ "methodWithNeedsCustomElementReactionStack", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNeedsCustomElementReactionStack), (intptr_t) (0) } },
#if ENABLE(CONDITION1) || ENABLE(CONDITION2)
{ "conditionalOverload", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionConditionalOverload), (intptr_t) (1) } },
@@ -7368,6 +7370,19 @@
return JSValue::encode(jsUndefined());
}
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionTestCustomPromiseFunction(ExecState* state)
+{
+ VM& vm = state->vm();
+ auto throwScope = DECLARE_THROW_SCOPE(vm);
+ UNUSED_PARAM(throwScope);
+ JSValue thisValue = state->thisValue();
+ auto castedThis = jsDynamicCast<JSTestObj*>(thisValue);
+ if (UNLIKELY(!castedThis))
+ return createRejectedPromiseWithTypeError(*state, makeThisTypeErrorMessage("TestObject", "testCustomPromiseFunction"));
+ ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
+ return JSValue::encode(castedThis->testCustomPromiseFunction(*state));
+}
+
EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNeedsCustomElementReactionStack(ExecState* state)
{
VM& vm = state->vm();
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h (206010 => 206011)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h 2016-09-16 07:41:49 UTC (rev 206010)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h 2016-09-16 07:51:37 UTC (rev 206011)
@@ -65,6 +65,7 @@
JSC::JSValue customMethod(JSC::ExecState&);
JSC::JSValue customMethodWithArgs(JSC::ExecState&);
static JSC::JSValue classMethod2(JSC::ExecState&);
+ JSC::JSValue testCustomPromiseFunction(JSC::ExecState&);
public:
static const unsigned StructureFlags = JSC::HasStaticPropertyTable | JSC::InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | JSC::OverridesGetOwnPropertySlot | JSC::OverridesGetPropertyNames | Base::StructureFlags;
protected:
Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (206010 => 206011)
--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl 2016-09-16 07:41:49 UTC (rev 206010)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl 2016-09-16 07:51:37 UTC (rev 206011)
@@ -388,6 +388,7 @@
Promise testPromiseOverloadedFunction(FetchRequest request);
static Promise testStaticPromiseFunction();
[RaisesException] static Promise testStaticPromiseFunctionWithException();
+ [Custom] Promise testCustomPromiseFunction();
// PutForwards
[PutForwards=name] readonly attribute TestNode putForwardsAttribute;