Bug 1509576 - Fix crash when showing tooltip. r=NeilDeakin, a=lizzard
authorBrendan Dahl <bdahl@mozilla.com>
Wed, 28 Nov 2018 18:42:57 +0000
changeset 501433 729dc4b0b006c47a77ce65fd129054962467d6ec
parent 501432 3bebbace6e4a76ba5c158a922b8f8b541a709e30
child 501434 cb70f86f71435d262a2686b2ff85d11bb53f4348
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersNeilDeakin, lizzard
bugs1509576
milestone64.0
Bug 1509576 - Fix crash when showing tooltip. r=NeilDeakin, a=lizzard Handle the case when there is no tooltip text provider. Differential Revision: https://phabricator.services.mozilla.com/D13105
dom/xul/XULTooltipElement.cpp
--- a/dom/xul/XULTooltipElement.cpp
+++ b/dom/xul/XULTooltipElement.cpp
@@ -85,18 +85,20 @@ XULTooltipElement::PostHandleEvent(Event
     // When the tooltip node has the "page" attribute set to "true" the
     // tooltip text provider is used to find the tooltip text from page where
     // mouse is hovering over.
     nsCOMPtr<nsITooltipTextProvider> textProvider =
       do_GetService(NS_DEFAULTTOOLTIPTEXTPROVIDER_CONTRACTID);
     nsString text;
     nsString direction;
     bool shouldChange = false;
-    textProvider->GetNodeText(GetTriggerNode(), getter_Copies(text),
-                              getter_Copies(direction), &shouldChange);
+    if (textProvider) {
+      textProvider->GetNodeText(GetTriggerNode(), getter_Copies(text),
+                                getter_Copies(direction), &shouldChange);
+    }
     if (shouldChange) {
       SetAttr(kNameSpaceID_None, nsGkAtoms::label, text, true);
       SetAttr(kNameSpaceID_None, nsGkAtoms::direction, direction, true);
     } else {
       aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
       aVisitor.mEvent->PreventDefault();
     }
   }