Bug 583041 - Style Editor integration; part 2; r=rcampbell
authorCedric Vivier <cedricv@neonux.com>
Mon, 03 Oct 2011 19:08:15 +0800
changeset 80301 69cd4124a49a44d338dd10938d57448c88cd3405
parent 80300 00e06ace79460572b3ce4eb4327c3b55d185eeec
child 80302 2513f713a23e53d90f4ac674b8b3c2feb304963f
push id330
push userrcampbell@mozilla.com
push dateThu, 17 Nov 2011 22:33:35 +0000
treeherderfx-team@1cac8411fdc6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrcampbell
bugs583041
milestone11.0a1
Bug 583041 - Style Editor integration; part 2; r=rcampbell
browser/devtools/sourceeditor/source-editor-orion.jsm
--- a/browser/devtools/sourceeditor/source-editor-orion.jsm
+++ b/browser/devtools/sourceeditor/source-editor-orion.jsm
@@ -217,17 +217,27 @@ SourceEditor.prototype = {
       this._view.setKeyBinding(binding, aKey.action);
 
       if (aKey.callback) {
         this._view.setAction(aKey.action, aKey.callback);
       }
     }, 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);
+      }
     }
   },
 
   /**
    * Initialize the custom Orion editor features.
    * @private
    */
   _initEditorFeatures: function SE__initEditorFeatures()