OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @constructor | 6 * @constructor |
7 * @implements {InspectorAppHostAPI} | 7 * @suppressGlobalPropertiesCheck |
8 */ | 8 */ |
9 WebInspector.DevToolsApp = function() | 9 WebInspector.DevToolsApp = function() |
10 { | 10 { |
11 window.InspectorAppHost = this; | |
12 | |
13 /** | 11 /** |
14 * @type {?Window} | 12 * @type {?Window} |
15 */ | 13 */ |
16 this._inspectorWindow = null; | 14 this._inspectorWindow = null; |
15 | |
16 this._iframe = document.querySelector("iframe.inspector-app-iframe"); | |
pfeldman
2014/11/13 17:48:11
just inline onIframeLoaded here.
dgozman
2014/11/13 17:53:27
Done.
| |
17 | |
18 /** | |
19 * @this {WebInspector.DevToolsApp} | |
20 */ | |
21 var loadCallback = (function() | |
22 { | |
23 this._iframe.removeEventListener("load", loadCallback, false); | |
24 this._onIframeLoaded(); | |
25 }).bind(this); | |
26 | |
27 if (this._iframe.contentDocument.readyState == "complete") | |
28 this._onIframeLoaded(); | |
29 else | |
30 this._iframe.addEventListener("load", loadCallback, false); | |
17 } | 31 } |
18 | 32 |
19 WebInspector.DevToolsApp.prototype = { | 33 WebInspector.DevToolsApp.prototype = { |
20 /** | 34 _onIframeLoaded: function() |
21 * @param {!Window} inspectorWindow | |
22 * @override | |
23 */ | |
24 inspectorAppWindowLoaded: function(inspectorWindow) | |
25 { | 35 { |
26 this._inspectorWindow = inspectorWindow; | 36 this._inspectorWindow = this._iframe.contentWindow; |
27 if (window.domAutomationController) | 37 this._inspectorWindow.InspectorFrontendHost = window.InspectorFrontendHo st; |
28 this._inspectorWindow.domAutomationController = window.domAutomation Controller; | |
29 }, | |
30 | |
31 /** | |
32 * @override | |
33 */ | |
34 beforeInspectorAppLoad: function() | |
35 { | |
36 if (this._inspectorWindow.uiTests) { | |
37 // FIXME: move Tests to the host or teach browser counterpart about iframe. | |
38 window.uiTests = this._inspectorWindow.uiTests; | |
39 } | |
40 }, | |
41 | |
42 /** | |
43 * @override | |
44 */ | |
45 afterInspectorAppLoad: function() | |
46 { | |
47 } | 38 } |
48 } | 39 } |
49 | 40 |
50 new WebInspector.DevToolsApp(); | 41 runOnWindowLoad(function() { new WebInspector.DevToolsApp(); }); |
OLD | NEW |