| Index: third_party/WebKit/Source/devtools/front_end/sdk/TargetManager.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/TargetManager.js b/third_party/WebKit/Source/devtools/front_end/sdk/TargetManager.js
|
| index f2afa4f500777defa67dfee04da99e0fe2030151..ed342a458c8f316ecf5bc4e70465781d26d81763 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/sdk/TargetManager.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/sdk/TargetManager.js
|
| @@ -234,23 +234,6 @@ WebInspector.TargetManager.prototype = {
|
| },
|
|
|
| /**
|
| - * @param {function(function(string)):!Promise<!InspectorBackendClass.Connection>} interceptor
|
| - */
|
| - setMainConnectionInterceptor: function(interceptor)
|
| - {
|
| - this._mainConnectionInterceptor = interceptor;
|
| - },
|
| -
|
| - /**
|
| - * @param {function(string)} onMessage
|
| - * @return {!Promise<!InspectorBackendClass.Connection>}
|
| - */
|
| - interceptMainConnection: function(onMessage)
|
| - {
|
| - return this._mainConnectionInterceptor.call(null, onMessage);
|
| - },
|
| -
|
| - /**
|
| * @param {!WebInspector.Target} target
|
| * @return {!Array<!WebInspector.TargetManager.Observer>}
|
| */
|
| @@ -380,6 +363,63 @@ WebInspector.TargetManager.prototype = {
|
| setImmediate(resourceTreeModel.resumeReload.bind(resourceTreeModel));
|
| },
|
|
|
| + /**
|
| + * @param {function()} webSocketConnectionLostCallback
|
| + */
|
| + connectToMainTarget: function(webSocketConnectionLostCallback)
|
| + {
|
| + this._webSocketConnectionLostCallback = webSocketConnectionLostCallback;
|
| + this._connectAndCreateMainTarget();
|
| + },
|
| +
|
| + _connectAndCreateMainTarget: function()
|
| + {
|
| + 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.Target;
|
| + if (Runtime.queryParam("isSharedWorker")) {
|
| + capabilities =
|
| + WebInspector.Target.Capability.Browser | WebInspector.Target.Capability.Log |
|
| + WebInspector.Target.Capability.Network | WebInspector.Target.Capability.Target;
|
| + } else if (Runtime.queryParam("v8only")) {
|
| + capabilities = WebInspector.Target.Capability.JS;
|
| + }
|
| +
|
| + var target = this.createTarget(WebInspector.UIString("Main"), capabilities, this._createMainConnection.bind(this), null);
|
| + target.runtimeAgent().runIfWaitingForDebugger();
|
| + },
|
| +
|
| + /**
|
| + * @param {!InspectorBackendClass.Connection.Params} params
|
| + * @return {!InspectorBackendClass.Connection}
|
| + */
|
| + _createMainConnection: function(params)
|
| + {
|
| + if (Runtime.queryParam("ws")) {
|
| + var ws = "ws://" + Runtime.queryParam("ws");
|
| + this._mainConnection = new WebInspector.WebSocketConnection(ws, this._webSocketConnectionLostCallback, params);
|
| + } else if (InspectorFrontendHost.isHostedMode()) {
|
| + this._mainConnection = new WebInspector.StubConnection(params);
|
| + } else {
|
| + this._mainConnection = new WebInspector.MainConnection(params);
|
| + }
|
| + return this._mainConnection;
|
| + },
|
| +
|
| + /**
|
| + * @param {function(string)} onMessage
|
| + * @return {!Promise<!InspectorBackendClass.Connection>}
|
| + */
|
| + interceptMainConnection: function(onMessage)
|
| + {
|
| + var params = {
|
| + onMessage: onMessage,
|
| + onDisconnect: this._connectAndCreateMainTarget.bind(this)
|
| + };
|
| + return this._mainConnection.disconnect().then(this._createMainConnection.bind(this, params));
|
| + },
|
| +
|
| __proto__: WebInspector.Object.prototype
|
| };
|
|
|
|
|