Bug 1495363 - Abort the previous request, if a form is submitted twice, r=nike
authorAndrea Marchesini <amarchesini@mozilla.com>
Wed, 16 Jan 2019 22:50:41 +0100
changeset 511319 7973453599bb4562c4a13b9a91027ac9724640ff
parent 511318 722bd413de72d9422924c052648a098ae48f3d4d
child 511320 1d6b361c337ad7b5b4fa016030f2f2aa84a76f83
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnike
bugs1495363
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1495363 - Abort the previous request, if a form is submitted twice, r=nike
uriloader/base/nsDocLoader.cpp
--- a/uriloader/base/nsDocLoader.cpp
+++ b/uriloader/base/nsDocLoader.cpp
@@ -388,23 +388,22 @@ nsDocLoader::OnStartRequest(nsIRequest* 
 
   //
   // Only fire a doStartDocumentLoad(...) if the document loader
   // has initiated a load...  Otherwise, this notification has
   // resulted from a request being added to the load group.
   //
   if (mIsLoadingDocument) {
     if (loadFlags & nsIChannel::LOAD_DOCUMENT_URI) {
-      //
-      // Make sure that the document channel is null at this point...
-      // (unless its been redirected)
-      //
-      NS_ASSERTION(
-          (loadFlags & nsIChannel::LOAD_REPLACE) || !(mDocumentRequest.get()),
-          "Overwriting an existing document channel!");
+      // If we have a document request channel, and this is not a redirect, we
+      // must abort it and replace it with the new one.
+      if (!(loadFlags & nsIChannel::LOAD_REPLACE) && mDocumentRequest) {
+        mDocumentRequest->Cancel(NS_ERROR_ABORT);
+        mDocumentRequest = nullptr;
+      }
 
       // This request is associated with the entire document...
       mDocumentRequest = request;
       mLoadGroup->SetDefaultLoadRequest(request);
 
       // Only fire the start document load notification for the first
       // document URI...  Do not fire it again for redirections
       //