Commit cf09007d authored by sergeyv@chromium.org's avatar sergeyv@chromium.org

DevTools: Process correctly a disconnection during target initialization

BUG=
NOTRY=true

Review URL: https://codereview.chromium.org/473553003

git-svn-id: svn://svn.chromium.org/blink/trunk@180475 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 619ffd8d
...@@ -318,12 +318,13 @@ WebInspector.Main.prototype = { ...@@ -318,12 +318,13 @@ WebInspector.Main.prototype = {
}, },
/** /**
* @param {!WebInspector.Target} mainTarget * @param {?WebInspector.Target} target
*/ */
_mainTargetCreated: function(mainTarget) _mainTargetCreated: function(target)
{ {
console.timeStamp("Main._mainTargetCreated"); console.timeStamp("Main._mainTargetCreated");
var mainTarget = /** @type {!WebInspector.Target} */(target);
this._registerShortcuts(); this._registerShortcuts();
WebInspector.workerTargetManager = new WebInspector.WorkerTargetManager(mainTarget, WebInspector.targetManager); WebInspector.workerTargetManager = new WebInspector.WorkerTargetManager(mainTarget, WebInspector.targetManager);
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* @extends {Protocol.Agents} * @extends {Protocol.Agents}
* @param {string} name * @param {string} name
* @param {!InspectorBackendClass.Connection} connection * @param {!InspectorBackendClass.Connection} connection
* @param {function(!WebInspector.Target)=} callback * @param {function(?WebInspector.Target)=} callback
*/ */
WebInspector.Target = function(name, connection, callback) WebInspector.Target = function(name, connection, callback)
{ {
...@@ -96,10 +96,15 @@ WebInspector.Target.prototype = { ...@@ -96,10 +96,15 @@ WebInspector.Target.prototype = {
}, },
/** /**
* @param {function(!WebInspector.Target)=} callback * @param {function(?WebInspector.Target)=} callback
*/ */
_loadedWithCapabilities: function(callback) _loadedWithCapabilities: function(callback)
{ {
if (this._connection.isClosed()) {
callback(null);
return;
}
/** @type {!WebInspector.ConsoleModel} */ /** @type {!WebInspector.ConsoleModel} */
this.consoleModel = new WebInspector.ConsoleModel(this); this.consoleModel = new WebInspector.ConsoleModel(this);
...@@ -334,7 +339,7 @@ WebInspector.TargetManager.prototype = { ...@@ -334,7 +339,7 @@ WebInspector.TargetManager.prototype = {
/** /**
* @param {string} name * @param {string} name
* @param {!InspectorBackendClass.Connection} connection * @param {!InspectorBackendClass.Connection} connection
* @param {function(!WebInspector.Target)=} callback * @param {function(?WebInspector.Target)=} callback
*/ */
createTarget: function(name, connection, callback) createTarget: function(name, connection, callback)
{ {
...@@ -342,11 +347,12 @@ WebInspector.TargetManager.prototype = { ...@@ -342,11 +347,12 @@ WebInspector.TargetManager.prototype = {
/** /**
* @this {WebInspector.TargetManager} * @this {WebInspector.TargetManager}
* @param {!WebInspector.Target} newTarget * @param {?WebInspector.Target} newTarget
*/ */
function callbackWrapper(newTarget) function callbackWrapper(newTarget)
{ {
this.addTarget(newTarget); if (newTarget)
this.addTarget(newTarget);
if (callback) if (callback)
callback(newTarget); callback(newTarget);
} }
......
...@@ -46,11 +46,11 @@ WebInspector.WorkerTargetManager.prototype = { ...@@ -46,11 +46,11 @@ WebInspector.WorkerTargetManager.prototype = {
} }
/** /**
* @param {!WebInspector.Target} target * @param {?WebInspector.Target} target
*/ */
function targetCreated(target) function targetCreated(target)
{ {
if (data.inspectorConnected) if (target && data.inspectorConnected)
target.runtimeAgent().run(); target.runtimeAgent().run();
} }
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment