Bug 1151909 - Wait for DOMContentLoaded
MozReview-Commit-ID: HGKns35JX75
--- a/devtools/server/actors/inspector.js
+++ b/devtools/server/actors/inspector.js
@@ -2342,16 +2342,23 @@ var WalkerActor = protocol.ActorClassWit
type: "inlineTextChild",
target: parentActor.actorID,
inlineTextChild:
inlineTextChild ? inlineTextChild.form() : undefined
});
},
onFrameLoad: function ({ window, isTopLevel }) {
+ let { readyState } = window.document;
+ if (readyState != "interactive" && readyState != "complete") {
+ window.addEventListener("DOMContentLoaded",
+ this.onFrameLoad.bind(this, { window, isTopLevel }),
+ { once: true });
+ return;
+ }
if (isTopLevel) {
// If we initialize the inspector while the document is loading,
// we may already have a root document set in the constructor.
if (this.rootDoc && !Cu.isDeadWrapper(this.rootDoc) &&
this.rootDoc.defaultView) {
this.onFrameUnload({ window: this.rootDoc.defaultView });
}
this.rootDoc = window.document;