Bug 146585

Summary: Promise-returning functions should reject promises if the callee is not of the expected type
Product: WebKit Reporter: youenn fablet <youennf>
Component: WebCore Misc.Assignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, darin
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch for landing none

Description youenn fablet 2015-07-03 04:44:04 PDT
As part of https://bugs.webkit.org/show_bug.cgi?id=146060, most exceptions are caught to reject promise in case of promise-returning functions.
Promise should also be rejected if the callee is not of the expected JS wrapper class name.
Comment 1 youenn fablet 2015-07-03 04:56:08 PDT
Created attachment 256092 [details]
Patch
Comment 2 Darin Adler 2015-07-04 09:38:02 PDT
Comment on attachment 256092 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=256092&action=review

> Source/WebCore/bindings/js/JSDOMPromise.h:63
> +    JSDOMGlobalObject* globalObject = JSC::jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject());

Should be a reference. It can’t be null.

> Source/WebCore/bindings/js/JSDOMPromise.h:64
> +    JSC::JSPromiseDeferred* promiseDeferred = JSC::JSPromiseDeferred::create(&state, globalObject);

Should be a reference. It can’t be null.
Comment 3 youenn fablet 2015-07-05 23:39:55 PDT
Comment on attachment 256092 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=256092&action=review

>> Source/WebCore/bindings/js/JSDOMPromise.h:63
>> +    JSDOMGlobalObject* globalObject = JSC::jsCast<JSDOMGlobalObject*>(state.lexicalGlobalObject());
> 
> Should be a reference. It can’t be null.

ok

>> Source/WebCore/bindings/js/JSDOMPromise.h:64
>> +    JSC::JSPromiseDeferred* promiseDeferred = JSC::JSPromiseDeferred::create(&state, globalObject);
> 
> Should be a reference. It can’t be null.

ok
Comment 4 youenn fablet 2015-07-06 00:12:14 PDT
Created attachment 256197 [details]
Patch for landing
Comment 5 WebKit Commit Bot 2015-07-06 01:11:29 PDT
Comment on attachment 256197 [details]
Patch for landing

Clearing flags on attachment: 256197

Committed r186312: <http://trac.webkit.org/changeset/186312>
Comment 6 WebKit Commit Bot 2015-07-06 01:11:33 PDT
All reviewed patches have been landed.  Closing bug.