Bug 66274

Summary: "new EventSource()" should throw SYNTAX_ERR when an invalid argument is passed
Product: WebKit Reporter: Kentaro Hara <haraken>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: abarth, ap, dominicc
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch abarth: review-

Description Kentaro Hara 2011-08-15 21:56:25 PDT
A Web IDL Constructor extended attribute should be implemented in V8 (bug 65839). We are going to split the patch for bug 65839 into the following eleven steps in order to avoid regressions. 

This patch is for [1]. Spec: http://dev.w3.org/html5/eventsource/#the-eventsource-interface

[1] "new EventSource()" should throw SYNTAX_ERR when an invalid argument is passed.
[2] "new SharedWorker()" should throw SYNTAX_ERR when an invalid argument is passed.
[3] "new WebKitCSSMatrix()" should throw SYNTAX_ERR when an invalid argument is passed.
[4] "new Worker()" should throw SYNTAX_ERR when an invalid argument is passed.
[5] Implement the Web IDL Constructor extended attribute in IDLParser.pm and CodeGeneratorV8.pm.
[6] Replace the EventSource constructor in V8 with the Web IDL Constructor extended attribute.
[7] Replace the FileReader constructor in V8 with the Web IDL Constructor extended attribute.
[8] Replace the SharedWorker constructor in V8 with the Web IDL Constructor extended attribute.
[9] Replace the WebKitCSSMatrix constructor in V8 with the Web IDL Constructor extended attribute.
[10] Replace the Worker constructor in V8 with the Web IDL Constructor extended attribute.
[11] Replace the XSLTProcessor constructor in V8 with the Web IDL Constructor extended attribute.

Dependencies: [6][7][8][9][10][11] depends on [1][2][3][4][5]. We can land [1][2][3][4][5] concurrently, and then can land [6][7][8][9][10][11] concurrently.
Comment 1 Kentaro Hara 2011-08-15 23:57:33 PDT
Created attachment 104011 [details]
Patch
Comment 2 Adam Barth 2011-08-16 11:11:19 PDT
Comment on attachment 104011 [details]
Patch

This patch does not appear correct, see:

http://www.w3.org/TR/WebIDL/#es-DOMString

In the null-or-undefined case, we hit step 3, which gives use "null" or "undefined", which is a valid relative URL.  Therefore, we shouldn't throw a SYNTAX_ERROR in that case.
Comment 3 Dominic Cooney 2011-08-16 17:45:16 PDT
Comment on attachment 104011 [details]
Patch

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

> LayoutTests/fast/eventsource/eventsource-constructor-exceptions-expected.txt:1
> +This tests an exception thrown by the EventSource constructor. This test cannot run interactively.

Nit: Why can’t this run interactively?
Comment 4 Kentaro Hara 2011-08-18 00:54:58 PDT
(In reply to comment #2)
> (From update of attachment 104011 [details])
> This patch does not appear correct, see:
> 
> http://www.w3.org/TR/WebIDL/#es-DOMString
> 
> In the null-or-undefined case, we hit step 3, which gives use "null" or "undefined", which is a valid relative URL.  Therefore, we shouldn't throw a SYNTAX_ERROR in that case.

Thank you for the information. I confirmed that this is not a bug and thus should not be fixed.
Comment 5 Alexey Proskuryakov 2011-08-23 11:28:59 PDT
You could also repurpose this bug instead filing a new one. Duping to preserve context.

*** This bug has been marked as a duplicate of bug 66454 ***