Diff
Modified: trunk/LayoutTests/ChangeLog (100109 => 100110)
--- trunk/LayoutTests/ChangeLog 2011-11-14 09:14:44 UTC (rev 100109)
+++ trunk/LayoutTests/ChangeLog 2011-11-14 09:16:06 UTC (rev 100110)
@@ -1,3 +1,15 @@
+2011-11-14 Yury Semikhatsky <[email protected]>
+
+ Web Inspector: [chromium] list dedicated workers in case inspector opened post-worker creation.
+ https://bugs.webkit.org/show_bug.cgi?id=72020
+
+ Reviewed by Pavel Feldman.
+
+ * http/tests/inspector-enabled/dedicated-workers-list-expected.txt: Added.
+ * http/tests/inspector-enabled/dedicated-workers-list.html: Added.
+ * http/tests/inspector-enabled/resources/dedicated-worker.js: Added.
+ (doWork):
+
2011-11-14 Philippe Normand <[email protected]>
Unreviewed, GTK baselines for 2 new svg tests.
Added: trunk/LayoutTests/http/tests/inspector-enabled/dedicated-workers-list-expected.txt (0 => 100110)
--- trunk/LayoutTests/http/tests/inspector-enabled/dedicated-workers-list-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/inspector-enabled/dedicated-workers-list-expected.txt 2011-11-14 09:16:06 UTC (rev 100110)
@@ -0,0 +1,9 @@
+CONSOLE MESSAGE: line 20: Received message from worker 1
+CONSOLE MESSAGE: line 20: Received message from worker 2
+Tests that dedicated workers created before worker inspection was enabled will be reported to the front-end. Bug 72020
+
+Worker inspection enabled
+Added worker: 1
+Added worker: 2
+Done.
+
Property changes on: trunk/LayoutTests/http/tests/inspector-enabled/dedicated-workers-list-expected.txt
___________________________________________________________________
Added: svn:eol-style
Added: trunk/LayoutTests/http/tests/inspector-enabled/dedicated-workers-list.html (0 => 100110)
--- trunk/LayoutTests/http/tests/inspector-enabled/dedicated-workers-list.html (rev 0)
+++ trunk/LayoutTests/http/tests/inspector-enabled/dedicated-workers-list.html 2011-11-14 09:16:06 UTC (rev 100110)
@@ -0,0 +1,63 @@
+<html>
+<head>
+<script src=""
+<script src=""
+
+<script>
+function handleLoad()
+{
+ if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+ var worker1 = new Worker("resources/dedicated-worker.js?id=1");
+ worker1._onmessage_ = handleMessageFromWorker;
+ var worker2 = new Worker("resources/dedicated-worker.js?id=2");
+ worker2._onmessage_ = handleMessageFromWorker;
+ var messageCount = 0;
+ function handleMessageFromWorker(event)
+ {
+ messageCount++;
+ console.log("Received message from worker " + messageCount);
+ if (messageCount === 2) {
+ if (window.layoutTestController)
+ layoutTestController.showWebInspector();
+ runTest();
+ }
+ }
+}
+
+
+function test()
+{
+ WorkerAgent.setWorkerInspectionEnabled(false, didDisableWorkerInspection);
+
+ function didDisableWorkerInspection()
+ {
+ WebInspector.workerManager.addEventListener(WebInspector.WorkerManager.Events.WorkerAdded, workerAdded, this);
+ WorkerAgent.setWorkerInspectionEnabled(true);
+ InspectorTest.addResult("Worker inspection enabled");
+ }
+
+ var workerCount = 0;
+ function workerAdded()
+ {
+ workerCount++;
+ InspectorTest.addResult("Added worker: " + workerCount);
+ if (workerCount === 2) {
+ InspectorTest.addResult("Done.");
+ InspectorTest.completeTest();
+ }
+ }
+};
+
+</script>
+
+</head>
+
+<body _onload_="handleLoad()">
+<p>Tests that dedicated workers created before worker inspection was enabled will be reported to the front-end.
+<a href="" 72020</a>
+</p>
+
+</body>
+</html>
Property changes on: trunk/LayoutTests/http/tests/inspector-enabled/dedicated-workers-list.html
___________________________________________________________________
Added: svn:eol-style
Added: trunk/LayoutTests/http/tests/inspector-enabled/resources/dedicated-worker.js (0 => 100110)
--- trunk/LayoutTests/http/tests/inspector-enabled/resources/dedicated-worker.js (rev 0)
+++ trunk/LayoutTests/http/tests/inspector-enabled/resources/dedicated-worker.js 2011-11-14 09:16:06 UTC (rev 100110)
@@ -0,0 +1,7 @@
+var workerId = location.search.substring(4);
+postMessage("Worker " + workerId + " started.");
+doWork();
+setInterval(doWork, 1000);
+function doWork() {
+}
+
Property changes on: trunk/LayoutTests/http/tests/inspector-enabled/resources/dedicated-worker.js
___________________________________________________________________
Added: svn:eol-style
Modified: trunk/LayoutTests/platform/chromium/test_expectations.txt (100109 => 100110)
--- trunk/LayoutTests/platform/chromium/test_expectations.txt 2011-11-14 09:14:44 UTC (rev 100109)
+++ trunk/LayoutTests/platform/chromium/test_expectations.txt 2011-11-14 09:16:06 UTC (rev 100110)
@@ -3882,3 +3882,6 @@
BUG_SENORBLANCO MAC LINUX GPU : fast/canvas/canvas-transforms-fillRect-shadow.html = TEXT
BUGWK72149 : media/track/tracklist-is-reachable.html = TEXT
+
+BUGV8_1821 WIN LINUX : http/tests/inspector-enabled/dedicated-workers-list.html = PASS CRASH
+BUGWK72133 SKIP MAC : http/tests/inspector-enabled/dedicated-workers-list.html = PASS CRASH TIMEOUT
Modified: trunk/Source/WebCore/ChangeLog (100109 => 100110)
--- trunk/Source/WebCore/ChangeLog 2011-11-14 09:14:44 UTC (rev 100109)
+++ trunk/Source/WebCore/ChangeLog 2011-11-14 09:16:06 UTC (rev 100110)
@@ -1,3 +1,31 @@
+2011-11-14 Yury Semikhatsky <[email protected]>
+
+ Web Inspector: [chromium] list dedicated workers in case inspector opened post-worker creation.
+ https://bugs.webkit.org/show_bug.cgi?id=72020
+
+ Collect information about dedicated workers even when inspector is closed. This
+ way we can list all dedicated workers if the front-end opens later.
+
+ Reviewed by Pavel Feldman.
+
+ Test: http/tests/inspector-enabled/dedicated-workers-list.html
+
+ * inspector/InspectorInstrumentation.h:
+ (WebCore::InspectorInstrumentation::didStartWorkerContext):
+ * inspector/InspectorWorkerAgent.cpp:
+ (WebCore::InspectorWorkerAgent::InspectorWorkerAgent):
+ (WebCore::InspectorWorkerAgent::~InspectorWorkerAgent):
+ (WebCore::InspectorWorkerAgent::setFrontend):
+ (WebCore::InspectorWorkerAgent::restore):
+ (WebCore::InspectorWorkerAgent::clearFrontend):
+ (WebCore::InspectorWorkerAgent::setWorkerInspectionEnabled):
+ (WebCore::InspectorWorkerAgent::didStartWorkerContext):
+ (WebCore::InspectorWorkerAgent::workerContextTerminated):
+ (WebCore::InspectorWorkerAgent::createWorkerFrontendChannelsForExistingWorkers):
+ (WebCore::InspectorWorkerAgent::destroyWorkerFrontendChannels):
+ (WebCore::InspectorWorkerAgent::createWorkerFrontendChannel):
+ * inspector/InspectorWorkerAgent.h:
+
2011-11-14 Zalan Bujtas <[email protected]>
Build breaks with --no-_javascript_-debugger --no-inspector
Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.h (100109 => 100110)
--- trunk/Source/WebCore/inspector/InspectorInstrumentation.h 2011-11-14 09:14:44 UTC (rev 100109)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.h 2011-11-14 09:16:06 UTC (rev 100110)
@@ -959,7 +959,6 @@
inline void InspectorInstrumentation::didStartWorkerContext(ScriptExecutionContext* context, WorkerContextProxy* proxy, const KURL& url)
{
#if ENABLE(INSPECTOR)
- FAST_RETURN_IF_NO_FRONTENDS(void());
if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
didStartWorkerContextImpl(instrumentingAgents, proxy, url);
#endif
Modified: trunk/Source/WebCore/inspector/InspectorWorkerAgent.cpp (100109 => 100110)
--- trunk/Source/WebCore/inspector/InspectorWorkerAgent.cpp 2011-11-14 09:14:44 UTC (rev 100109)
+++ trunk/Source/WebCore/inspector/InspectorWorkerAgent.cpp 2011-11-14 09:16:06 UTC (rev 100110)
@@ -115,34 +115,30 @@
, m_inspectorFrontend(0)
, m_inspectorState(inspectorState)
{
+ m_instrumentingAgents->setInspectorWorkerAgent(this);
}
InspectorWorkerAgent::~InspectorWorkerAgent()
{
+ m_instrumentingAgents->setInspectorWorkerAgent(0);
}
void InspectorWorkerAgent::setFrontend(InspectorFrontend* frontend)
{
m_inspectorFrontend = frontend;
- restore();
}
void InspectorWorkerAgent::restore()
{
if (m_inspectorState->getBoolean(WorkerAgentState::workerInspectionEnabled))
- m_instrumentingAgents->setInspectorWorkerAgent(this);
+ createWorkerFrontendChannelsForExistingWorkers();
}
void InspectorWorkerAgent::clearFrontend()
{
m_inspectorFrontend = 0;
- m_instrumentingAgents->setInspectorWorkerAgent(0);
m_inspectorState->setBoolean(WorkerAgentState::autoconnectToWorkers, false);
- for (WorkerChannels::iterator it = m_idToChannel.begin(); it != m_idToChannel.end(); ++it) {
- it->second->disconnectFromWorkerContext();
- delete it->second;
- }
- m_idToChannel.clear();
+ destroyWorkerFrontendChannels();
}
void InspectorWorkerAgent::setWorkerInspectionEnabled(ErrorString*, bool value)
@@ -151,9 +147,9 @@
if (!m_inspectorFrontend)
return;
if (value)
- m_instrumentingAgents->setInspectorWorkerAgent(this);
+ createWorkerFrontendChannelsForExistingWorkers();
else
- m_instrumentingAgents->setInspectorWorkerAgent(0);
+ destroyWorkerFrontendChannels();
}
void InspectorWorkerAgent::connectToWorker(ErrorString* error, int workerId)
@@ -195,18 +191,14 @@
void InspectorWorkerAgent::didStartWorkerContext(WorkerContextProxy* workerContextProxy, const KURL& url)
{
- WorkerFrontendChannel* channel = new WorkerFrontendChannel(m_inspectorFrontend, workerContextProxy);
- m_idToChannel.set(channel->id(), channel);
-
- ASSERT(m_inspectorFrontend);
- bool autoconnectToWorkers = m_inspectorState->getBoolean(WorkerAgentState::autoconnectToWorkers);
- if (autoconnectToWorkers)
- channel->connectToWorkerContext();
- m_inspectorFrontend->worker()->workerCreated(channel->id(), url.string(), autoconnectToWorkers);
+ m_dedicatedWorkers.set(workerContextProxy, url.string());
+ if (m_inspectorFrontend && m_inspectorState->getBoolean(WorkerAgentState::workerInspectionEnabled))
+ createWorkerFrontendChannel(workerContextProxy, url.string());
}
void InspectorWorkerAgent::workerContextTerminated(WorkerContextProxy* proxy)
{
+ m_dedicatedWorkers.remove(proxy);
for (WorkerChannels::iterator it = m_idToChannel.begin(); it != m_idToChannel.end(); ++it) {
if (proxy == it->second->proxy()) {
m_inspectorFrontend->worker()->workerTerminated(it->first);
@@ -217,6 +209,33 @@
}
}
+void InspectorWorkerAgent::createWorkerFrontendChannelsForExistingWorkers()
+{
+ for (DedicatedWorkers::iterator it = m_dedicatedWorkers.begin(); it != m_dedicatedWorkers.end(); ++it)
+ createWorkerFrontendChannel(it->first, it->second);
+}
+
+void InspectorWorkerAgent::destroyWorkerFrontendChannels()
+{
+ for (WorkerChannels::iterator it = m_idToChannel.begin(); it != m_idToChannel.end(); ++it) {
+ it->second->disconnectFromWorkerContext();
+ delete it->second;
+ }
+ m_idToChannel.clear();
+}
+
+void InspectorWorkerAgent::createWorkerFrontendChannel(WorkerContextProxy* workerContextProxy, const String& url)
+{
+ WorkerFrontendChannel* channel = new WorkerFrontendChannel(m_inspectorFrontend, workerContextProxy);
+ m_idToChannel.set(channel->id(), channel);
+
+ ASSERT(m_inspectorFrontend);
+ bool autoconnectToWorkers = m_inspectorState->getBoolean(WorkerAgentState::autoconnectToWorkers);
+ if (autoconnectToWorkers)
+ channel->connectToWorkerContext();
+ m_inspectorFrontend->worker()->workerCreated(channel->id(), url, autoconnectToWorkers);
+}
+
} // namespace WebCore
#endif // ENABLE(WORKERS) && ENABLE(INSPECTOR)
Modified: trunk/Source/WebCore/inspector/InspectorWorkerAgent.h (100109 => 100110)
--- trunk/Source/WebCore/inspector/InspectorWorkerAgent.h 2011-11-14 09:14:44 UTC (rev 100109)
+++ trunk/Source/WebCore/inspector/InspectorWorkerAgent.h 2011-11-14 09:16:06 UTC (rev 100110)
@@ -69,6 +69,9 @@
private:
InspectorWorkerAgent(InstrumentingAgents*, InspectorState*);
+ void createWorkerFrontendChannelsForExistingWorkers();
+ void createWorkerFrontendChannel(WorkerContextProxy*, const String& url);
+ void destroyWorkerFrontendChannels();
InstrumentingAgents* m_instrumentingAgents;
InspectorFrontend* m_inspectorFrontend;
@@ -77,6 +80,8 @@
class WorkerFrontendChannel;
typedef HashMap<int, WorkerFrontendChannel*> WorkerChannels;
WorkerChannels m_idToChannel;
+ typedef HashMap<WorkerContextProxy*, String> DedicatedWorkers;
+ DedicatedWorkers m_dedicatedWorkers;
};
} // namespace WebCore