New issue
Advanced search Search tips

Issue 658704 link

Starred by 0 users

Issue metadata

Status: Fixed
Owner:
Closed: Dec 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Feature



Sign in to add a comment

Promise-returning DOM operations must return a reject promise instead of throwing a TypeError.

Project Member Reported by yukishiino@chromium.org, Oct 24 2016

Issue description

Web IDL specifies that DOM operations must return a reject promise and never throw an exception, however V8 throws a TypeError if the receiver object is not of type of the interface.

https://heycam.github.io/webidl/#dfn-create-operation-function
--------
3.6.7. Operations
To create an operation function
...
And then, if an exception was thrown:
  1. If the operation has a return type that is a promise type, then:
    1. Let reject be the initial value of %Promise%.reject.
    2. Return the result of calling reject with %Promise% as the this object and the exception as the single argument value.
--------

If Blink specified v8::Signature when defining v8::FunctionTemplate for a DOM operation, V8 checks the signature when the function has got called, and then V8 throws a TypeError because of mismatch of the type of |this| object.  However, we'd like to return a reject promise created from a TypeError instead.

Should V8 provide a new API to support this situation?

 
Owner: jochen@chromium.org
At the moment, assigning this to jochen@.

Status: Assigned (was: Untriaged)

Comment 3 by jochen@chromium.org, Oct 26 2016

Cc: verwa...@chromium.org
Cc: jochen@chromium.org
Owner: yukishiino@chromium.org
Status: Fixed (was: Assigned)
Toon suggested to fix this issue on Blink side, and I implemented type checking on Blink side.

Sign in to add a comment