2011-02-24 Ilya Tikhonovsky <loislo@chromium.org>
authorloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Feb 2011 11:43:39 +0000 (11:43 +0000)
committerloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Feb 2011 11:43:39 +0000 (11:43 +0000)
        Reviewed by Pavel Feldman.

        Web Inspector: There is a validator of the protocol message format.

        It has two parts. InspectorBackendStub.js is the frontend part.
        InspectorBackendDispatcher.cpp is the backend part.
        Both parts are checking protocol message format and report the error if
        the message has not enough fields or the types of fields do not match with
        Inspector.idl specification. These validators are generated automatically.

        In addition, we have a number of places at the backend where we check the
        function arguments and do nothing if the arguments are invalid
        from the business logic point of view.

        This patch bring us an ability to report a custom error from such function to the frontend.

        https://bugs.webkit.org/show_bug.cgi?id=54971

        * inspector/CodeGeneratorInspector.pm:
        * inspector/InjectedScriptHost.cpp:
        * inspector/InspectorAgent.cpp:
        * inspector/InspectorAgent.h:
        * inspector/InspectorApplicationCacheAgent.cpp:
        * inspector/InspectorApplicationCacheAgent.h:
        * inspector/InspectorBrowserDebuggerAgent.cpp:
        * inspector/InspectorBrowserDebuggerAgent.h:
        * inspector/InspectorCSSAgent.cpp:
        * inspector/InspectorCSSAgent.h:
        * inspector/InspectorConsoleAgent.cpp:
        * inspector/InspectorConsoleAgent.h:
        * inspector/InspectorController.cpp:
        * inspector/InspectorDOMAgent.cpp:
        * inspector/InspectorDOMAgent.h:
        * inspector/InspectorDOMStorageAgent.cpp:
        * inspector/InspectorDOMStorageAgent.h:
        * inspector/InspectorDatabaseAgent.cpp:
        * inspector/InspectorDatabaseAgent.h:
        * inspector/InspectorDebuggerAgent.cpp:
        * inspector/InspectorDebuggerAgent.h:
        * inspector/InspectorProfilerAgent.cpp:
        * inspector/InspectorProfilerAgent.h:
        * inspector/InspectorResourceAgent.cpp:
        * inspector/InspectorResourceAgent.h:
        * inspector/InspectorRuntimeAgent.cpp:
        * inspector/InspectorRuntimeAgent.h:
        * inspector/InspectorTimelineAgent.cpp:
        * inspector/InspectorTimelineAgent.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@79539 268f45cc-cd09-0410-ab3c-d52691b4dbfc

30 files changed:
Source/WebCore/ChangeLog
Source/WebCore/inspector/CodeGeneratorInspector.pm
Source/WebCore/inspector/InjectedScriptHost.cpp
Source/WebCore/inspector/InspectorAgent.cpp
Source/WebCore/inspector/InspectorAgent.h
Source/WebCore/inspector/InspectorApplicationCacheAgent.cpp
Source/WebCore/inspector/InspectorApplicationCacheAgent.h
Source/WebCore/inspector/InspectorBrowserDebuggerAgent.cpp
Source/WebCore/inspector/InspectorBrowserDebuggerAgent.h
Source/WebCore/inspector/InspectorCSSAgent.cpp
Source/WebCore/inspector/InspectorCSSAgent.h
Source/WebCore/inspector/InspectorConsoleAgent.cpp
Source/WebCore/inspector/InspectorConsoleAgent.h
Source/WebCore/inspector/InspectorController.cpp
Source/WebCore/inspector/InspectorDOMAgent.cpp
Source/WebCore/inspector/InspectorDOMAgent.h
Source/WebCore/inspector/InspectorDOMStorageAgent.cpp
Source/WebCore/inspector/InspectorDOMStorageAgent.h
Source/WebCore/inspector/InspectorDatabaseAgent.cpp
Source/WebCore/inspector/InspectorDatabaseAgent.h
Source/WebCore/inspector/InspectorDebuggerAgent.cpp
Source/WebCore/inspector/InspectorDebuggerAgent.h
Source/WebCore/inspector/InspectorProfilerAgent.cpp
Source/WebCore/inspector/InspectorProfilerAgent.h
Source/WebCore/inspector/InspectorResourceAgent.cpp
Source/WebCore/inspector/InspectorResourceAgent.h
Source/WebCore/inspector/InspectorRuntimeAgent.cpp
Source/WebCore/inspector/InspectorRuntimeAgent.h
Source/WebCore/inspector/InspectorTimelineAgent.cpp
Source/WebCore/inspector/InspectorTimelineAgent.h

index b76a57e003bf99ff0eb9c794ace1d44c5bec6806..42393fa2fc1531b8f13922180419f78e60b3dc83 100644 (file)
@@ -1,3 +1,53 @@
+2011-02-24  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: There is a validator of the protocol message format.
+
+        It has two parts. InspectorBackendStub.js is the frontend part.
+        InspectorBackendDispatcher.cpp is the backend part.
+        Both parts are checking protocol message format and report the error if
+        the message has not enough fields or the types of fields do not match with
+        Inspector.idl specification. These validators are generated automatically.
+
+        In addition, we have a number of places at the backend where we check the
+        function arguments and do nothing if the arguments are invalid
+        from the business logic point of view.
+
+        This patch bring us an ability to report a custom error from such function to the frontend.
+
+        https://bugs.webkit.org/show_bug.cgi?id=54971
+
+        * inspector/CodeGeneratorInspector.pm:
+        * inspector/InjectedScriptHost.cpp:
+        * inspector/InspectorAgent.cpp:
+        * inspector/InspectorAgent.h:
+        * inspector/InspectorApplicationCacheAgent.cpp:
+        * inspector/InspectorApplicationCacheAgent.h:
+        * inspector/InspectorBrowserDebuggerAgent.cpp:
+        * inspector/InspectorBrowserDebuggerAgent.h:
+        * inspector/InspectorCSSAgent.cpp:
+        * inspector/InspectorCSSAgent.h:
+        * inspector/InspectorConsoleAgent.cpp:
+        * inspector/InspectorConsoleAgent.h:
+        * inspector/InspectorController.cpp:
+        * inspector/InspectorDOMAgent.cpp:
+        * inspector/InspectorDOMAgent.h:
+        * inspector/InspectorDOMStorageAgent.cpp:
+        * inspector/InspectorDOMStorageAgent.h:
+        * inspector/InspectorDatabaseAgent.cpp:
+        * inspector/InspectorDatabaseAgent.h:
+        * inspector/InspectorDebuggerAgent.cpp:
+        * inspector/InspectorDebuggerAgent.h:
+        * inspector/InspectorProfilerAgent.cpp:
+        * inspector/InspectorProfilerAgent.h:
+        * inspector/InspectorResourceAgent.cpp:
+        * inspector/InspectorResourceAgent.h:
+        * inspector/InspectorRuntimeAgent.cpp:
+        * inspector/InspectorRuntimeAgent.h:
+        * inspector/InspectorTimelineAgent.cpp:
+        * inspector/InspectorTimelineAgent.h:
+
 2011-02-24  Ryosuke Niwa  <rniwa@webkit.org>
 
         Reviewed by Ojan Vafai.
index b59a4d12178957faf36b8eb06433a015023d6887..58236b546cbcfd1e5c2c6602c5c290d66dc41b07 100644 (file)
@@ -453,9 +453,12 @@ sub generateBackendFunction
         $indent = "    ";
     }
 
-    my $args = join(", ", (map($_->name, @inArgs), map("&" . $_->name, @outArgs)));
+    push(@function, "$indent    ErrorString error;");
+    my $args = join(", ", ("&error", map($_->name, @inArgs), map("&" . $_->name, @outArgs)));
     push(@function, "$indent    if (!protocolErrors->length())");
     push(@function, "$indent        $domainAccessor->$functionName($args);");
