Title: [263841] trunk
Revision
263841
Author
[email protected]
Date
2020-07-02 05:38:08 -0700 (Thu, 02 Jul 2020)

Log Message

Fragment navigation involving fragment identifiers does not match specification
https://bugs.webkit.org/show_bug.cgi?id=83930

Patch by Rob Buis <[email protected]> on 2020-07-02
Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Update improved test results and import scroll-frag-non-utf8-encoded-document.html.

* web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/fragment-and-encoding-2-expected.txt:
* web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/fragment-and-encoding-expected.txt:
* web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/scroll-frag-non-utf8-encoded-document-expected.txt: Added.
* web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/scroll-frag-non-utf8-encoded-document.html: Added.
* web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/scroll-to-anchor-name-expected.txt:

Source/WebCore:

Implement step 5 and 6 of [1] to allow fragment identifier lookup
using percent-decoding, after normal lookup failed.

Behavior matches Chrome and Firefox.

[1] https://html.spec.whatwg.org/multipage/browsing-the-web.html#the-indicated-part-of-the-document

Tests: imported/w3c/web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/scroll-to-anchor-name.html
       imported/w3c/web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/fragment-and-encoding-2.html
       imported/w3c/web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/fragment-and-encoding.html
       imported/w3c/web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/scroll-frag-non-utf8-encoded-document.html

* page/FrameView.cpp:
(WebCore::FrameView::scrollToFragmentInternal):

LayoutTests:

Replace anchor-frames-gbk.html by scroll-frag-non-utf8-encoded-document.html.

* http/tests/navigation/anchor-frames-gbk-expected.txt: Removed.
* http/tests/navigation/anchor-frames-gbk.html: Removed.
* http/tests/navigation/resources/frame-with-anchor-gbk.html: Removed.
* platform/ios-wk1/TestExpectations:
* platform/ios-wk2/TestExpectations:

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (263840 => 263841)


--- trunk/LayoutTests/ChangeLog	2020-07-02 10:40:48 UTC (rev 263840)
+++ trunk/LayoutTests/ChangeLog	2020-07-02 12:38:08 UTC (rev 263841)
@@ -1,3 +1,18 @@
+2020-07-02  Rob Buis  <[email protected]>
+
+        Fragment navigation involving fragment identifiers does not match specification
+        https://bugs.webkit.org/show_bug.cgi?id=83930
+
+        Reviewed by Darin Adler.
+
+        Replace anchor-frames-gbk.html by scroll-frag-non-utf8-encoded-document.html.
+
+        * http/tests/navigation/anchor-frames-gbk-expected.txt: Removed.
+        * http/tests/navigation/anchor-frames-gbk.html: Removed.
+        * http/tests/navigation/resources/frame-with-anchor-gbk.html: Removed.
+        * platform/ios-wk1/TestExpectations:
+        * platform/ios-wk2/TestExpectations:
+
 2020-07-02  Enrique Ocaña González  <[email protected]>
 
         Unreviewed GTK multimedia gardening

Deleted: trunk/LayoutTests/http/tests/navigation/anchor-frames-gbk-expected.txt (263840 => 263841)


--- trunk/LayoutTests/http/tests/navigation/anchor-frames-gbk-expected.txt	2020-07-02 10:40:48 UTC (rev 263840)
+++ trunk/LayoutTests/http/tests/navigation/anchor-frames-gbk-expected.txt	2020-07-02 12:38:08 UTC (rev 263841)
@@ -1,22 +0,0 @@
-
-
---------
-Frame: 'main'
---------
-Tests that loading a frame with a URL that contains a fragment pointed at a named anchor actually scrolls to that anchor.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS document.body.offsetHeight > document.documentElement.clientHeight is true
-PASS document.scrollingElement.scrollTop > 0 is true
-PASS document.scrollingElement.scrollTop + document.documentElement.clientHeight > 2000 is true
-PASS successfullyParsed is true
-
-TEST COMPLETE
-This is an anchor point named as the Unicode equivalent of the GBK sequence %a9g (test trailing low byte).
-
---------
-Frame: 'footer'
---------
-

