Title: [189198] trunk
Revision
189198
Author
[email protected]
Date
2015-08-31 17:22:41 -0700 (Mon, 31 Aug 2015)

Log Message

http/tests/w3c/dom/nodes/Element-matches.html is flaky
https://bugs.webkit.org/show_bug.cgi?id=148615

Reviewed by Ryosuke Niwa.

Source/WebCore:

Several newly-imported w3c tests were flaky due to the :target
pseudo-class selectors sometimes giving different results. The
issue seems to be that this type of selector relies on the
Document::cssTarget() element to do the matching. We update
this cssTarget Element in FrameView's scrollToFragment() /
scrollToAnchor(). This is called from
scrollToFragmentWithParentBoundary() which is called by
FrameLoader's finishedParsing() and loadInSameDocument().

In the first one, it is called *after* calling checkComplete()
which fires the onload event. However, in the second method,
it is called *before*. This patch updates finishedParsing()
so that scrollToFragmentWithParentBoundary() is called *before*
firing the onload event, consistently with loadInSameDocument().
This makes sure that _javascript_ executed in an onload event
handler will get accurate results for :target pseudo-class
selectors.

No new tests, covered by:
http/tests/w3c/dom/nodes/Element-matches.html
http/tests/w3c/dom/nodes/ParentNode-querySelector-All-xhtml.xhtml

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::finishedParsing):

LayoutTests:

Unskip the tests and rebaseline them now that the target pseudo selector
checks are consistently passing.

* TestExpectations:
* http/tests/w3c/dom/nodes/Element-matches-expected.txt:
* http/tests/w3c/dom/nodes/ParentNode-querySelector-All-expected.txt:
* http/tests/w3c/dom/nodes/ParentNode-querySelector-All-xhtml-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (189197 => 189198)


--- trunk/LayoutTests/ChangeLog	2015-09-01 00:05:29 UTC (rev 189197)
+++ trunk/LayoutTests/ChangeLog	2015-09-01 00:22:41 UTC (rev 189198)
@@ -1,3 +1,18 @@
+2015-08-31  Chris Dumez  <[email protected]>
+
+        http/tests/w3c/dom/nodes/Element-matches.html is flaky
+        https://bugs.webkit.org/show_bug.cgi?id=148615
+
+        Reviewed by Ryosuke Niwa.
+
+        Unskip the tests and rebaseline them now that the target pseudo selector
+        checks are consistently passing.
+
+        * TestExpectations:
+        * http/tests/w3c/dom/nodes/Element-matches-expected.txt:
+        * http/tests/w3c/dom/nodes/ParentNode-querySelector-All-expected.txt:
+        * http/tests/w3c/dom/nodes/ParentNode-querySelector-All-xhtml-expected.txt:
+
 2015-08-31  Alexey Proskuryakov  <[email protected]>
 
         Skip Web Inspector debugger tests more thoroughly.

Modified: trunk/LayoutTests/TestExpectations (189197 => 189198)


--- trunk/LayoutTests/TestExpectations	2015-09-01 00:05:29 UTC (rev 189197)
+++ trunk/LayoutTests/TestExpectations	2015-09-01 00:22:41 UTC (rev 189198)
@@ -222,10 +222,6 @@
 webkit.org/b/148546 [ Debug ] http/tests/w3c/dom/ranges/Range-mutations.html [ Skip ]
 webkit.org/b/148546 [ Debug ] http/tests/w3c/dom/ranges/Range-set.html [ Skip ]
 
-# Newly imported W3C DOM tests that are flaky.
-webkit.org/b/148615 http/tests/w3c/dom/nodes/Element-matches.html [ Failure Pass ]
-webkit.org/b/148638 http/tests/w3c/dom/nodes/ParentNode-querySelector-All-xhtml.xhtml [ Failure Pass ]
-
 # @supports W3C Failures
 webkit.org/b/137566 css3/conditional/w3c/at-supports-010.html [ ImageOnlyFailure ]
 webkit.org/b/137568 css3/conditional/w3c/at-supports-014.html [ ImageOnlyFailure ]

Modified: trunk/LayoutTests/http/tests/w3c/dom/nodes/Element-matches-expected.txt (189197 => 189198)


--- trunk/LayoutTests/http/tests/w3c/dom/nodes/Element-matches-expected.txt	2015-09-01 00:05:29 UTC (rev 189197)
+++ trunk/LayoutTests/http/tests/w3c/dom/nodes/Element-matches-expected.txt	2015-09-01 00:22:41 UTC (rev 189198)
@@ -171,7 +171,7 @@
 PASS In-document Element.matches: :empty pseudo-class selector, matching all empty elements (with no refNodes): #pseudo-empty :empty 
 PASS In-document Element.matches: :link and :visited pseudo-class selectors, matching a and area elements with href attributes (with no refNodes): #pseudo-link :link, #pseudo-link :visited 
 PASS In-document Element.matches: :link and :visited pseudo-class selectors, matching link elements with href attributes (with no refNodes): #head :link, #head :visited 
