Diff
Modified: trunk/Source/WebCore/ChangeLog (89651 => 89652)
--- trunk/Source/WebCore/ChangeLog 2011-06-24 05:30:29 UTC (rev 89651)
+++ trunk/Source/WebCore/ChangeLog 2011-06-24 05:42:25 UTC (rev 89652)
@@ -1,3 +1,38 @@
+2011-06-23 Yury Semikhatsky <yu...@chromium.org>
+
+ Reviewed by Pavel Feldman.
+
+ [Chromium] Web Inspector: provide context menu item for enabling native worker inspection
+ https://bugs.webkit.org/show_bug.cgi?id=63258
+
+ Added context menu checkbox item that allows to enable inspection of
+ native workers. The value will be persisted as other inspector settings
+ and will be restored after frontend/breowser reopening.
+
+ * inspector/Inspector.json:
+ * inspector/InspectorController.cpp:
+ (WebCore::InspectorController::restoreInspectorStateFromCookie):
+ * inspector/InspectorInstrumentation.h:
+ (WebCore::InspectorInstrumentation::didStartWorkerContext):
+ * inspector/InspectorWorkerAgent.cpp:
+ (WebCore::InspectorWorkerAgent::setFrontend):
+ (WebCore::InspectorWorkerAgent::restore):
+ (WebCore::InspectorWorkerAgent::setWorkerInspectionEnabled):
+ * inspector/InspectorWorkerAgent.h:
+ * inspector/front-end/ScriptsPanel.js:
+ (WebInspector.ScriptsPanel):
+ (WebInspector.ScriptsPanel.prototype.reset):
+ (WebInspector.ScriptsPanel.prototype._toggleFormatSourceFiles):
+ (WebInspector.ScriptsPanel.prototype._contextMenu.enableWorkerInspection):
+ (WebInspector.ScriptsPanel.prototype._contextMenu):
+ * inspector/front-end/Settings.js:
+ (WebInspector.Settings):
+ * inspector/front-end/inspector.js:
+ (WebInspector.didCreateWorker):
+ (WebInspector.didDestroyWorker):
+ * workers/Worker.cpp:
+ (WebCore::Worker::notifyFinished):
+
2011-06-23 Simon Fraser <simon.fra...@apple.com>
Reviewed by Dan Bernstein.
Modified: trunk/Source/WebCore/inspector/Inspector.json (89651 => 89652)
--- trunk/Source/WebCore/inspector/Inspector.json 2011-06-24 05:30:29 UTC (rev 89651)
+++ trunk/Source/WebCore/inspector/Inspector.json 2011-06-24 05:42:25 UTC (rev 89652)
@@ -1757,6 +1757,12 @@
"types": [],
"commands": [
{
+ "name": "setWorkerInspectionEnabled",
+ "parameters": [
+ { "name": "value", "type": "boolean" }
+ ]
+ },
+ {
"name": "sendMessageToWorker",
"parameters": [
{ "name": "workerId", "type": "integer" },
Modified: trunk/Source/WebCore/inspector/InspectorController.cpp (89651 => 89652)
--- trunk/Source/WebCore/inspector/InspectorController.cpp 2011-06-24 05:30:29 UTC (rev 89651)
+++ trunk/Source/WebCore/inspector/InspectorController.cpp 2011-06-24 05:42:25 UTC (rev 89652)
@@ -339,6 +339,9 @@
#if ENABLE(DOM_STORAGE)
m_domStorageAgent->restore();
#endif
+#if ENABLE(WORKERS)
+ m_workerAgent->restore();
+#endif
#if ENABLE(_javascript__DEBUGGER)
m_debuggerAgent->restore();
m_profilerAgent->restore();
Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.h (89651 => 89652)
--- trunk/Source/WebCore/inspector/InspectorInstrumentation.h 2011-06-24 05:30:29 UTC (rev 89651)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.h 2011-06-24 05:42:25 UTC (rev 89652)
@@ -166,8 +166,7 @@
#endif
#if ENABLE(WORKERS)
- static bool willStartWorkerContext(ScriptExecutionContext*, WorkerContextProxy*);
- static void didStartWorkerContext(ScriptExecutionContext*, WorkerContextProxy*, bool paused, const KURL&);
+ static void didStartWorkerContext(ScriptExecutionContext*, WorkerContextProxy*, const KURL&);
static void didCreateWorker(ScriptExecutionContext*, intptr_t id, const String& url, bool isSharedWorker);
static void didDestroyWorker(ScriptExecutionContext*, intptr_t id);
static void workerContextTerminated(ScriptExecutionContext*, WorkerContextProxy*);
@@ -907,16 +906,9 @@
#endif
#if ENABLE(WORKERS)
-inline bool InspectorInstrumentation::willStartWorkerContext(ScriptExecutionContext*, WorkerContextProxy*)
+inline void InspectorInstrumentation::didStartWorkerContext(ScriptExecutionContext* context, WorkerContextProxy* proxy, const KURL& url)
{
- return false;
-}
-
-inline void InspectorInstrumentation::didStartWorkerContext(ScriptExecutionContext* context, WorkerContextProxy* proxy, bool paused, const KURL& url)
-{
#if ENABLE(INSPECTOR)
- if (!paused)
- return;
FAST_RETURN_IF_NO_FRONTENDS(void());
if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
didStartWorkerContextImpl(instrumentingAgents, proxy, url);
Modified: trunk/Source/WebCore/inspector/InspectorWorkerAgent.cpp (89651 => 89652)
--- trunk/Source/WebCore/inspector/InspectorWorkerAgent.cpp 2011-06-24 05:30:29 UTC (rev 89651)
+++ trunk/Source/WebCore/inspector/InspectorWorkerAgent.cpp 2011-06-24 05:42:25 UTC (rev 89652)
@@ -47,6 +47,7 @@
namespace WebCore {
namespace WorkerAgentState {
+static const char workerInspectionEnabled[] = "workerInspectionEnabled";
static const char autoconnectToWorkers[] = "autoconnectToWorkers";
};
@@ -123,10 +124,15 @@
void InspectorWorkerAgent::setFrontend(InspectorFrontend* frontend)
{
m_inspectorFrontend = frontend;
- // Disabled for now.
- // m_instrumentingAgents->setInspectorWorkerAgent(this);
+ restore();
}
+void InspectorWorkerAgent::restore()
+{
+ if (m_inspectorState->getBoolean(WorkerAgentState::workerInspectionEnabled))
+ m_instrumentingAgents->setInspectorWorkerAgent(this);
+}
+
void InspectorWorkerAgent::clearFrontend()
{
m_inspectorFrontend = 0;
@@ -139,6 +145,17 @@
m_idToChannel.clear();
}
+void InspectorWorkerAgent::setWorkerInspectionEnabled(ErrorString*, bool value)
+{
+ m_inspectorState->setBoolean(WorkerAgentState::workerInspectionEnabled, value);
+ if (!m_inspectorFrontend)
+ return;
+ if (value)
+ m_instrumentingAgents->setInspectorWorkerAgent(this);
+ else
+ m_instrumentingAgents->setInspectorWorkerAgent(0);
+}
+
void InspectorWorkerAgent::connectToWorker(ErrorString* error, int workerId)
{
WorkerFrontendChannel* channel = m_idToChannel.get(workerId);
Modified: trunk/Source/WebCore/inspector/InspectorWorkerAgent.h (89651 => 89652)
--- trunk/Source/WebCore/inspector/InspectorWorkerAgent.h 2011-06-24 05:30:29 UTC (rev 89651)
+++ trunk/Source/WebCore/inspector/InspectorWorkerAgent.h 2011-06-24 05:42:25 UTC (rev 89652)
@@ -52,6 +52,7 @@
~InspectorWorkerAgent();
void setFrontend(InspectorFrontend*);
+ void restore();
void clearFrontend();
// Called from InspectorInstrumentation
@@ -59,6 +60,7 @@
void workerContextTerminated(WorkerContextProxy*);
// Called from InspectorBackendDispatcher
+ void setWorkerInspectionEnabled(ErrorString*, bool value);
void connectToWorker(ErrorString*, int workerId);
void disconnectFromWorker(ErrorString*, int workerId);
void sendMessageToWorker(ErrorString*, int workerId, PassRefPtr<InspectorObject> message);
Modified: trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js (89651 => 89652)
--- trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js 2011-06-24 05:30:29 UTC (rev 89651)
+++ trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js 2011-06-24 05:42:25 UTC (rev 89652)
@@ -106,11 +106,14 @@
this.sidebarPanes.eventListenerBreakpoints = new WebInspector.EventListenerBreakpointsSidebarPane();
}
- this.sidebarPanes.workers = new WebInspector.WorkersSidebarPane();
if (Preferences.canInspectWorkers && WebInspector.workerManager)
+ this.sidebarElement.addEventListener("contextmenu", this._contextMenu.bind(this), true);
+ if (Preferences.canInspectWorkers && WebInspector.workerManager && WebInspector.settings.workerInspectionEnabled) {
+ WorkerAgent.setWorkerInspectionEnabled(true);
this.sidebarPanes.workerList = new WebInspector.WorkerListSidebarPane(WebInspector.workerManager);
+ } else
+ this.sidebarPanes.workers = new WebInspector.WorkersSidebarPane();
-
for (var pane in this.sidebarPanes)
this.sidebarElement.appendChild(this.sidebarPanes[pane].element);
@@ -497,7 +500,7 @@
this.sidebarPanes.jsBreakpoints.reset();
this.sidebarPanes.watchExpressions.refreshExpressions();
- if (!preserveItems)
+ if (!preserveItems && this.sidebarPanes.workers)
this.sidebarPanes.workers.reset();
},
@@ -1066,6 +1069,32 @@
WebInspector.panels.scripts.reset();
this._toggleFormatSourceFilesButton.toggled = !this._toggleFormatSourceFilesButton.toggled;
this._presentationModel.setFormatSourceFiles(this._toggleFormatSourceFilesButton.toggled);
+ },
+
+ _contextMenu: function(event)
+ {
+ var contextMenu = new WebInspector.ContextMenu();
+
+ function enableWorkerInspection()
+ {
+ var newValue = !WebInspector.settings.workerInspectionEnabled;
+ WebInspector.settings.workerInspectionEnabled = newValue;
+ WorkerAgent.setWorkerInspectionEnabled(newValue);
+ if (newValue) {
+ var element = this.sidebarPanes.workers.element;
+ delete this.sidebarPanes.workers;
+ this.sidebarPanes.workerList = new WebInspector.WorkerListSidebarPane(WebInspector.workerManager);
+ element.parentNode.replaceChild(this.sidebarPanes.workerList.element, element);
+ } else {
+ var element = this.sidebarPanes.workerList.element;
+ delete this.sidebarPanes.workerList;
+ this.sidebarPanes.workers = new WebInspector.WorkersSidebarPane();
+ element.parentNode.replaceChild(this.sidebarPanes.workers.element, element);
+ }
+ }
+ contextMenu.appendCheckboxItem(WebInspector.UIString("Enable worker inspection"), enableWorkerInspection.bind(this), WebInspector.settings.workerInspectionEnabled);
+
+ contextMenu.show(event);
}
}
Modified: trunk/Source/WebCore/inspector/front-end/Settings.js (89651 => 89652)
--- trunk/Source/WebCore/inspector/front-end/Settings.js 2011-06-24 05:30:29 UTC (rev 89651)
+++ trunk/Source/WebCore/inspector/front-end/Settings.js 2011-06-24 05:42:25 UTC (rev 89652)
@@ -78,6 +78,7 @@
this.installApplicationSetting("eventListenerBreakpoints", []);
this.installApplicationSetting("domBreakpoints", []);
this.installApplicationSetting("xhrBreakpoints", []);
+ this.installApplicationSetting("workerInspectionEnabled", []);
// If there are too many breakpoints in a storage, it is likely due to a recent bug that caused
// periodical breakpoints duplication leading to inspector slowness.
Modified: trunk/Source/WebCore/inspector/front-end/inspector.js (89651 => 89652)
--- trunk/Source/WebCore/inspector/front-end/inspector.js 2011-06-24 05:30:29 UTC (rev 89651)
+++ trunk/Source/WebCore/inspector/front-end/inspector.js 2011-06-24 05:42:25 UTC (rev 89652)
@@ -1004,13 +1004,15 @@
WebInspector.didCreateWorker = function()
{
var workersPane = WebInspector.panels.scripts.sidebarPanes.workers;
- workersPane.addWorker.apply(workersPane, arguments);
+ if (workersPane)
+ workersPane.addWorker.apply(workersPane, arguments);
}
WebInspector.didDestroyWorker = function()
{
var workersPane = WebInspector.panels.scripts.sidebarPanes.workers;
- workersPane.removeWorker.apply(workersPane, arguments);
+ if (workersPane)
+ workersPane.removeWorker.apply(workersPane, arguments);
}
WebInspector.log = function(message, messageLevel)
Modified: trunk/Source/WebCore/workers/Worker.cpp (89651 => 89652)
--- trunk/Source/WebCore/workers/Worker.cpp 2011-06-24 05:30:29 UTC (rev 89651)
+++ trunk/Source/WebCore/workers/Worker.cpp 2011-06-24 05:42:25 UTC (rev 89652)
@@ -131,9 +131,8 @@
if (m_scriptLoader->failed())
dispatchEvent(Event::create(eventNames().errorEvent, false, true));
else {
- bool shouldStartPaused = InspectorInstrumentation::willStartWorkerContext(scriptExecutionContext(), m_contextProxy);
m_contextProxy->startWorkerContext(m_scriptLoader->url(), scriptExecutionContext()->userAgent(m_scriptLoader->url()), m_scriptLoader->script());
- InspectorInstrumentation::didStartWorkerContext(scriptExecutionContext(), m_contextProxy, shouldStartPaused, m_scriptLoader->url());
+ InspectorInstrumentation::didStartWorkerContext(scriptExecutionContext(), m_contextProxy, m_scriptLoader->url());
InspectorInstrumentation::scriptImported(scriptExecutionContext(), m_scriptLoader->identifier(), m_scriptLoader->script());
}
m_scriptLoader = nullptr;
Modified: trunk/Source/WebKit/chromium/ChangeLog (89651 => 89652)
--- trunk/Source/WebKit/chromium/ChangeLog 2011-06-24 05:30:29 UTC (rev 89651)
+++ trunk/Source/WebKit/chromium/ChangeLog 2011-06-24 05:42:25 UTC (rev 89652)
@@ -1,3 +1,13 @@
+2011-06-23 Yury Semikhatsky <yu...@chromium.org>
+
+ Reviewed by Pavel Feldman.
+
+ [Chromium] Web Inspector: provide context menu item for enabling native worker inspection
+ https://bugs.webkit.org/show_bug.cgi?id=63258
+
+ * src/js/DevTools.js:
+ ():
+
2011-06-23 John Bates <jba...@google.com>
Reviewed by James Robinson.
Modified: trunk/Source/WebKit/chromium/src/js/DevTools.js (89651 => 89652)
--- trunk/Source/WebKit/chromium/src/js/DevTools.js 2011-06-24 05:30:29 UTC (rev 89651)
+++ trunk/Source/WebKit/chromium/src/js/DevTools.js 2011-06-24 05:42:25 UTC (rev 89652)
@@ -52,6 +52,7 @@
Preferences.showCookiesTab = true;
Preferences.saveAsAvailable = true;
Preferences.useLowerCaseMenuTitlesOnWindows = true;
+ Preferences.canInspectWorkers = true;
})();
// Recognize WebP as a valid image mime type.