Bug 93226 - [V8] Replace throwError(ExceptionCode, Isolate*) with setDOMException(ExceptionCode, Isolate*) in v8/* and v8/custom/*
Summary: [V8] Replace throwError(ExceptionCode, Isolate*) with setDOMException(Excepti...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore JavaScript (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Kentaro Hara
URL:
Keywords:
Depends on:
Blocks: 93095
  Show dependency treegraph
 
Reported: 2012-08-05 23:08 PDT by Kentaro Hara
Modified: 2012-08-07 22:06 PDT (History)
6 users (show)

See Also:


Attachments
Patch (27.21 KB, patch)
2012-08-05 23:13 PDT, Kentaro Hara
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kentaro Hara 2012-08-05 23:08:01 PDT
Now throwError(ExceptionCode, Isolate*) is equivalent to setDOMException(ExceptionCode, Isolate*). We can replace the former with the latter. After this replacement, the rule becomes simple and sane: "Use throwError() for throwing JavaScript errors, use setDOMException() for throwing DOM exceptions".
Comment 1 Kentaro Hara 2012-08-05 23:13:42 PDT
Created attachment 156600 [details]
Patch
Comment 2 Kentaro Hara 2012-08-05 23:20:07 PDT
I couldn't replace throwError(ExceptionCode) with setDOMException(ExceptionCode, Isolate*) in V8Utilities::extractTransferables(), because extractTransferables() does not know an Isolate. I will upload follow-up patches to pass an Isolate to Dictionary, and then to extractTransferables().
Comment 3 Eric Seidel (no email) 2012-08-07 15:20:44 PDT
I'm not sure I understand the goal here.  I thought we were getting rid of V8Proxy?  Isn't throwError the function name used in the JSC bindings?  Don't we want to continue making the two codebases more similar?
Comment 4 Kentaro Hara 2012-08-07 15:31:35 PDT
(In reply to comment #3)
> I thought we were getting rid of V8Proxy?

Yes. I am removing unnecessary V8Proxy methods for that goal.

> Isn't throwError the function name used in the JSC bindings?  Don't we want to continue making the two codebases more similar?

V8Proxy::throwError(ErrorType, const char* message, Isolate*) still exists, and only this throwError() should exist (i.e. throwError(ExceptionCode, Isolate*) should be gone away).

Currently, DOM exceptions are thrown sometimes by throwError(ExceptionCode, Isolate*) and sometimes by setDOMException(ExceptionCode), which is inconsistent. By replacing throwError(ExceptionCode, Isolate*) with setDOMException(ExceptionCode, Isolate*), the code becomes consistent. In other words, we can use throwError(ErrorType, const char* message, Isolate*) for throwing JavaScript errors and use setDOMException(ExceptionCode, Isolate*) for throwing DOM exceptions.
Comment 5 Kentaro Hara 2012-08-07 16:47:06 PDT
(In reply to comment #4)
> > Isn't throwError the function name used in the JSC bindings?  Don't we want to continue making the two codebases more similar?
>
>  we can use throwError(ErrorType, const char* message, Isolate*) for throwing JavaScript errors and use setDOMException(ExceptionCode, Isolate*) for throwing DOM exceptions.

And I would point out that JSC already follows the rule; i.e. throwError() for JavaScript errors and setDOMException() for DOM exceptions.
Comment 6 Eric Seidel (no email) 2012-08-07 21:42:25 PDT
Comment on attachment 156600 [details]
Patch

Are we going to remove throwError(ExceptionCode?)  Is that the next patch?
Comment 7 Kentaro Hara 2012-08-07 21:44:18 PDT
(In reply to comment #6)
> (From update of attachment 156600 [details])
> Are we going to remove throwError(ExceptionCode?)  Is that the next patch?

Will be in the next of the next patch:) There is a subtle issue around Isolate and I need to solve it first.
Comment 8 WebKit Review Bot 2012-08-07 22:06:48 PDT
Comment on attachment 156600 [details]
Patch

Clearing flags on attachment: 156600

Committed r124985: <http://trac.webkit.org/changeset/124985>
Comment 9 WebKit Review Bot 2012-08-07 22:06:52 PDT
All reviewed patches have been landed.  Closing bug.