Exception in console and broken right click after attempting to show context menu...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Apr 2015 06:34:07 +0000 (06:34 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Apr 2015 06:34:07 +0000 (06:34 +0000)
https://bugs.webkit.org/show_bug.cgi?id=143556

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2015-04-08
Reviewed by Brady Eidson.

* Shared/mac/NativeContextMenuItem.mm:
(WebKit::NativeContextMenuItem::NativeContextMenuItem):
Add an ASSERT to immediately catch a menu item created with a nil native menu item.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::internalShowContextMenu):
Gracefully handle a null share context menu item.

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

Source/WebKit2/ChangeLog
Source/WebKit2/Shared/mac/NativeContextMenuItem.mm
Source/WebKit2/UIProcess/WebPageProxy.cpp

index 8e5fbf0461edc61d85acf849ed9e9f5c2cb3dbd7..91c5644915c4caceb28485c5f97c072296ae20dc 100644 (file)
@@ -1,3 +1,18 @@
+2015-04-08  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Exception in console and broken right click after attempting to show context menu in Inspector
+        https://bugs.webkit.org/show_bug.cgi?id=143556
+
+        Reviewed by Brady Eidson.
+
+        * Shared/mac/NativeContextMenuItem.mm:
+        (WebKit::NativeContextMenuItem::NativeContextMenuItem):
+        Add an ASSERT to immediately catch a menu item created with a nil native menu item.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::internalShowContextMenu):
+        Gracefully handle a null share context menu item.
+
 2015-04-08  Brent Fulgham  <bfulgham@apple.com>
 
         [Mac] Unreviewed test fix after r182584
index d378940072cea3a19af56f8e5f456ce514c727a3..903bd3529f77379d441c27f2e8c8790739da3ad9 100644 (file)
@@ -37,6 +37,7 @@ namespace WebKit {
 NativeContextMenuItem::NativeContextMenuItem(const ContextMenuItem& coreItem)
     : m_nsMenuItem(coreItem.platformDescription())
 {
+    ASSERT(m_nsMenuItem);
 }
 
 } // namespace WebKit
index 06f0e92c82d9480e956d92e79115fd855f7f5f5d..fb880c4822236e9bc4956986d1e4eea31c69dfb6 100644 (file)
@@ -4060,7 +4060,8 @@ void WebPageProxy::internalShowContextMenu(const IntPoint& menuLocation, const C
         }
 
         ContextMenuItem coreItem = ContextMenuItem::shareMenuItem(absoluteLinkURL, downloadableMediaURL, image.get(), contextMenuContextData.selectedText());
-        proposedAPIItems.append(WebContextMenuItem::create(coreItem));
+        if (!coreItem.isNull())
+            proposedAPIItems.append(WebContextMenuItem::create(coreItem));
     }
 
     Vector<RefPtr<WebContextMenuItem>> clientItems;