Title: [193499] trunk/Source/WebKit2
Revision
193499
Author
ander...@apple.com
Date
2015-12-04 17:45:27 -0800 (Fri, 04 Dec 2015)

Log Message

Crash when secondary clicking on a link on yahoo.com
https://bugs.webkit.org/show_bug.cgi?id=151900
rdar://problem/23765149

Reviewed by Beth Dakin.

Don't use +[NSURL URLWithString:] since it doesn't handle invalid URLs as well as WebCore::URL.

* UIProcess/mac/WebContextMenuProxyMac.mm:
(WebKit::WebContextMenuProxyMac::createShareMenuItem):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (193498 => 193499)


--- trunk/Source/WebKit2/ChangeLog	2015-12-05 01:35:47 UTC (rev 193498)
+++ trunk/Source/WebKit2/ChangeLog	2015-12-05 01:45:27 UTC (rev 193499)
@@ -1,3 +1,16 @@
+2015-12-04  Anders Carlsson  <ander...@apple.com>
+
+        Crash when secondary clicking on a link on yahoo.com
+        https://bugs.webkit.org/show_bug.cgi?id=151900
+        rdar://problem/23765149
+
+        Reviewed by Beth Dakin.
+
+        Don't use +[NSURL URLWithString:] since it doesn't handle invalid URLs as well as WebCore::URL.
+
+        * UIProcess/mac/WebContextMenuProxyMac.mm:
+        (WebKit::WebContextMenuProxyMac::createShareMenuItem):
+
 2015-12-04  Beth Dakin  <bda...@apple.com>
 
         Crash in clients using userData in 

Modified: trunk/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm (193498 => 193499)


--- trunk/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm	2015-12-05 01:35:47 UTC (rev 193498)
+++ trunk/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm	2015-12-05 01:45:27 UTC (rev 193499)
@@ -268,13 +268,15 @@
     auto items = adoptNS([[NSMutableArray alloc] init]);
 
     if (!hitTestData.absoluteLinkURL.isEmpty()) {
-        NSURL *absoluteLinkURL = [NSURL URLWithString:hitTestData.absoluteLinkURL];
-        [items addObject:absoluteLinkURL];
+        auto absoluteLinkURL = URL(ParsedURLString, hitTestData.absoluteLinkURL);
+        if (!absoluteLinkURL.isEmpty())
+            [items addObject:(NSURL *)absoluteLinkURL];
     }
 
     if (hitTestData.isDownloadableMedia && !hitTestData.absoluteMediaURL.isEmpty()) {
-        NSURL *downloadableMediaURL = [NSURL URLWithString:hitTestData.absoluteMediaURL];
-        [items addObject:downloadableMediaURL];
+        auto downloadableMediaURL = URL(ParsedURLString, hitTestData.absoluteMediaURL);
+        if (!downloadableMediaURL.isEmpty())
+            [items addObject:(NSURL *)downloadableMediaURL];
     }
 
     if (hitTestData.imageSharedMemory && hitTestData.imageSize) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to