URLWithUserTypedString should return nil for URLs deemed to be invalid by WebCore...
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Sep 2018 21:52:21 +0000 (21:52 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Sep 2018 21:52:21 +0000 (21:52 +0000)
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):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/mac/WebCoreNSURLExtras.mm
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebCore/cocoa/URLExtras.mm

index 1250998..7afff8e 100644 (file)
@@ -1,3 +1,16 @@
+2018-09-26  Alex Christensen  <achristensen@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  <rniwa@webkit.org>
 
         Selection should work across shadow boundary when initiated by a mouse drag
index e45fdaa..1e82b91 100644 (file)
@@ -853,6 +853,9 @@ NSURL *URLWithData(NSData *data, NSURL *baseURL)
     } else
         result = [NSURL URLWithString:@""];
 
+    if (!WebCore::URL(result).isValid())
+        return nil;
+    
     return result;
 }
 static NSData *dataWithUserTypedString(NSString *string)
index eac6d84..e4b235a 100644 (file)
@@ -1,3 +1,14 @@
+2018-09-26  Alex Christensen  <achristensen@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  <rniwa@webkit.org>
 
         Selection should work across shadow boundary when initiated by a mouse drag
index 6ffd7da..699acbb 100644 (file)
@@ -192,6 +192,8 @@ TEST(WebCore, URLExtras_ParsingError)
 
     NSString *encodedHostName = WebCore::encodeHostName(@"http://.com");
     EXPECT_TRUE(encodedHostName == nil);
+    
+    EXPECT_TRUE(WebCore::URLWithUserTypedString(@"https://a@/b", nil) == nil);
 }
 
 TEST(WebCore, URLExtras_Nil)