Bug 84628 - "Not enough arguments" error should be TypeError
Summary: "Not enough arguments" error should be TypeError
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: 84074
  Show dependency treegraph
 
Reported: 2012-04-23 13:41 PDT by Kentaro Hara
Modified: 2012-04-28 03:31 PDT (History)
8 users (show)

See Also:


Attachments
Patch (13.74 KB, patch)
2012-04-23 14:03 PDT, Kentaro Hara
no flags Details | Formatted Diff | Diff
Patch (19.78 KB, patch)
2012-04-23 16:17 PDT, Kentaro Hara
darin: commit-queue-
Details | Formatted Diff | Diff
test cases (996 bytes, text/html)
2012-04-24 11:21 PDT, Kentaro Hara
no flags Details
patch for landing (19.54 KB, patch)
2012-04-27 19:28 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-04-23 13:41:54 PDT
Currently, some custom bindings implement "Not enough arguments" error as SyntaxError. The Web IDL spec requires that it should be TypeError:
http://www.w3.org/TR/WebIDL/#dfn-overload-resolution-algorithm
Comment 1 Kentaro Hara 2012-04-23 14:03:50 PDT
Created attachment 138422 [details]
Patch
Comment 2 Darin Adler 2012-04-23 15:22:15 PDT
Comment on attachment 138422 [details]
Patch

Test coverage is insufficient. There are 5 call sites in JS bindings modified, but only three test results changing. We need a test that covers each affected call site.
Comment 3 Kentaro Hara 2012-04-23 16:17:28 PDT
Created attachment 138451 [details]
Patch
Comment 4 Kentaro Hara 2012-04-23 16:18:05 PDT
(In reply to comment #2)
> (From update of attachment 138422 [details])
> Test coverage is insufficient. There are 5 call sites in JS bindings modified, but only three test results changing. We need a test that covers each affected call site.

darin: Thanks. Added test cases.
Comment 5 Kentaro Hara 2012-04-24 10:42:05 PDT
I believe that the current behavior is just due to mis-implementation of custom bindings, but let me confirm other browsers' behaviors.
Comment 6 Alexey Proskuryakov 2012-04-24 10:54:51 PDT
I'm not particularly concerned about this change, because we've been already raising an exception, and sites hardly ever check for specific exception type.

Checking other browsers is worth doing anyway.
Comment 7 Kentaro Hara 2012-04-24 11:21:39 PDT
Created attachment 138606 [details]
test cases
Comment 8 Kentaro Hara 2012-04-24 11:22:31 PDT
Opera 11.62:
WebSocket is not defined.
WebSocket is not defined.
XMLHttpRequest.open(): Error: WRONG_ARGUMENTS_ERR
SVGLength.convertToSpecifiedUnits(): Error: WRONG_ARGUMENTS_ERR

Firefox 11.0:
new WebSocket(): [Exception... "An invalid or illegal string was specified" code: "12" nsresult: "0x8053000c (NS_ERROR_DOM_SYNTAX_ERR)" location: "http://www.corp.google.com/~haraken/null/typeerror.html Line: 12"]
WebSocket.send(): [Exception... "Not enough arguments" nsresult: "0x80570001 (NS_ERROR_XPC_NOT_ENOUGH_ARGS)" location: "JS frame :: http://www.corp.google.com/~haraken/null/typeerror.html :: :: line 23" data: no]
XMLHttpRequest.open(): [Exception... "Not enough arguments" nsresult: "0x80570001 (NS_ERROR_XPC_NOT_ENOUGH_ARGS)" location: "JS frame :: http://www.corp.google.com/~haraken/null/typeerror.html :: :: line 34" data: no]
SVGLength.convertToSpecifiedUnits(): [Exception... "Not enough arguments [nsIDOMSVGLength.convertToSpecifiedUnits]" nsresult: "0x80570001 (NS_ERROR_XPC_NOT_ENOUGH_ARGS)" location: "JS frame :: http://www.corp.google.com/~haraken/null/typeerror.html :: :: line 46" data: no]
Comment 9 Kentaro Hara 2012-04-27 13:33:30 PDT
darin, ap: review?
Comment 10 Darin Adler 2012-04-27 18:24:15 PDT
Comment on attachment 138451 [details]
Patch

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

> LayoutTests/ChangeLog:31
> +2012-04-23  Kentaro Hara  <haraken@chromium.org>
> +
> +
> +        * http/tests/websocket/tests/hixie76/send-empty-expected.txt:
> +        * http/tests/websocket/tests/hybi/send-empty-expected.txt:
> +        * svg/dom/SVGLength-expected.txt:

Extra stray change log here.
Comment 11 Kentaro Hara 2012-04-27 19:28:37 PDT
Created attachment 139324 [details]
patch for landing
Comment 12 WebKit Review Bot 2012-04-27 20:29:45 PDT
Comment on attachment 139324 [details]
patch for landing

Clearing flags on attachment: 139324

Committed r115533: <http://trac.webkit.org/changeset/115533>