Bug 86576 - [V8][Refactoring] Support an optional 'message' argument for throwTypeError()
Summary: [V8][Refactoring] Support an optional 'message' argument for throwTypeError()
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: 86752
Blocks: 84074
  Show dependency treegraph
 
Reported: 2012-05-15 22:33 PDT by Kentaro Hara
Modified: 2012-05-17 10:41 PDT (History)
6 users (show)

See Also:


Attachments
Patch (12.10 KB, patch)
2012-05-15 22:39 PDT, Kentaro Hara
no flags Details | Formatted Diff | Diff
Patch (16.96 KB, patch)
2012-05-17 06:51 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-05-15 22:33:03 PDT
As commented here (https://bugs.webkit.org/show_bug.cgi?id=84074#c5), I am planning to refactor a series of confusing throwError()s. 

As a first step, I replace throwTypeError() with throwTypeError("Type error"). Actually I think we should use a more descriptive error message than "Type error", but to keep the behavior of JSC and V8 consistent, this patch just uses "Type error" for now.
Comment 1 Kentaro Hara 2012-05-15 22:39:48 PDT
Created attachment 142150 [details]
Patch
Comment 2 Adam Barth 2012-05-16 19:29:59 PDT
Can we avoid repeating this string everywhere?  Perhaps we should have a header that contains constants for these strings so we don't typo them somewhere.
Comment 3 Kentaro Hara 2012-05-16 19:48:44 PDT
(In reply to comment #2)
> Can we avoid repeating this string everywhere?  Perhaps we should have a header that contains constants for these strings so we don't typo them somewhere.

Or we might want to make the 'message' argument optional, like throwTypeError(const char* message = 0). If omitted, it uses "Type error".
Comment 4 Adam Barth 2012-05-16 20:48:05 PDT
That's fine too.
Comment 5 Kentaro Hara 2012-05-17 06:51:47 PDT
Created attachment 142464 [details]
Patch
Comment 6 Adam Barth 2012-05-17 07:40:56 PDT
Comment on attachment 142464 [details]
Patch

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

> Source/WebCore/bindings/v8/V8Proxy.cpp:614
> -    return throwError(TypeError, "Type error");
> +    return throwError(TypeError, (message ? message : "Type error"));

You don't need the outer ( ) around the ? : operator.
Comment 7 Kentaro Hara 2012-05-17 07:42:44 PDT
Comment on attachment 142464 [details]
Patch

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

>> Source/WebCore/bindings/v8/V8Proxy.cpp:614
>> +    return throwError(TypeError, (message ? message : "Type error"));
> 
> You don't need the outer ( ) around the ? : operator.

Yeah, but previously some apple guy told me to put () around ?: for clarification.
Comment 8 WebKit Review Bot 2012-05-17 08:16:38 PDT
Comment on attachment 142464 [details]
Patch

Clearing flags on attachment: 142464

Committed r117448: <http://trac.webkit.org/changeset/117448>
Comment 9 WebKit Review Bot 2012-05-17 08:16:44 PDT
All reviewed patches have been landed.  Closing bug.
Comment 10 WebKit Review Bot 2012-05-17 10:39:22 PDT
Re-opened since this is blocked by 86752
Comment 11 Raphael Kubo da Costa (:rakuco) 2012-05-17 10:41:08 PDT
Sorry for the noise, the rollout was for r117449.