Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1238)

Unified Diff: Source/devtools/front_end/sdk/Target.js

Issue 473553003: DevTools: Process correctly a disconnection during target initialization (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/devtools/front_end/sdk/Target.js
diff --git a/Source/devtools/front_end/sdk/Target.js b/Source/devtools/front_end/sdk/Target.js
index 6066f7048124722d14af2210b71b389893c9e1ae..137361b4a6d9d2c0317c8b7d76c7536fd9a22f6c 100644
--- a/Source/devtools/front_end/sdk/Target.js
+++ b/Source/devtools/front_end/sdk/Target.js
@@ -9,7 +9,7 @@
* @extends {Protocol.Agents}
* @param {string} name
* @param {!InspectorBackendClass.Connection} connection
- * @param {function(!WebInspector.Target)=} callback
+ * @param {function(?WebInspector.Target)=} callback
*/
WebInspector.Target = function(name, connection, callback)
{
@@ -96,10 +96,15 @@ WebInspector.Target.prototype = {
},
/**
- * @param {function(!WebInspector.Target)=} callback
+ * @param {function(?WebInspector.Target)=} callback
*/
_loadedWithCapabilities: function(callback)
{
+ if (this._connection.isClosed()) {
+ callback(null);
+ return;
+ }
+
/** @type {!WebInspector.ConsoleModel} */
this.consoleModel = new WebInspector.ConsoleModel(this);
@@ -334,7 +339,7 @@ WebInspector.TargetManager.prototype = {
/**
* @param {string} name
* @param {!InspectorBackendClass.Connection} connection
- * @param {function(!WebInspector.Target)=} callback
+ * @param {function(?WebInspector.Target)=} callback
*/
createTarget: function(name, connection, callback)
{
@@ -342,11 +347,12 @@ WebInspector.TargetManager.prototype = {
/**
* @this {WebInspector.TargetManager}
- * @param {!WebInspector.Target} newTarget
+ * @param {?WebInspector.Target} newTarget
*/
function callbackWrapper(newTarget)
{
- this.addTarget(newTarget);
+ if (newTarget)
+ this.addTarget(newTarget);
if (callback)
callback(newTarget);
}

Powered by Google App Engine
This is Rietveld 408576698