-FAIL In-document Element.matches: :target pseudo-class selector, matching the element referenced by the URL fragment identifier (with no refNodes): :target assert_true: The element #target should match the selector. expected true got false
+PASS In-document Element.matches: :target pseudo-class selector, matching the element referenced by the URL fragment identifier (with no refNodes): :target 
 PASS In-document Element.matches: :lang pseudo-class selector, matching inherited language (with no refNodes): #pseudo-lang-div1:lang(en) 
 PASS In-document Element.matches: :lang pseudo-class selector, matching specified language with exact value (with no refNodes): #pseudo-lang-div2:lang(fr) 
 PASS In-document Element.matches: :lang pseudo-class selector, matching specified language with partial value (with no refNodes): #pseudo-lang-div3:lang(en) 

Modified: trunk/LayoutTests/http/tests/w3c/dom/nodes/ParentNode-querySelector-All-expected.txt (189197 => 189198)


--- trunk/LayoutTests/http/tests/w3c/dom/nodes/ParentNode-querySelector-All-expected.txt	2015-09-01 00:05:29 UTC (rev 189197)
+++ trunk/LayoutTests/http/tests/w3c/dom/nodes/ParentNode-querySelector-All-expected.txt	2015-09-01 00:22:41 UTC (rev 189198)
@@ -553,8 +553,8 @@
 PASS Document.querySelector: :link and :visited pseudo-class selectors, matching a and area elements with href attributes: #pseudo-link :link, #pseudo-link :visited 
 PASS Document.querySelectorAll: :link and :visited pseudo-class selectors, matching link elements with href attributes: #head :link, #head :visited 
 PASS Document.querySelector: :link and :visited pseudo-class selectors, matching link elements with href attributes: #head :link, #head :visited 
-FAIL Document.querySelectorAll: :target pseudo-class selector, matching the element referenced by the URL fragment identifier: :target assert_equals: The method should return the expected number of matches. expected 1 but got 0
-FAIL Document.querySelector: :target pseudo-class selector, matching the element referenced by the URL fragment identifier: :target assert_not_equals: The method should return a match. got disallowed value null
+PASS Document.querySelectorAll: :target pseudo-class selector, matching the element referenced by the URL fragment identifier: :target 
+PASS Document.querySelector: :target pseudo-class selector, matching the element referenced by the URL fragment identifier: :target 
 PASS Document.querySelectorAll: :lang pseudo-class selector, matching inherited language: #pseudo-lang-div1:lang(en) 
 PASS Document.querySelector: :lang pseudo-class selector, matching inherited language: #pseudo-lang-div1:lang(en) 
 PASS Document.querySelectorAll: :lang pseudo-class selector, matching specified language with exact value: #pseudo-lang-div2:lang(fr) 
@@ -1803,8 +1803,8 @@
 PASS In-document Element.querySelector: :link and :visited pseudo-class selectors, not matching link elements with href attributes: #head :link, #head :visited 
 PASS In-document Element.querySelectorAll: :link and :visited pseudo-class selectors, chained, mutually exclusive pseudo-classes match nothing: :link:visited 
 PASS In-document Element.querySelector: :link and :visited pseudo-class selectors, chained, mutually exclusive pseudo-classes match nothing: :link:visited 
-FAIL In-document Element.querySelectorAll: :target pseudo-class selector, matching the element referenced by the URL fragment identifier: :target assert_equals: The method should return the expected number of matches. expected 1 but got 0
-FAIL In-document Element.querySelector: :target pseudo-class selector, matching the element referenced by the URL fragment identifier: :target assert_not_equals: The method should return a match. got disallowed value null
+PASS In-document Element.querySelectorAll: :target pseudo-class selector, matching the element referenced by the URL fragment identifier: :target 
+PASS In-document Element.querySelector: :target pseudo-class selector, matching the element referenced by the URL fragment identifier: :target 
 PASS In-document Element.querySelectorAll: :lang pseudo-class selector, matching inherited language: #pseudo-lang-div1:lang(en) 
 PASS In-document Element.querySelector: :lang pseudo-class selector, matching inherited language: #pseudo-lang-div1:lang(en) 
 PASS In-document Element.querySelectorAll: :lang pseudo-class selector, matching specified language with exact value: #pseudo-lang-div2:lang(fr) 

Modified: trunk/LayoutTests/http/tests/w3c/dom/nodes/ParentNode-querySelector-All-xhtml-expected.txt (189197 => 189198)


--- trunk/LayoutTests/http/tests/w3c/dom/nodes/ParentNode-querySelector-All-xhtml-expected.txt	2015-09-01 00:05:29 UTC (rev 189197)
+++ trunk/LayoutTests/http/tests/w3c/dom/nodes/ParentNode-querySelector-All-xhtml-expected.txt	2015-09-01 00:22:41 UTC (rev 189198)
@@ -553,8 +553,8 @@
 PASS Document.querySelector: :link and :visited pseudo-class selectors, matching a and area elements with href attributes: #pseudo-link :link, #pseudo-link :visited 
 PASS Document.querySelectorAll: :link and :visited pseudo-class selectors, matching link elements with href attributes: #head :link, #head :visited 
 PASS Document.querySelector: :link and :visited pseudo-class selectors, matching link elements with href attributes: #head :link, #head :visited 
