| Index: third_party/WebKit/Source/devtools/front_end/main/Main.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/main/Main.js b/third_party/WebKit/Source/devtools/front_end/main/Main.js
|
| index 88677b8a46ae85d4c1d28cf24412e4328419376d..eaec441d14078aeae7eda23b666e27fe53b25e93 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/main/Main.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/main/Main.js
|
| @@ -30,7 +30,6 @@
|
|
|
| /**
|
| * @constructor
|
| - * @implements {InspectorAgent.Dispatcher}
|
| * @suppressGlobalPropertiesCheck
|
| */
|
| WebInspector.Main = function()
|
| @@ -231,7 +230,6 @@ WebInspector.Main.prototype = {
|
| WebInspector.inspectorView.createToolbars();
|
| InspectorFrontendHost.loadCompleted();
|
|
|
| - InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.EvaluateForTestInFrontend, this._evaluateForTestInFrontend, this);
|
| InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.ReloadInspectedPage, this._reloadInspectedPage, this);
|
|
|
| var extensions = self.runtime.extensions(WebInspector.QueryParamHandler);
|
| @@ -270,26 +268,20 @@ WebInspector.Main.prototype = {
|
|
|
| if (Runtime.queryParam("ws")) {
|
| var ws = "ws://" + Runtime.queryParam("ws");
|
| - WebInspector.WebSocketConnection.Create(ws, this._connectionEstablished.bind(this));
|
| + WebInspector.WebSocketConnection.Create(ws, connection => {
|
| + connection.addEventListener(InspectorBackendClass.Connection.Events.Disconnected, onDisconnected);
|
| + this._connectionEstablished(connection);
|
| + });
|
| return;
|
| }
|
|
|
| if (!InspectorFrontendHost.isHostedMode()) {
|
| this._connectionEstablished(new WebInspector.MainConnection());
|
| + WebInspector.targetManager.setMainTargetFactory(this._createMainTargetOverMainConnection.bind(this));
|
| return;
|
| }
|
|
|
| this._connectionEstablished(new WebInspector.StubConnection());
|
| - },
|
| -
|
| - /**
|
| - * @param {!InspectorBackendClass.Connection} connection
|
| - */
|
| - _connectionEstablished: function(connection)
|
| - {
|
| - console.timeStamp("Main._connectionEstablished");
|
| - this._mainConnection = connection;
|
| - connection.addEventListener(InspectorBackendClass.Connection.Events.Disconnected, onDisconnected);
|
|
|
| /**
|
| * @param {!WebInspector.Event} event
|
| @@ -300,31 +292,50 @@ WebInspector.Main.prototype = {
|
| return;
|
| WebInspector.RemoteDebuggingTerminatedScreen.show(event.data.reason);
|
| }
|
| + },
|
| +
|
| + _createMainTargetOverMainConnection()
|
| + {
|
| + this._createMainTarget(new WebInspector.MainConnection());
|
| + },
|
| +
|
| + /**
|
| + * @param {!InspectorBackendClass.Connection} connection
|
| + */
|
| + _connectionEstablished: function(connection)
|
| + {
|
| + console.timeStamp("Main._connectionEstablished");
|
|
|
| - this._createMainTarget();
|
| + this._createMainTarget(connection);
|
| InspectorFrontendHost.readyForTest();
|
| // Asynchronously run the extensions.
|
| setTimeout(this._lateInitialization.bind(this), 100);
|
| },
|
|
|
| - _createMainTarget: function()
|
| + /**
|
| + * @param {!InspectorBackendClass.Connection} connection
|
| + */
|
| + _createMainTarget: function(connection)
|
| {
|
| var capabilities =
|
| WebInspector.Target.Capability.Browser | WebInspector.Target.Capability.DOM |
|
| WebInspector.Target.Capability.JS | WebInspector.Target.Capability.Log |
|
| WebInspector.Target.Capability.Network | WebInspector.Target.Capability.Worker;
|
| - if (Runtime.queryParam("isSharedWorker"))
|
| + if (Runtime.queryParam("isSharedWorker")) {
|
| capabilities =
|
| WebInspector.Target.Capability.Browser | WebInspector.Target.Capability.Log |
|
| WebInspector.Target.Capability.Network | WebInspector.Target.Capability.Worker;
|
| - else if (Runtime.queryParam("v8only"))
|
| + } else if (Runtime.queryParam("v8only")) {
|
| capabilities = WebInspector.Target.Capability.JS;
|
| + }
|
|
|
| - this._mainTarget = WebInspector.targetManager.createTarget(WebInspector.UIString("Main"), capabilities, this._mainConnection, null);
|
| - this._mainTarget.registerInspectorDispatcher(this);
|
| - this._mainTarget.runtimeAgent().runIfWaitingForDebugger();
|
| - if (this._mainTarget.hasBrowserCapability())
|
| - this._mainTarget.inspectorAgent().enable();
|
| + var target = WebInspector.targetManager.createTarget(WebInspector.UIString("Main"), capabilities, connection, null);
|
| + target.registerInspectorDispatcher(new WebInspector.Main.InspectorDomainDispatcher(target));
|
| + target.runtimeAgent().runIfWaitingForDebugger();
|
| + if (target.hasBrowserCapability())
|
| + target.inspectorAgent().enable();
|
| + if (Runtime.experiments.isEnabled("nodeDebugging"))
|
| + new WebInspector.RemoteLocationManager(target);
|
| console.timeStamp("Main._mainTargetCreated");
|
| },
|
|
|
| @@ -333,8 +344,6 @@ WebInspector.Main.prototype = {
|
| console.timeStamp("Main._lateInitialization");
|
| this._registerShortcuts();
|
| WebInspector.extensionServer.initializeExtensions();
|
| - if (Runtime.experiments.isEnabled("nodeDebugging"))
|
| - new WebInspector.RemoteLocationManager(this._mainTarget);
|
| },
|
|
|
| _registerForwardedShortcuts: function()
|
| @@ -536,6 +545,24 @@ WebInspector.Main.prototype = {
|
| WebInspector.Main._reloadPage(hard);
|
| },
|
|
|
| + _onSuspendStateChanged: function()
|
| + {
|
| + var suspended = WebInspector.targetManager.allTargetsSuspended();
|
| + WebInspector.inspectorView.onSuspendStateChanged(suspended);
|
| + }
|
| +}
|
| +
|
| +/**
|
| + * @constructor
|
| + * @implements {InspectorAgent.Dispatcher}
|
| + * @param {!WebInspector.Target} target
|
| + */
|
| +WebInspector.Main.InspectorDomainDispatcher = function(target)
|
| +{
|
| + this._target = target;
|
| +}
|
| +
|
| +WebInspector.Main.InspectorDomainDispatcher.prototype = {
|
| /**
|
| * @override
|
| * @param {string} reason
|
| @@ -551,45 +578,13 @@ WebInspector.Main.prototype = {
|
| */
|
| targetCrashed: function()
|
| {
|
| - var debuggerModel = WebInspector.DebuggerModel.fromTarget(this._mainTarget);
|
| + var debuggerModel = WebInspector.DebuggerModel.fromTarget(this._target);
|
| if (debuggerModel)
|
| WebInspector.TargetCrashedScreen.show(debuggerModel);
|
| - },
|
| -
|
| - _onSuspendStateChanged: function()
|
| - {
|
| - var suspended = WebInspector.targetManager.allTargetsSuspended();
|
| - WebInspector.inspectorView.onSuspendStateChanged(suspended);
|
| - },
|
| -
|
| - /**
|
| - * @param {!WebInspector.Event} event
|
| - */
|
| - _evaluateForTestInFrontend: function(event)
|
| - {
|
| - if (!InspectorFrontendHost.isUnderTest())
|
| - return;
|
| -
|
| - var callId = /** @type {number} */ (event.data["callId"]);
|
| - var script = /** @type {number} */ (event.data["script"]);
|
| -
|
| - /**
|
| - * @suppressGlobalPropertiesCheck
|
| - */
|
| - function invokeMethod()
|
| - {
|
| - try {
|
| - script = script + "//# sourceURL=evaluateInWebInspector" + callId + ".js";
|
| - window.eval(script);
|
| - } catch (e) {
|
| - console.error(e.stack);
|
| - }
|
| - }
|
| -
|
| - this._mainConnection.deprecatedRunAfterPendingDispatches(invokeMethod);
|
| }
|
| }
|
|
|
| +
|
| /**
|
| * @constructor
|
| * @implements {WebInspector.ActionDelegate}
|
|
|