Title: [236524] trunk
Revision
236524
Author
achristen...@apple.com
Date
2018-09-26 14:52:21 -0700 (Wed, 26 Sep 2018)

Log Message

URLWithUserTypedString should return nil for URLs deemed to be invalid by WebCore::URL
https://bugs.webkit.org/show_bug.cgi?id=189979
<rdar://problem/44119696>

Reviewed by Chris Dumez.

Source/WebCore:

Covered by an API test.

* platform/mac/WebCoreNSURLExtras.mm:
(WebCore::URLWithData):

Tools:

* TestWebKitAPI/Tests/WebCore/cocoa/URLExtras.mm:
(TestWebKitAPI::TEST):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (236523 => 236524)


--- trunk/Source/WebCore/ChangeLog	2018-09-26 21:48:04 UTC (rev 236523)
+++ trunk/Source/WebCore/ChangeLog	2018-09-26 21:52:21 UTC (rev 236524)
@@ -1,3 +1,16 @@
+2018-09-26  Alex Christensen  <achristen...@webkit.org>
+
+        URLWithUserTypedString should return nil for URLs deemed to be invalid by WebCore::URL
+        https://bugs.webkit.org/show_bug.cgi?id=189979
+        <rdar://problem/44119696>
+
+        Reviewed by Chris Dumez.
+
+        Covered by an API test.
+
+        * platform/mac/WebCoreNSURLExtras.mm:
+        (WebCore::URLWithData):
+
 2018-09-26  Ryosuke Niwa  <rn...@webkit.org>
 
         Selection should work across shadow boundary when initiated by a mouse drag

Modified: trunk/Source/WebCore/platform/mac/WebCoreNSURLExtras.mm (236523 => 236524)


--- trunk/Source/WebCore/platform/mac/WebCoreNSURLExtras.mm	2018-09-26 21:48:04 UTC (rev 236523)
+++ trunk/Source/WebCore/platform/mac/WebCoreNSURLExtras.mm	2018-09-26 21:52:21 UTC (rev 236524)
@@ -853,6 +853,9 @@
     } else
         result = [NSURL URLWithString:@""];
 
+    if (!WebCore::URL(result).isValid())
+        return nil;
+    
     return result;
 }
 static NSData *dataWithUserTypedString(NSString *string)

Modified: trunk/Tools/ChangeLog (236523 => 236524)


--- trunk/Tools/ChangeLog	2018-09-26 21:48:04 UTC (rev 236523)
+++ trunk/Tools/ChangeLog	2018-09-26 21:52:21 UTC (rev 236524)
@@ -1,3 +1,14 @@
+2018-09-26  Alex Christensen  <achristen...@webkit.org>
+
+        URLWithUserTypedString should return nil for URLs deemed to be invalid by WebCore::URL
+        https://bugs.webkit.org/show_bug.cgi?id=189979
+        <rdar://problem/44119696>
+
+        Reviewed by Chris Dumez.
+
+        * TestWebKitAPI/Tests/WebCore/cocoa/URLExtras.mm:
+        (TestWebKitAPI::TEST):
+
 2018-09-26  Ryosuke Niwa  <rn...@webkit.org>
 
         Selection should work across shadow boundary when initiated by a mouse drag

Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/cocoa/URLExtras.mm (236523 => 236524)


--- trunk/Tools/TestWebKitAPI/Tests/WebCore/cocoa/URLExtras.mm	2018-09-26 21:48:04 UTC (rev 236523)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/cocoa/URLExtras.mm	2018-09-26 21:52:21 UTC (rev 236524)
@@ -192,6 +192,8 @@
 
     NSString *encodedHostName = WebCore::encodeHostName(@"http://.com");
     EXPECT_TRUE(encodedHostName == nil);
+    
+    EXPECT_TRUE(WebCore::URLWithUserTypedString(@"https://a@/b", nil) == nil);
 }
 
 TEST(WebCore, URLExtras_Nil)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to