Diff
Modified: trunk/LayoutTests/ChangeLog (261103 => 261104)
--- trunk/LayoutTests/ChangeLog 2020-05-04 19:51:18 UTC (rev 261103)
+++ trunk/LayoutTests/ChangeLog 2020-05-04 19:51:30 UTC (rev 261104)
@@ -1,5 +1,15 @@
2020-05-04 Devin Rousso <[email protected]>
+ Web Inspector: Worker: should use the name of the worker if it exists
+ https://bugs.webkit.org/show_bug.cgi?id=211244
+
+ Reviewed by Brian Burg.
+
+ * inspector/worker/runtime-basic.html:
+ * inspector/worker/runtime-basic-expected.txt:
+
+2020-05-04 Devin Rousso <[email protected]>
+
Web Inspector: provide a way for inspector to turn on/off ITP debug mode and AdClickAttribution debug mode
https://bugs.webkit.org/show_bug.cgi?id=209763
Modified: trunk/LayoutTests/inspector/worker/runtime-basic-expected.txt (261103 => 261104)
--- trunk/LayoutTests/inspector/worker/runtime-basic-expected.txt 2020-05-04 19:51:18 UTC (rev 261103)
+++ trunk/LayoutTests/inspector/worker/runtime-basic-expected.txt 2020-05-04 19:51:30 UTC (rev 261104)
@@ -6,11 +6,11 @@
Target - Page - passphrase - page-passphrase
-- Running test case: Worker.Runtime.evaluate
-Target - worker-1.js - passphrase - worker-passphrase
+Target - TestWorker - passphrase - worker-passphrase
-- Running test case: Main.Runtime.RemoteObjectAndPropertyDescriptor.
Target - Page - location and href - Location: inspector/worker/runtime-basic.html
-- Running test case: Worker.Runtime.RemoteObjectAndPropertyDescriptor.
-Target - worker-1.js - location and href - WorkerLocation: inspector/worker/resources/worker-1.js
+Target - TestWorker - location and href - WorkerLocation: inspector/worker/resources/worker-1.js
Modified: trunk/LayoutTests/inspector/worker/runtime-basic.html (261103 => 261104)
--- trunk/LayoutTests/inspector/worker/runtime-basic.html 2020-05-04 19:51:18 UTC (rev 261103)
+++ trunk/LayoutTests/inspector/worker/runtime-basic.html 2020-05-04 19:51:30 UTC (rev 261104)
@@ -4,7 +4,7 @@
<script src=""
<script>
passphrase = "page-passphrase";
-let worker = new Worker("resources/worker-1.js");
+let worker = new Worker("resources/worker-1.js", {name: "TestWorker"});
function test()
{
Modified: trunk/Source/_javascript_Core/ChangeLog (261103 => 261104)
--- trunk/Source/_javascript_Core/ChangeLog 2020-05-04 19:51:18 UTC (rev 261103)
+++ trunk/Source/_javascript_Core/ChangeLog 2020-05-04 19:51:30 UTC (rev 261104)
@@ -1,5 +1,15 @@
2020-05-04 Devin Rousso <[email protected]>
+ Web Inspector: Worker: should use the name of the worker if it exists
+ https://bugs.webkit.org/show_bug.cgi?id=211244
+
+ Reviewed by Brian Burg.
+
+ * inspector/protocol/Worker.json:
+ Include the `name` in `Worker.workerCreated`.
+
+2020-05-04 Devin Rousso <[email protected]>
+
Web Inspector: provide a way for inspector to turn on/off ITP debug mode and AdClickAttribution debug mode
https://bugs.webkit.org/show_bug.cgi?id=209763
Modified: trunk/Source/_javascript_Core/inspector/protocol/Worker.json (261103 => 261104)
--- trunk/Source/_javascript_Core/inspector/protocol/Worker.json 2020-05-04 19:51:18 UTC (rev 261103)
+++ trunk/Source/_javascript_Core/inspector/protocol/Worker.json 2020-05-04 19:51:30 UTC (rev 261104)
@@ -32,7 +32,8 @@
"name": "workerCreated",
"parameters": [
{ "name": "workerId", "type": "string" },
- { "name": "url", "type": "string" }
+ { "name": "url", "type": "string" },
+ { "name": "name", "type": "string" }
]
},
{
Modified: trunk/Source/WebCore/ChangeLog (261103 => 261104)
--- trunk/Source/WebCore/ChangeLog 2020-05-04 19:51:18 UTC (rev 261103)
+++ trunk/Source/WebCore/ChangeLog 2020-05-04 19:51:30 UTC (rev 261104)
@@ -1,5 +1,46 @@
2020-05-04 Devin Rousso <[email protected]>
+ Web Inspector: Worker: should use the name of the worker if it exists
+ https://bugs.webkit.org/show_bug.cgi?id=211244
+
+ Reviewed by Brian Burg.
+
+ Test: inspector/worker/runtime-basic.html
+
+ Pass the `name` from the `WorkerOptions` given to the `Worker` when it's constructed to Web
+ Inspector so it can be used in the frontend UI.
+
+ Drive-by: replace lots of pointers with references.
+
+ * workers/WorkerMessagingProxy.cpp:
+ (WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
+
+ * workers/WorkerInspectorProxy.h:
+ (WebCore::WorkerInspectorProxy::name const): Added.
+ * workers/WorkerInspectorProxy.cpp:
+ (WebCore::WorkerInspectorProxy::workerStarted):
+ (WebCore::WorkerInspectorProxy::workerTerminated):
+ (WebCore::WorkerInspectorProxy::connectToWorkerInspectorController):
+ (WebCore::WorkerInspectorProxy::sendMessageFromWorkerToFrontend):
+
+ * inspector/InspectorInstrumentation.h:
+ (WebCore::InspectorInstrumentation::workerStarted):
+ (WebCore::InspectorInstrumentation::workerTerminated):
+ * inspector/InspectorInstrumentation.cpp:
+ (WebCore::InspectorInstrumentation::workerStartedImpl):
+ (WebCore::InspectorInstrumentation::workerTerminatedImpl):
+
+ * inspector/agents/InspectorWorkerAgent.h:
+ * inspector/agents/InspectorWorkerAgent.cpp:
+ (WebCore::InspectorWorkerAgent::sendMessageFromWorkerToFrontend):
+ (WebCore::InspectorWorkerAgent::workerStarted):
+ (WebCore::InspectorWorkerAgent::workerTerminated):
+ (WebCore::InspectorWorkerAgent::connectToAllWorkerInspectorProxiesForPage):
+ (WebCore::InspectorWorkerAgent::connectToWorkerInspectorProxy):
+ (WebCore::InspectorWorkerAgent::disconnectFromWorkerInspectorProxy):
+
+2020-05-04 Devin Rousso <[email protected]>
+
Web Inspector: provide a way for inspector to turn on/off ITP debug mode and AdClickAttribution debug mode
https://bugs.webkit.org/show_bug.cgi?id=209763
Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp (261103 => 261104)
--- trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp 2020-05-04 19:51:18 UTC (rev 261103)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp 2020-05-04 19:51:30 UTC (rev 261104)
@@ -979,13 +979,13 @@
return false;
}
-void InspectorInstrumentation::workerStartedImpl(InstrumentingAgents& instrumentingAgents, WorkerInspectorProxy* proxy, const URL& url)
+void InspectorInstrumentation::workerStartedImpl(InstrumentingAgents& instrumentingAgents, WorkerInspectorProxy& proxy)
{
if (InspectorWorkerAgent* workerAgent = instrumentingAgents.inspectorWorkerAgent())
- workerAgent->workerStarted(proxy, url);
+ workerAgent->workerStarted(proxy);
}
-void InspectorInstrumentation::workerTerminatedImpl(InstrumentingAgents& instrumentingAgents, WorkerInspectorProxy* proxy)
+void InspectorInstrumentation::workerTerminatedImpl(InstrumentingAgents& instrumentingAgents, WorkerInspectorProxy& proxy)
{
if (InspectorWorkerAgent* workerAgent = instrumentingAgents.inspectorWorkerAgent())
workerAgent->workerTerminated(proxy);
Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.h (261103 => 261104)
--- trunk/Source/WebCore/inspector/InspectorInstrumentation.h 2020-05-04 19:51:18 UTC (rev 261103)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.h 2020-05-04 19:51:30 UTC (rev 261104)
@@ -47,6 +47,7 @@
#include "Page.h"
#include "StorageArea.h"
#include "WebAnimation.h"
+#include "WorkerInspectorProxy.h"
#include <_javascript_Core/ConsoleMessage.h>
#include <initializer_list>
#include <wtf/CompletionHandler.h>
@@ -97,7 +98,6 @@
class TimerBase;
class WebKitNamedFlow;
class WorkerGlobalScope;
-class WorkerInspectorProxy;
#if ENABLE(WEBGL)
class WebGLProgram;
@@ -270,8 +270,8 @@
static void didDispatchDOMStorageEvent(Page&, const String& key, const String& oldValue, const String& newValue, StorageType, SecurityOrigin*);
static bool shouldWaitForDebuggerOnStart(ScriptExecutionContext&);
- static void workerStarted(ScriptExecutionContext&, WorkerInspectorProxy*, const URL&);
- static void workerTerminated(ScriptExecutionContext&, WorkerInspectorProxy*);
+ static void workerStarted(WorkerInspectorProxy&);
+ static void workerTerminated(WorkerInspectorProxy&);
static void didCreateWebSocket(Document*, unsigned long identifier, const URL& requestURL);
static void willSendWebSocketHandshakeRequest(Document*, unsigned long identifier, const ResourceRequest&);
@@ -470,8 +470,8 @@
static void didDispatchDOMStorageEventImpl(InstrumentingAgents&, const String& key, const String& oldValue, const String& newValue, StorageType, SecurityOrigin*);
static bool shouldWaitForDebuggerOnStartImpl(InstrumentingAgents&);
- static void workerStartedImpl(InstrumentingAgents&, WorkerInspectorProxy*, const URL&);
- static void workerTerminatedImpl(InstrumentingAgents&, WorkerInspectorProxy*);
+ static void workerStartedImpl(InstrumentingAgents&, WorkerInspectorProxy&);
+ static void workerTerminatedImpl(InstrumentingAgents&, WorkerInspectorProxy&);
static void didCreateWebSocketImpl(InstrumentingAgents&, unsigned long identifier, const URL& requestURL);
static void willSendWebSocketHandshakeRequestImpl(InstrumentingAgents&, unsigned long identifier, const ResourceRequest&);
@@ -1293,17 +1293,17 @@
return false;
}
-inline void InspectorInstrumentation::workerStarted(ScriptExecutionContext& context, WorkerInspectorProxy* proxy, const URL& url)
+inline void InspectorInstrumentation::workerStarted(WorkerInspectorProxy& proxy)
{
FAST_RETURN_IF_NO_FRONTENDS(void());
- if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
- workerStartedImpl(*instrumentingAgents, proxy, url);
+ if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(proxy.scriptExecutionContext()))
+ workerStartedImpl(*instrumentingAgents, proxy);
}
-inline void InspectorInstrumentation::workerTerminated(ScriptExecutionContext& context, WorkerInspectorProxy* proxy)
+inline void InspectorInstrumentation::workerTerminated(WorkerInspectorProxy& proxy)
{
FAST_RETURN_IF_NO_FRONTENDS(void());
- if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
+ if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(proxy.scriptExecutionContext()))
workerTerminatedImpl(*instrumentingAgents, proxy);
}
Modified: trunk/Source/WebCore/inspector/agents/InspectorWorkerAgent.cpp (261103 => 261104)
--- trunk/Source/WebCore/inspector/agents/InspectorWorkerAgent.cpp 2020-05-04 19:51:18 UTC (rev 261103)
+++ trunk/Source/WebCore/inspector/agents/InspectorWorkerAgent.cpp 2020-05-04 19:51:30 UTC (rev 261104)
@@ -104,9 +104,9 @@
proxy->sendMessageToWorkerInspectorController(message);
}
-void InspectorWorkerAgent::sendMessageFromWorkerToFrontend(WorkerInspectorProxy* proxy, const String& message)
+void InspectorWorkerAgent::sendMessageFromWorkerToFrontend(WorkerInspectorProxy& proxy, const String& message)
{
- m_frontendDispatcher->dispatchMessageFromWorker(proxy->identifier(), message);
+ m_frontendDispatcher->dispatchMessageFromWorker(proxy.identifier(), message);
}
bool InspectorWorkerAgent::shouldWaitForDebuggerOnStart() const
@@ -114,7 +114,7 @@
return m_enabled;
}
-void InspectorWorkerAgent::workerStarted(WorkerInspectorProxy* proxy, const URL&)
+void InspectorWorkerAgent::workerStarted(WorkerInspectorProxy& proxy)
{
if (!m_enabled)
return;
@@ -122,7 +122,7 @@
connectToWorkerInspectorProxy(proxy);
}
-void InspectorWorkerAgent::workerTerminated(WorkerInspectorProxy* proxy)
+void InspectorWorkerAgent::workerTerminated(WorkerInspectorProxy& proxy)
{
if (!m_enabled)
return;
@@ -142,7 +142,7 @@
if (document.page() != &m_page)
continue;
- connectToWorkerInspectorProxy(proxy);
+ connectToWorkerInspectorProxy(*proxy);
}
}
@@ -154,22 +154,22 @@
m_connectedProxies.clear();
}
-void InspectorWorkerAgent::connectToWorkerInspectorProxy(WorkerInspectorProxy* proxy)
+void InspectorWorkerAgent::connectToWorkerInspectorProxy(WorkerInspectorProxy& proxy)
{
- proxy->connectToWorkerInspectorController(this);
+ proxy.connectToWorkerInspectorController(*this);
- m_connectedProxies.set(proxy->identifier(), proxy);
+ m_connectedProxies.set(proxy.identifier(), &proxy);
- m_frontendDispatcher->workerCreated(proxy->identifier(), proxy->url().string());
+ m_frontendDispatcher->workerCreated(proxy.identifier(), proxy.url().string(), proxy.name());
}
-void InspectorWorkerAgent::disconnectFromWorkerInspectorProxy(WorkerInspectorProxy* proxy)
+void InspectorWorkerAgent::disconnectFromWorkerInspectorProxy(WorkerInspectorProxy& proxy)
{
- m_frontendDispatcher->workerTerminated(proxy->identifier());
+ m_frontendDispatcher->workerTerminated(proxy.identifier());
- m_connectedProxies.remove(proxy->identifier());
+ m_connectedProxies.remove(proxy.identifier());
- proxy->disconnectFromWorkerInspectorController();
+ proxy.disconnectFromWorkerInspectorController();
}
} // namespace Inspector
Modified: trunk/Source/WebCore/inspector/agents/InspectorWorkerAgent.h (261103 => 261104)
--- trunk/Source/WebCore/inspector/agents/InspectorWorkerAgent.h 2020-05-04 19:51:18 UTC (rev 261103)
+++ trunk/Source/WebCore/inspector/agents/InspectorWorkerAgent.h 2020-05-04 19:51:30 UTC (rev 261104)
@@ -55,18 +55,18 @@
void sendMessageToWorker(ErrorString&, const String& workerId, const String& message) override;
// WorkerInspectorProxy::PageChannel
- void sendMessageFromWorkerToFrontend(WorkerInspectorProxy*, const String& message) override;
+ void sendMessageFromWorkerToFrontend(WorkerInspectorProxy&, const String& message) override;
// InspectorInstrumentation
bool shouldWaitForDebuggerOnStart() const;
- void workerStarted(WorkerInspectorProxy*, const URL&);
- void workerTerminated(WorkerInspectorProxy*);
+ void workerStarted(WorkerInspectorProxy&);
+ void workerTerminated(WorkerInspectorProxy&);
private:
void connectToAllWorkerInspectorProxiesForPage();
void disconnectFromAllWorkerInspectorProxies();
- void connectToWorkerInspectorProxy(WorkerInspectorProxy*);
- void disconnectFromWorkerInspectorProxy(WorkerInspectorProxy*);
+ void connectToWorkerInspectorProxy(WorkerInspectorProxy&);
+ void disconnectFromWorkerInspectorProxy(WorkerInspectorProxy&);
std::unique_ptr<Inspector::WorkerFrontendDispatcher> m_frontendDispatcher;
RefPtr<Inspector::WorkerBackendDispatcher> m_backendDispatcher;
Modified: trunk/Source/WebCore/workers/WorkerInspectorProxy.cpp (261103 => 261104)
--- trunk/Source/WebCore/workers/WorkerInspectorProxy.cpp 2020-05-04 19:51:18 UTC (rev 261103)
+++ trunk/Source/WebCore/workers/WorkerInspectorProxy.cpp 2020-05-04 19:51:30 UTC (rev 261104)
@@ -31,6 +31,7 @@
#include "WorkerGlobalScope.h"
#include "WorkerInspectorController.h"
#include "WorkerRunLoop.h"
+#include "WorkerThread.h"
#include <_javascript_Core/InspectorAgentBase.h>
#include <wtf/NeverDestroyed.h>
@@ -61,7 +62,7 @@
return pauseOnStart ? WorkerThreadStartMode::WaitForInspector : WorkerThreadStartMode::Normal;
}
-void WorkerInspectorProxy::workerStarted(ScriptExecutionContext* scriptExecutionContext, WorkerThread* thread, const URL& url)
+void WorkerInspectorProxy::workerStarted(ScriptExecutionContext* scriptExecutionContext, WorkerThread* thread, const URL& url, const String& name)
{
ASSERT(!m_workerThread);
@@ -68,10 +69,11 @@
m_scriptExecutionContext = scriptExecutionContext;
m_workerThread = thread;
m_url = url;
+ m_name = name;
allWorkerInspectorProxies().add(this);
- InspectorInstrumentation::workerStarted(*m_scriptExecutionContext.get(), this, m_url);
+ InspectorInstrumentation::workerStarted(*this);
}
void WorkerInspectorProxy::workerTerminated()
@@ -79,7 +81,7 @@
if (!m_workerThread)
return;
- InspectorInstrumentation::workerTerminated(*m_scriptExecutionContext.get(), this);
+ InspectorInstrumentation::workerTerminated(*this);
allWorkerInspectorProxies().remove(this);
@@ -95,13 +97,13 @@
});
}
-void WorkerInspectorProxy::connectToWorkerInspectorController(PageChannel* channel)
+void WorkerInspectorProxy::connectToWorkerInspectorController(PageChannel& channel)
{
ASSERT(m_workerThread);
if (!m_workerThread)
return;
- m_pageChannel = channel;
+ m_pageChannel = &channel;
m_workerThread->runLoop().postDebuggerTask([] (ScriptExecutionContext& context) {
downcast<WorkerGlobalScope>(context).inspectorController().connectFrontend();
@@ -141,7 +143,7 @@
if (!m_pageChannel)
return;
- m_pageChannel->sendMessageFromWorkerToFrontend(this, message);
+ m_pageChannel->sendMessageFromWorkerToFrontend(*this, message);
}
} // namespace WebCore
Modified: trunk/Source/WebCore/workers/WorkerInspectorProxy.h (261103 => 261104)
--- trunk/Source/WebCore/workers/WorkerInspectorProxy.h 2020-05-04 19:51:18 UTC (rev 261103)
+++ trunk/Source/WebCore/workers/WorkerInspectorProxy.h 2020-05-04 19:51:30 UTC (rev 261104)
@@ -25,9 +25,9 @@
#pragma once
+#include <wtf/HashSet.h>
+#include <wtf/RefPtr.h>
#include <wtf/URL.h>
-#include "WorkerThread.h"
-#include <wtf/HashSet.h>
#include <wtf/text/WTFString.h>
// All of these methods should be called on the Main Thread.
@@ -38,6 +38,8 @@
class ScriptExecutionContext;
class WorkerThread;
+enum class WorkerThreadStartMode;
+
class WorkerInspectorProxy {
WTF_MAKE_NONCOPYABLE(WorkerInspectorProxy);
WTF_MAKE_FAST_ALLOCATED;
@@ -49,21 +51,22 @@
class PageChannel {
public:
virtual ~PageChannel() = default;
- virtual void sendMessageFromWorkerToFrontend(WorkerInspectorProxy*, const String&) = 0;
+ virtual void sendMessageFromWorkerToFrontend(WorkerInspectorProxy&, const String&) = 0;
};
static HashSet<WorkerInspectorProxy*>& allWorkerInspectorProxies();
const URL& url() const { return m_url; }
+ const String& name() const { return m_name; }
const String& identifier() const { return m_identifier; }
ScriptExecutionContext* scriptExecutionContext() const { return m_scriptExecutionContext.get(); }
WorkerThreadStartMode workerStartMode(ScriptExecutionContext&);
- void workerStarted(ScriptExecutionContext*, WorkerThread*, const URL&);
+ void workerStarted(ScriptExecutionContext*, WorkerThread*, const URL&, const String& name);
void workerTerminated();
void resumeWorkerIfPaused();
- void connectToWorkerInspectorController(PageChannel*);
+ void connectToWorkerInspectorController(PageChannel&);
void disconnectFromWorkerInspectorController();
void sendMessageToWorkerInspectorController(const String&);
void sendMessageFromWorkerToFrontend(const String&);
@@ -73,6 +76,7 @@
RefPtr<WorkerThread> m_workerThread;
String m_identifier;
URL m_url;
+ String m_name;
PageChannel* m_pageChannel { nullptr };
};
Modified: trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp (261103 => 261104)
--- trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp 2020-05-04 19:51:18 UTC (rev 261103)
+++ trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp 2020-05-04 19:51:30 UTC (rev 261104)
@@ -95,7 +95,7 @@
workerThreadCreated(thread.get());
thread->start();
- m_inspectorProxy->workerStarted(m_scriptExecutionContext.get(), thread.ptr(), scriptURL);
+ m_inspectorProxy->workerStarted(m_scriptExecutionContext.get(), thread.ptr(), scriptURL, name);
}
void WorkerMessagingProxy::postMessageToWorkerObject(MessageWithMessagePorts&& message)
Modified: trunk/Source/WebInspectorUI/ChangeLog (261103 => 261104)
--- trunk/Source/WebInspectorUI/ChangeLog 2020-05-04 19:51:18 UTC (rev 261103)
+++ trunk/Source/WebInspectorUI/ChangeLog 2020-05-04 19:51:30 UTC (rev 261104)
@@ -1,5 +1,30 @@
2020-05-04 Devin Rousso <[email protected]>
+ Web Inspector: Worker: should use the name of the worker if it exists
+ https://bugs.webkit.org/show_bug.cgi?id=211244
+
+ Reviewed by Brian Burg.
+
+ * UserInterface/Protocol/WorkerObserver.js:
+ (WI.WorkerObserver.prototype.workerCreated):
+ * UserInterface/Controllers/WorkerManager.js:
+ (WI.WorkerManager.prototype.workerCreated):
+ * UserInterface/Protocol/WorkerTarget.js:
+ (WI.WorkerTarget):
+ (WI.WorkerTarget.prototype.get customName): Added.
+ (WI.WorkerTarget.prototype.get displayName):
+ (WI.WorkerTarget.prototype.get displayURL): Added.
+ Use the `name` from the `WorkerOptions` given to the `Worker` when it's constructed as the
+ `displayName` of the `WI.WorkerTarget` if able. Also exposed via `get customName`.
+
+ * UserInterface/Views/ScriptTreeElement.js:
+ (WI.ScriptTreeElement):
+ * UserInterface/Views/WorkerTreeElement.js:
+ (WI.WorkerTreeElement):
+ Accept an `options` optional object that can be used to override the `mainTitle`.
+
+2020-05-04 Devin Rousso <[email protected]>
+
Web Inspector: provide a way for inspector to turn on/off ITP debug mode and AdClickAttribution debug mode
https://bugs.webkit.org/show_bug.cgi?id=209763
Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/WorkerManager.js (261103 => 261104)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/WorkerManager.js 2020-05-04 19:51:18 UTC (rev 261103)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/WorkerManager.js 2020-05-04 19:51:30 UTC (rev 261104)
@@ -42,11 +42,11 @@
// WorkerObserver
- workerCreated(target, workerId, url)
+ workerCreated(target, workerId, url, name)
{
console.assert(target.hasCommand("Worker.sendMessageToWorker"));
let connection = new InspectorBackend.WorkerConnection;
- let workerTarget = new WI.WorkerTarget(target, workerId, url, connection);
+ let workerTarget = new WI.WorkerTarget(target, workerId, url, name, connection);
workerTarget.initialize();
WI.targetManager.addTarget(workerTarget);
Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/WorkerObserver.js (261103 => 261104)
--- trunk/Source/WebInspectorUI/UserInterface/Protocol/WorkerObserver.js 2020-05-04 19:51:18 UTC (rev 261103)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/WorkerObserver.js 2020-05-04 19:51:30 UTC (rev 261104)
@@ -27,9 +27,9 @@
{
// Events defined by the "Worker" domain.
- workerCreated(workerId, url)
+ workerCreated(workerId, url, name)
{
- WI.workerManager.workerCreated(this._target, workerId, url);
+ WI.workerManager.workerCreated(this._target, workerId, url, name);
}
workerTerminated(workerId)
Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/WorkerTarget.js (261103 => 261104)
--- trunk/Source/WebInspectorUI/UserInterface/Protocol/WorkerTarget.js 2020-05-04 19:51:18 UTC (rev 261103)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/WorkerTarget.js 2020-05-04 19:51:30 UTC (rev 261104)
@@ -25,17 +25,29 @@
WI.WorkerTarget = class WorkerTarget extends WI.Target
{
- constructor(parentTarget, workerId, name, connection, options = {})
+ constructor(parentTarget, workerId, url, displayName, connection, options = {})
{
- super(parentTarget, workerId, name, WI.TargetType.Worker, connection, options);
+ super(parentTarget, workerId, url, WI.TargetType.Worker, connection, options);
+ this._displayName = displayName;
+
this._executionContext = new WI.ExecutionContext(this, WI.RuntimeManager.TopLevelContextExecutionIdentifier, WI.ExecutionContext.Type.Normal, this.displayName);
}
// Protected (Target)
+ get customName()
+ {
+ return this._displayName;
+ }
+
get displayName()
{
+ return this._displayName || this.displayURL;
+ }
+
+ get displayURL()
+ {
return WI.displayNameForURL(this._name);
}
};
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ScriptTreeElement.js (261103 => 261104)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ScriptTreeElement.js 2020-05-04 19:51:18 UTC (rev 261103)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ScriptTreeElement.js 2020-05-04 19:51:30 UTC (rev 261104)
@@ -25,38 +25,45 @@
WI.ScriptTreeElement = class ScriptTreeElement extends WI.SourceCodeTreeElement
{
- constructor(script)
+ constructor(script, options = {})
{
console.assert(script instanceof WI.Script);
- const title = null;
- const subtitle = null;
- super(script, "script", title, subtitle);
+ let scriptDisplayName = script.displayName;
- this.mainTitle = script.displayName;
+ let title = options.mainTitle || scriptDisplayName;
+ let subtitle = null;
+ let tooltip = null;
+ let classNames = ["script"];
if (script.url && !script.dynamicallyAddedScriptElement) {
- if (script.urlComponents.scheme === "web-inspector")
- this.tooltip = this.mainTitle;
- else {
+ if (script.urlComponents.scheme !== "web-inspector") {
// Show the host as the subtitle if it is different from the main title.
let host = WI.displayNameForHost(script.urlComponents.host);
- this.subtitle = this.mainTitle !== host ? host : null;
+ if (host && title !== host)
+ subtitle = host;
+ else if (scriptDisplayName && title !== scriptDisplayName)
+ subtitle = scriptDisplayName;
- this.tooltip = script.url;
+ tooltip = script.url;
}
- this.addClassName(WI.ResourceTreeElement.ResourceIconStyleClassName);
- this.addClassName(WI.Resource.Type.Script);
+ classNames.push(WI.ResourceTreeElement.ResourceIconStyleClassName);
+ classNames.push(WI.Resource.Type.Script);
} else
- this.addClassName(WI.ScriptTreeElement.AnonymousScriptIconStyleClassName);
+ classNames.push(WI.ScriptTreeElement.AnonymousScriptIconStyleClassName);
if (script.isMainResource()) {
console.assert(script.target.type === WI.TargetType.Worker || script.target.type === WI.TargetType.ServiceWorker, script.target.type);
- this.addClassName("worker-icon");
+ classNames.push("worker-icon");
}
+ super(script, classNames, title, subtitle);
+
this._script = script;
+
+ if (tooltip)
+ this.tooltip = tooltip;
}
// Public
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/WorkerTreeElement.js (261103 => 261104)
--- trunk/Source/WebInspectorUI/UserInterface/Views/WorkerTreeElement.js 2020-05-04 19:51:18 UTC (rev 261103)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/WorkerTreeElement.js 2020-05-04 19:51:30 UTC (rev 261104)
@@ -30,12 +30,16 @@
{
constructor(target)
{
- super(target.mainResource);
-
console.assert(target instanceof WI.Target);
console.assert(target.type === WI.TargetType.Worker || target.type === WI.TargetType.ServiceWorker);
console.assert(target.mainResource instanceof WI.Script);
+ let options = {};
+ if (target instanceof WI.WorkerTarget)
+ options.mainTitle = target.customName;
+
+ super(target.mainResource, options);
+
this._target = target;
this._target.addEventListener(WI.Target.Event.ResourceAdded, this._resourceAdded, this);
this._target.addEventListener(WI.Target.Event.ScriptAdded, this._scriptAdded, this);