summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/WebCore/inspector/InspectorBackend.cpp
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@nokia.com>2009-11-19 09:58:03 +0100
committerPaul Olav Tvete <paul.tvete@nokia.com>2009-11-19 09:58:03 +0100
commit879e2ea7d15510ec5f94d6d7a005b157b115f69f (patch)
tree73aedd0bffe7ab39387229a9417aa50cecbbf0aa /src/3rdparty/webkit/WebCore/inspector/InspectorBackend.cpp
parent8fc2eec5b3282665f76f1e0313a03608bf4e7bc1 (diff)
parent80cd617b05ad3e647c87dc063d40cde0617344ca (diff)
Merge remote branch 'origin/4.6' into lighthouse
Conflicts: configure src/plugins/graphicssystems/graphicssystems.pro
Diffstat (limited to 'src/3rdparty/webkit/WebCore/inspector/InspectorBackend.cpp')
-rw-r--r--src/3rdparty/webkit/WebCore/inspector/InspectorBackend.cpp146
1 files changed, 118 insertions, 28 deletions
diff --git a/src/3rdparty/webkit/WebCore/inspector/InspectorBackend.cpp b/src/3rdparty/webkit/WebCore/inspector/InspectorBackend.cpp
index 752ec0cee5..67c08b9051 100644
--- a/src/3rdparty/webkit/WebCore/inspector/InspectorBackend.cpp
+++ b/src/3rdparty/webkit/WebCore/inspector/InspectorBackend.cpp
@@ -46,6 +46,7 @@
#include "InspectorFrontend.h"
#include "InspectorResource.h"
#include "Pasteboard.h"
+#include "ScriptArray.h"
#include "ScriptFunctionCall.h"
#if ENABLE(DOM_STORAGE)
@@ -244,12 +245,6 @@ const String& InspectorBackend::platform() const
#endif
#elif PLATFORM(WIN_OS)
DEFINE_STATIC_LOCAL(const String, platform, ("windows"));
-#elif PLATFORM(QT)
- DEFINE_STATIC_LOCAL(const String, platform, ("qt"));
-#elif PLATFORM(GTK)
- DEFINE_STATIC_LOCAL(const String, platform, ("gtk"));
-#elif PLATFORM(WX)
- DEFINE_STATIC_LOCAL(const String, platform, ("wx"));
#else
DEFINE_STATIC_LOCAL(const String, platform, ("unknown"));
#endif
@@ -257,33 +252,42 @@ const String& InspectorBackend::platform() const
return platform;
}
-void InspectorBackend::enableTimeline(bool always)
+
+const String& InspectorBackend::port() const
{
- if (m_inspectorController)
- m_inspectorController->enableTimeline(always);
+#if PLATFORM(QT)
+ DEFINE_STATIC_LOCAL(const String, port, ("qt"));
+#elif PLATFORM(GTK)
+ DEFINE_STATIC_LOCAL(const String, port, ("gtk"));
+#elif PLATFORM(WX)
+ DEFINE_STATIC_LOCAL(const String, port, ("wx"));
+#else
+ DEFINE_STATIC_LOCAL(const String, port, ("unknown"));
+#endif
+
+ return port;
}
-void InspectorBackend::disableTimeline(bool always)
+void InspectorBackend::startTimelineProfiler()
{
if (m_inspectorController)
- m_inspectorController->disableTimeline(always);
+ m_inspectorController->startTimelineProfiler();
}
-bool InspectorBackend::timelineEnabled() const
+void InspectorBackend::stopTimelineProfiler()
{
if (m_inspectorController)
- return m_inspectorController->timelineEnabled();
- return false;
+ m_inspectorController->stopTimelineProfiler();
}
-#if ENABLE(JAVASCRIPT_DEBUGGER)
-const ProfilesArray& InspectorBackend::profiles() const
+bool InspectorBackend::timelineProfilerEnabled() const
{
if (m_inspectorController)
- return m_inspectorController->profiles();
- return m_emptyProfiles;
+ return m_inspectorController->timelineProfilerEnabled();
+ return false;
}
+#if ENABLE(JAVASCRIPT_DEBUGGER)
void InspectorBackend::startProfiling()
{
if (m_inspectorController)
@@ -315,6 +319,18 @@ bool InspectorBackend::profilerEnabled()
return false;
}
+void InspectorBackend::getProfileHeaders(long callId)
+{
+ if (m_inspectorController)
+ m_inspectorController->getProfileHeaders(callId);
+}
+
+void InspectorBackend::getProfile(long callId, unsigned uid)
+{
+ if (m_inspectorController)
+ m_inspectorController->getProfile(callId, uid);
+}
+
void InspectorBackend::enableDebugger(bool always)
{
if (m_inspectorController)
@@ -395,7 +411,7 @@ void InspectorBackend::stepOutOfFunctionInDebugger()
#endif
-void InspectorBackend::dispatchOnInjectedScript(long callId, const String& methodName, const String& arguments)
+void InspectorBackend::dispatchOnInjectedScript(long callId, const String& methodName, const String& arguments, bool async)
{
InspectorFrontend* frontend = inspectorFrontend();
if (!frontend)
@@ -404,8 +420,12 @@ void InspectorBackend::dispatchOnInjectedScript(long callId, const String& metho
ScriptFunctionCall function(m_inspectorController->m_scriptState, m_inspectorController->m_injectedScriptObj, "dispatch");
function.appendArgument(methodName);
function.appendArgument(arguments);
+ if (async)
+ function.appendArgument(static_cast<int>(callId));
bool hadException = false;
ScriptValue result = function.call(hadException);
+ if (async)
+ return; // InjectedScript will return result asynchronously by means of ::reportDidDispatchOnInjectedScript.
if (hadException)
frontend->didDispatchOnInjectedScript(callId, "", true);
else
@@ -450,18 +470,48 @@ void InspectorBackend::copyNode(long nodeId)
String markup = createMarkup(node);
Pasteboard::generalPasteboard()->writePlainText(markup);
}
+
+void InspectorBackend::removeNode(long callId, long nodeId)
+{
+ InspectorFrontend* frontend = inspectorFrontend();
+ if (!frontend)
+ return;
+
+ Node* node = nodeForId(nodeId);
+ if (!node) {
+ // Use -1 to denote an error condition.
+ frontend->didRemoveNode(callId, -1);
+ return;
+ }
+
+ Node* parentNode = node->parentNode();
+ if (!parentNode) {
+ frontend->didRemoveNode(callId, -1);
+ return;
+ }
-void InspectorBackend::getCookies(long callId)
+ ExceptionCode code;
+ parentNode->removeChild(node, code);
+ if (code) {
+ frontend->didRemoveNode(callId, -1);
+ return;
+ }
+
+ frontend->didRemoveNode(callId, nodeId);
+}
+
+void InspectorBackend::getCookies(long callId, const String& domain)
{
- if (InspectorDOMAgent* domAgent = inspectorDOMAgent())
- domAgent->getCookies(callId);
+ if (!m_inspectorController)
+ return;
+ m_inspectorController->getCookies(callId, domain);
}
-void InspectorBackend::deleteCookie(const String& cookieName)
+void InspectorBackend::deleteCookie(const String& cookieName, const String& domain)
{
if (!m_inspectorController)
return;
- m_inspectorController->deleteCookie(cookieName);
+ m_inspectorController->deleteCookie(cookieName, domain);
}
void InspectorBackend::highlight(long nodeId)
@@ -477,10 +527,10 @@ Node* InspectorBackend::nodeForId(long nodeId)
return 0;
}
-ScriptValue InspectorBackend::wrapObject(const ScriptValue& object)
+ScriptValue InspectorBackend::wrapObject(const ScriptValue& object, const String& objectGroup)
{
if (m_inspectorController)
- return m_inspectorController->wrapObject(object);
+ return m_inspectorController->wrapObject(object, objectGroup);
return ScriptValue();
}
@@ -491,6 +541,12 @@ ScriptValue InspectorBackend::unwrapObject(const String& objectId)
return ScriptValue();
}
+void InspectorBackend::releaseWrapperObjectGroup(const String& objectGroup)
+{
+ if (m_inspectorController)
+ m_inspectorController->releaseWrapperObjectGroup(objectGroup);
+}
+
long InspectorBackend::pushNodePathToFrontend(Node* node, bool selectInUI)
{
InspectorFrontend* frontend = inspectorFrontend();
@@ -510,10 +566,32 @@ void InspectorBackend::addNodesToSearchResult(const String& nodeIds)
}
#if ENABLE(DATABASE)
+Database* InspectorBackend::databaseForId(long databaseId)
+{
+ if (m_inspectorController)
+ return m_inspectorController->databaseForId(databaseId);
+ return 0;
+}
+
void InspectorBackend::selectDatabase(Database* database)
{
- if (InspectorFrontend* frontend = inspectorFrontend())
- frontend->selectDatabase(database);
+ if (m_inspectorController)
+ m_inspectorController->selectDatabase(database);
+}
+
+void InspectorBackend::getDatabaseTableNames(long callId, long databaseId)
+{
+ if (InspectorFrontend* frontend = inspectorFrontend()) {
+ ScriptArray result = frontend->newScriptArray();
+ Database* database = m_inspectorController->databaseForId(databaseId);
+ if (database) {
+ Vector<String> tableNames = database->tableNames();
+ unsigned length = tableNames.size();
+ for (unsigned i = 0; i < length; ++i)
+ result.set(i, tableNames[i]);
+ }
+ frontend->didGetDatabaseTableNames(callId, result);
+ }
}
#endif
@@ -543,6 +621,18 @@ void InspectorBackend::removeDOMStorageItem(long callId, long storageId, const S
}
#endif
+void InspectorBackend::didEvaluateForTestInFrontend(long callId, const String& jsonResult)
+{
+ if (m_inspectorController)
+ m_inspectorController->didEvaluateForTestInFrontend(callId, jsonResult);
+}
+
+void InspectorBackend::reportDidDispatchOnInjectedScript(long callId, const String& result, bool isException)
+{
+ if (InspectorFrontend* frontend = inspectorFrontend())
+ frontend->didDispatchOnInjectedScript(callId, result, isException);
+}
+
InspectorDOMAgent* InspectorBackend::inspectorDOMAgent()
{
if (!m_inspectorController)