+    push(@function, "$indent    if (error.length())");
+    push(@function, "$indent        protocolErrors->pushString(error);");
     if (scalar(@inArgs)) {
         push(@function, "    } else {");
         push(@function, "        protocolErrors->pushString(\"Protocol Error: 'arguments' property with type 'object' was not found.\");");
@@ -874,6 +877,8 @@ namespace $namespace {
 
 $forwardDeclarations
 
+typedef String ErrorString;
+
 class $className {
 public:
 $constructor
index 5b137781205f700c03ff5223fdf8353de6a4140a..4cf1ecca3ffcc321102fe11ea41cf88cc760d91b 100644 (file)
@@ -89,8 +89,10 @@ void InjectedScriptHost::inspect(Node* node)
 
 void InjectedScriptHost::clearConsoleMessages()
 {
-    if (m_inspectorAgent)
-        m_inspectorAgent->consoleAgent()->clearConsoleMessages();
+    if (m_inspectorAgent) {
+        ErrorString error;
+        m_inspectorAgent->consoleAgent()->clearConsoleMessages(&error);
+    }
 }
 
 void InjectedScriptHost::copyText(const String& text)
index 3cb77d0ff639117f1d248f2be0cc4d202b937e75..cb1907d361d7d2087a4478fb922300e5336a313c 100644 (file)
@@ -171,7 +171,8 @@ void InspectorAgent::inspectedPageDestroyed()
     if (m_frontend)
         m_frontend->disconnectFromBackend();
 
-    hideHighlight();
+    ErrorString error;
+    hideHighlight(&error);
 
 #if ENABLE(JAVASCRIPT_DEBUGGER)
     m_debuggerAgent.clear();
@@ -237,7 +238,7 @@ void InspectorAgent::focusNode()
     m_nodeToFocus = 0;
 }
 
-void InspectorAgent::highlight(Node* node)
+void InspectorAgent::highlight(ErrorString*, Node* node)
 {
     if (!enabled())
         return;
@@ -246,25 +247,25 @@ void InspectorAgent::highlight(Node* node)
     m_client->highlight(node);
 }
 
-void InspectorAgent::highlightDOMNode(long nodeId)
+void InspectorAgent::highlightDOMNode(ErrorString* error, long nodeId)
 {
     Node* node = 0;
     if (m_domAgent && (node = m_domAgent->nodeForId(nodeId)))
-        highlight(node);
+        highlight(error, node);
 }
 
-void InspectorAgent::highlightFrame(unsigned long frameId)
+void InspectorAgent::highlightFrame(ErrorString* error, unsigned long frameId)
 {
     Frame* mainFrame = m_inspectedPage->mainFrame();
     for (Frame* frame = mainFrame; frame; frame = frame->tree()->traverseNext(mainFrame)) {
         if (reinterpret_cast<uintptr_t>(frame) == frameId && frame->ownerElement()) {
-            highlight(frame->ownerElement());
+            highlight(error, frame->ownerElement());
             return;
         }
     }
 }
 
-void InspectorAgent::hideHighlight()
+void InspectorAgent::hideHighlight(ErrorString*)
 {
     if (!enabled())
         return;
@@ -280,8 +281,10 @@ void InspectorAgent::mouseDidMoveOverElement(const HitTestResult& result, unsign
     Node* node = result.innerNode();
     while (node && node->nodeType() == Node::TEXT_NODE)
         node = node->parentNode();
-    if (node)
-        highlight(node);
+    if (node) {
+        ErrorString error;
+        highlight(&error, node);
+    }
 }
 
 bool InspectorAgent::handleMousePress()
@@ -324,11 +327,13 @@ void InspectorAgent::setSearchingForNode(bool enabled)
     if (searchingForNodeInPage() == enabled)
         return;
     m_state->setBoolean(InspectorAgentState::searchingForNode, enabled);
-    if (!enabled)
-        hideHighlight();
+    if (!enabled) {
+        ErrorString error;
+        hideHighlight(&error);
+    }
 }
 
-void InspectorAgent::setSearchingForNode(bool enabled, bool* newState)
+void InspectorAgent::setSearchingForNode(ErrorString*, bool enabled, bool* newState)
 {
     *newState = enabled;
     setSearchingForNode(enabled);
@@ -366,15 +371,16 @@ void InspectorAgent::disconnectFrontend()
 
     m_frontend = 0;
 
+    ErrorString error;
 #if ENABLE(JAVASCRIPT_DEBUGGER)
     // If the window is being closed with the debugger enabled,
     // remember this state to re-enable debugger on the next window
     // opening.
-    disableDebugger();
+    disableDebugger(&error);
 #endif
     setSearchingForNode(false);
 
-    hideHighlight();
+    hideHighlight(&error);
 
 #if ENABLE(JAVASCRIPT_DEBUGGER)
     m_profilerAgent->setFrontend(0);
@@ -420,7 +426,7 @@ void InspectorAgent::releaseFrontendLifetimeAgents()
 #endif
 }
 
-void InspectorAgent::populateScriptObjects()
+void InspectorAgent::populateScriptObjects(ErrorString*)
 {
     ASSERT(m_frontend);
     if (!m_frontend)
@@ -477,8 +483,10 @@ void InspectorAgent::restoreProfiler(ProfilerRestoreAction action)
     ASSERT(m_frontend);
 #if ENABLE(JAVASCRIPT_DEBUGGER)
     m_profilerAgent->setFrontend(m_frontend);
-    if (m_state->getBoolean(InspectorAgentState::profilerEnabled))
-        enableProfiler();
+    if (m_state->getBoolean(InspectorAgentState::profilerEnabled)) {
+        ErrorString error;
+        enableProfiler(&error);
+    }
     if (action == ProfilerRestoreResetAgent)
         m_profilerAgent->resetFrontendProfiles();
 #endif
@@ -577,7 +585,7 @@ bool InspectorAgent::isMainResourceLoader(DocumentLoader* loader, const KURL& re
     return loader->frame() == m_inspectedPage->mainFrame() && requestUrl == loader->requestURL();
 }
 
-void InspectorAgent::setUserAgentOverride(const String& userAgent)
+void InspectorAgent::setUserAgentOverride(ErrorString*, const String& userAgent)
 {
     m_userAgentOverride = userAgent;
 }
@@ -657,7 +665,7 @@ void InspectorAgent::didDestroyWorker(intptr_t id)
 }
 #endif // ENABLE(WORKERS)
 
-void InspectorAgent::getCookies(RefPtr<InspectorArray>* cookies, WTF::String* cookiesString)
+void InspectorAgent::getCookies(ErrorString*, RefPtr<InspectorArray>* cookies, WTF::String* cookiesString)
 {
     // If we can get raw cookies.
     ListHashSet<Cookie> rawCookiesList;
@@ -728,7 +736,7 @@ PassRefPtr<InspectorObject> InspectorAgent::buildObjectForCookie(const Cookie& c
     return value;
 }
 
-void InspectorAgent::deleteCookie(const String& cookieName, const String& domain)
+void InspectorAgent::deleteCookie(ErrorString*, const String& cookieName, const String& domain)
 {
     for (Frame* frame = m_inspectedPage->mainFrame(); frame; frame = frame->tree()->traverseNext(m_inspectedPage->mainFrame())) {
         Document* document = frame->document();
@@ -798,7 +806,7 @@ bool InspectorAgent::profilerEnabled() const
     return enabled() && m_profilerAgent->enabled();
 }
 
-void InspectorAgent::enableProfiler()
+void InspectorAgent::enableProfiler(ErrorString*)
 {
     if (profilerEnabled())
         return;
@@ -806,7 +814,7 @@ void InspectorAgent::enableProfiler()
     m_profilerAgent->enable(false);
 }
 
-void InspectorAgent::disableProfiler()
+void InspectorAgent::disableProfiler(ErrorString*)
 {
     m_state->setBoolean(InspectorAgentState::profilerEnabled, false);
     m_profilerAgent->disable();
@@ -841,7 +849,7 @@ void InspectorAgent::enableDebugger(bool eraseStickyBreakpoints)
     m_frontend->debuggerWasEnabled();
 }
 
-void InspectorAgent::disableDebugger()
+void InspectorAgent::disableDebugger(ErrorString*)
 {
     if (!enabled())
         return;
@@ -854,12 +862,6 @@ void InspectorAgent::disableDebugger()
         m_state->setBoolean(InspectorAgentState::debuggerEnabled, false);
     }
 }
-
-void InspectorAgent::resume()
-{
-    if (m_debuggerAgent)
-        m_debuggerAgent->resume();
-}
 #endif
 
 void InspectorAgent::evaluateForTestInFrontend(long callId, const String& script)
@@ -870,7 +872,7 @@ void InspectorAgent::evaluateForTestInFrontend(long callId, const String& script
         m_pendingEvaluateTestCommands.append(pair<long, String>(callId, script));
 }
 
-void InspectorAgent::didEvaluateForTestInFrontend(long callId, const String& jsonResult)
+void InspectorAgent::didEvaluateForTestInFrontend(ErrorString*, long callId, const String& jsonResult)
 {
     ScriptState* scriptState = scriptStateFromPage(debuggerWorld(), m_inspectedPage);
     ScriptObject window;
@@ -1125,7 +1127,7 @@ void InspectorAgent::drawElementTitle(GraphicsContext& context, const IntRect& b
     context.drawText(font, nodeTitleRun, IntPoint(titleRect.x() + rectInflatePx, titleRect.y() + font.fontMetrics().height()));
 }
 
-void InspectorAgent::openInInspectedWindow(const String& url)
+void InspectorAgent::openInInspectedWindow(ErrorString*, const String& url)
 {
     Frame* mainFrame = m_inspectedPage->mainFrame();
 
@@ -1143,12 +1145,12 @@ void InspectorAgent::openInInspectedWindow(const String& url)
     newFrame->loader()->changeLocation(mainFrame->document()->securityOrigin(), newFrame->loader()->completeURL(url), "", false, false);
 }
 
-void InspectorAgent::addScriptToEvaluateOnLoad(const String& source)
+void InspectorAgent::addScriptToEvaluateOnLoad(ErrorString*, const String& source)
 {
     m_scriptsToEvaluateOnLoad.append(source);
 }
 
-void InspectorAgent::removeAllScriptsToEvaluateOnLoad()
+void InspectorAgent::removeAllScriptsToEvaluateOnLoad(ErrorString*)
 {
     m_scriptsToEvaluateOnLoad.clear();
 }
@@ -1170,7 +1172,7 @@ KURL InspectorAgent::inspectedURLWithoutFragment() const
     return url;
 }
 
-void InspectorAgent::reloadPage(bool ignoreCache)
+void InspectorAgent::reloadPage(ErrorString*, bool ignoreCache)
 {
     m_inspectedPage->mainFrame()->loader()->reload(ignoreCache);
 }
index 764e4aff883ded09c6494cf15758676f6709a05c..6da0b60203bb5167b4f85fb6163071556d667143 100644 (file)
@@ -99,6 +99,8 @@ class WebSocketHandshakeRequest;
 class WebSocketHandshakeResponse;
 #endif
 
+typedef String ErrorString;
+
 class InspectorAgent {
     WTF_MAKE_NONCOPYABLE(InspectorAgent);
     WTF_MAKE_FAST_ALLOCATED;
@@ -116,19 +118,19 @@ public:
     Page* inspectedPage() const { return m_inspectedPage; }
     KURL inspectedURL() const;
     KURL inspectedURLWithoutFragment() const;
-    void reloadPage(bool ignoreCache);
+    void reloadPage(ErrorString* error, bool ignoreCache);
     void showConsole();
 
     void restoreInspectorStateFromCookie(const String& inspectorCookie);
 
-    void highlight(Node*);
-    void hideHighlight();
+    void highlight(ErrorString* error, Node*);
+    void hideHighlight(ErrorString* error);
     void inspect(Node*);
-    void highlightDOMNode(long nodeId);
-    void hideDOMNodeHighlight() { hideHighlight(); }
+    void highlightDOMNode(ErrorString* error, long nodeId);
+    void hideDOMNodeHighlight(ErrorString* error) { hideHighlight(error); }
 
-    void highlightFrame(unsigned long frameId);
-    void hideFrameHighlight() { hideHighlight(); }
+    void highlightFrame(ErrorString* error, unsigned long frameId);
+    void hideFrameHighlight(ErrorString* error) { hideHighlight(error); }
 
     void setFrontend(InspectorFrontend*);
     InspectorFrontend* frontend() const { return m_frontend; }
@@ -167,8 +169,8 @@ public:
 
     void didCommitLoad(DocumentLoader*);
 
-    void getCookies(RefPtr<InspectorArray>* cookies, WTF::String* cookiesString);
-    void deleteCookie(const String& cookieName, const String& domain);
+    void getCookies(ErrorString* error, RefPtr<InspectorArray>* cookies, WTF::String* cookiesString);
+    void deleteCookie(ErrorString* error, const String& cookieName, const String& domain);
 
     void domContentLoadedEventFired(DocumentLoader*, const KURL&);
     void loadEventFired(DocumentLoader*, const KURL&);
@@ -191,32 +193,31 @@ public:
     bool hasFrontend() const { return m_frontend; }
 
     void drawNodeHighlight(GraphicsContext&) const;
-    void openInInspectedWindow(const String& url);
+    void openInInspectedWindow(ErrorString* error, const String& url);
     void drawElementTitle(GraphicsContext&, const IntRect& boundingBox, const FloatRect& overlayRect, WebCore::Settings*) const;
 
 #if ENABLE(JAVASCRIPT_DEBUGGER)
     bool isRecordingUserInitiatedProfile() const;
-    void startProfiling() { startUserInitiatedProfiling(); }
+    void startProfiling(ErrorString*) { startUserInitiatedProfiling(); }
     void startUserInitiatedProfiling();
-    void stopProfiling() { stopUserInitiatedProfiling(); }
+    void stopProfiling(ErrorString*) { stopUserInitiatedProfiling(); }
     void stopUserInitiatedProfiling();
-    void enableProfiler();
-    void disableProfiler();
+    void enableProfiler(ErrorString* error);
+    void disableProfiler(ErrorString* error);
     bool profilerEnabled() const;
 
     void startUserInitiatedDebugging();
-    void enableDebugger() { enableDebugger(false); }
+    void enableDebugger(ErrorString*) { enableDebugger(false); }
     void enableDebugger(bool eraseStickyBreakpoints);
-    void disableDebugger();
+    void disableDebugger(ErrorString* error);
     bool debuggerEnabled() const { return m_debuggerAgent; }
-    void resume();
 #endif
 
     // Generic code called from custom implementations.
     void evaluateForTestInFrontend(long testCallId, const String& script);
 
-    void addScriptToEvaluateOnLoad(const String& source);
-    void removeAllScriptsToEvaluateOnLoad();
+    void addScriptToEvaluateOnLoad(ErrorString* error, const String& source);
+    void removeAllScriptsToEvaluateOnLoad(ErrorString* error);
     void setInspectorExtensionAPI(const String& source);
 
     InspectorState* state() { return m_state.get(); }
@@ -224,12 +225,12 @@ public:
     // InspectorAgent API
     void getInspectorState(RefPtr<InspectorObject>* state);
     void setMonitoringXHREnabled(bool enabled, bool* newState);
-    void populateScriptObjects();
+    void populateScriptObjects(ErrorString* error);
     // Following are used from InspectorBackend and internally.
-    void setSearchingForNode(bool enabled, bool* newState);
-    void didEvaluateForTestInFrontend(long callId, const String& jsonResult);
+    void setSearchingForNode(ErrorString* error, bool enabled, bool* newState);
+    void didEvaluateForTestInFrontend(ErrorString* error, long callId, const String& jsonResult);
 
-    void setUserAgentOverride(const String& userAgent);
+    void setUserAgentOverride(ErrorString* error, const String& userAgent);
     void applyUserAgentOverride(String* userAgent) const;
 
 private:
index b38bb8362b4c0e952f5d9a83a3000bff143f7473..a39c980a8305bbaa83b2e9dd44133c1095761fc6 100644 (file)
@@ -64,7 +64,7 @@ void InspectorApplicationCacheAgent::networkStateChanged()
     m_frontend->updateNetworkState(isNowOnline);
 }
 
-void InspectorApplicationCacheAgent::getApplicationCaches(RefPtr<InspectorValue>* applicationCaches)
+void InspectorApplicationCacheAgent::getApplicationCaches(ErrorString*, RefPtr<InspectorValue>* applicationCaches)
 {
     if (m_documentLoader) {
         ApplicationCacheHost* host = m_documentLoader->applicationCacheHost();
index 33cee593f90a6cc3ffd4eb1de8a9f588957a7c2c..dd15df010bd85df039a6f9b9c925c76e9866e5ab 100644 (file)
@@ -42,6 +42,8 @@ class InspectorObject;
 class InspectorValue;
 class ResourceResponse;
 
+typedef String ErrorString;
+
 class InspectorApplicationCacheAgent {
     WTF_MAKE_NONCOPYABLE(InspectorApplicationCacheAgent); WTF_MAKE_FAST_ALLOCATED;
 public:
@@ -55,7 +57,7 @@ public:
     void networkStateChanged();
 
     // From Frontend
-    void getApplicationCaches(RefPtr<InspectorValue>* applicationCaches);
+    void getApplicationCaches(ErrorString* error, RefPtr<InspectorValue>* applicationCaches);
 
 private:
     PassRefPtr<InspectorObject> buildObjectForApplicationCache(const ApplicationCacheHost::ResourceInfoList&, const ApplicationCacheHost::CacheInfo&);
index 5fe9937d6fba400e41fb57a0f5e24c31af7da2d9..176c3aa7283ad630ea2a543e8c6468604761d5dd 100644 (file)
@@ -39,6 +39,7 @@
 #include "InspectorDOMAgent.h"
 #include "InspectorDebuggerAgent.h"
 #include "InspectorState.h"
+#include "InspectorValues.h"
 #include <wtf/text/CString.h>
 
 namespace {
@@ -82,7 +83,7 @@ InspectorBrowserDebuggerAgent::~InspectorBrowserDebuggerAgent()
 {
 }
 
-void InspectorBrowserDebuggerAgent::setAllBrowserBreakpoints(PassRefPtr<InspectorObject> breakpoints)
+void InspectorBrowserDebuggerAgent::setAllBrowserBreakpoints(ErrorString*, PassRefPtr<InspectorObject> breakpoints)
 {
     m_inspectorAgent->state()->setObject(BrowserDebuggerAgentState::browserBreakpoints, breakpoints);
     inspectedURLChanged(m_inspectorAgent->inspectedURLWithoutFragment());
@@ -116,20 +117,21 @@ void InspectorBrowserDebuggerAgent::restoreStickyBreakpoint(PassRefPtr<Inspector
     if (!condition)
         return;
 
+    ErrorString error;
     if (type == eventListenerNativeBreakpointType) {
         if (!enabled)
             return;
         String eventName;
         if (!condition->getString("eventName", &eventName))
             return;
-        setEventListenerBreakpoint(eventName);
+        setEventListenerBreakpoint(&error, eventName);
     } else if (type == xhrNativeBreakpointType) {
         if (!enabled)
             return;
         String url;
         if (!condition->getString("url", &url))
             return;
-        setXHRBreakpoint(url);
+        setXHRBreakpoint(&error, url);
     }
 }
 
@@ -138,12 +140,12 @@ void InspectorBrowserDebuggerAgent::discardBindings()
     m_domBreakpoints.clear();
 }
 
-void InspectorBrowserDebuggerAgent::setEventListenerBreakpoint(const String& eventName)
+void InspectorBrowserDebuggerAgent::setEventListenerBreakpoint(ErrorString*, const String& eventName)
 {
     m_eventListenerBreakpoints.add(eventName);
 }
 
-void InspectorBrowserDebuggerAgent::removeEventListenerBreakpoint(const String& eventName)
+void InspectorBrowserDebuggerAgent::removeEventListenerBreakpoint(ErrorString*, const String& eventName)
 {
     m_eventListenerBreakpoints.remove(eventName);
 }
@@ -176,7 +178,7 @@ void InspectorBrowserDebuggerAgent::didRemoveDOMNode(Node* node)
     }
 }
 
-void InspectorBrowserDebuggerAgent::setDOMBreakpoint(long nodeId, long type)
+void InspectorBrowserDebuggerAgent::setDOMBreakpoint(ErrorString*, long nodeId, long type)
 {
     Node* node = m_inspectorAgent->domAgent()->nodeForId(nodeId);
     if (!node)
@@ -190,7 +192,7 @@ void InspectorBrowserDebuggerAgent::setDOMBreakpoint(long nodeId, long type)
     }
 }
 
-void InspectorBrowserDebuggerAgent::removeDOMBreakpoint(long nodeId, long type)
+void InspectorBrowserDebuggerAgent::removeDOMBreakpoint(ErrorString*, long nodeId, long type)
 {
     Node* node = m_inspectorAgent->domAgent()->nodeForId(nodeId);
     if (!node)
@@ -331,7 +333,7 @@ void InspectorBrowserDebuggerAgent::pauseOnNativeEventIfNeeded(const String& cat
         debuggerAgent->schedulePauseOnNextStatement(NativeBreakpointDebuggerEventType, eventData.release());
 }
 
-void InspectorBrowserDebuggerAgent::setXHRBreakpoint(const String& url)
+void InspectorBrowserDebuggerAgent::setXHRBreakpoint(ErrorString*, const String& url)
 {
     if (url.isEmpty())
         m_hasXHRBreakpointWithEmptyURL = true;
@@ -339,7 +341,7 @@ void InspectorBrowserDebuggerAgent::setXHRBreakpoint(const String& url)
         m_XHRBreakpoints.add(url);
 }
 
-void InspectorBrowserDebuggerAgent::removeXHRBreakpoint(const String& url)
+void InspectorBrowserDebuggerAgent::removeXHRBreakpoint(ErrorString*, const String& url)
 {
     if (url.isEmpty())
         m_hasXHRBreakpointWithEmptyURL = false;
index fac54bb55da5f6e0b931a97b36e67cc704462122..804e3a3427e7fbc1def5402cb0b8abc278be4ca9 100644 (file)
@@ -48,6 +48,8 @@ class InspectorAgent;
 class InspectorObject;
 class Node;
 
+typedef String ErrorString;
+
 class InspectorBrowserDebuggerAgent {
     WTF_MAKE_NONCOPYABLE(InspectorBrowserDebuggerAgent);
 public:
@@ -55,16 +57,16 @@ public:
 
     virtual ~InspectorBrowserDebuggerAgent();
 
-    void setAllBrowserBreakpoints(PassRefPtr<InspectorObject>);
+    void setAllBrowserBreakpoints(ErrorString* error, PassRefPtr<InspectorObject>);
     void inspectedURLChanged(const String& url);
 
     // BrowserDebugger API for InspectorFrontend
-    void setXHRBreakpoint(const String& url);
-    void removeXHRBreakpoint(const String& url);
-    void setEventListenerBreakpoint(const String& eventName);
-    void removeEventListenerBreakpoint(const String& eventName);
-    void setDOMBreakpoint(long nodeId, long type);
-    void removeDOMBreakpoint(long nodeId, long type);
+    void setXHRBreakpoint(ErrorString* error, const String& url);
+    void removeXHRBreakpoint(ErrorString* error, const String& url);
+    void setEventListenerBreakpoint(ErrorString* error, const String& eventName);
+    void removeEventListenerBreakpoint(ErrorString* error, const String& eventName);
+    void setDOMBreakpoint(ErrorString* error, long nodeId, long type);
+    void removeDOMBreakpoint(ErrorString* error, long nodeId, long type);
 
     // InspectorInstrumentation API
     void willInsertDOMNode(Node*, Node* parent);
index 33d485c98b5b197501242bddc6692b634d74a31e..1fb88b130dc903e6352f9c1f382b5bc0dfbedbb1 100644 (file)
@@ -167,7 +167,7 @@ void InspectorCSSAgent::reset()
     m_documentToInspectorStyleSheet.clear();
 }
 
-void InspectorCSSAgent::getStylesForNode(long nodeId, RefPtr<InspectorValue>* result)
+void InspectorCSSAgent::getStylesForNode(ErrorString*, long nodeId, RefPtr<InspectorValue>* result)
 {
     Element* element = elementForId(nodeId);
     if (!element)
@@ -222,7 +222,7 @@ void InspectorCSSAgent::getStylesForNode(long nodeId, RefPtr<InspectorValue>* re
     *result = resultObject.release();
 }
 
-void InspectorCSSAgent::getInlineStyleForNode(long nodeId, RefPtr<InspectorValue>* style)
+void InspectorCSSAgent::getInlineStyleForNode(ErrorString*, long nodeId, RefPtr<InspectorValue>* style)
 {
     Element* element = elementForId(nodeId);
     if (!element)
@@ -235,7 +235,7 @@ void InspectorCSSAgent::getInlineStyleForNode(long nodeId, RefPtr<InspectorValue
     *style = styleSheet->buildObjectForStyle(element->style());
 }
 
-void InspectorCSSAgent::getComputedStyleForNode(long nodeId, RefPtr<InspectorValue>* style)
+void InspectorCSSAgent::getComputedStyleForNode(ErrorString*, long nodeId, RefPtr<InspectorValue>* style)
 {
     Element* element = elementForId(nodeId);
     if (!element)
@@ -246,7 +246,7 @@ void InspectorCSSAgent::getComputedStyleForNode(long nodeId, RefPtr<InspectorVal
     *style = inspectorStyle->buildObjectForStyle();
 }
 
-void InspectorCSSAgent::getAllStyles(RefPtr<InspectorArray>* styles)
+void InspectorCSSAgent::getAllStyles(ErrorString*, RefPtr<InspectorArray>* styles)
 {
     Vector<Document*> documents = m_domAgent->documents();
     for (Vector<Document*>::iterator it = documents.begin(); it != documents.end(); ++it) {
@@ -261,7 +261,7 @@ void InspectorCSSAgent::getAllStyles(RefPtr<InspectorArray>* styles)
     }
 }
 
-void InspectorCSSAgent::getStyleSheet(const String& styleSheetId, RefPtr<InspectorValue>* styleSheetObject)
+void InspectorCSSAgent::getStyleSheet(ErrorString*, const String& styleSheetId, RefPtr<InspectorValue>* styleSheetObject)
 {
     InspectorStyleSheet* inspectorStyleSheet = styleSheetForId(styleSheetId);
     if (!inspectorStyleSheet)
@@ -270,7 +270,7 @@ void InspectorCSSAgent::getStyleSheet(const String& styleSheetId, RefPtr<Inspect
     *styleSheetObject = inspectorStyleSheet->buildObjectForStyleSheet();
 }
 
-void InspectorCSSAgent::getStyleSheetText(const String& styleSheetId, String* url, String* result)
+void InspectorCSSAgent::getStyleSheetText(ErrorString*, const String& styleSheetId, String* url, String* result)
 {
     InspectorStyleSheet* inspectorStyleSheet = styleSheetForId(styleSheetId);
     if (!inspectorStyleSheet)
@@ -279,7 +279,7 @@ void InspectorCSSAgent::getStyleSheetText(const String& styleSheetId, String* ur
     inspectorStyleSheet->text(result);
 }
 
-void InspectorCSSAgent::setStyleSheetText(const String& styleSheetId, const String& text, bool* success)
+void InspectorCSSAgent::setStyleSheetText(ErrorString*, const String& styleSheetId, const String& text, bool* success)
 {
     InspectorStyleSheet* inspectorStyleSheet = styleSheetForId(styleSheetId);
     if (!inspectorStyleSheet) {
@@ -292,7 +292,7 @@ void InspectorCSSAgent::setStyleSheetText(const String& styleSheetId, const Stri
         inspectorStyleSheet->reparseStyleSheet(text);
 }
 
-void InspectorCSSAgent::setPropertyText(const RefPtr<InspectorObject>& fullStyleId, long propertyIndex, const String& text, bool overwrite, RefPtr<InspectorValue>* result)
+void InspectorCSSAgent::setPropertyText(ErrorString*, const RefPtr<InspectorObject>& fullStyleId, long propertyIndex, const String& text, bool overwrite, RefPtr<InspectorValue>* result)
 {
     InspectorCSSId compoundId(fullStyleId);
     ASSERT(!compoundId.isEmpty());
@@ -306,7 +306,7 @@ void InspectorCSSAgent::setPropertyText(const RefPtr<InspectorObject>& fullStyle
         *result = inspectorStyleSheet->buildObjectForStyle(inspectorStyleSheet->styleForId(compoundId));
 }
 
-void InspectorCSSAgent::toggleProperty(const RefPtr<InspectorObject>& fullStyleId, long propertyIndex, bool disable, RefPtr<InspectorValue>* result)
+void InspectorCSSAgent::toggleProperty(ErrorString*, const RefPtr<InspectorObject>& fullStyleId, long propertyIndex, bool disable, RefPtr<InspectorValue>* result)
 {
     InspectorCSSId compoundId(fullStyleId);
     ASSERT(!compoundId.isEmpty());
@@ -320,7 +320,7 @@ void InspectorCSSAgent::toggleProperty(const RefPtr<InspectorObject>& fullStyleI
         *result = inspectorStyleSheet->buildObjectForStyle(inspectorStyleSheet->styleForId(compoundId));
 }
 
-void InspectorCSSAgent::setRuleSelector(const RefPtr<InspectorObject>& fullRuleId, const String& selector, RefPtr<InspectorValue>* result)
+void InspectorCSSAgent::setRuleSelector(ErrorString*, const RefPtr<InspectorObject>& fullRuleId, const String& selector, RefPtr<InspectorValue>* result)
 {
     InspectorCSSId compoundId(fullRuleId);
     ASSERT(!compoundId.isEmpty());
@@ -336,7 +336,7 @@ void InspectorCSSAgent::setRuleSelector(const RefPtr<InspectorObject>& fullRuleI
     *result = inspectorStyleSheet->buildObjectForRule(inspectorStyleSheet->ruleForId(compoundId));
 }
 
-void InspectorCSSAgent::addRule(const long contextNodeId, const String& selector, RefPtr<InspectorValue>* result)
+void InspectorCSSAgent::addRule(ErrorString*, const long contextNodeId, const String& selector, RefPtr<InspectorValue>* result)
 {
     Node* node = m_domAgent->nodeForId(contextNodeId);
     if (!node)
@@ -352,7 +352,7 @@ void InspectorCSSAgent::addRule(const long contextNodeId, const String& selector
     *result = inspectorStyleSheet->buildObjectForRule(newRule);
 }
 
-void InspectorCSSAgent::getSupportedCSSProperties(RefPtr<InspectorArray>* cssProperties)
+void InspectorCSSAgent::getSupportedCSSProperties(ErrorString*, RefPtr<InspectorArray>* cssProperties)
 {
     RefPtr<InspectorArray> properties = InspectorArray::create();
     for (int i = 0; i < numCSSProperties; ++i)
@@ -361,7 +361,7 @@ void InspectorCSSAgent::getSupportedCSSProperties(RefPtr<InspectorArray>* cssPro
     *cssProperties = properties.release();
 }
 
-void InspectorCSSAgent::querySelectorAll(const long nodeId, const String& selector, RefPtr<InspectorArray>* result)
+void InspectorCSSAgent::querySelectorAll(ErrorString*, const long nodeId, const String& selector, RefPtr<InspectorArray>* result)
 {
     Node* node = m_domAgent->nodeForId(nodeId);
     if (!node)
index 3f1eec586ad8c1f5e0e9aa62847a73d00784cfd6..a81fbbc72ba463c1c220cbb32d95555d4c063fcb 100644 (file)
@@ -59,19 +59,19 @@ public:
     ~InspectorCSSAgent();
 
     void reset();
-    void getStylesForNode(long nodeId, RefPtr<InspectorValue>* result);
-    void getInlineStyleForNode(long nodeId, RefPtr<InspectorValue>* style);
-    void getComputedStyleForNode(long nodeId, RefPtr<InspectorValue>* style);
-    void getAllStyles(RefPtr<InspectorArray>* styles);
-    void getStyleSheet(const String& styleSheetId, RefPtr<InspectorValue>* result);
-    void getStyleSheetText(const String& styleSheetId, String* url, String* result);
-    void setStyleSheetText(const String& styleSheetId, const String& text, bool* success);
-    void setPropertyText(const RefPtr<InspectorObject>& styleId, long propertyIndex, const String& text, bool overwrite, RefPtr<InspectorValue>* result);
-    void toggleProperty(const RefPtr<InspectorObject>& styleId, long propertyIndex, bool disable, RefPtr<InspectorValue>* result);
-    void setRuleSelector(const RefPtr<InspectorObject>& ruleId, const String& selector, RefPtr<InspectorValue>* result);
-    void addRule(const long contextNodeId, const String& selector, RefPtr<InspectorValue>* result);
-    void getSupportedCSSProperties(RefPtr<InspectorArray>* result);
-    void querySelectorAll(const long nodeId, const String& selector, RefPtr<InspectorArray>* result);
+    void getStylesForNode(ErrorString* error, long nodeId, RefPtr<InspectorValue>* result);
+    void getInlineStyleForNode(ErrorString* error, long nodeId, RefPtr<InspectorValue>* style);
+    void getComputedStyleForNode(ErrorString* error, long nodeId, RefPtr<InspectorValue>* style);
+    void getAllStyles(ErrorString* error, RefPtr<InspectorArray>* styles);
+    void getStyleSheet(ErrorString* error, const String& styleSheetId, RefPtr<InspectorValue>* result);
+    void getStyleSheetText(ErrorString* error, const String& styleSheetId, String* url, String* result);
+    void setStyleSheetText(ErrorString* error, const String& styleSheetId, const String& text, bool* success);
+    void setPropertyText(ErrorString* error, const RefPtr<InspectorObject>& styleId, long propertyIndex, const String& text, bool overwrite, RefPtr<InspectorValue>* result);
+    void toggleProperty(ErrorString* error, const RefPtr<InspectorObject>& styleId, long propertyIndex, bool disable, RefPtr<InspectorValue>* result);
+    void setRuleSelector(ErrorString* error, const RefPtr<InspectorObject>& ruleId, const String& selector, RefPtr<InspectorValue>* result);
+    void addRule(ErrorString* error, const long contextNodeId, const String& selector, RefPtr<InspectorValue>* result);
+    void getSupportedCSSProperties(ErrorString* error, RefPtr<InspectorArray>* result);
+    void querySelectorAll(ErrorString* error, const long nodeId, const String& selector, RefPtr<InspectorArray>* result);
 
 private:
     typedef HashMap<String, RefPtr<InspectorStyleSheet> > IdToInspectorStyleSheet;
index 42ad23399db30526cfcb824f9ac23c42822cd868..7dabd4c25f22bef69436852667173d13da436675 100644 (file)
@@ -78,13 +78,13 @@ InspectorConsoleAgent::~InspectorConsoleAgent()
     m_inspectorDOMAgent = 0;
 }
 
-void InspectorConsoleAgent::setConsoleMessagesEnabled(bool enabled, bool* newState)
+void InspectorConsoleAgent::setConsoleMessagesEnabled(ErrorString*, bool enabled, bool* newState)
 {
     *newState = enabled;
     setConsoleMessagesEnabled(enabled);
 }
 
-void InspectorConsoleAgent::clearConsoleMessages()
+void InspectorConsoleAgent::clearConsoleMessages(ErrorString*)
 {
     m_consoleMessages.clear();
     m_expiredConsoleMessageCount = 0;
@@ -98,7 +98,8 @@ void InspectorConsoleAgent::clearConsoleMessages()
 
 void InspectorConsoleAgent::reset()
 {
-    clearConsoleMessages();
+    ErrorString error;
+    clearConsoleMessages(&error);
     m_times.clear();
     m_counts.clear();
 }
@@ -211,7 +212,7 @@ void InspectorConsoleAgent::didFailLoading(unsigned long identifier, const Resou
     addConsoleMessage(new ConsoleMessage(OtherMessageSource, NetworkErrorMessageType, ErrorMessageLevel, message, error.failingURL(), identifier));
 }
 
-void InspectorConsoleAgent::setMonitoringXHREnabled(bool enabled)
+void InspectorConsoleAgent::setMonitoringXHREnabled(ErrorString*, bool enabled)
 {
     m_inspectorState->setBoolean(ConsoleAgentState::monitoringXHR, enabled);
 }
index 565f87bdcacaf73cc2711ea6a4ca6f0ae291612d..a21368e3007154e55a2c9fae3560de9972d7acc2 100644 (file)
@@ -49,14 +49,16 @@ class ScriptArguments;
 class ScriptCallStack;
 class ScriptProfile;
 
+typedef String ErrorString;
+
 class InspectorConsoleAgent {
     WTF_MAKE_NONCOPYABLE(InspectorConsoleAgent);
 public:
     InspectorConsoleAgent(InstrumentingAgents*, InspectorAgent*, InspectorState*, InjectedScriptHost*, InspectorDOMAgent*);
     ~InspectorConsoleAgent();
 
-    void setConsoleMessagesEnabled(bool enabled, bool* newState);
-    void clearConsoleMessages();
+    void setConsoleMessagesEnabled(ErrorString* error, bool enabled, bool* newState);
+    void clearConsoleMessages(ErrorString* error);
     void reset();
     void setFrontend(InspectorFrontend*);
     void clearFrontend();
@@ -75,7 +77,7 @@ public:
     void addProfileFinishedMessageToConsole(PassRefPtr<ScriptProfile>, unsigned lineNumber, const String& sourceURL);
     void addStartProfilingMessageToConsole(const String& title, unsigned lineNumber, const String& sourceURL);
 #endif
-    void setMonitoringXHREnabled(bool enabled);
+    void setMonitoringXHREnabled(ErrorString* error, bool enabled);
 
 private:
     void setConsoleMessagesEnabled(bool);
index 803d3dd7430fd949cf2e47cc19261d71be136365..85448732d51c03f0211b8351444435a53708153d 100644 (file)
@@ -85,12 +85,14 @@ void InspectorController::didClearWindowObjectInWorld(Frame* frame, DOMWrapperWo
 
 void InspectorController::startTimelineProfiler()
 {
-    m_inspectorAgent->timelineAgent()->start();
+    ErrorString error;
+    m_inspectorAgent->timelineAgent()->start(&error);
 }
 
 void InspectorController::stopTimelineProfiler()
 {
-    m_inspectorAgent->timelineAgent()->stop();
+    ErrorString error;
+    m_inspectorAgent->timelineAgent()->stop(&error);
 }
 
 void InspectorController::connectFrontend()
@@ -205,18 +207,21 @@ void InspectorController::dispatchMessageFromFrontend(const String& message)
 
 void InspectorController::hideHighlight()
 {
-    m_inspectorAgent->hideHighlight();
+    ErrorString error;
+    m_inspectorAgent->hideHighlight(&error);
 }
 
 #if ENABLE(JAVASCRIPT_DEBUGGER)
 void InspectorController::enableProfiler()
 {
-    m_inspectorAgent->enableProfiler();
+    ErrorString error;
+    m_inspectorAgent->enableProfiler(&error);
 }
 
 void InspectorController::disableProfiler()
 {
-    m_inspectorAgent->disableProfiler();
+    ErrorString error;
+    m_inspectorAgent->disableProfiler(&error);
 }
 
 bool InspectorController::profilerEnabled()
@@ -239,7 +244,8 @@ void InspectorController::showAndEnableDebugger()
 
 void InspectorController::disableDebugger()
 {
-    m_inspectorAgent->disableDebugger();
+    ErrorString error;
+    m_inspectorAgent->disableDebugger(&error);
 }
 
 void InspectorController::startUserInitiatedProfiling()
@@ -262,8 +268,10 @@ bool InspectorController::isRecordingUserInitiatedProfile() const
 
 void InspectorController::resume()
 {
-    if (InspectorDebuggerAgent* debuggerAgent = m_inspectorAgent->debuggerAgent())
-        debuggerAgent->resume();
+    if (InspectorDebuggerAgent* debuggerAgent = m_inspectorAgent->debuggerAgent()) {
+        ErrorString error;
+        debuggerAgent->resume(&error);
+    }
 }
 
 #endif
index cf6fc112c86f03e64b8d18a2599b1d1edf6799e1..ca757e6175cb10fb8a8498cf6e09b8c75e75ec46 100644 (file)
@@ -287,7 +287,8 @@ Vector<Document*> InspectorDOMAgent::documents()
 
 void InspectorDOMAgent::reset()
 {
-    searchCanceled();
+    ErrorString error;
+    searchCanceled(&error);
     discardBindings();
     if (m_revalidateStyleAttrTask)
         m_revalidateStyleAttrTask->reset();
@@ -417,7 +418,7 @@ Node* InspectorDOMAgent::nodeForId(long id)
     return 0;
 }
 
-void InspectorDOMAgent::getChildNodes(long nodeId)
+void InspectorDOMAgent::getChildNodes(ErrorString*, long nodeId)
 {
     pushChildNodesToFrontend(nodeId);
 }
@@ -464,7 +465,7 @@ long InspectorDOMAgent::pushNodePathToFrontend(Node* nodeToPush)
     return map->get(nodeToPush);
 }
 
-void InspectorDOMAgent::setAttribute(long elementId, const String& name, const String& value, bool* success)
+void InspectorDOMAgent::setAttribute(ErrorString*, long elementId, const String& name, const String& value, bool* success)
 {
     Node* node = nodeForId(elementId);
     if (node && (node->nodeType() == Node::ELEMENT_NODE)) {
@@ -475,7 +476,7 @@ void InspectorDOMAgent::setAttribute(long elementId, const String& name, const S
     }
 }
 
-void InspectorDOMAgent::removeAttribute(long elementId, const String& name, bool* success)
+void InspectorDOMAgent::removeAttribute(ErrorString* error, long elementId, const String& name, bool* success)
 {
     Node* node = nodeForId(elementId);
     if (node && (node->nodeType() == Node::ELEMENT_NODE)) {
@@ -486,7 +487,7 @@ void InspectorDOMAgent::removeAttribute(long elementId, const String& name, bool
     }
 }
 
-void InspectorDOMAgent::removeNode(long nodeId, long* outNodeId)
+void InspectorDOMAgent::removeNode(ErrorString*, long nodeId, long* outNodeId)
 {
     Node* node = nodeForId(nodeId);
     if (!node)
@@ -504,7 +505,7 @@ void InspectorDOMAgent::removeNode(long nodeId, long* outNodeId)
     *outNodeId = nodeId;
 }
 
-void InspectorDOMAgent::changeTagName(long nodeId, const String& tagName, long* newId)
+void InspectorDOMAgent::changeTagName(ErrorString*, long nodeId, const String& tagName, long* newId)
 {
     Node* oldNode = nodeForId(nodeId);
     if (!oldNode || !oldNode->isElementNode())
@@ -539,7 +540,7 @@ void InspectorDOMAgent::changeTagName(long nodeId, const String& tagName, long*
         pushChildNodesToFrontend(*newId);
 }
 
-void InspectorDOMAgent::getOuterHTML(long nodeId, WTF::String* outerHTML)
+void InspectorDOMAgent::getOuterHTML(ErrorString*, long nodeId, WTF::String* outerHTML)
 {
     Node* node = nodeForId(nodeId);
     if (!node || !node->isHTMLElement())
@@ -548,7 +549,7 @@ void InspectorDOMAgent::getOuterHTML(long nodeId, WTF::String* outerHTML)
     *outerHTML = toHTMLElement(node)->outerHTML();
 }
 
-void InspectorDOMAgent::setOuterHTML(long nodeId, const String& outerHTML, long* newId)
+void InspectorDOMAgent::setOuterHTML(ErrorString*, long nodeId, const String& outerHTML, long* newId)
 {
     Node* node = nodeForId(nodeId);
     if (!node || !node->isHTMLElement())
@@ -586,7 +587,7 @@ void InspectorDOMAgent::setOuterHTML(long nodeId, const String& outerHTML, long*
         pushChildNodesToFrontend(*newId);
 }
 
-void InspectorDOMAgent::setTextNodeValue(long nodeId, const String& value, bool* success)
+void InspectorDOMAgent::setTextNodeValue(ErrorString*, long nodeId, const String& value, bool* success)
 {
     Node* node = nodeForId(nodeId);
     if (node && (node->nodeType() == Node::TEXT_NODE)) {
@@ -597,7 +598,7 @@ void InspectorDOMAgent::setTextNodeValue(long nodeId, const String& value, bool*
     }
 }
 
-void InspectorDOMAgent::getEventListenersForNode(long nodeId, long* outNodeId, RefPtr<InspectorArray>* listenersArray)
+void InspectorDOMAgent::getEventListenersForNode(ErrorString*, long nodeId, long* outNodeId, RefPtr<InspectorArray>* listenersArray)
 {
     Node* node = nodeForId(nodeId);
     *outNodeId = nodeId;
@@ -664,14 +665,14 @@ void InspectorDOMAgent::getEventListenersForNode(long nodeId, long* outNodeId, R
     }
 }
 
-void InspectorDOMAgent::addInspectedNode(long nodeId)
+void InspectorDOMAgent::addInspectedNode(ErrorString*, long nodeId)
 {
     m_inspectedNodes.prepend(nodeId);
     while (m_inspectedNodes.size() > 5)
         m_inspectedNodes.removeLast();
 }
 
-void InspectorDOMAgent::performSearch(const String& whitespaceTrimmedQuery, bool runSynchronously)
+void InspectorDOMAgent::performSearch(ErrorString* error, const String& whitespaceTrimmedQuery, bool runSynchronously)
 {
     // FIXME: Few things are missing here:
     // 1) Search works with node granularity - number of matches within node is not calculated.
@@ -698,7 +699,7 @@ void InspectorDOMAgent::performSearch(const String& whitespaceTrimmedQuery, bool
     escapedTagNameQuery.replace("'", "\\'");
 
     // Clear pending jobs.
-    searchCanceled();
+    searchCanceled(error);
 
     // Find all frames, iframes and object elements to search their documents.
     Vector<Document*> docs = documents();
@@ -752,13 +753,13 @@ void InspectorDOMAgent::performSearch(const String& whitespaceTrimmedQuery, bool
         for (Deque<MatchJob*>::iterator it = m_pendingMatchJobs.begin(); it != m_pendingMatchJobs.end(); ++it)
             (*it)->match(resultCollector);
         reportNodesAsSearchResults(resultCollector);
-        searchCanceled();
+        searchCanceled(error);
         return;
     }
     m_matchJobsTimer.startOneShot(0);
 }
 
-void InspectorDOMAgent::searchCanceled()
+void InspectorDOMAgent::searchCanceled(ErrorString*)
 {
     if (m_matchJobsTimer.isActive())
         m_matchJobsTimer.stop();
@@ -767,28 +768,28 @@ void InspectorDOMAgent::searchCanceled()
     m_searchResults.clear();
 }
 
-void InspectorDOMAgent::resolveNode(long nodeId, RefPtr<InspectorValue>* result)
+void InspectorDOMAgent::resolveNode(ErrorString*, long nodeId, RefPtr<InspectorValue>* result)
 {
     InjectedScript injectedScript = injectedScriptForNodeId(nodeId);
     if (!injectedScript.hasNoValue())
         injectedScript.resolveNode(nodeId, result);
 }
 
-void InspectorDOMAgent::getNodeProperties(long nodeId, PassRefPtr<InspectorArray> propertiesArray, RefPtr<InspectorValue>* result)
+void InspectorDOMAgent::getNodeProperties(ErrorString*, long nodeId, PassRefPtr<InspectorArray> propertiesArray, RefPtr<InspectorValue>* result)
 {
     InjectedScript injectedScript = injectedScriptForNodeId(nodeId);
     if (!injectedScript.hasNoValue())
         injectedScript.getNodeProperties(nodeId, propertiesArray, result);
 }
 
-void InspectorDOMAgent::getNodePrototypes(long nodeId, RefPtr<InspectorValue>* result)
+void InspectorDOMAgent::getNodePrototypes(ErrorString*, long nodeId, RefPtr<InspectorValue>* result)
 {
     InjectedScript injectedScript = injectedScriptForNodeId(nodeId);
     if (!injectedScript.hasNoValue())
         injectedScript.getNodePrototypes(nodeId, result);
 }
 
-void InspectorDOMAgent::pushNodeToFrontend(PassRefPtr<InspectorObject> objectId, long* nodeId)
+void InspectorDOMAgent::pushNodeToFrontend(ErrorString*, PassRefPtr<InspectorObject> objectId, long* nodeId)
 {
     InjectedScript injectedScript = m_injectedScriptHost->injectedScriptForObjectId(objectId.get());
     Node* node = injectedScript.nodeForObjectId(objectId);
@@ -1138,7 +1139,8 @@ PassRefPtr<InspectorArray> InspectorDOMAgent::toArray(const Vector<String>& data
 void InspectorDOMAgent::onMatchJobsTimer(Timer<InspectorDOMAgent>*)
 {
     if (!m_pendingMatchJobs.size()) {
-        searchCanceled();
+        ErrorString error;
+        searchCanceled(&error);
         return;
     }
 
@@ -1164,7 +1166,7 @@ void InspectorDOMAgent::reportNodesAsSearchResults(ListHashSet<Node*>& resultCol
     m_frontend->addNodesToSearchResult(nodeIds.release());
 }
 
-void InspectorDOMAgent::copyNode(long nodeId)
+void InspectorDOMAgent::copyNode(ErrorString*, long nodeId)
 {
     Node* node = nodeForId(nodeId);
     if (!node)
@@ -1173,7 +1175,7 @@ void InspectorDOMAgent::copyNode(long nodeId)
     Pasteboard::generalPasteboard()->writePlainText(markup);
 }
 
-void InspectorDOMAgent::pushNodeByPathToFrontend(const String& path, long* nodeId)
+void InspectorDOMAgent::pushNodeByPathToFrontend(ErrorString*, const String& path, long* nodeId)
 {
     if (Node* node = nodeForPath(path))
         *nodeId = pushNodePathToFrontend(node);
index fb49e165a5db26648478eba4c7505920b2a6ca92..524cf5c68a878483a272aba464e5f5edd2b4fd3c 100644 (file)
@@ -60,6 +60,8 @@ class Node;
 class Page;
 class RevalidateStyleAttributeTask;
 
+typedef String ErrorString;
+
 #if ENABLE(INSPECTOR)
 
 struct EventListenerInfo {
@@ -100,22 +102,22 @@ public:
     void reset();
 
     // Methods called from the frontend for DOM nodes inspection.
-    void getChildNodes(long nodeId);
-    void setAttribute(long elementId, const String& name, const String& value, bool* success);
-    void removeAttribute(long elementId, const String& name, bool* success);
-    void removeNode(long nodeId, long* outNodeId);
-    void changeTagName(long nodeId, const String& tagName, long* newId);
-    void getOuterHTML(long nodeId, WTF::String* outerHTML);
-    void setOuterHTML(long nodeId, const String& outerHTML, long* newId);
-    void setTextNodeValue(long nodeId, const String& value, bool* success);
-    void getEventListenersForNode(long nodeId, long* outNodeId, RefPtr<InspectorArray>* listenersArray);
-    void addInspectedNode(long nodeId);
-    void performSearch(const String& whitespaceTrimmedQuery, bool runSynchronously);
-    void searchCanceled();
-    void resolveNode(long nodeId, RefPtr<InspectorValue>* result);
-    void getNodeProperties(long nodeId, PassRefPtr<InspectorArray> propertiesArray, RefPtr<InspectorValue>* result);
-    void getNodePrototypes(long nodeId, RefPtr<InspectorValue>* result);
-    void pushNodeToFrontend(PassRefPtr<InspectorObject> objectId, long* nodeId);
+    void getChildNodes(ErrorString* error, long nodeId);
+    void setAttribute(ErrorString* error, long elementId, const String& name, const String& value, bool* success);
+    void removeAttribute(ErrorString* error, long elementId, const String& name, bool* success);
+    void removeNode(ErrorString* error, long nodeId, long* outNodeId);
+    void changeTagName(ErrorString* error, long nodeId, const String& tagName, long* newId);
+    void getOuterHTML(ErrorString* error, long nodeId, WTF::String* outerHTML);
+    void setOuterHTML(ErrorString* error, long nodeId, const String& outerHTML, long* newId);
+    void setTextNodeValue(ErrorString* error, long nodeId, const String& value, bool* success);
+    void getEventListenersForNode(ErrorString* error, long nodeId, long* outNodeId, RefPtr<InspectorArray>* listenersArray);
+    void addInspectedNode(ErrorString* error, long nodeId);
+    void performSearch(ErrorString* error, const String& whitespaceTrimmedQuery, bool runSynchronously);
+    void searchCanceled(ErrorString* error);
+    void resolveNode(ErrorString* error, long nodeId, RefPtr<InspectorValue>* result);
+    void getNodeProperties(ErrorString* error, long nodeId, PassRefPtr<InspectorArray> propertiesArray, RefPtr<InspectorValue>* result);
+    void getNodePrototypes(ErrorString* error, long nodeId, RefPtr<InspectorValue>* result);
+    void pushNodeToFrontend(ErrorString* error, PassRefPtr<InspectorObject> objectId, long* nodeId);
 
     // Methods called from the InspectorInstrumentation.
     void setDocument(Document*);
@@ -133,10 +135,10 @@ public:
     Node* nodeForId(long nodeId);
     long pushNodePathToFrontend(Node*);
     void pushChildNodesToFrontend(long nodeId);
-    void pushNodeByPathToFrontend(const String& path, long* nodeId);
+    void pushNodeByPathToFrontend(ErrorString* error, const String& path, long* nodeId);
     void inspect(Node*);
     long inspectedNode(unsigned long num);
-    void copyNode(long nodeId);
+    void copyNode(ErrorString* error, long nodeId);
     void setDOMListener(DOMListener*);
 
     String documentURLString(Document*) const;
index 5c186b87c664b86952149cb2ba1a71ca9c2b39e9..18f692f2eac92f2ef70b6776601cd2b20e43c7e1 100644 (file)
@@ -79,7 +79,7 @@ void InspectorDOMStorageAgent::clearFrontend()
     m_frontend = 0;
 }
 
-void InspectorDOMStorageAgent::getDOMStorageEntries(long storageId, RefPtr<InspectorArray>* entries)
+void InspectorDOMStorageAgent::getDOMStorageEntries(ErrorString*, long storageId, RefPtr<InspectorArray>* entries)
 {
     InspectorDOMStorageResource* storageResource = getDOMStorageResourceForId(storageId);
     if (storageResource) {
@@ -96,7 +96,7 @@ void InspectorDOMStorageAgent::getDOMStorageEntries(long storageId, RefPtr<Inspe
     }
 }
 
-void InspectorDOMStorageAgent::setDOMStorageItem(long storageId, const String& key, const String& value, bool* success)
+void InspectorDOMStorageAgent::setDOMStorageItem(ErrorString*, long storageId, const String& key, const String& value, bool* success)
 {
     InspectorDOMStorageResource* storageResource = getDOMStorageResourceForId(storageId);
     if (storageResource) {
@@ -106,7 +106,7 @@ void InspectorDOMStorageAgent::setDOMStorageItem(long storageId, const String& k
     }
 }
 
-void InspectorDOMStorageAgent::removeDOMStorageItem(long storageId, const String& key, bool* success)
+void InspectorDOMStorageAgent::removeDOMStorageItem(ErrorString*, long storageId, const String& key, bool* success)
 {
     InspectorDOMStorageResource* storageResource = getDOMStorageResourceForId(storageId);
     if (storageResource) {
index 85fb95de7fe06ce3a9abcff36d87c851a3f779ef..5226b61d423a3177d1f5b54d1d4a830a0fdf7d13 100644 (file)
@@ -43,6 +43,8 @@ class InstrumentingAgents;
 class Storage;
 class StorageArea;
 
+typedef String ErrorString;
+
 class InspectorDOMStorageAgent {
 public:
     static PassOwnPtr<InspectorDOMStorageAgent> create(InstrumentingAgents* instrumentingAgents)
@@ -57,9 +59,9 @@ public:
     void clearResources();
 
     // Called from the front-end.
-    void getDOMStorageEntries(long storageId, RefPtr<InspectorArray>* entries);
-    void setDOMStorageItem(long storageId, const String& key, const String& value, bool* success);
-    void removeDOMStorageItem(long storageId, const String& key, bool* success);
+    void getDOMStorageEntries(ErrorString* error, long storageId, RefPtr<InspectorArray>* entries);
+    void setDOMStorageItem(ErrorString* error, long storageId, const String& key, const String& value, bool* success);
+    void removeDOMStorageItem(ErrorString* error, long storageId, const String& key, bool* success);
 
     // Called from the injected script.
     void selectDOMStorage(Storage* storage);
index 37ff0aedf45895a9b27188d6d6c99c9316959638..c99167cfceb1016602ce8d5898c07b47260dfe9e 100644 (file)
@@ -259,7 +259,7 @@ void InspectorDatabaseAgent::clearFrontend()
     m_frontendProvider.clear();
 }
 
-void InspectorDatabaseAgent::getDatabaseTableNames(long databaseId, RefPtr<InspectorArray>* names)
+void InspectorDatabaseAgent::getDatabaseTableNames(ErrorString*, long databaseId, RefPtr<InspectorArray>* names)
 {
     Database* database = databaseForId(databaseId);
     if (database) {
@@ -270,7 +270,7 @@ void InspectorDatabaseAgent::getDatabaseTableNames(long databaseId, RefPtr<Inspe
     }
 }
 
-void InspectorDatabaseAgent::executeSQL(long databaseId, const String& query, bool* success, long* transactionId)
+void InspectorDatabaseAgent::executeSQL(ErrorString*, long databaseId, const String& query, bool* success, long* transactionId)
 {
     Database* database = databaseForId(databaseId);
     if (!database) {
index dfb05102ec9acb90fee95b9a3428400efab390ec..763c0f6346f2ebc65e356027913356197e7b715d 100644 (file)
@@ -41,6 +41,8 @@ class InspectorDatabaseResource;
 class InspectorFrontend;
 class InstrumentingAgents;
 
+typedef String ErrorString;
+
 class InspectorDatabaseAgent {
 public:
     class FrontendProvider;
@@ -57,8 +59,8 @@ public:
     void clearResources();
 
     // Called from the front-end.
-    void getDatabaseTableNames(long databaseId, RefPtr<InspectorArray>* names);
-    void executeSQL(long databaseId, const String& query, bool* success, long* transactionId);
+    void getDatabaseTableNames(ErrorString* error, long databaseId, RefPtr<InspectorArray>* names);
+    void executeSQL(ErrorString* error, long databaseId, const String& query, bool* success, long* transactionId);
 
     // Called from the injected script.
     Database* databaseForId(long databaseId);
index e8b4ad5edf1ee092d08a61956e50563c4490bc7c..3e87f7778afa7a6279e9516a2c30f23f271f0e8c 100644 (file)
@@ -72,12 +72,12 @@ InspectorDebuggerAgent::~InspectorDebuggerAgent()
     m_pausedScriptState = 0;
 }
 
-void InspectorDebuggerAgent::activateBreakpoints()
+void InspectorDebuggerAgent::activateBreakpoints(ErrorString*)
 {
     ScriptDebugServer::shared().activateBreakpoints();
 }
 
-void InspectorDebuggerAgent::deactivateBreakpoints()
+void InspectorDebuggerAgent::deactivateBreakpoints(ErrorString*)
 {
     ScriptDebugServer::shared().deactivateBreakpoints();
 }
@@ -88,7 +88,7 @@ void InspectorDebuggerAgent::inspectedURLChanged(const String&)
     m_breakpointIdToDebugServerBreakpointIds.clear();
 }
 
-void InspectorDebuggerAgent::setJavaScriptBreakpoint(const String& url, int lineNumber, int columnNumber, const String& condition, bool enabled, String* outBreakpointId, RefPtr<InspectorArray>* locations)
+void InspectorDebuggerAgent::setJavaScriptBreakpoint(ErrorString*, const String& url, int lineNumber, int columnNumber, const String& condition, bool enabled, String* outBreakpointId, RefPtr<InspectorArray>* locations)
 {
     String breakpointId = makeString(url, ":", String::number(lineNumber), ":", String::number(columnNumber));
     RefPtr<InspectorObject> breakpointsCookie = m_inspectorAgent->state()->getObject(DebuggerAgentState::javaScriptBreakpoints);
@@ -119,7 +119,7 @@ void InspectorDebuggerAgent::setJavaScriptBreakpoint(const String& url, int line
     *outBreakpointId = breakpointId;
 }
 
-void InspectorDebuggerAgent::setJavaScriptBreakpointBySourceId(const String& sourceId, int lineNumber, int columnNumber, const String& condition, bool enabled, String* outBreakpointId, int* actualLineNumber, int* actualColumnNumber)
+void InspectorDebuggerAgent::setJavaScriptBreakpointBySourceId(ErrorString*, const String& sourceId, int lineNumber, int columnNumber, const String& condition, bool enabled, String* outBreakpointId, int* actualLineNumber, int* actualColumnNumber)
 {
     String breakpointId = makeString(sourceId, ":", String::number(lineNumber), ":", String::number(columnNumber));
     if (m_breakpointIdToDebugServerBreakpointIds.find(breakpointId) != m_breakpointIdToDebugServerBreakpointIds.end())
@@ -130,7 +130,7 @@ void InspectorDebuggerAgent::setJavaScriptBreakpointBySourceId(const String& sou
     *outBreakpointId = breakpointId;
 }
 
-void InspectorDebuggerAgent::removeJavaScriptBreakpoint(const String& breakpointId)
+void InspectorDebuggerAgent::removeJavaScriptBreakpoint(ErrorString*, const String& breakpointId)
 {
     RefPtr<InspectorObject> breakpointsCookie = m_inspectorAgent->state()->getObject(DebuggerAgentState::javaScriptBreakpoints);
     breakpointsCookie->remove(breakpointId);
@@ -144,7 +144,7 @@ void InspectorDebuggerAgent::removeJavaScriptBreakpoint(const String& breakpoint
     m_breakpointIdToDebugServerBreakpointIds.remove(debugServerBreakpointIdsIterator);
 }
 
-void InspectorDebuggerAgent::continueToLocation(const String& sourceId, int lineNumber, int columnNumber)
+void InspectorDebuggerAgent::continueToLocation(ErrorString* error, const String& sourceId, int lineNumber, int columnNumber)
 {
     if (!m_continueToLocationBreakpointId.isEmpty()) {
         ScriptDebugServer::shared().removeBreakpoint(m_continueToLocationBreakpointId);
@@ -152,7 +152,7 @@ void InspectorDebuggerAgent::continueToLocation(const String& sourceId, int line
     }
     ScriptBreakpoint breakpoint(lineNumber, columnNumber, "", true);
     m_continueToLocationBreakpointId = ScriptDebugServer::shared().setBreakpoint(sourceId, breakpoint, &lineNumber, &columnNumber);
-    resume();
+    resume(error);
 }
 
 bool InspectorDebuggerAgent::resolveBreakpoint(const String& breakpointId, const String& sourceId, const ScriptBreakpoint& breakpoint, int* actualLineNumber, int* actualColumnNumber)
@@ -185,13 +185,13 @@ bool InspectorDebuggerAgent::resolveBreakpoint(const String& breakpointId, const
     return true;
 }
 
-void InspectorDebuggerAgent::editScriptSource(const String& sourceID, const String& newContent, bool* success, String* result, RefPtr<InspectorValue>* newCallFrames)
+void InspectorDebuggerAgent::editScriptSource(ErrorString*, const String& sourceID, const String& newContent, bool* success, String* result, RefPtr<InspectorValue>* newCallFrames)
 {
     if ((*success = ScriptDebugServer::shared().editScriptSource(sourceID, newContent, *result)))
         *newCallFrames = currentCallFrames();
 }
 
-void InspectorDebuggerAgent::getScriptSource(const String& sourceID, String* scriptSource)
+void InspectorDebuggerAgent::getScriptSource(ErrorString*, const String& sourceID, String* scriptSource)
 {
     *scriptSource = m_scripts.get(sourceID).data;
 }
@@ -214,46 +214,46 @@ void InspectorDebuggerAgent::cancelPauseOnNextStatement()
     ScriptDebugServer::shared().setPauseOnNextStatement(false);
 }
 
-void InspectorDebuggerAgent::pause()
+void InspectorDebuggerAgent::pause(ErrorString*)
 {
     schedulePauseOnNextStatement(JavaScriptPauseEventType, InspectorObject::create());
     m_javaScriptPauseScheduled = true;
 }
 
-void InspectorDebuggerAgent::resume()
+void InspectorDebuggerAgent::resume(ErrorString*)
 {
     ScriptDebugServer::shared().continueProgram();
 }
 
-void InspectorDebuggerAgent::stepOver()
+void InspectorDebuggerAgent::stepOver(ErrorString*)
 {
     ScriptDebugServer::shared().stepOverStatement();
 }
 
-void InspectorDebuggerAgent::stepInto()
+void InspectorDebuggerAgent::stepInto(ErrorString*)
 {
     ScriptDebugServer::shared().stepIntoStatement();
 }
 
-void InspectorDebuggerAgent::stepOut()
+void InspectorDebuggerAgent::stepOut(ErrorString*)
 {
     ScriptDebugServer::shared().stepOutOfFunction();
 }
 
-void InspectorDebuggerAgent::setPauseOnExceptionsState(long pauseState, long* newState)
+void InspectorDebuggerAgent::setPauseOnExceptionsState(ErrorString*, long pauseState, long* newState)
 {
     ScriptDebugServer::shared().setPauseOnExceptionsState(static_cast<ScriptDebugServer::PauseOnExceptionsState>(pauseState));
     *newState = ScriptDebugServer::shared().pauseOnExceptionsState();
 }
 
-void InspectorDebuggerAgent::evaluateOnCallFrame(PassRefPtr<InspectorObject> callFrameId, const String& expression, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorValue>* result)
+void InspectorDebuggerAgent::evaluateOnCallFrame(ErrorString*, PassRefPtr<InspectorObject> callFrameId, const String& expression, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorValue>* result)
 {
     InjectedScript injectedScript = m_inspectorAgent->injectedScriptHost()->injectedScriptForObjectId(callFrameId.get());
     if (!injectedScript.hasNoValue())
         injectedScript.evaluateOnCallFrame(callFrameId, expression, objectGroup, includeCommandLineAPI, result);
 }
 
-void InspectorDebuggerAgent::getCompletionsOnCallFrame(PassRefPtr<InspectorObject> callFrameId, const String& expression, bool includeCommandLineAPI, RefPtr<InspectorValue>* result)
+void InspectorDebuggerAgent::getCompletionsOnCallFrame(ErrorString*, PassRefPtr<InspectorObject> callFrameId, const String& expression, bool includeCommandLineAPI, RefPtr<InspectorValue>* result)
 {
     InjectedScript injectedScript = m_inspectorAgent->injectedScriptHost()->injectedScriptForObjectId(callFrameId.get());
     if (!injectedScript.hasNoValue())
index 644557fe61c02345697266b0ef72e3c1400260c6..7cadac1fef1a07aa7d73a6c27eec27452453e94a 100644 (file)
 #include <wtf/text/StringHash.h>
 
 namespace WebCore {
+
 class InjectedScriptHost;
 class InspectorAgent;
 class InspectorFrontend;
 class InspectorObject;
 class InspectorValue;
 
+typedef String ErrorString;
+
 enum DebuggerEventType {
     JavaScriptPauseEventType,
     JavaScriptBreakpointEventType,
@@ -63,27 +66,27 @@ public:
     void inspectedURLChanged(const String& url);
 
     // Part of the protocol.
-    void activateBreakpoints();
-    void deactivateBreakpoints();
+    void activateBreakpoints(ErrorString* error);
+    void deactivateBreakpoints(ErrorString* error);
 
-    void setJavaScriptBreakpoint(const String& url, int lineNumber, int columnNumber, const String& condition, bool enabled, String* breakpointId, RefPtr<InspectorArray>* locations);
-    void setJavaScriptBreakpointBySourceId(const String& sourceId, int lineNumber, int columnNumber, const String& condition, bool enabled, String* breakpointId, int* actualLineNumber, int* actualColumnNumber);
-    void removeJavaScriptBreakpoint(const String& breakpointId);
-    void continueToLocation(const String& sourceId, int lineNumber, int columnNumber);
+    void setJavaScriptBreakpoint(ErrorString* error, const String& url, int lineNumber, int columnNumber, const String& condition, bool enabled, String* breakpointId, RefPtr<InspectorArray>* locations);
+    void setJavaScriptBreakpointBySourceId(ErrorString* error, const String& sourceId, int lineNumber, int columnNumber, const String& condition, bool enabled, String* breakpointId, int* actualLineNumber, int* actualColumnNumber);
+    void removeJavaScriptBreakpoint(ErrorString* error, const String& breakpointId);
+    void continueToLocation(ErrorString* error, const String& sourceId, int lineNumber, int columnNumber);
 
-    void editScriptSource(const String& sourceID, const String& newContent, bool* success, String* result, RefPtr<InspectorValue>* newCallFrames);
-    void getScriptSource(const String& sourceID, String* scriptSource);
+    void editScriptSource(ErrorString* error, const String& sourceID, const String& newContent, bool* success, String* result, RefPtr<InspectorValue>* newCallFrames);
+    void getScriptSource(ErrorString* error, const String& sourceID, String* scriptSource);
     void schedulePauseOnNextStatement(DebuggerEventType type, PassRefPtr<InspectorValue> data);
     void cancelPauseOnNextStatement();
     void breakProgram(DebuggerEventType type, PassRefPtr<InspectorValue> data);
-    void pause();
-    void resume();
-    void stepOver();
-    void stepInto();
-    void stepOut();
-    void setPauseOnExceptionsState(long pauseState, long* newState);
-    void evaluateOnCallFrame(PassRefPtr<InspectorObject> callFrameId, const String& expression, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorValue>* result);
-    void getCompletionsOnCallFrame(PassRefPtr<InspectorObject> callFrameId, const String& expression, bool includeCommandLineAPI, RefPtr<InspectorValue>* result);
+    void pause(ErrorString* error);
+    void resume(ErrorString* error);
+    void stepOver(ErrorString* error);
+    void stepInto(ErrorString* error);
+    void stepOut(ErrorString* error);
+    void setPauseOnExceptionsState(ErrorString* error, long pauseState, long* newState);
+    void evaluateOnCallFrame(ErrorString* error, PassRefPtr<InspectorObject> callFrameId, const String& expression, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorValue>* result);
+    void getCompletionsOnCallFrame(ErrorString* error, PassRefPtr<InspectorObject> callFrameId, const String& expression, bool includeCommandLineAPI, RefPtr<InspectorValue>* result);
 
 private:
     InspectorDebuggerAgent(InspectorAgent*, InspectorFrontend*, bool eraseStickyBreakpoints);
index 550febfd065a0ab699ca5b9b17db57371cfc069d..93852c7c23fec3bc700e8458a5c81eab7495fdc9 100644 (file)
@@ -151,7 +151,7 @@ String InspectorProfilerAgent::getCurrentUserInitiatedProfileName(bool increment
     return makeString(UserInitiatedProfileName, '.', String::number(m_currentUserInitiatedProfileNumber));
 }
 
-void InspectorProfilerAgent::getProfileHeaders(RefPtr<InspectorArray>* headers)
+void InspectorProfilerAgent::getProfileHeaders(ErrorString*, RefPtr<InspectorArray>* headers)
 {
     ProfilesMap::iterator profilesEnd = m_profiles.end();
     for (ProfilesMap::iterator it = m_profiles.begin(); it != profilesEnd; ++it)
@@ -176,7 +176,7 @@ private:
 
 } // namespace
 
-void InspectorProfilerAgent::getProfile(const String& type, unsigned uid, RefPtr<InspectorObject>* profileObject)
+void InspectorProfilerAgent::getProfile(ErrorString*, const String& type, unsigned uid, RefPtr<InspectorObject>* profileObject)
 {
     if (type == CPUProfileType) {
         ProfilesMap::iterator it = m_profiles.find(uid);
@@ -197,7 +197,7 @@ void InspectorProfilerAgent::getProfile(const String& type, unsigned uid, RefPtr
     }
 }
 
-void InspectorProfilerAgent::removeProfile(const String& type, unsigned uid)
+void InspectorProfilerAgent::removeProfile(ErrorString*, const String& type, unsigned uid)
 {
     if (type == CPUProfileType) {
         if (m_profiles.contains(uid))
@@ -293,7 +293,7 @@ private:
 
 };
 
-void InspectorProfilerAgent::takeHeapSnapshot(bool detailed)
+void InspectorProfilerAgent::takeHeapSnapshot(ErrorString*, bool detailed)
 {
     String title = makeString(UserInitiatedProfileName, '.', String::number(m_nextUserInitiatedHeapSnapshotNumber));
     ++m_nextUserInitiatedHeapSnapshotNumber;
index 93637f59cfb7f2bf6ccb040e84339d8c7afa5504..d436418b6d8d982c81725a68bafe63de9dd8a404 100644 (file)
@@ -47,6 +47,8 @@ class InspectorObject;
 class ScriptHeapSnapshot;
 class ScriptProfile;
 
+typedef String ErrorString;
+
 class InspectorProfilerAgent {
     WTF_MAKE_NONCOPYABLE(InspectorProfilerAgent); WTF_MAKE_FAST_ALLOCATED;
 public:
@@ -56,21 +58,21 @@ public:
     void addProfile(PassRefPtr<ScriptProfile> prpProfile, unsigned lineNumber, const String& sourceURL);
     void addProfileFinishedMessageToConsole(PassRefPtr<ScriptProfile>, unsigned lineNumber, const String& sourceURL);
     void addStartProfilingMessageToConsole(const String& title, unsigned lineNumber, const String& sourceURL);
-    void clearProfiles() { resetState(); }
+    void clearProfiles(ErrorString*) { resetState(); }
     void disable();
     void enable(bool skipRecompile);
     bool enabled() { return m_enabled; }
     String getCurrentUserInitiatedProfileName(bool incrementProfileNumber = false);
-    void getProfileHeaders(RefPtr<InspectorArray>* headers);
-    void getProfile(const String& type, unsigned uid, RefPtr<InspectorObject>* profileObject);
+    void getProfileHeaders(ErrorString* error, RefPtr<InspectorArray>* headers);
+    void getProfile(ErrorString* error, const String& type, unsigned uid, RefPtr<InspectorObject>* profileObject);
     bool isRecordingUserInitiatedProfile() { return m_recordingUserInitiatedProfile; }
-    void removeProfile(const String& type, unsigned uid);
+    void removeProfile(ErrorString* error, const String& type, unsigned uid);
     void resetState();
     void resetFrontendProfiles();
     void setFrontend(InspectorFrontend* frontend) { m_frontend = frontend; }
     void startUserInitiatedProfiling();
     void stopUserInitiatedProfiling(bool ignoreProfile = false);
-    void takeHeapSnapshot(bool detailed);
+    void takeHeapSnapshot(ErrorString* error, bool detailed);
     void toggleRecordButton(bool isProfiling);
 
 private:
index f02431e0c177b00a11b203a0b91c8c8c354a8046..ae3e46c7e2edba1620382360b2aeeb197b6ac92d 100644 (file)
@@ -311,7 +311,7 @@ void InspectorResourceAgent::identifierForInitialRequest(unsigned long identifie
     m_frontend->identifierForInitialRequest(identifier, url.string(), loaderObject, callStackValue);
 }
 
-void InspectorResourceAgent::setExtraHeaders(PassRefPtr<InspectorObject> headers)
+void InspectorResourceAgent::setExtraHeaders(ErrorString*, PassRefPtr<InspectorObject> headers)
 {
     m_state->setObject(ResourceAgentState::extraRequestHeaders, headers);
 }
@@ -498,12 +498,12 @@ Frame* InspectorResourceAgent::frameForId(unsigned long frameId)
     return 0;
 }
 
-void InspectorResourceAgent::cachedResources(RefPtr<InspectorObject>* object)
+void InspectorResourceAgent::cachedResources(ErrorString* error, RefPtr<InspectorObject>* object)
 {
     *object = buildObjectForFrameTree(m_page->mainFrame(), true);
 }
 
-void InspectorResourceAgent::resourceContent(unsigned long frameId, const String& url, bool base64Encode, bool* success, String* content)
+void InspectorResourceAgent::resourceContent(ErrorString*, unsigned long frameId, const String& url, bool base64Encode, bool* success, String* content)
 {
     Frame* frame = frameForId(frameId);
     if (!frame) {
index fb24b704aae285e1b188bbcbd98527bad5d73e9b..190d16f181dcd1876ed57db9244c533572725d1c 100644 (file)
@@ -64,6 +64,8 @@ class WebSocketHandshakeRequest;
 class WebSocketHandshakeResponse;
 #endif
 
+typedef String ErrorString;
+
 class InspectorResourceAgent : public RefCounted<InspectorResourceAgent> {
 public:
     static PassRefPtr<InspectorResourceAgent> create(Page* page, InspectorState* state, InspectorFrontend* frontend)
@@ -102,9 +104,9 @@ public:
     Frame* frameForId(unsigned long);
 
     // Called from frontend 
-    void cachedResources(RefPtr<InspectorObject>*);
-    void resourceContent(unsigned long frameId, const String& url, bool base64Encode, bool* resourceFound, String* content);
-    void setExtraHeaders(PassRefPtr<InspectorObject>);
+    void cachedResources(ErrorString* error, RefPtr<InspectorObject>*);
+    void resourceContent(ErrorString* error, unsigned long frameId, const String& url, bool base64Encode, bool* resourceFound, String* content);
+    void setExtraHeaders(ErrorString* error, PassRefPtr<InspectorObject>);
 
 private:
     InspectorResourceAgent(Page* page, InspectorState*, InspectorFrontend* frontend);
index 7938afdc7784171f9c91fb1c67701bbbeadec581..6cdf7c2cbc059c43e8e3b3d41a17236ad94d5f4c 100644 (file)
@@ -45,35 +45,35 @@ InspectorRuntimeAgent::InspectorRuntimeAgent(InjectedScriptHost* injectedScriptH
 
 InspectorRuntimeAgent::~InspectorRuntimeAgent() { }
 
-void InspectorRuntimeAgent::evaluate(const String& expression, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorValue>* result)
+void InspectorRuntimeAgent::evaluate(ErrorString* error, const String& expression, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorValue>* result)
 {
     InjectedScript injectedScript = m_injectedScriptHost->injectedScriptForMainFrame();
     if (!injectedScript.hasNoValue())
         injectedScript.evaluate(expression, objectGroup, includeCommandLineAPI, result);
 }
 
-void InspectorRuntimeAgent::getCompletions(const String& expression, bool includeCommandLineAPI, RefPtr<InspectorValue>* result)
+void InspectorRuntimeAgent::getCompletions(ErrorString*, const String& expression, bool includeCommandLineAPI, RefPtr<InspectorValue>* result)
 {
     InjectedScript injectedScript = m_injectedScriptHost->injectedScriptForMainFrame();
     if (!injectedScript.hasNoValue())
         injectedScript.getCompletions(expression, includeCommandLineAPI, result);
 }
 
-void InspectorRuntimeAgent::getProperties(PassRefPtr<InspectorObject> objectId, bool ignoreHasOwnProperty, bool abbreviate, RefPtr<InspectorValue>* result)
+void InspectorRuntimeAgent::getProperties(ErrorString*, PassRefPtr<InspectorObject> objectId, bool ignoreHasOwnProperty, bool abbreviate, RefPtr<InspectorValue>* result)
 {
     InjectedScript injectedScript = m_injectedScriptHost->injectedScriptForObjectId(objectId.get());
     if (!injectedScript.hasNoValue())
         injectedScript.getProperties(objectId, ignoreHasOwnProperty, abbreviate, result);
 }
 
-void InspectorRuntimeAgent::setPropertyValue(PassRefPtr<InspectorObject> objectId, const String& propertyName, const String& expression, RefPtr<InspectorValue>* result)
+void InspectorRuntimeAgent::setPropertyValue(ErrorString*, PassRefPtr<InspectorObject> objectId, const String& propertyName, const String& expression, RefPtr<InspectorValue>* result)
 {
     InjectedScript injectedScript = m_injectedScriptHost->injectedScriptForObjectId(objectId.get());
     if (!injectedScript.hasNoValue())
         injectedScript.setPropertyValue(objectId, propertyName, expression, result);
 }
 
-void InspectorRuntimeAgent::releaseWrapperObjectGroup(long injectedScriptId, const String& objectGroup)
+void InspectorRuntimeAgent::releaseWrapperObjectGroup(ErrorString*, long injectedScriptId, const String& objectGroup)
 {
     m_injectedScriptHost->releaseWrapperObjectGroup(injectedScriptId, objectGroup);
 }
index 9fb2716fff335286f37d1ca364d3fd5252006135..47bfba3564fe55ef0689d85c7b53efbc995d9883 100644 (file)
@@ -46,6 +46,8 @@ class InjectedScriptHost;
 class InspectorObject;
 class InspectorValue;
 
+typedef String ErrorString;
+
 class InspectorRuntimeAgent {
     WTF_MAKE_NONCOPYABLE(InspectorRuntimeAgent);
 public:
@@ -57,11 +59,11 @@ public:
     ~InspectorRuntimeAgent();
 
     // Part of the protocol.
-    void evaluate(const String& expression, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorValue>* result);
-    void getCompletions(const String& expression, bool includeCommandLineAPI, RefPtr<InspectorValue>* result);
-    void getProperties(PassRefPtr<InspectorObject> objectId, bool ignoreHasOwnProperty, bool abbreviate, RefPtr<InspectorValue>* result);
-    void setPropertyValue(PassRefPtr<InspectorObject> objectId, const String& propertyName, const String& expression, RefPtr<InspectorValue>* result);
-    void releaseWrapperObjectGroup(long injectedScriptId, const String& objectGroup);
+    void evaluate(ErrorString* error, const String& expression, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorValue>* result);
+    void getCompletions(ErrorString* error, const String& expression, bool includeCommandLineAPI, RefPtr<InspectorValue>* result);
+    void getProperties(ErrorString* error, PassRefPtr<InspectorObject> objectId, bool ignoreHasOwnProperty, bool abbreviate, RefPtr<InspectorValue>* result);
+    void setPropertyValue(ErrorString* error, PassRefPtr<InspectorObject> objectId, const String& propertyName, const String& expression, RefPtr<InspectorValue>* result);
+    void releaseWrapperObjectGroup(ErrorString* error, long injectedScriptId, const String& objectGroup);
 
 private:
     InspectorRuntimeAgent(InjectedScriptHost*);
index 354bdaded41f27d17752fc16e707d29894b1d9b5..fe87e9a1c87fc6b93367c833794dbc0d325c2a16 100644 (file)
@@ -82,18 +82,21 @@ void InspectorTimelineAgent::setFrontend(InspectorFrontend* frontend)
 
 void InspectorTimelineAgent::clearFrontend()
 {
-    stop();
+    ErrorString error;
+    stop(&error);
     m_frontend = 0;
 }
 
 void InspectorTimelineAgent::restore(InspectorState* state, InspectorFrontend* frontend)
 {
     setFrontend(frontend);
-    if (state->getBoolean(TimelineAgentState::timelineAgentEnabled))
-        start();
+    if (state->getBoolean(TimelineAgentState::timelineAgentEnabled)) {
+        ErrorString error;
+        start(&error);
+    }
 }
 
-void InspectorTimelineAgent::start()
+void InspectorTimelineAgent::start(ErrorString*)
 {
     if (!m_frontend)
         return;
@@ -103,7 +106,7 @@ void InspectorTimelineAgent::start()
     m_state->setBoolean(TimelineAgentState::timelineAgentEnabled, true);
 }
 
-void InspectorTimelineAgent::stop()
+void InspectorTimelineAgent::stop(ErrorString*)
 {
     if (!started())
         return;
index b81acbbf067d17820971d98cea14bf2223dca622..8c73ae833e94cc8e4784cfbf67949af40217233f 100644 (file)
@@ -48,6 +48,8 @@ class IntRect;
 class ResourceRequest;
 class ResourceResponse;
 
+typedef String ErrorString;
+
 // Must be kept in sync with TimelineAgent.js
 enum TimelineRecordType {
     EventDispatchTimelineRecordType = 0,
@@ -88,8 +90,8 @@ public:
 
     void restore(InspectorState*, InspectorFrontend*);
 
-    void start();
-    void stop();
+    void start(ErrorString* error);
+    void stop(ErrorString* error);
     bool started() const;
 
     int id() const { return m_id; }