Deleted: trunk/LayoutTests/http/tests/navigation/anchor-frames-gbk.html (263840 => 263841)


--- trunk/LayoutTests/http/tests/navigation/anchor-frames-gbk.html	2020-07-02 10:40:48 UTC (rev 263840)
+++ trunk/LayoutTests/http/tests/navigation/anchor-frames-gbk.html	2020-07-02 12:38:08 UTC (rev 263841)
@@ -1,14 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>
-  <!-- See resources/frame-with-anchor-gbk.html for description of test -->
-  <!-- See also https://bugs.webkit.org/show_bug.cgi?id=71316 -->
-  <script>
-    if (window.testRunner)
-        testRunner.dumpChildFramesAsText();
-  </script>
-  <frameset rows="90%,10%">
-    <frame src="" name="main">
-    <frame src="" name="footer">
-  </frameset>
-</html>

Deleted: trunk/LayoutTests/http/tests/navigation/resources/frame-with-anchor-gbk.html (263840 => 263841)


--- trunk/LayoutTests/http/tests/navigation/resources/frame-with-anchor-gbk.html	2020-07-02 10:40:48 UTC (rev 263840)
+++ trunk/LayoutTests/http/tests/navigation/resources/frame-with-anchor-gbk.html	2020-07-02 12:38:08 UTC (rev 263841)
@@ -1,41 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-  <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>
-  <script src=""
-  <script>
-    function runTest() {
-      description('Tests that loading a frame with a URL that contains a fragment pointed at a named anchor actually scrolls to that anchor.');
-
-      // Check scroll position in a timeout to make sure that the anchor has
-      // been scrolled to.
-      setTimeout(function() {
-          // Make sure that the body is taller than the viewport (i.e. scrolling is
-          // required).
-          shouldBeTrue('document.body.offsetHeight > document.documentElement.clientHeight');
-          
-          // We should be scrolled at least a little bit
-          shouldBeTrue('document.scrollingElement.scrollTop > 0');
-
-          // And the bottom of the viewable area should be at least 2000 pixels from the top, due to the spacer element above.
-          shouldBeTrue('document.scrollingElement.scrollTop + document.documentElement.clientHeight > 2000');
-
-          finishJSTest();
-      }, 0);
-    }
-
-    var jsTestIsAsync = true;
-  </script>
-</head>
-<body _onload_="runTest()">
-<p id="description"></p>
-<div id="console"></div>
-
-<div style="height: 2000px">
-  <!-- Spacer to make sure that the named anchor below requires scrolling -->
-</div>
-
-<a name="&#x586f">This is an anchor point named as the Unicode equivalent of the GBK sequence %a9g (test trailing low byte)</a>.
-<script src=""
-</body>
-</html>

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (263840 => 263841)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2020-07-02 10:40:48 UTC (rev 263840)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2020-07-02 12:38:08 UTC (rev 263841)
@@ -1,3 +1,18 @@
+2020-07-02  Rob Buis  <[email protected]>
+
+        Fragment navigation involving fragment identifiers does not match specification
+        https://bugs.webkit.org/show_bug.cgi?id=83930
+
+        Reviewed by Darin Adler.
+
+        Update improved test results and import scroll-frag-non-utf8-encoded-document.html.
+
+        * web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/fragment-and-encoding-2-expected.txt:
+        * web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/fragment-and-encoding-expected.txt:
+        * web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/scroll-frag-non-utf8-encoded-document-expected.txt: Added.
+        * web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/scroll-frag-non-utf8-encoded-document.html: Added.
+        * web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/scroll-to-anchor-name-expected.txt:
+
 2020-06-29  Chris Dumez  <[email protected]>
 
         REGRESSION(r263626): 2 imported/w3c/web-platform-tests/cors/ tests failing constantly

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/fragment-and-encoding-2-expected.txt (263840 => 263841)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/fragment-and-encoding-2-expected.txt	2020-07-02 10:40:48 UTC (rev 263840)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/fragment-and-encoding-2-expected.txt	2020-07-02 12:38:08 UTC (rev 263841)
@@ -1,5 +1,5 @@
 
