Bug 1145870. r=bz a=lmandel
authorKyle Huey <khuey@kylehuey.com>
Fri, 20 Mar 2015 19:05:56 -0700
changeset 245480 57cc76236bd7
parent 245479 b7f14a4db45a
child 245481 96aacf3fcb79
child 245483 408da4719528
child 245484 df45b1c67169
push id693
push userkhuey@mozilla.com
push date2015-03-21 02:33 +0000
treeherdermozilla-release@57cc76236bd7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz, lmandel
bugs1145870
milestone36.0.3
Bug 1145870. r=bz a=lmandel
docshell/base/nsDocShell.cpp
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -9382,16 +9382,18 @@ nsDocShell::InternalLoad(nsIURI * aURI,
     if (!aURI) {
         return NS_ERROR_NULL_POINTER;
     }
 
     NS_ENSURE_TRUE(IsValidLoadType(aLoadType), NS_ERROR_INVALID_ARG);
 
     NS_ENSURE_TRUE(!mIsBeingDestroyed, NS_ERROR_NOT_AVAILABLE);
 
+    NS_ENSURE_TRUE(!mBlockNavigation, NS_ERROR_UNEXPECTED);
+
     // wyciwyg urls can only be loaded through history. Any normal load of
     // wyciwyg through docshell is  illegal. Disallow such loads.
     if (aLoadType & LOAD_CMD_NORMAL) {
         bool isWyciwyg = false;
         rv = aURI->SchemeIs("wyciwyg", &isWyciwyg);   
         if ((isWyciwyg && NS_SUCCEEDED(rv)) || NS_FAILED(rv)) 
             return NS_ERROR_FAILURE;
     }
@@ -13106,17 +13108,17 @@ nsDocShell::OnLinkClick(nsIContent* aCon
                         const char16_t* aTargetSpec,
                         const nsAString& aFileName,
                         nsIInputStream* aPostDataStream,
                         nsIInputStream* aHeadersDataStream,
                         bool aIsTrusted)
 {
   NS_ASSERTION(NS_IsMainThread(), "wrong thread");
 
-  if (!IsOKToLoadURI(aURI)) {
+  if (!IsOKToLoadURI(aURI) || mBlockNavigation) {
     return NS_OK;
   }
 
   // On history navigation through Back/Forward buttons, don't execute
   // automatic JavaScript redirection such as |anchorElement.click()| or
   // |formElement.submit()|.
   //
   // XXX |formElement.submit()| bypasses this checkpoint because it calls
@@ -13162,17 +13164,17 @@ nsDocShell::OnLinkClickSync(nsIContent *
   // Initialize the DocShell / Request
   if (aDocShell) {
     *aDocShell = nullptr;
   }
   if (aRequest) {
     *aRequest = nullptr;
   }
 
-  if (!IsOKToLoadURI(aURI)) {
+  if (!IsOKToLoadURI(aURI) || mBlockNavigation) {
     return NS_OK;
   }
 
   // XXX When the linking node was HTMLFormElement, it is synchronous event.
   //     That is, the caller of this method is not |OnLinkClickEvent::Run()|
   //     but |HTMLFormElement::SubmitSubmission(...)|.
   if (nsGkAtoms::form == aContent->Tag() && ShouldBlockLoadingForBackButton()) {
     return NS_OK;