Bug 1412559 - Make the "confirm repost" prompt tab modal. r=bz draft
authorJohann Hofmann <jhofmann@mozilla.com>
Wed, 08 Nov 2017 18:26:33 +0100
changeset 695038 d3426bfef38a3dba27b1d1183b5f4427cbeb7436
parent 694943 f63559d7e6a570e4e73ba367964099394248e18d
child 739500 93840b61762aebbe928013fa2632e21594268787
push id88316
push userbmo:jhofmann@mozilla.com
push dateWed, 08 Nov 2017 17:29:01 +0000
reviewersbz
bugs1412559
milestone58.0a1
Bug 1412559 - Make the "confirm repost" prompt tab modal. r=bz This is done to prevent malicious pages from abusing the feature to lock up the browser. MozReview-Commit-ID: 8Gf55nbMwCu
docshell/base/nsDocShell.cpp
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -13539,16 +13539,22 @@ nsDocShell::ConfirmRepost(bool* aRepost)
     return rv;
   }
 
   rv = appBundle->GetStringFromName("resendButton.label", button0Title);
   if (NS_FAILED(rv)) {
     return rv;
   }
 
+  // Make the repost prompt tab modal to prevent malicious pages from locking
+  // up the browser, see bug 1412559 for an example.
+  if (nsCOMPtr<nsIWritablePropertyBag2> promptBag = do_QueryInterface(prompter)) {
+    promptBag->SetPropertyAsBool(NS_LITERAL_STRING("allowTabModal"), true);
+  }
+
   int32_t buttonPressed;
   // The actual value here is irrelevant, but we can't pass an invalid
   // bool through XPConnect.
   bool checkState = false;
   rv = prompter->ConfirmEx(
     nullptr, msgString.get(),
     (nsIPrompt::BUTTON_POS_0 * nsIPrompt::BUTTON_TITLE_IS_STRING) +
       (nsIPrompt::BUTTON_POS_1 * nsIPrompt::BUTTON_TITLE_CANCEL),