Bug 1440827 - Cancel preloaded requests if we decide not to use them. r=baku, a=jcristau
authorJon Coppeard <jcoppeard@mozilla.com>
Thu, 29 Mar 2018 17:11:41 +0100
changeset 460854 91c3fd61b7cbfdae098597dd6846ae5a04451992
parent 460853 e01db642d00735eb47413dde4a8259d827fedfdb
child 460855 60f1019b5235bae9fdfe17957a8e90aab09fe1b0
push id9078
push userryanvm@gmail.com
push dateTue, 17 Apr 2018 16:51:51 +0000
treeherdermozilla-beta@652cff2a5a79 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku, jcristau
bugs1440827
milestone60.0
Bug 1440827 - Cancel preloaded requests if we decide not to use them. r=baku, a=jcristau
dom/html/crashtests/1440827.html
dom/script/ScriptLoader.cpp
new file mode 100644
--- /dev/null
+++ b/dom/html/crashtests/1440827.html
@@ -0,0 +1,6 @@
+<html>
+<head>
+<meta charset="UTF-8">
+>
+<meta content='referrer no-referrer;manifest-src self http:' http-equiv='Content-Security-Policy'>
+<script src='http://zzzzzz.z'></script>
--- a/dom/script/ScriptLoader.cpp
+++ b/dom/script/ScriptLoader.cpp
@@ -1614,16 +1614,17 @@ ScriptLoader::LookupPreloadRequest(nsISc
   // we have now.
   nsAutoString elementCharset;
   aElement->GetScriptCharset(elementCharset);
   if (!elementCharset.Equals(preloadCharset) ||
       aElement->GetCORSMode() != request->mCORSMode ||
       mDocument->GetReferrerPolicy() != request->mReferrerPolicy ||
       aScriptKind != request->mKind) {
     // Drop the preload.
+    request->Cancel();
     AccumulateCategorical(LABELS_DOM_SCRIPT_PRELOAD_RESULT::RequestMismatch);
     return nullptr;
   }
 
   return request;
 }
 
 void