Fix parsing of <meta http-equiv=refresh> to allow time starting with a '.' without...
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Aug 2017 04:37:10 +0000 (04:37 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Aug 2017 04:37:10 +0000 (04:37 +0000)
https://bugs.webkit.org/show_bug.cgi?id=175132

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Re-sync WPT tests from upstream c8bf1bbe9296. This extends test coverage.

* web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/allow-scripts-flag-changing-1-expected.txt:
* web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/allow-scripts-flag-changing-2-expected.txt:
* web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/moving-documents-expected.txt: Removed.
* web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/parsing-expected.txt:
* web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/parsing.html:
* web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/remove-from-document-expected.txt: Added.
* web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/remove-from-document.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/moving-documents.html.
* web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/refresh.sub.html: Added.
* web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/w3c-import.log:
* web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/w3c-import.log:

Source/WebCore:

Fix parsing of <meta http-equiv=refresh> to allow time starting with a '.', without
a leading 0. This is as per https://github.com/whatwg/html/pull/2852.

The latest spec is at:
- https://html.spec.whatwg.org/multipage/semantics.html#attr-meta-http-equiv-refresh

Test: imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/parsing.html

* html/parser/HTMLParserIdioms.cpp:
(WebCore::parseHTTPRefreshInternal):

LayoutTests:

* TestExpectations:
Mark as flaky tests that used to not run because they were missing a subresource. Now that I imported
this subresource, the tests run but are failing. When they fail, those tests are flaky due to the lines
they log.

* tests-options.json:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220252 268f45cc-cd09-0410-ab3c-d52691b4dbfc

16 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/allow-scripts-flag-changing-1-expected.txt
LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/allow-scripts-flag-changing-2-expected.txt
LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/moving-documents-expected.txt [deleted file]
LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/parsing-expected.txt
LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/parsing.html
LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/remove-from-document-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/remove-from-document.html [moved from LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/moving-documents.html with 56% similarity]
LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/refresh.sub.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/w3c-import.log
LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/w3c-import.log
LayoutTests/tests-options.json
Source/WebCore/ChangeLog
Source/WebCore/html/parser/HTMLParserIdioms.cpp

index 8ca86c5..bf5e941 100644 (file)
@@ -1,5 +1,19 @@
 2017-08-03  Chris Dumez  <cdumez@apple.com>
 
+        Fix parsing of <meta http-equiv=refresh> to allow time starting with a '.' without a leading 0
+        https://bugs.webkit.org/show_bug.cgi?id=175132
+
+        Reviewed by Darin Adler.
+
+        * TestExpectations:
+        Mark as flaky tests that used to not run because they were missing a subresource. Now that I imported
+        this subresource, the tests run but are failing. When they fail, those tests are flaky due to the lines
+        they log.
+
+        * tests-options.json:
+
+2017-08-03  Chris Dumez  <cdumez@apple.com>
+
         Multiple Layout tests from web-platform-tests/beacon/ are timing out.
         https://bugs.webkit.org/show_bug.cgi?id=175076
         <rdar://problem/33704752>
index 6e40c92..030a35f 100644 (file)
@@ -299,6 +299,10 @@ imported/w3c/web-platform-tests/IndexedDB/clone-before-keypath-eval.html [ Pass
 imported/w3c/web-platform-tests/IndexedDB/bindings-inject-key.html [ Pass Failure ]
 imported/w3c/web-platform-tests/fetch/dangling-markup-mitigation.tentative.html [ Pass Failure ]
 
+# Those WPT tests are flaky when failing.
+imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/allow-scripts-flag-changing-1.html [ Pass Failure ]
+imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/allow-scripts-flag-changing-2.html [ Pass Failure ]
+
 # css alignment tests
 webkit.org/b/172711 css3/parse-alignment-of-root-elements.html [ Failure ]
 
index 514f4f4..41bec5d 100644 (file)
@@ -1,5 +1,25 @@
 2017-08-03  Chris Dumez  <cdumez@apple.com>
 
+        Fix parsing of <meta http-equiv=refresh> to allow time starting with a '.' without a leading 0
+        https://bugs.webkit.org/show_bug.cgi?id=175132
+
+        Reviewed by Darin Adler.
+
+        Re-sync WPT tests from upstream c8bf1bbe9296. This extends test coverage.
+
+        * web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/allow-scripts-flag-changing-1-expected.txt:
+        * web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/allow-scripts-flag-changing-2-expected.txt:
+        * web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/moving-documents-expected.txt: Removed.
+        * web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/parsing-expected.txt:
+        * web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/parsing.html:
+        * web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/remove-from-document-expected.txt: Added.
+        * web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/remove-from-document.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/moving-documents.html.
+        * web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/refresh.sub.html: Added.
+        * web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/w3c-import.log:
+        * web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/w3c-import.log:
+
+2017-08-03  Chris Dumez  <cdumez@apple.com>
+
         Multiple Layout tests from web-platform-tests/beacon/ are timing out.
         https://bugs.webkit.org/show_bug.cgi?id=175076
         <rdar://problem/33704752>
index 1e786fd..10effda 100644 (file)
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: line 47: TypeError: Argument 1 ('node') to Node.appendChild must be an instance of Node
+CONSOLE MESSAGE: line 2566: Error: assert_unreached: The iframe from which the meta came from must not refresh Reached unreachable code
 
-FAIL Meta refresh is blocked by the allow-scripts sandbox flag at its creation time, not when refresh comes due TypeError: Argument 1 ('node') to Node.appendChild must be an instance of Node
+FAIL Meta refresh is blocked by the allow-scripts sandbox flag at its creation time, not when refresh comes due Error: assert_unreached: The iframe from which the meta came from must not refresh Reached unreachable code
 
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/moving-documents-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/moving-documents-expected.txt
deleted file mode 100644 (file)
index 5da208a..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-CONSOLE MESSAGE: line 42: TypeError: Argument 1 ('node') to Node.appendChild must be an instance of Node
-
-FAIL When moving between documents, must refresh the original document TypeError: Argument 1 ('node') to Node.appendChild must be an instance of Node
-
index 1927a65..ef10a57 100644 (file)
@@ -1,68 +1,75 @@
 
-Harness Error (TIMEOUT), message = null
-
-FAIL "" assert_equals: expected "refresh.sub.html" but got "{\"error\": {\"message\": \"\", \"code\": 404}}"
-TIMEOUT "1" Test timed out
-TIMEOUT "1 " Test timed out
-TIMEOUT "1\t" Test timed out
-TIMEOUT "1\r" Test timed out
-TIMEOUT "1\n" Test timed out
-TIMEOUT "1\f" Test timed out
-TIMEOUT "1;" Test timed out
-TIMEOUT "1," Test timed out
-TIMEOUT "1; url=foo" Test timed out
-TIMEOUT "1, url=foo" Test timed out
-TIMEOUT "1 url=foo" Test timed out
-TIMEOUT "1;\turl=foo" Test timed out
-TIMEOUT "1,\turl=foo" Test timed out
-TIMEOUT "1\turl=foo" Test timed out
-TIMEOUT "1;\rurl=foo" Test timed out
-TIMEOUT "1,\rurl=foo" Test timed out
-TIMEOUT "1\rurl=foo" Test timed out
-TIMEOUT "1;\nurl=foo" Test timed out
-TIMEOUT "1,\nurl=foo" Test timed out
-TIMEOUT "1\nurl=foo" Test timed out
-TIMEOUT "1;\furl=foo" Test timed out
-TIMEOUT "1,\furl=foo" Test timed out
-TIMEOUT "1\furl=foo" Test timed out
-FAIL "1url=foo" assert_equals: expected "refresh.sub.html" but got "{\"error\": {\"message\": \"\", \"code\": 404}}"
-FAIL "1x;url=foo" assert_equals: expected "refresh.sub.html" but got "{\"error\": {\"message\": \"\", \"code\": 404}}"
-TIMEOUT "1 x;url=foo" Test timed out
-TIMEOUT "1;;url=foo" Test timed out
-TIMEOUT "  1  ;  url  =  foo" Test timed out
-TIMEOUT "  1  ,  url  =  foo" Test timed out
-TIMEOUT "  1  ;  foo" Test timed out
-TIMEOUT "  1  ,  foo" Test timed out
-TIMEOUT "  1  url  =  foo" Test timed out
-TIMEOUT "1; url=foo " Test timed out
-TIMEOUT "1; url=f\to\no" Test timed out
-TIMEOUT "1; url=\"foo\"bar" Test timed out
-TIMEOUT "1; url='foo'bar" Test timed out
-TIMEOUT "1; url=\"foo'bar" Test timed out
-TIMEOUT "1; url foo" Test timed out
-TIMEOUT "1; urlfoo" Test timed out
-TIMEOUT "1; urfoo" Test timed out
-TIMEOUT "1; ufoo" Test timed out
-TIMEOUT "1; \"foo\"bar" Test timed out
-FAIL "; foo" assert_equals: expected "refresh.sub.html" but got "{\"error\": {\"message\": \"\", \"code\": 404}}"
-FAIL ", foo" assert_equals: expected "refresh.sub.html" but got "{\"error\": {\"message\": \"\", \"code\": 404}}"
-FAIL "foo" assert_equals: expected "refresh.sub.html" but got "{\"error\": {\"message\": \"\", \"code\": 404}}"
-FAIL "+1; url=foo" assert_equals: expected "refresh.sub.html" but got "{\"error\": {\"message\": \"\", \"code\": 404}}"
-FAIL "-1; url=foo" assert_equals: expected "refresh.sub.html" but got "{\"error\": {\"message\": \"\", \"code\": 404}}"
-FAIL "+0; url=foo" assert_equals: expected "refresh.sub.html" but got "{\"error\": {\"message\": \"\", \"code\": 404}}"
-FAIL "-0; url=foo" assert_equals: expected "refresh.sub.html" but got "{\"error\": {\"message\": \"\", \"code\": 404}}"
-TIMEOUT "0; url=foo" Test timed out
-FAIL "+1; foo" assert_equals: expected "refresh.sub.html" but got "{\"error\": {\"message\": \"\", \"code\": 404}}"
-FAIL "-1; foo" assert_equals: expected "refresh.sub.html" but got "{\"error\": {\"message\": \"\", \"code\": 404}}"
-FAIL "+0; foo" assert_equals: expected "refresh.sub.html" but got "{\"error\": {\"message\": \"\", \"code\": 404}}"
-FAIL "-0; foo" assert_equals: expected "refresh.sub.html" but got "{\"error\": {\"message\": \"\", \"code\": 404}}"
-TIMEOUT "0; foo" Test timed out
-FAIL "+1" assert_equals: expected "refresh.sub.html" but got "{\"error\": {\"message\": \"\", \"code\": 404}}"
-FAIL "-1" assert_equals: expected "refresh.sub.html" but got "{\"error\": {\"message\": \"\", \"code\": 404}}"
-FAIL "+0" assert_equals: expected "refresh.sub.html" but got "{\"error\": {\"message\": \"\", \"code\": 404}}"
-FAIL "-0" assert_equals: expected "refresh.sub.html" but got "{\"error\": {\"message\": \"\", \"code\": 404}}"
-TIMEOUT "0" Test timed out
-TIMEOUT "1.9; url=foo" Test timed out
-TIMEOUT "1.9..5.; url=foo" Test timed out
-FAIL ".9; url=foo" assert_equals: expected "refresh.sub.html" but got "{\"error\": {\"message\": \"\", \"code\": 404}}"
+PASS "" 
+PASS "1" 
+PASS "1 " 
+PASS "1\t" 
+PASS "1\r" 
+PASS "1\n" 
+PASS "1\f" 
+PASS "1;" 
+PASS "1," 
+PASS "1; url=foo" 
+PASS "1, url=foo" 
+PASS "1 url=foo" 
+PASS "1;\turl=foo" 
+PASS "1,\turl=foo" 
+PASS "1\turl=foo" 
+PASS "1;\rurl=foo" 
+PASS "1,\rurl=foo" 
+PASS "1\rurl=foo" 
+PASS "1;\nurl=foo" 
+PASS "1,\nurl=foo" 
+PASS "1\nurl=foo" 
+PASS "1;\furl=foo" 
+PASS "1,\furl=foo" 
+PASS "1\furl=foo" 
+PASS "1url=foo" 
+PASS "1x;url=foo" 
+PASS "1 x;url=foo" 
+PASS "1;;url=foo" 
+PASS "  1  ;  url  =  foo" 
+PASS "  1  ,  url  =  foo" 
+PASS "  1  ;  foo" 
+PASS "  1  ,  foo" 
+PASS "  1  url  =  foo" 
+PASS "1; url=foo " 
+PASS "1; url=f\to\no" 
+PASS "1; url=\"foo\"bar" 
+PASS "1; url='foo'bar" 
+PASS "1; url=\"foo'bar" 
+PASS "1; url foo" 
+PASS "1; urlfoo" 
+PASS "1; urfoo" 
+PASS "1; ufoo" 
+PASS "1; \"foo\"bar" 
+PASS "; foo" 
+PASS ";foo" 
+PASS ", foo" 
+PASS ",foo" 
+PASS "foo" 
+PASS "+1; url=foo" 
+PASS "-1; url=foo" 
+PASS "+0; url=foo" 
+PASS "-0; url=foo" 
+PASS "0; url=foo" 
+PASS "+1; foo" 
+PASS "-1; foo" 
+PASS "+0; foo" 
+PASS "-0; foo" 
+PASS "0; foo" 
+PASS "+1" 
+PASS "-1" 
+PASS "+0" 
+PASS "-0" 
+PASS "0" 
+PASS "1.9; url=foo" 
+PASS "1.9..5.; url=foo" 
+PASS ".9; url=foo" 
+PASS "0.9; url=foo" 
+PASS "0...9; url=foo" 
+PASS "0...; url=foo" 
+PASS "1e0; url=foo" 
+PASS "1e1; url=foo" 
+PASS "10e-1; url=foo" 
+PASS "-0.1; url=foo" 
 
index cbfc180..333ac8d 100644 (file)
@@ -1,5 +1,6 @@
 <!doctype html>
 <meta charset=utf-8>
+<meta name=timeout content=long>
 <title>Parsing of meta refresh</title>
 <script src=/resources/testharness.js></script>
 <script src=/resources/testharnessreport.js></script>
@@ -57,7 +58,9 @@ var tests_arr = [
   {input: '1; ufoo', expected: [1, 'ufoo']},
   {input: '1; "foo"bar', expected: [1, 'foo']},
   {input: '; foo', expected: []},
+  {input: ';foo', expected: []},
   {input: ', foo', expected: []},
+  {input: ',foo', expected: []},
   {input: 'foo', expected: []},
   {input: '+1; url=foo', expected: []},
   {input: '-1; url=foo', expected: []},
@@ -76,7 +79,14 @@ var tests_arr = [
   {input: '0', expected: [0, 'refresh.sub.html']},
   {input: '1.9; url=foo', expected: [1, 'foo']},
   {input: '1.9..5.; url=foo', expected: [1, 'foo']},
-  {input: '.9; url=foo', expected: []},
+  {input: '.9; url=foo', expected: [0, 'foo']},
+  {input: '0.9; url=foo', expected: [0, 'foo']},
+  {input: '0...9; url=foo', expected: [0, 'foo']},
+  {input: '0...; url=foo', expected: [0, 'foo']},
+  {input: '1e0; url=foo', expected: []},
+  {input: '1e1; url=foo', expected: []},
+  {input: '10e-1; url=foo', expected: []},
+  {input: '-0.1; url=foo', expected: []},
 ];
 
 tests_arr.forEach(function(test_obj) {
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/remove-from-document-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/remove-from-document-expected.txt
new file mode 100644 (file)
index 0000000..bbad626
--- /dev/null
@@ -0,0 +1,3 @@
+
+PASS A meta must refresh the original document even if it was removed. 
+
@@ -1,6 +1,6 @@
 <!DOCTYPE html>
 <meta charset="utf-8">
-<title>When moving between documents, must refresh the original document</title>
+<title>A meta must refresh the original document even if it was removed.</title>
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#attr-meta-http-equiv-refresh">
@@ -11,9 +11,7 @@
 "use strict";
 
 const sourceIFrame = document.createElement("iframe");
-const destIFrame = document.createElement("iframe");
 let sourceLoadCount = 0;
-let destLoadCount = 0;
 
 sourceIFrame.onload = () => {
   ++sourceLoadCount;
@@ -26,26 +24,13 @@ sourceIFrame.onload = () => {
   maybeStartTest();
 };
 
-destIFrame.onload = () => {
-  ++destLoadCount;
-
-  if (destLoadCount === 2) {
-    assert_unreached("The iframe into which the meta was moved must not refresh");
-  }
-
-  maybeStartTest();
-};
-
 function maybeStartTest() {
-  if (sourceLoadCount === 1 && destLoadCount === 1) {
-    const meta = sourceIFrame.contentDocument.querySelector("meta");
-    destIFrame.contentDocument.body.appendChild(meta);
+  if (sourceLoadCount === 1) {
+    sourceIFrame.contentDocument.querySelector("meta").remove();
   }
 }
 
 sourceIFrame.src = "support/refresh.sub.html?input=" + encodeURIComponent("1; url=foo");
-destIFrame.src = "support/ufoo";
 
 document.body.appendChild(sourceIFrame);
-document.body.appendChild(destIFrame);
 </script>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/refresh.sub.html b/LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/refresh.sub.html
new file mode 100644 (file)
index 0000000..bc97f29
--- /dev/null
@@ -0,0 +1 @@
+<!doctype html><meta http-equiv=refresh content="{{GET[input]}}">refresh.sub.html
index fedd678..b34b10d 100644 (file)
@@ -18,6 +18,7 @@ List of files:
 /LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/__dir__.headers
 /LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/foo
 /LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/foo'bar
+/LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/refresh.sub.html
 /LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/ufoo
 /LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/urfoo
 /LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/support/url foo
index 7595db9..1b29fd0 100644 (file)
@@ -17,6 +17,6 @@ List of files:
 /LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/allow-scripts-flag-changing-1.html
 /LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/allow-scripts-flag-changing-2.html
 /LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/dynamic-append.html
-/LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/moving-documents.html
 /LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/not-in-shadow-tree.html
 /LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/parsing.html
+/LayoutTests/imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/remove-from-document.html
index 053bedf..1409353 100644 (file)
     "imported/w3c/web-platform-tests/html/dom/reflection-text.html": [
         "slow"
     ],
+    "imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/parsing.html": [
+        "slow"
+    ],
     "imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/sizes/parse-a-sizes-attribute.html": [
         "slow"
     ],
index 7692631..e626ea7 100644 (file)
@@ -1,3 +1,21 @@
+2017-08-03  Chris Dumez  <cdumez@apple.com>
+
+        Fix parsing of <meta http-equiv=refresh> to allow time starting with a '.' without a leading 0
+        https://bugs.webkit.org/show_bug.cgi?id=175132
+
+        Reviewed by Darin Adler.
+
+        Fix parsing of <meta http-equiv=refresh> to allow time starting with a '.', without
+        a leading 0. This is as per https://github.com/whatwg/html/pull/2852.
+
+        The latest spec is at:
+        - https://html.spec.whatwg.org/multipage/semantics.html#attr-meta-http-equiv-refresh
+
+        Test: imported/w3c/web-platform-tests/html/semantics/document-metadata/the-meta-element/pragma-directives/attr-meta-http-equiv-refresh/parsing.html
+
+        * html/parser/HTMLParserIdioms.cpp:
+        (WebCore::parseHTTPRefreshInternal):
+
 2017-08-03  Brian Burg  <bburg@apple.com>
 
         Remove ENABLE(WEB_SOCKET) guards
index 490e2a8..10ebb0b 100644 (file)
@@ -360,26 +360,35 @@ static bool parseHTTPRefreshInternal(const CharacterType* position, const Charac
     while (position < end && isHTMLSpace(*position))
         ++position;
 
+    unsigned time = 0;
+
     const CharacterType* numberStart = position;
     while (position < end && isASCIIDigit(*position))
         ++position;
 
-    auto optionalNumber = parseHTMLNonNegativeInteger(StringView(numberStart, position - numberStart));
-    if (!optionalNumber)
-        return false;
+    StringView timeString(numberStart, position - numberStart);
+    if (timeString.isEmpty()) {
+        if (position >= end || *position != '.')
+            return false;
+    } else {
+        auto optionalNumber = parseHTMLNonNegativeInteger(timeString);
+        if (!optionalNumber)
+            return false;
+        time = optionalNumber.value();
+    }
 
     while (position < end && (isASCIIDigit(*position) || *position == '.'))
         ++position;
 
     if (position == end) {
-        parsedDelay = optionalNumber.value();
+        parsedDelay = time;
         return true;
     }
 
     if (*position != ';' && *position != ',' && !isHTMLSpace(*position))
         return false;
 
-    parsedDelay = optionalNumber.value();
+    parsedDelay = time;
 
     while (position < end && isHTMLSpace(*position))
         ++position;