Bug 1492484 - Do not reprioritize pushed streams on tab switch. r=kershaw
authorNicholas Hurley <hurley@mozilla.com>
Mon, 24 Sep 2018 15:16:22 +0000
changeset 437910 6341eaf530a716d406b0d84ea21c343fc1c67dd6
parent 437909 cc0cb1e1912da852b34fd63be0664bc6001e85c4
child 437911 e9f354569cc1a8cf8639131feb0368f68b80375c
push id34706
push userrgurzau@mozilla.com
push dateMon, 24 Sep 2018 22:01:48 +0000
treeherdermozilla-central@b7aa0f3bdf68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskershaw
bugs1492484
milestone64.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 1492484 - Do not reprioritize pushed streams on tab switch. r=kershaw Right now, pushed streams don't get put in the priority hierarchy anyway, and with the code as it was, we were sending an illegal PRIORITY frame for stream 0. This prevents that from happening. We should probably think about putting pushed streams in the priority hierarchy at some point. Differential Revision: https://phabricator.services.mozilla.com/D6500
netwerk/protocol/http/Http2Session.cpp
netwerk/protocol/http/Http2Stream.cpp
--- a/netwerk/protocol/http/Http2Session.cpp
+++ b/netwerk/protocol/http/Http2Session.cpp
@@ -1053,16 +1053,17 @@ Http2Session::SendPriorityFrame(uint32_t
   FlushOutputQueue();
 }
 
 char *
 Http2Session::CreatePriorityFrame(uint32_t streamID,
                                   uint32_t dependsOn,
                                   uint8_t weight)
 {
+  MOZ_ASSERT(streamID, "Priority on stream 0");
   char *packet = EnsureOutputBuffer(kFrameHeaderBytes + 5);
   CreateFrameHeader(packet, 5, FRAME_TYPE_PRIORITY, 0, streamID);
   mOutputQueueUsed += kFrameHeaderBytes + 5;
   NetworkEndian::writeUint32(packet + kFrameHeaderBytes, dependsOn); // depends on
   packet[kFrameHeaderBytes + 4] = weight; // weight
   return packet;
 }
 
--- a/netwerk/protocol/http/Http2Stream.cpp
+++ b/netwerk/protocol/http/Http2Stream.cpp
@@ -1363,17 +1363,19 @@ Http2Stream::TopLevelOuterContentWindowI
       return;
     }
 
     mPriorityDependency = GetPriorityDependencyFromTransaction(trans);
     LOG3(("Http2Stream::TopLevelOuterContentWindowIdChanged %p "
           "depends on stream 0x%X\n", this, mPriorityDependency));
   }
 
-  mSession->SendPriorityFrame(mStreamID, mPriorityDependency, mPriorityWeight);
+  if (mStreamID) {
+    mSession->SendPriorityFrame(mStreamID, mPriorityDependency, mPriorityWeight);
+  }
 }
 
 void
 Http2Stream::SetRecvdFin(bool aStatus)
 {
   mRecvdFin = aStatus ? 1 : 0;
   if (!aStatus)
     return;