Bug 160906 - querySelector() / querySelectorAll() should always throw a SyntaxError when failing to parse selector string
Summary: querySelector() / querySelectorAll() should always throw a SyntaxError when f...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL: https://dom.spec.whatwg.org/#dom-pare...
Keywords: WebExposed
Depends on:
Blocks:
 
Reported: 2016-08-16 12:41 PDT by Chris Dumez
Modified: 2016-08-16 13:59 PDT (History)
10 users (show)

See Also:


Attachments
Patch (160.74 KB, patch)
2016-08-16 12:43 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2016-08-16 12:41:36 PDT
querySelector() / querySelectorAll() should always throw a SyntaxError when failing to parse selector string:
- https://dom.spec.whatwg.org/#dom-parentnode-queryselector
- https://dom.spec.whatwg.org/#scope-match-a-selectors-string

In some cases, WebKit was throwing a NamespaceError instead.
Comment 1 Chris Dumez 2016-08-16 12:43:27 PDT
Created attachment 286194 [details]
Patch
Comment 2 Ryosuke Niwa 2016-08-16 13:35:49 PDT
This seems like a risky change.
Comment 3 Chris Dumez 2016-08-16 13:36:26 PDT
(In reply to comment #2)
> This seems like a risky change.

? Throwing a different exception type ?
Comment 4 Ryosuke Niwa 2016-08-16 13:37:35 PDT
Comment on attachment 286194 [details]
Patch

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

> Source/WebCore/dom/SelectorQuery.cpp:634
> -        ec = NAMESPACE_ERR;
> +        ec = SYNTAX_ERR;

Oh, you're just changing the exception type.
Comment 5 WebKit Commit Bot 2016-08-16 13:59:36 PDT
Comment on attachment 286194 [details]
Patch

Clearing flags on attachment: 286194

Committed r204522: <http://trac.webkit.org/changeset/204522>
Comment 6 WebKit Commit Bot 2016-08-16 13:59:41 PDT
All reviewed patches have been landed.  Closing bug.