Bug 1542788 - Don't allow content to cancel process-changing channels, r=valentin
authorNika Layzell <nika@thelayzells.com>
Wed, 17 Apr 2019 00:53:07 +0000
changeset 469825 273bf7c8d7609189e977a85ced9d4c0f5889c107
parent 469824 0a60df7f0a44a91bd4da6e2788952bf24c521f27
child 469826 5fde2cc9277a3d4bb73d859ba571c84fdc2ead9b
push id35883
push userbtara@mozilla.com
push dateWed, 17 Apr 2019 21:47:29 +0000
treeherdermozilla-central@02b89c29412b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvalentin
bugs1542788
milestone68.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 1542788 - Don't allow content to cancel process-changing channels, r=valentin With the process switching approach taken by frame swaps, there is some additional latency between nsDocShell teardown and when the channel is connected into the new process. This leads to the nsDocShell canceling the channel before the redirect is complete. This change should fix that. Differential Revision: https://phabricator.services.mozilla.com/D26557
netwerk/protocol/http/HttpChannelParent.cpp
--- a/netwerk/protocol/http/HttpChannelParent.cpp
+++ b/netwerk/protocol/http/HttpChannelParent.cpp
@@ -803,16 +803,22 @@ mozilla::ipc::IPCResult HttpChannelParen
     mChannel->Resume();
   }
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult HttpChannelParent::RecvCancel(const nsresult& status) {
   LOG(("HttpChannelParent::RecvCancel [this=%p]\n", this));
 
+  // Don't cancel our channel if we're doing a CrossProcessRedirect.
+  if (mDoingCrossProcessRedirect) {
+    LOG(("Child was cancelled for cross-process redirect. Skip Cancel()."));
+    return IPC_OK();
+  }
+
   // May receive cancel before channel has been constructed!
   if (mChannel) {
     mChannel->Cancel(status);
 
     // Once we receive |Cancel|, child will stop sending RecvBytesRead. Force
     // the channel resumed if needed.
     if (mSuspendedForFlowControl) {
       LOG(("  resume the channel due to e10s backpressure relief by cancel"));