From 858a03f3ced0fe9a76a35351896658324d736865 Mon Sep 17 00:00:00 2001 From: Cedric Vivier Date: Mon, 3 Oct 2011 19:08:15 +0800 Subject: [PATCH] Bug 583041 - Style Editor integration; part 2; r=rcampbell --- .../devtools/sourceeditor/source-editor-orion.jsm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/browser/devtools/sourceeditor/source-editor-orion.jsm b/browser/devtools/sourceeditor/source-editor-orion.jsm index aa5980e48a6..183ec25fb2f 100644 --- a/browser/devtools/sourceeditor/source-editor-orion.jsm +++ b/browser/devtools/sourceeditor/source-editor-orion.jsm @@ -222,7 +222,17 @@ SourceEditor.prototype = { }, this); if (aCallback) { - aCallback(this); + let iframe = this._view._frame; + let document = iframe.contentDocument; + if (!document || document.readyState != "complete") { + let onIframeLoad = function () { + iframe.contentWindow.removeEventListener("load", onIframeLoad, false); + aCallback(this); + }.bind(this); + iframe.contentWindow.addEventListener("load", onIframeLoad, false); + } else { + aCallback(this); + } } },