Bug 42968

Summary: Browser is failing 16 baseline test from Selector API Test Suite
Product: WebKit Reporter: Abhijit <abhijitgupta312>
Component: WebCore JavaScriptAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, ademar, commit-queue, eric, hao.1.lu, jwieczorek, nokiabugz, sam, suresh.voruganti, webkit.review.bot, yael
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Windows XP   
Attachments:
Description Flags
Patch.
eric: review+
Patch, fixing the typo in querySelector. none

Description Abhijit 2010-07-26 05:09:29 PDT
WebKit (Safari and Chrome) is failing 16 of the baseline tests. 

Google Chrome Version: 5.0.375.99
Safari Version: 5.0
Webkit Version: Comes with Safari and Chrome. I am not using webkit nighly build. I downloaded Chrome and Safari browser and executed
following test. 

I found some bugs on querySelectorAll  in webkit but could not find any which could map to following bug.

Steps to reproduce:
====================

Load http://ejohn.org/apps/selectortest/#target
or
http://dev.w3.org/2006/webapi/selectors-api-testsuite/001.html#target


Actual Results
==============
16 test cases failed.

Expected Results
=================
No test cases should fail.


Additional Info
=================
This 16 test case failures also discussed in following URL
http://www.mail-archive.com/public-webapps@w3.org/msg08576.html
http://ejohn.org/blog/selectors-api-test-suite-in-ie8/#postcomment


Log
========
# 99.3%: 2148 passed, 16 failed
FAIL Element.querySelectorAll no value
FAIL Element.querySelector no value
FAIL Syntax Error: Element.querySelectorAll no value
FAIL Syntax Error: Element.querySelector no value
FAIL Disconnected Element.querySelectorAll no value
FAIL Disconnected Element.querySelector no value
FAIL Syntax Error: Disconnected Element.querySelectorAll no value
FAIL Syntax Error: Disconnected Element.querySelector no value
FAIL Fragment.querySelectorAll no value
FAIL Fragment.querySelector no value
FAIL Syntax Error: Fragment.querySelectorAll no value
FAIL Syntax Error: Fragment.querySelector no value
FAIL Document.querySelectorAll no value
FAIL Document.querySelector no value
FAIL Syntax Error: Document.querySelectorAll no value
FAIL Syntax Error: Document.querySelector no value
Comment 1 Jakub Wieczorek 2010-07-28 16:08:54 PDT
*** Bug 42975 has been marked as a duplicate of this bug. ***
Comment 2 Jakub Wieczorek 2010-07-28 16:15:38 PDT
A fix for this would be simple (add the RequiresAllArguments flag to the IDLs) but I don't think these failing test cases are valid. At least neither the Selectors API nor the WebIDL specifications specify what should happen when an argument is left out.
Comment 3 Hao Lu 2010-08-12 11:25:22 PDT
Venkat Penukonda added a comment - 12/Aug/10 11:45 AM 
These are not test case issues. Earlier version of FireFox browser (upto 3.6.8) used to fail all these 16 tests.
But they all pass with latest FireFox (4.0 Beta) version. This means, mozilla did some fixes in their latest version to pass these tests. 
Opera 10.61 also passes all these tests.

Hence, in my opinion, webkit too need to treat this as a valid bug and fix the issue.
Comment 4 Yael 2010-12-20 19:44:46 PST
(In reply to comment #2)
> A fix for this would be simple (add the RequiresAllArguments flag to the IDLs) but I don't think these failing test cases are valid. At least neither the Selectors API nor the WebIDL specifications specify what should happen when an argument is left out.

FireFox 4, IE 9 and Opera pass these tests. I think webkit based browsers should pass them too.
Comment 5 Yael 2010-12-21 07:57:34 PST
Created attachment 77113 [details]
Patch.

Throw an exception if there is no argument to querySelector or to querySelectorAll. This follows the same behavior as Firefox 4.07b, IE 9 beta and Opera 10.63.
Actually, 17 tests are failing, so after this patch, one test still fails, and it should be fixed separately.
Comment 6 Sam Weinig 2010-12-21 10:43:05 PST
I am not sure we should take this until it is worked out in the working group what the default stringification behavior is.
Comment 7 Yael 2010-12-22 17:19:27 PST
(In reply to comment #6)
> I am not sure we should take this until it is worked out in the working group what the default stringification behavior is.

WebIDL is still under discussion, however this test suite was adopted by W3C.
It is linked from http://www.w3.org/TR/selectors-api/#sotd.
And available at http://dev.w3.org/2006/webapi/selectors-api-testsuite/003.xhtml#target
Comment 8 Yael 2010-12-23 13:40:59 PST
The :target selector test is failing because when the test was brought in, setting window.location.href="#target" was commented out.
When I un-commented those 2 lines, the test passed both with Qt port and mac port.

Sam, do you remember why are those lines commented out?
Comment 9 Eric Seidel (no email) 2010-12-24 10:25:12 PST
Comment on attachment 77113 [details]
Patch.

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

Otherwise looks fine.

> WebCore/ChangeLog:8
> +        Throw an exception if there is no argument to querySelecotr or 

querySelecotr
Comment 10 Yael 2010-12-27 05:34:01 PST
Created attachment 77493 [details]
Patch, fixing the typo in querySelector.
Comment 11 WebKit Commit Bot 2010-12-27 06:11:12 PST
Comment on attachment 77493 [details]
Patch, fixing the typo in querySelector.

Clearing flags on attachment: 77493

Committed r74681: <http://trac.webkit.org/changeset/74681>
Comment 12 WebKit Review Bot 2010-12-27 07:13:38 PST
http://trac.webkit.org/changeset/74681 might have broken Leopard Intel Debug (Tests)
Comment 13 Yael 2010-12-27 08:36:45 PST
(In reply to comment #12)
> http://trac.webkit.org/changeset/74681 might have broken Leopard Intel Debug (Tests)

I think this is a false alarm.
fast/blockflow/broken-ideograph-small-caps.html is failing, but it was also failing yesterday, see <http://build.webkit.org/results/Leopard%20Intel%20Debug%20%28Tests%29/r74679%20%2825145%29/results.html> . And it is not related to the change in this patch.
Comment 14 Suresh Voruganti 2011-01-04 10:51:04 PST
Please cherry pick the fix for Qtwebkit 2.2
Comment 15 Ademar Reis 2011-01-06 10:01:11 PST
Revision r74681 cherry-picked into qtwebkit-2.2 with commit 8c22a83 <http://gitorious.org/webkit/qtwebkit/commit/8c22a83>