Reviewed by Yury Semikhatsky.
WebInspector: small refactoring for monitorXHR backend property.
Our Inspector API is quite big and can be simplified a bit.
As example for single backend property like monitoringXHR we
have 4 functions in the API. Two functions for frontend
enableMonitoringXHR/disableMonitoringXHR and
two functions for backend monitoringXHRWasEnabled and
monitoringXHRWasDisabled. These functions can be replaced by
one setMonitoringXHR with one 'in' and one 'out' argument.
The initial state of the flag can be gathered from backend
with help of getSettings call where additional section was
added for backend state information.
https://bugs.webkit.org/show_bug.cgi?id=45759
* inspector/Inspector.idl:
* inspector/InspectorController.cpp:
* inspector/InspectorController.h:
* inspector/front-end/ConsoleView.js:
* inspector/front-end/Settings.js:
* inspector/front-end/inspector.js:
2010-09-14 Ilya Tikhonovsky <loislo@chromium.org>
Reviewed by Yury Semikhatsky.
WebInspector: small refactoring for monitorXHR backend property.
Our Inspector API is quite big and can be simplified a bit.
As example for single backend property like monitoringXHR we
have 4 functions in the API. Two functions for frontend
enableMonitoringXHR/disableMonitoringXHR and
two functions for backend monitoringXHRWasEnabled and
monitoringXHRWasDisabled. These functions can be replaced by
one setMonitoringXHR with one 'in' and one 'out' argument.
The initial state of the flag can be gathered from backend
with help of getSettings call where additional section was
added for backend state information.
https://bugs.webkit.org/show_bug.cgi?id=45759
* inspector/Inspector.idl:
* inspector/InspectorController.cpp:
* inspector/InspectorController.h:
* inspector/front-end/ConsoleView.js:
* inspector/front-end/Settings.js:
* inspector/front-end/inspector.js:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@67547
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2010-09-14 Ilya Tikhonovsky <loislo@chromium.org>
+
+ Reviewed by Yury Semikhatsky.
+
+ WebInspector: small refactoring for monitorXHR backend property.
+
+ Our Inspector API is quite big and can be simplified a bit.
+ As example for single backend property like monitoringXHR we
+ have 4 functions in the API. Two functions for frontend
+ enableMonitoringXHR/disableMonitoringXHR and
+ two functions for backend monitoringXHRWasEnabled and
+ monitoringXHRWasDisabled. These functions can be replaced by
+ one setMonitoringXHR with one 'in' and one 'out' argument.
+ The initial state of the flag can be gathered from backend
+ with help of getSettings call where additional section was
+ added for backend state information.
+
+ https://bugs.webkit.org/show_bug.cgi?id=45759
+
+ * http/tests/inspector/console-xhr-logging.html:
+ * inspector/report-API-errors.html:
+
2010-09-15 Steve Block <steveblock@google.com>
Reviewed by Kent Tamura.
function frontend_enableXMLHttpRequestLogging(testController)
{
- InspectorBackend.enableMonitoringXHR();
+ InspectorBackend.setMonitoringXHR(true, function(newStatus) {
+ if (newStatus)
+ testController.notifyDone("enabled");
+ });
+
if (WebInspector.monitoringXHREnabled)
return "enabled";
testController.waitUntilDone();
- frontend_addSniffer(WebInspector, "monitoringXHRWasEnabled", function() {
- testController.notifyDone("enabled");
- });
}
function frontend_disableXMLHttpRequestLogging(testController)
{
- InspectorBackend.disableMonitoringXHR();
+ InspectorBackend.setMonitoringXHR(false, function(newStatus) {
+ if (!newStatus)
+ testController.notifyDone("disabled");
+ });
+
if (!WebInspector.monitoringXHREnabled)
return "disabled";
testController.waitUntilDone();
- frontend_addSniffer(WebInspector, "monitoringXHRWasDisabled", function() {
- testController.notifyDone("disabled");
- });
}
</script>
InspectorBackend.enableResourceTracking(1);
InspectorBackend.enableResourceTracking();
InspectorBackend.enableResourceTracking(true, "not a function");
- InspectorBackend.enableMonitoringXHR(undefined);
- InspectorBackend.disableMonitoringXHR(undefined);
+ InspectorBackend.setMonitoringXHR(true, undefined);
+ InspectorBackend.setMonitoringXHR(false, undefined);
WebInspector_syncDispatch('{"type": "event", "domain": "dom", "event": "something-strange", "data": {}}');
InspectorTest.completeTest();
+2010-09-14 Ilya Tikhonovsky <loislo@chromium.org>
+
+ Reviewed by Yury Semikhatsky.
+
+ WebInspector: small refactoring for monitorXHR backend property.
+
+ Our Inspector API is quite big and can be simplified a bit.
+ As example for single backend property like monitoringXHR we
+ have 4 functions in the API. Two functions for frontend
+ enableMonitoringXHR/disableMonitoringXHR and
+ two functions for backend monitoringXHRWasEnabled and
+ monitoringXHRWasDisabled. These functions can be replaced by
+ one setMonitoringXHR with one 'in' and one 'out' argument.
+ The initial state of the flag can be gathered from backend
+ with help of getSettings call where additional section was
+ added for backend state information.
+
+ https://bugs.webkit.org/show_bug.cgi?id=45759
+
+ * inspector/Inspector.idl:
+ * inspector/InspectorController.cpp:
+ * inspector/InspectorController.h:
+ * inspector/front-end/ConsoleView.js:
+ * inspector/front-end/Settings.js:
+ * inspector/front-end/inspector.js:
+
2010-09-15 Pavel Feldman <pfeldman@chromium.org>
Reviewed by Yury Semikhatsky.
[notify] void evaluateForTestInFrontend(out long testCallId, out String script);
[notify] void disconnectFromBackend();
[notify] void inspectedURLChanged(out String url);
- [notify] void monitoringXHRWasEnabled();
- [notify] void monitoringXHRWasDisabled();
[notify] void removeResource(out unsigned long identifier);
[notify] void reset();
[notify] void resetProfilesPanel();
[handler=Controller] void enableSearchingForNode();
[handler=Controller] void disableSearchingForNode();
- [handler=Controller] void enableMonitoringXHR();
- [handler=Controller] void disableMonitoringXHR();
+ [handler=Controller] void setMonitoringXHR(in boolean enable, out boolean newState);
[handler=Controller] void enableResourceTracking(in boolean always);
[handler=Controller] void disableResourceTracking(in boolean always);
m_sessionSettings = InspectorValue::parseJSON(settingsJSON);
}
+String InspectorController::getBackendSettings()
+{
+ RefPtr<InspectorObject> runtimeSettings = InspectorObject::create();
+ runtimeSettings->setBoolean(monitoringXHRSettingName, m_monitoringXHR);
+ return runtimeSettings->toJSONString();
+}
+
void InspectorController::getSettings(RefPtr<InspectorObject>* settings)
{
*settings = InspectorObject::create();
(*settings)->setString("application", setting(frontendSettingsSettingName()));
(*settings)->setString("session", m_sessionSettings->toJSONString());
+ (*settings)->setString("backend", getBackendSettings());
}
void InspectorController::inspect(Node* node)
}
}
-void InspectorController::setMonitoringXHR(bool enabled)
+void InspectorController::setMonitoringXHR(bool enabled, bool* newState)
{
+ *newState = enabled;
if (m_monitoringXHR == enabled)
return;
m_monitoringXHR = enabled;
setSetting(monitoringXHRSettingName, enabled ? "true" : "false");
- if (m_frontend) {
- if (enabled)
- m_frontend->monitoringXHRWasEnabled();
- else
- m_frontend->monitoringXHRWasDisabled();
- }
}
void InspectorController::connectFrontend()
if (m_searchingForNode)
m_frontend->searchingForNodeWasEnabled();
- if (m_monitoringXHR)
- m_frontend->monitoringXHRWasEnabled();
#if ENABLE(JAVASCRIPT_DEBUGGER)
if (m_profilerAgent->enabled())
private:
static const String& frontendSettingsSettingName();
+ String getBackendSettings();
friend class InspectorBackend;
friend class InspectorBackendDispatcher;
void enableSearchingForNode() { setSearchingForNode(true); }
void disableSearchingForNode() { setSearchingForNode(false); }
- void setMonitoringXHR(bool enabled);
- void enableMonitoringXHR() { setMonitoringXHR(true); }
- void disableMonitoringXHR() { setMonitoringXHR(false); }
+ void setMonitoringXHR(bool enabled, bool* newState);
void storeLastActivePanel(const String& panelName);
InspectorDOMAgent* domAgent() { return m_domAgent.get(); }
void releaseFrontendLifetimeAgents();
}
var contextMenu = new WebInspector.ContextMenu();
- if (!WebInspector.monitoringXHREnabled)
- contextMenu.appendCheckboxItem(WebInspector.UIString("XMLHttpRequest logging"), InspectorBackend.enableMonitoringXHR.bind(InspectorBackend), false);
- else
- contextMenu.appendCheckboxItem(WebInspector.UIString("XMLHttpRequest logging"), InspectorBackend.disableMonitoringXHR.bind(InspectorBackend), true);
+
+ function monitoringXHRWasChanged(newState)
+ {
+ WebInspector.monitoringXHREnabled = newState;
+ }
+ var itemAction = InspectorBackend.setMonitoringXHR.bind(InspectorBackend, !WebInspector.monitoringXHREnabled, monitoringXHRWasChanged);
+ contextMenu.appendCheckboxItem(WebInspector.UIString("XMLHttpRequest logging"), itemAction, WebInspector.monitoringXHREnabled);
contextMenu.appendItem(WebInspector.UIString("Clear Console"), this.requestClearMessages.bind(this));
contextMenu.show(event);
},
WebInspector.sessionSettings.dispatchEventToListeners("loaded");
}
+ function populateBackendSettings(settingsString)
+ {
+ var settings = JSON.parse(settingsString);
+
+ WebInspector.monitoringXHREnabled = settings.monitoringXHREnabled;
+ }
+
InspectorBackend.getSettings(function(settings) {
populateApplicationSettings(settings.application);
populateSessionSettings(settings.session);
+ populateBackendSettings(settings.backend);
});
}
this.panels.elements.searchingForNodeWasDisabled();
}
-WebInspector.monitoringXHRWasEnabled = function()
-{
- this.monitoringXHREnabled = true;
-}
-
-WebInspector.monitoringXHRWasDisabled = function()
-{
- this.monitoringXHREnabled = false;
-}
-
WebInspector.attachDebuggerWhenShown = function()
{
this.panels.scripts.attachDebuggerWhenShown();