Bug 1145870. r=bz, a=2.0+
authorKyle Huey <khuey@kylehuey.com>
Fri, 20 Mar 2015 19:05:56 -0700
changeset 204555 3ddabfe0bb0661698294ead456a2f904c3386f67
parent 204554 8e0185659915892e1462b94d97a6d0824e349aa8
child 204556 bd3c9050906f7dbf6e21a6f8c64f693e8c08e562
push id723
push userryanvm@gmail.com
push dateMon, 23 Mar 2015 13:55:57 +0000
treeherdermozilla-b2g32_v2_0@bd3c9050906f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz, 2
bugs1145870
milestone32.0
Bug 1145870. r=bz, a=2.0+
docshell/base/nsDocShell.cpp
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -8903,16 +8903,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;
     }
@@ -12569,17 +12571,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
@@ -12625,17 +12627,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;