Bug 1556034 - Prevent overlays from being applied when document.readyState is "loading". r=mkmelin
authorGeoff Lankow <geoff@darktrojan.net>
Mon, 03 Jun 2019 22:40:43 +1200
changeset 35750 3adb373a816afe236275baee53713a7447b33cbe
parent 35749 7389c579b86823526669b8831696635b09cf4c27
child 35751 03606755e03302c31ad7a3cff4bcfe88f4bc2a57
push id392
push userclokep@gmail.com
push dateMon, 02 Sep 2019 20:17:19 +0000
reviewersmkmelin
bugs1556034
Bug 1556034 - Prevent overlays from being applied when document.readyState is "loading". r=mkmelin
mail/components/extensions/parent/ext-legacy.js
--- a/mail/components/extensions/parent/ext-legacy.js
+++ b/mail/components/extensions/parent/ext-legacy.js
@@ -151,17 +151,21 @@ this.legacy = class extends ExtensionAPI
       } catch (e) {
         console.error("Error firing profile-after-change listener for", contractid);
       }
     }
 
     // Add overlays to all existing windows.
     let enumerator = Services.wm.getEnumerator("mail:3pane");
     if (enumerator.hasMoreElements() && enumerator.getNext().document.readyState == "complete") {
-      getAllWindows().forEach(w => Overlays.load(chromeManifest, w));
+      getAllWindows().forEach(w => {
+        if (["interactive", "complete"].includes(w.document.readyState)) {
+          Overlays.load(chromeManifest, w);
+        }
+      });
     }
 
     // Listen for new windows to overlay.
     let documentObserver = {
       observe(document) {
         if (ExtensionCommon.instanceOf(document, "XULDocument")) {
           Overlays.load(chromeManifest, document.defaultView);
         }