Bug 1496706 - Windows 8 doesn't return valid IInspectable when clicking toast notification. r=aklotz
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Tue, 23 Oct 2018 20:59:02 +0000
changeset 491052 39abbcc4230bd8f4e6a6f54c5b771eff57cbb0df
parent 491046 e61ca916da324a49717d173224c8f54e30097bbe
child 491053 c3e9b06cc27d0555af93b5c8feba00614f904052
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersaklotz
bugs1496706
milestone65.0a1
Bug 1496706 - Windows 8 doesn't return valid IInspectable when clicking toast notification. r=aklotz When clicking toast notification window, OnActivate is called. When using Windows 8, 2nd parameter (IInspectable) might be nullptr. So when this parameter is nullptr, it should recognize as alertclickcallback with mClickable=true. Differential Revision: https://phabricator.services.mozilla.com/D8076
widget/windows/ToastNotificationHandler.cpp
--- a/widget/windows/ToastNotificationHandler.cpp
+++ b/widget/windows/ToastNotificationHandler.cpp
@@ -393,28 +393,31 @@ ToastNotificationHandler::CreateWindowsN
   return true;
 }
 
 HRESULT
 ToastNotificationHandler::OnActivate(IToastNotification *notification,
                                      IInspectable *inspectable)
 {
   if (mAlertListener) {
-    ComPtr<IToastActivatedEventArgs> eventArgs;
-    HRESULT hr = inspectable->QueryInterface(__uuidof(IToastActivatedEventArgs),
-                                           (void**)&eventArgs);
     nsAutoString argString;
-    if (SUCCEEDED(hr)) {
-      HSTRING arguments;
-      hr = eventArgs->get_Arguments(&arguments);
+    if (inspectable) {
+      ComPtr<IToastActivatedEventArgs> eventArgs;
+      HRESULT hr = inspectable->QueryInterface(
+                     __uuidof(IToastActivatedEventArgs),
+                     (void**)&eventArgs);
       if (SUCCEEDED(hr)) {
-        uint32_t len = 0;
-        const wchar_t* buffer = WindowsGetStringRawBuffer(arguments, &len);
-        if (buffer) {
-          argString.Assign(buffer, len);
+        HSTRING arguments;
+        hr = eventArgs->get_Arguments(&arguments);
+        if (SUCCEEDED(hr)) {
+          uint32_t len = 0;
+          const wchar_t* buffer = WindowsGetStringRawBuffer(arguments, &len);
+          if (buffer) {
+            argString.Assign(buffer, len);
+          }
         }
       }
     }
 
     if (argString.EqualsLiteral("settings")) {
       mAlertListener->Observe(nullptr, "alertsettingscallback", mCookie.get());
     } else if (argString.EqualsLiteral("snooze")) {
       mAlertListener->Observe(nullptr, "alertdisablecallback", mCookie.get());