Bug 1496706 - Windows 8 doesn't return valid IInspectable when clicking toast notification. r=aklotz, a=RyanVM
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Tue, 23 Oct 2018 20:59:02 +0000
changeset 498137 48cbfa94559ec1167ed3d31f55bd025fd19b91fe
parent 498136 7f4bdb3b9a35fb04365daaf9b3d2077255efe280
child 498138 b2d0036536466f8bb4e7c32be967fe2c428924f4
push id10037
push userryanvm@gmail.com
push dateThu, 25 Oct 2018 14:35:07 +0000
treeherdermozilla-beta@6accf3af8c85 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaklotz, RyanVM
bugs1496706
milestone64.0
Bug 1496706 - Windows 8 doesn't return valid IInspectable when clicking toast notification. r=aklotz, a=RyanVM 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());