Bug 1484373: Follow-up: Fix null deref. r=bustage CLOSED TREE
authorKris Maglione <maglione.k@gmail.com>
Thu, 23 Aug 2018 16:05:55 -0700
changeset 488343 eef3785a6b441e83d392c2569091e969e1eac658
parent 488342 40ae82f3f8b57aa80f3891d09bc30fd8149af42f
child 488344 d6eb2c2d5830712ec0632bfec4a1c7c1e7b6cbae
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbustage
bugs1484373
milestone63.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 1484373: Follow-up: Fix null deref. r=bustage CLOSED TREE
toolkit/components/extensions/ExtensionPolicyService.cpp
--- a/toolkit/components/extensions/ExtensionPolicyService.cpp
+++ b/toolkit/components/extensions/ExtensionPolicyService.cpp
@@ -542,27 +542,26 @@ void
 ExtensionPolicyService::CheckContentScripts(const DocInfo& aDocInfo, bool aIsPreload)
 {
   nsCOMPtr<nsPIDOMWindowInner> win;
   if (!aIsPreload) {
     win = aDocInfo.GetWindow()->GetCurrentInnerWindow();
   }
 
   for (auto iter = mExtensions.Iter(); !iter.Done(); iter.Next()) {
-    if (!win->IsCurrentInnerWindow()) {
-      break;
-    }
-
     RefPtr<WebExtensionPolicy> policy = iter.Data();
 
     for (auto& script : policy->ContentScripts()) {
       if (script->Matches(aDocInfo)) {
         if (aIsPreload) {
           ProcessScript().PreloadContentScript(script);
         } else {
+          if (!win->IsCurrentInnerWindow()) {
+            break;
+          }
           RefPtr<Promise> promise;
           ProcessScript().LoadContentScript(script, win, getter_AddRefs(promise));
         }
       }
     }
   }
 
   for (auto iter = mObservers.Iter(); !iter.Done(); iter.Next()) {