-FAIL Invalid percent-encoded UTF-8 byte should decode as U+FFFD assert_greater_than: #%C2 expected a number greater than 1000 but got 0
-FAIL Percent-encoded UTF-8 BOM followed by invalid UTF-8 byte should decode as U+FEFF U+FFFD assert_greater_than: #%EF%BB%BF%C2 expected a number greater than 1000 but got 0
-FAIL Percent-encoded UTF-8 byte sequence for U+FFFD should decode as U+FFFD assert_greater_than: #%EF%BF%BD expected a number greater than 1000 but got 0
+PASS Invalid percent-encoded UTF-8 byte should decode as U+FFFD 
+PASS Percent-encoded UTF-8 BOM followed by invalid UTF-8 byte should decode as U+FEFF U+FFFD 
+PASS Percent-encoded UTF-8 byte sequence for U+FFFD should decode as U+FFFD 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/fragment-and-encoding-expected.txt (263840 => 263841)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/fragment-and-encoding-expected.txt	2020-07-02 10:40:48 UTC (rev 263840)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/fragment-and-encoding-expected.txt	2020-07-02 12:38:08 UTC (rev 263841)
@@ -1,6 +1,6 @@
 
-FAIL U+00FF should find U+00FF assert_greater_than: #%C3%BF expected a number greater than 1000 but got 0
-FAIL Percent-encoded UTF-8 BOM should find U+FEFF as BOM is not stripped when decoding assert_greater_than: #%EF%BB%BF expected a number greater than 1000 but got 0
-FAIL %FF should not find U+00FF as decoding it gives U+FFFD assert_equals: #%FF expected 0 but got 9416
+PASS U+00FF should find U+00FF 
+PASS Percent-encoded UTF-8 BOM should find U+FEFF as BOM is not stripped when decoding 
+PASS %FF should not find U+00FF as decoding it gives U+FFFD 
 PASS Valid UTF-8 + invalid UTF-8 should not be matched to the utf8-decoded former + the isomorphic-decoded latter 
 

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/scroll-frag-non-utf8-encoded-document-expected.txt (0 => 263841)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/scroll-frag-non-utf8-encoded-document-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/scroll-frag-non-utf8-encoded-document-expected.txt	2020-07-02 12:38:08 UTC (rev 263841)
@@ -0,0 +1,3 @@
+
+PASS Fragment Navigation: fragment id should not be found in non UTF8 document 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/scroll-frag-non-utf8-encoded-document.html (0 => 263841)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/scroll-frag-non-utf8-encoded-document.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/scroll-frag-non-utf8-encoded-document.html	2020-07-02 12:38:08 UTC (rev 263841)
@@ -0,0 +1,21 @@
+<!doctype html>
+<title>Fragment Navigation: fragment id should not be found in non UTF8 document</title>
+<meta name=timeout content=long>
+<meta http-equiv="Content-Type" content="text/html; charset=gbk"/>
+<script src=""
+<script src=""
+<body>
+<div></div>
+<div id="&#x586f" style="position:absolute; top:100px;"></div>
+<div style="height:200vh;"></div>
+<script>
+assert_equals(document.characterSet, "GBK", "Document should be GBK encoded");
+assert_equals(location.hash, "", "Page must be loaded with no hash");
+async_test(test => {
+  location.hash = '%89g';
+  test.step_timeout(() => {
+    assert_equals( document.scrollingElement.scrollTop, 0 );
+    test.done();
+  }, 1);
+});
+</script>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/scroll-to-anchor-name-expected.txt (263840 => 263841)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/scroll-to-anchor-name-expected.txt	2020-07-02 10:40:48 UTC (rev 263840)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/scroll-to-anchor-name-expected.txt	2020-07-02 12:38:08 UTC (rev 263841)
@@ -1,3 +1,3 @@
 
-FAIL Fragment Navigation: scroll to anchor name is lower priority than equal id assert_equals: expected 400 but got 300
+PASS Fragment Navigation: scroll to anchor name is lower priority than equal id 
 

