Title: [225186] trunk/Source/WebCore
Revision
225186
Author
[email protected]
Date
2017-11-27 12:23:13 -0800 (Mon, 27 Nov 2017)

Log Message

imported/w3c/web-platform-tests/url/failure.html crashes on debug builds
https://bugs.webkit.org/show_bug.cgi?id=172337

Reviewed by Chris Dumez.

There were two problems:
1. Invalid URLs can contain non-ASCII characters in its UTF8 representation.
We should not put these URLs into content extension finite state machines.  They won't load anyways.
2. If we don't have any content extensions installed, we still call String.utf8 unnecessarily.  Let's not.

* contentextensions/ContentExtensionsBackend.cpp:
(WebCore::ContentExtensions::ContentExtensionsBackend::actionsForResourceLoad const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (225185 => 225186)


--- trunk/Source/WebCore/ChangeLog	2017-11-27 20:02:09 UTC (rev 225185)
+++ trunk/Source/WebCore/ChangeLog	2017-11-27 20:23:13 UTC (rev 225186)
@@ -1,3 +1,18 @@
+2017-11-27  Alex Christensen  <[email protected]>
+
+        imported/w3c/web-platform-tests/url/failure.html crashes on debug builds
+        https://bugs.webkit.org/show_bug.cgi?id=172337
+
+        Reviewed by Chris Dumez.
+
+        There were two problems:
+        1. Invalid URLs can contain non-ASCII characters in its UTF8 representation.
+        We should not put these URLs into content extension finite state machines.  They won't load anyways.
+        2. If we don't have any content extensions installed, we still call String.utf8 unnecessarily.  Let's not.
+
+        * contentextensions/ContentExtensionsBackend.cpp:
+        (WebCore::ContentExtensions::ContentExtensionsBackend::actionsForResourceLoad const):
+
 2017-11-27  Simon Fraser  <[email protected]>
 
         Use TextStream's indent tracking, rather than passing indent to all the externalRepresentation() functions

Modified: trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp (225185 => 225186)


--- trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp	2017-11-27 20:02:09 UTC (rev 225185)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp	2017-11-27 20:23:13 UTC (rev 225186)
@@ -76,12 +76,14 @@
 #if CONTENT_EXTENSIONS_PERFORMANCE_REPORTING
     double addedTimeStart = monotonicallyIncreasingTime();
 #endif
-    if (resourceLoadInfo.resourceURL.protocolIsData())
+    if (m_contentExtensions.isEmpty()
+        || !resourceLoadInfo.resourceURL.isValid()
+        || resourceLoadInfo.resourceURL.protocolIsData())
         return { };
 
     const String& urlString = resourceLoadInfo.resourceURL.string();
     ASSERT_WITH_MESSAGE(urlString.isAllASCII(), "A decoded URL should only contain ASCII characters. The matching algorithm assumes the input is ASCII.");
-    const CString& urlCString = urlString.utf8();
+    const auto urlCString = urlString.utf8();
 
     Vector<Action> finalActions;
     Vector<String> stylesheetIdentifiers;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to