Bug 1622749 - Force new documents resulting from clicking on notifications to open in tabs so we don't crash. r=nika, a=RyanVM
authorAnny Gakhokidze <agakhokidze@mozilla.com>
Tue, 14 Apr 2020 17:44:32 +0000
changeset 585539 2bb367f73d58f5b925741f296412321fc4d44f4f
parent 585538 a68b30e5ac84d13bff75288e6d1738ef3e13244c
child 585540 a3482e46d0b6af349252648d0221ae262ef38886
push id13004
push userryanvm@gmail.com
push dateWed, 15 Apr 2020 20:35:43 +0000
treeherdermozilla-beta@9d27f85c23cb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnika, RyanVM
bugs1622749
milestone76.0
Bug 1622749 - Force new documents resulting from clicking on notifications to open in tabs so we don't crash. r=nika, a=RyanVM This is a temporary solution as we don't want to permanently override users' preferences. Differential Revision: https://phabricator.services.mozilla.com/D70761
dom/clients/manager/ClientOpenWindowUtils.cpp
--- a/dom/clients/manager/ClientOpenWindowUtils.cpp
+++ b/dom/clients/manager/ClientOpenWindowUtils.cpp
@@ -234,18 +234,19 @@ void OpenWindow(const ClientOpenWindowAr
 
   nsCOMPtr<nsIBrowserDOMWindow> bwin;
   chromeWin->GetBrowserDOMWindow(getter_AddRefs(bwin));
 
   if (NS_WARN_IF(!bwin)) {
     aRv.ThrowTypeError("Unable to open window");
     return;
   }
-
-  rv = bwin->OpenURI(uri, nullptr, nsIBrowserDOMWindow::OPEN_DEFAULTWINDOW,
+  // annyG: This is a hack to fix bug 1622749.
+  // We will force to open new windows in tabs so we don't crash later.
+  rv = bwin->OpenURI(uri, nullptr, nsIBrowserDOMWindow::OPEN_NEWTAB,
                      nsIBrowserDOMWindow::OPEN_NEW, principal, csp, aBC);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     aRv.ThrowTypeError("Unable to open window");
     return;
   }
 }
 
 void WaitForLoad(const ClientOpenWindowArgs& aArgs,