-FAIL Document.querySelectorAll: :target pseudo-class selector, matching the element referenced by the URL fragment identifier: :target assert_equals: The method should return the expected number of matches. expected 1 but got 0
-FAIL Document.querySelector: :target pseudo-class selector, matching the element referenced by the URL fragment identifier: :target assert_not_equals: The method should return a match. got disallowed value null
+PASS Document.querySelectorAll: :target pseudo-class selector, matching the element referenced by the URL fragment identifier: :target 
+PASS Document.querySelector: :target pseudo-class selector, matching the element referenced by the URL fragment identifier: :target 
 PASS Document.querySelectorAll: :lang pseudo-class selector, matching inherited language: #pseudo-lang-div1:lang(en) 
 PASS Document.querySelector: :lang pseudo-class selector, matching inherited language: #pseudo-lang-div1:lang(en) 
 PASS Document.querySelectorAll: :lang pseudo-class selector, matching specified language with exact value: #pseudo-lang-div2:lang(fr) 
@@ -1803,8 +1803,8 @@
 PASS In-document Element.querySelector: :link and :visited pseudo-class selectors, not matching link elements with href attributes: #head :link, #head :visited 
 PASS In-document Element.querySelectorAll: :link and :visited pseudo-class selectors, chained, mutually exclusive pseudo-classes match nothing: :link:visited 
 PASS In-document Element.querySelector: :link and :visited pseudo-class selectors, chained, mutually exclusive pseudo-classes match nothing: :link:visited 
-FAIL In-document Element.querySelectorAll: :target pseudo-class selector, matching the element referenced by the URL fragment identifier: :target assert_equals: The method should return the expected number of matches. expected 1 but got 0
-FAIL In-document Element.querySelector: :target pseudo-class selector, matching the element referenced by the URL fragment identifier: :target assert_not_equals: The method should return a match. got disallowed value null
+PASS In-document Element.querySelectorAll: :target pseudo-class selector, matching the element referenced by the URL fragment identifier: :target 
+PASS In-document Element.querySelector: :target pseudo-class selector, matching the element referenced by the URL fragment identifier: :target 
 PASS In-document Element.querySelectorAll: :lang pseudo-class selector, matching inherited language: #pseudo-lang-div1:lang(en) 
 PASS In-document Element.querySelector: :lang pseudo-class selector, matching inherited language: #pseudo-lang-div1:lang(en) 
 PASS In-document Element.querySelectorAll: :lang pseudo-class selector, matching specified language with exact value: #pseudo-lang-div2:lang(fr) 

Modified: trunk/Source/WebCore/ChangeLog (189197 => 189198)


--- trunk/Source/WebCore/ChangeLog	2015-09-01 00:05:29 UTC (rev 189197)
+++ trunk/Source/WebCore/ChangeLog	2015-09-01 00:22:41 UTC (rev 189198)
@@ -1,3 +1,35 @@
+2015-08-31  Chris Dumez  <[email protected]>
+
+        http/tests/w3c/dom/nodes/Element-matches.html is flaky
+        https://bugs.webkit.org/show_bug.cgi?id=148615
+
+        Reviewed by Ryosuke Niwa.
+
+        Several newly-imported w3c tests were flaky due to the :target
+        pseudo-class selectors sometimes giving different results. The
+        issue seems to be that this type of selector relies on the
+        Document::cssTarget() element to do the matching. We update
+        this cssTarget Element in FrameView's scrollToFragment() /
+        scrollToAnchor(). This is called from
+        scrollToFragmentWithParentBoundary() which is called by
+        FrameLoader's finishedParsing() and loadInSameDocument().
+
+        In the first one, it is called *after* calling checkComplete()
+        which fires the onload event. However, in the second method,
+        it is called *before*. This patch updates finishedParsing()
+        so that scrollToFragmentWithParentBoundary() is called *before*
+        firing the onload event, consistently with loadInSameDocument().
+        This makes sure that _javascript_ executed in an onload event
+        handler will get accurate results for :target pseudo-class
+        selectors.
+
+        No new tests, covered by:
+        http/tests/w3c/dom/nodes/Element-matches.html
+        http/tests/w3c/dom/nodes/ParentNode-querySelector-All-xhtml.xhtml
+
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::finishedParsing):
+
 2015-08-31  Yusuke Suzuki  <[email protected]>
 
         The error handler of ReadableJSStream should own stream object

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (189197 => 189198)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2015-09-01 00:05:29 UTC (rev 189197)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2015-09-01 00:22:41 UTC (rev 189198)
@@ -753,6 +753,8 @@
 
     m_client.dispatchDidFinishDocumentLoad();
 
+    scrollToFragmentWithParentBoundary(m_frame.document()->url());
+
     checkCompleted();
 
     if (!m_frame.view())
@@ -761,7 +763,6 @@
     // Check if the scrollbars are really needed for the content.
     // If not, remove them, relayout, and repaint.
     m_frame.view()->restoreScrollbar();
-    scrollToFragmentWithParentBoundary(m_frame.document()->url());
 }
 
 void FrameLoader::loadDone()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to