Modified: trunk/LayoutTests/platform/ios-wk1/TestExpectations (263840 => 263841)


--- trunk/LayoutTests/platform/ios-wk1/TestExpectations	2020-07-02 10:40:48 UTC (rev 263840)
+++ trunk/LayoutTests/platform/ios-wk1/TestExpectations	2020-07-02 12:38:08 UTC (rev 263841)
@@ -1061,7 +1061,6 @@
 http/tests/local/formdata/send-form-data-with-string-containing-null.html
 http/tests/navigation/anchor-basic.html
 http/tests/navigation/anchor-frames-cross-origin.html
-http/tests/navigation/anchor-frames-gbk.html
 http/tests/security/contentSecurityPolicy/media-src-blocked.html
 http/tests/security/contentSecurityPolicy/media-src-track-block.html
 http/tests/security/inactive-document-with-empty-security-origin.html

Modified: trunk/LayoutTests/platform/ios-wk2/TestExpectations (263840 => 263841)


--- trunk/LayoutTests/platform/ios-wk2/TestExpectations	2020-07-02 10:40:48 UTC (rev 263840)
+++ trunk/LayoutTests/platform/ios-wk2/TestExpectations	2020-07-02 12:38:08 UTC (rev 263841)
@@ -323,7 +323,6 @@
 http/tests/misc/iframe404.html [ Failure ]
 http/tests/misc/redirect-to-external-url.html [ Failure ]
 http/tests/misc/slow-loading-image-in-pattern.html [ Failure ]
-http/tests/navigation/anchor-frames-gbk.html [ Failure ]
 http/tests/navigation/anchor-frames-same-origin.html [ Failure ]
 http/tests/navigation/anchor-frames.html [ Failure ]
 http/tests/navigation/anchor-subframeload.html [ Failure ]

Modified: trunk/Source/WebCore/ChangeLog (263840 => 263841)


--- trunk/Source/WebCore/ChangeLog	2020-07-02 10:40:48 UTC (rev 263840)
+++ trunk/Source/WebCore/ChangeLog	2020-07-02 12:38:08 UTC (rev 263841)
@@ -1,3 +1,25 @@
+2020-07-02  Rob Buis  <[email protected]>
+
+        Fragment navigation involving fragment identifiers does not match specification
+        https://bugs.webkit.org/show_bug.cgi?id=83930
+
+        Reviewed by Darin Adler.
+
+        Implement step 5 and 6 of [1] to allow fragment identifier lookup
+        using percent-decoding, after normal lookup failed.
+
+        Behavior matches Chrome and Firefox.
+
+        [1] https://html.spec.whatwg.org/multipage/browsing-the-web.html#the-indicated-part-of-the-document
+
+        Tests: imported/w3c/web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/scroll-to-anchor-name.html
+               imported/w3c/web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/fragment-and-encoding-2.html
+               imported/w3c/web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/fragment-and-encoding.html
+               imported/w3c/web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid/scroll-frag-non-utf8-encoded-document.html
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::scrollToFragmentInternal):
+
 2020-07-02  Alexander Mikhaylenko  <[email protected]>
 
         [GTK] Kinetic scrolling is still triggered if you wait before lifting fingers

Modified: trunk/Source/WebCore/page/FrameView.cpp (263840 => 263841)


--- trunk/Source/WebCore/page/FrameView.cpp	2020-07-02 10:40:48 UTC (rev 263840)
+++ trunk/Source/WebCore/page/FrameView.cpp	2020-07-02 12:38:08 UTC (rev 263841)
@@ -2181,11 +2181,8 @@
     if (scrollToFragmentInternal(fragmentIdentifier.toString()))
         return true;
 
-    // Try again after decoding the ref, based on the document's encoding.
-    if (TextResourceDecoder* decoder = frame().document()->decoder()) {
-        if (scrollToFragmentInternal(decodeURLEscapeSequences(fragmentIdentifier, decoder->encoding())))
-            return true;
-    }
+    if (scrollToFragmentInternal(decodeURLEscapeSequences(fragmentIdentifier)))
+        return true;
 
     resetScrollAnchor();
     return false;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to