Title: [245900] trunk
- Revision
- 245900
- Author
- [email protected]
- Date
- 2019-05-30 12:41:53 -0700 (Thu, 30 May 2019)
Log Message
[iOS] Do not linkify telephone numbers inside <a> elements.
https://bugs.webkit.org/show_bug.cgi?id=198378
Reviewed by Chris Dumez.
Source/WebCore:
Phone number linkifying mutates the DOM in a potentially unexpected way triggering different kinds of failures with JS, CSS selectors etc.
This patch tightens the linkifying rule so that content inside an <a> element won't get linkified even when the <a> has no valid href attribute.
Test: fast/dom/linkify-phone-numbers.html
* html/parser/HTMLTreeBuilder.cpp:
(WebCore::disallowTelephoneNumberParsing):
LayoutTests:
* fast/dom/linkify-phone-numbers-expected.html: Added.
* fast/dom/linkify-phone-numbers.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (245899 => 245900)
--- trunk/LayoutTests/ChangeLog 2019-05-30 19:34:19 UTC (rev 245899)
+++ trunk/LayoutTests/ChangeLog 2019-05-30 19:41:53 UTC (rev 245900)
@@ -1,3 +1,13 @@
+2019-05-30 Zalan Bujtas <[email protected]>
+
+ [iOS] Do not linkify telephone numbers inside <a> elements.
+ https://bugs.webkit.org/show_bug.cgi?id=198378
+
+ Reviewed by Chris Dumez.
+
+ * fast/dom/linkify-phone-numbers-expected.html: Added.
+ * fast/dom/linkify-phone-numbers.html: Added.
+
2019-05-30 Jer Noble <[email protected]>
Video playback in Safari should continue when CarPlay is plugged in
Modified: trunk/LayoutTests/TestExpectations (245899 => 245900)
--- trunk/LayoutTests/TestExpectations 2019-05-30 19:34:19 UTC (rev 245899)
+++ trunk/LayoutTests/TestExpectations 2019-05-30 19:41:53 UTC (rev 245900)
@@ -3101,3 +3101,6 @@
webkit.org/b/157743 imported/w3c/web-platform-tests/resize-observer/eventloop.html [ Pass Failure ]
webkit.org/b/198103 imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/offsets-into-the-media-resource/currentTime.html [ Pass Failure ]
+
+# iOS only
+fast/dom/linkify-phone-numbers.html [ ImageOnlyFailure ]
Added: trunk/LayoutTests/fast/dom/linkify-phone-numbers-expected.html (0 => 245900)
--- trunk/LayoutTests/fast/dom/linkify-phone-numbers-expected.html (rev 0)
+++ trunk/LayoutTests/fast/dom/linkify-phone-numbers-expected.html 2019-05-30 19:41:53 UTC (rev 245900)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests the most common cases of linkifying/not linkifying phone numbers on iOS</title>
+</head>
+<body>
+<a href="" 111 222">408 111 222</a><br>
+<span><a href="" 111 222">408 111 222</a></span>
+<div><a href="" 111 222">408 111 222</a></div>
+<a>408 111 222</a><br>
+<a href="" 111 222</a>
+<pre>408 111 222</pre>
+<code>408 111 222</code>
+</body>
+</html>
Added: trunk/LayoutTests/fast/dom/linkify-phone-numbers.html (0 => 245900)
--- trunk/LayoutTests/fast/dom/linkify-phone-numbers.html (rev 0)
+++ trunk/LayoutTests/fast/dom/linkify-phone-numbers.html 2019-05-30 19:41:53 UTC (rev 245900)
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests the most common cases of linkifying/not linkifying phone numbers on iOS</title>
+<script>
+if (window.internals)
+ internals.settings.setTelephoneNumberParsingEnabled(true);
+</script>
+</head>
+<body>
+408 111 222<br>
+<span>408 111 222</span>
+<div>408 111 222</div>
+<a>408 111 222</a><br>
+<a href="" 111 222</a>
+<pre>408 111 222</pre>
+<code>408 111 222</code>
+</body>
+</html>
Modified: trunk/LayoutTests/platform/ios/TestExpectations (245899 => 245900)
--- trunk/LayoutTests/platform/ios/TestExpectations 2019-05-30 19:34:19 UTC (rev 245899)
+++ trunk/LayoutTests/platform/ios/TestExpectations 2019-05-30 19:41:53 UTC (rev 245900)
@@ -2224,6 +2224,9 @@
webkit.org/b/148806 imported/w3c/web-platform-tests/css/css-multicol/multicol-span-all-block-sibling-003.xht [ ImageOnlyFailure ]
webkit.org/b/148806 imported/w3c/web-platform-tests/css/css-multicol/multicol-span-all-margin-nested-firstchild-001.xht [ ImageOnlyFailure ]
+# Enable "phone number linkifying" test for iOS
+fast/dom/linkify-phone-numbers.html [ Pass ]
+
# Enable "aria-current" test for iOS
webkit.org/b/149297 accessibility/aria-current.html [ Pass ]
Modified: trunk/Source/WebCore/ChangeLog (245899 => 245900)
--- trunk/Source/WebCore/ChangeLog 2019-05-30 19:34:19 UTC (rev 245899)
+++ trunk/Source/WebCore/ChangeLog 2019-05-30 19:41:53 UTC (rev 245900)
@@ -1,3 +1,18 @@
+2019-05-30 Zalan Bujtas <[email protected]>
+
+ [iOS] Do not linkify telephone numbers inside <a> elements.
+ https://bugs.webkit.org/show_bug.cgi?id=198378
+
+ Reviewed by Chris Dumez.
+
+ Phone number linkifying mutates the DOM in a potentially unexpected way triggering different kinds of failures with JS, CSS selectors etc.
+ This patch tightens the linkifying rule so that content inside an <a> element won't get linkified even when the <a> has no valid href attribute.
+
+ Test: fast/dom/linkify-phone-numbers.html
+
+ * html/parser/HTMLTreeBuilder.cpp:
+ (WebCore::disallowTelephoneNumberParsing):
+
2019-05-30 Truitt Savell <[email protected]>
Unreviewed, rolling out r245883.
Modified: trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp (245899 => 245900)
--- trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp 2019-05-30 19:34:19 UTC (rev 245899)
+++ trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp 2019-05-30 19:41:53 UTC (rev 245900)
@@ -2258,6 +2258,7 @@
static inline bool disallowTelephoneNumberParsing(const ContainerNode& node)
{
return node.isLink()
+ || node.hasTagName(aTag)
|| node.hasTagName(scriptTag)
|| is<HTMLFormControlElement>(node)
|| node.hasTagName(styleTag)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes