Bug 1637039 - Adjust `PreloaderBase::NotifyStart` to read channel tainting also for non-opened preloads, r=edgar
authorHonza Bambas <honzab.moz@firemni.cz>
Mon, 25 May 2020 18:38:36 +0000
changeset 532063 059e7a42f158f5d713f4ddca4a5c54e5d3d92984
parent 532062 0c679f6566dcab8f42e04adc8ffd64d7b654b088
child 532064 bfe7e80e784a9881a006fae690447a8af6959cb1
push id37449
push userncsoregi@mozilla.com
push dateTue, 26 May 2020 02:38:57 +0000
treeherdermozilla-central@da2c7b0ac9a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersedgar
bugs1637039
milestone78.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 1637039 - Adjust `PreloaderBase::NotifyStart` to read channel tainting also for non-opened preloads, r=edgar Differential Revision: https://phabricator.services.mozilla.com/D76362
uriloader/preload/PreloaderBase.cpp
--- a/uriloader/preload/PreloaderBase.cpp
+++ b/uriloader/preload/PreloaderBase.cpp
@@ -162,21 +162,24 @@ void PreloaderBase::NotifyRestart(dom::D
   mKey = PreloadHashKey();
 
   if (aNewPreloader) {
     aNewPreloader->mNodes = std::move(mNodes);
   }
 }
 
 void PreloaderBase::NotifyStart(nsIRequest* aRequest) {
-  if (!SameCOMIdentity(aRequest, mChannel)) {
+  // If there is no channel assigned on this preloader, we are not between
+  // channel switching, so we can freely update the mShouldFireLoadEvent using
+  // the given channel.
+  if (mChannel && !SameCOMIdentity(aRequest, mChannel)) {
     return;
   }
 
-  nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(mChannel);
+  nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(aRequest);
   if (!httpChannel) {
     return;
   }
 
   // if the load is cross origin without CORS, or the CORS access is rejected,
   // always fire load event to avoid leaking site information.
   nsresult rv;
   nsCOMPtr<nsILoadInfo> loadInfo = httpChannel->LoadInfo();