Bug 146585 - Promise-returning functions should reject promises if the callee is not of the expected type
Summary: Promise-returning functions should reject promises if the callee is not of th...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-03 04:44 PDT by youenn fablet
Modified: 2015-07-06 01:11 PDT (History)
2 users (show)

See Also:


Attachments
Patch (14.11 KB, patch)
2015-07-03 04:56 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch for landing (14.18 KB, patch)
2015-07-06 00:12 PDT, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.