Commit b563fbb2 authored by apavlov@chromium.org's avatar apavlov@chromium.org

DevTools: Avoid exception when inspecting blob-based workers

The blob: scheme is not handled by ParsedURL, so it is
impossible to compute the human-readable worker name
for them using the common scheme.

R=pfeldman, vsevik
BUG=404098
NOTRY=true

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

git-svn-id: svn://svn.chromium.org/blink/trunk@180356 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 36b91b44
...@@ -13,8 +13,10 @@ WebInspector.WorkerTargetManager = function(mainTarget, targetManager) ...@@ -13,8 +13,10 @@ WebInspector.WorkerTargetManager = function(mainTarget, targetManager)
this._mainTarget = mainTarget; this._mainTarget = mainTarget;
this._targetManager = targetManager; this._targetManager = targetManager;
mainTarget.workerManager.addEventListener(WebInspector.WorkerManager.Events.WorkerAdded, this._onWorkerAdded, this); mainTarget.workerManager.addEventListener(WebInspector.WorkerManager.Events.WorkerAdded, this._onWorkerAdded, this);
mainTarget.workerManager.addEventListener(WebInspector.WorkerManager.Events.WorkersCleared, this._onWorkersCleared, this);
WebInspector.profilingLock().addEventListener(WebInspector.Lock.Events.StateChanged, this._onProfilingStateChanged, this); WebInspector.profilingLock().addEventListener(WebInspector.Lock.Events.StateChanged, this._onProfilingStateChanged, this);
this._onProfilingStateChanged(); this._onProfilingStateChanged();
this._lastAnonymousTargetId = 0;
} }
WebInspector.WorkerTargetManager.prototype = { WebInspector.WorkerTargetManager.prototype = {
...@@ -38,7 +40,9 @@ WebInspector.WorkerTargetManager.prototype = { ...@@ -38,7 +40,9 @@ WebInspector.WorkerTargetManager.prototype = {
*/ */
function onConnectionReady(connection) function onConnectionReady(connection)
{ {
this._targetManager.createTarget(WebInspector.UIString("Worker %s", data.url.asParsedURL().lastPathComponent), connection, targetCreated) var parsedURL = data.url.asParsedURL();
var workerId = parsedURL ? parsedURL.lastPathComponent : "#" + (++this._lastAnonymousTargetId);
this._targetManager.createTarget(WebInspector.UIString("Worker %s", workerId), connection, targetCreated);
} }
/** /**
...@@ -49,6 +53,11 @@ WebInspector.WorkerTargetManager.prototype = { ...@@ -49,6 +53,11 @@ WebInspector.WorkerTargetManager.prototype = {
if (data.inspectorConnected) if (data.inspectorConnected)
target.runtimeAgent().run(); target.runtimeAgent().run();
} }
},
_onWorkersCleared: function()
{
this._lastAnonymousTargetId = 0;
} }
} }
......
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