2011-02-04 Andrey Kosyakov <caseq@chromium.org>
authorcaseq@chromium.org <caseq@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Feb 2011 13:42:10 +0000 (13:42 +0000)
committercaseq@chromium.org <caseq@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Feb 2011 13:42:10 +0000 (13:42 +0000)
        Reviewed by Pavel Feldman.

        Web Inspector: [refacotring] merge InspectorAgent::willSendRequest() into InspectorResourceAgent
        https://bugs.webkit.org/show_bug.cgi?id=53789
         - perform UserAgent override via InspectorInstrumentation
         - move adding extra request headers to InspectorResourceAgent
         - simplified things in InspectorState

        * inspector/Inspector.idl:
        * inspector/InspectorAgent.cpp:
        (WebCore::InspectorAgent::disconnectFrontend):
        (WebCore::InspectorAgent::applyUserAgentOverride):
        * inspector/InspectorAgent.h:
        * inspector/InspectorInstrumentation.cpp:
        (WebCore::InspectorInstrumentation::applyUserAgentOverrideImpl):
        (WebCore::InspectorInstrumentation::willSendRequestImpl):
        * inspector/InspectorInstrumentation.h:
        (WebCore::InspectorInstrumentation::applyUserAgentOverride):
        * inspector/InspectorResourceAgent.cpp:
        (WebCore::InspectorResourceAgent::setExtraHeaders):
        (WebCore::InspectorResourceAgent::willSendRequest):
        * inspector/InspectorResourceAgent.h:
        * inspector/InspectorState.cpp:
        (WebCore::InspectorState::InspectorState):
        (WebCore::InspectorState::restoreFromInspectorCookie):
        (WebCore::InspectorState::updateCookie):
        (WebCore::InspectorState::setValue):
        (WebCore::InspectorState::getBoolean):
        (WebCore::InspectorState::getString):
        (WebCore::InspectorState::getLong):
        (WebCore::InspectorState::getObject):
        * inspector/InspectorState.h:
        (WebCore::InspectorState::setObject):
        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::userAgent):

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

16 files changed:
Source/WebCore/ChangeLog
Source/WebCore/inspector/Inspector.idl
Source/WebCore/inspector/InspectorAgent.cpp
Source/WebCore/inspector/InspectorAgent.h
Source/WebCore/inspector/InspectorBrowserDebuggerAgent.cpp
Source/WebCore/inspector/InspectorBrowserDebuggerAgent.h
Source/WebCore/inspector/InspectorConsoleAgent.cpp
Source/WebCore/inspector/InspectorDebuggerAgent.cpp
Source/WebCore/inspector/InspectorDebuggerAgent.h
Source/WebCore/inspector/InspectorInstrumentation.cpp
Source/WebCore/inspector/InspectorInstrumentation.h
Source/WebCore/inspector/InspectorResourceAgent.cpp
Source/WebCore/inspector/InspectorResourceAgent.h
Source/WebCore/inspector/InspectorState.cpp
Source/WebCore/inspector/InspectorState.h
Source/WebCore/loader/FrameLoader.cpp

index 3d58c5e..16005ab 100644 (file)
@@ -1,3 +1,41 @@
+2011-02-04  Andrey Kosyakov  <caseq@chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: [refacotring] merge InspectorAgent::willSendRequest() into InspectorResourceAgent
+        https://bugs.webkit.org/show_bug.cgi?id=53789
+         - perform UserAgent override via InspectorInstrumentation
+         - move adding extra request headers to InspectorResourceAgent
+         - simplified things in InspectorState
+
+        * inspector/Inspector.idl:
+        * inspector/InspectorAgent.cpp:
+        (WebCore::InspectorAgent::disconnectFrontend):
+        (WebCore::InspectorAgent::applyUserAgentOverride):
+        * inspector/InspectorAgent.h:
+        * inspector/InspectorInstrumentation.cpp:
+        (WebCore::InspectorInstrumentation::applyUserAgentOverrideImpl):
+        (WebCore::InspectorInstrumentation::willSendRequestImpl):
+        * inspector/InspectorInstrumentation.h:
+        (WebCore::InspectorInstrumentation::applyUserAgentOverride):
+        * inspector/InspectorResourceAgent.cpp:
+        (WebCore::InspectorResourceAgent::setExtraHeaders):
+        (WebCore::InspectorResourceAgent::willSendRequest):
+        * inspector/InspectorResourceAgent.h:
+        * inspector/InspectorState.cpp:
+        (WebCore::InspectorState::InspectorState):
+        (WebCore::InspectorState::restoreFromInspectorCookie):
+        (WebCore::InspectorState::updateCookie):
+        (WebCore::InspectorState::setValue):
+        (WebCore::InspectorState::getBoolean):
+        (WebCore::InspectorState::getString):
+        (WebCore::InspectorState::getLong):
+        (WebCore::InspectorState::getObject):
+        * inspector/InspectorState.h:
+        (WebCore::InspectorState::setObject):
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::userAgent):
+
 2011-02-08  Pavel Feldman  <pfeldman@chromium.org>
 
         Reviewed by Yury Semikhatsky.
index 966d69b..ea0f480 100644 (file)
@@ -62,7 +62,6 @@ module core {
         [domain=Inspector] void hideFrameHighlight();
         [notify, domain=Inspector] void updateFocusedNode(out long nodeId);
 
-        [domain=Inspector] void setExtraHeaders(in Object headers);
         [domain=Inspector] void setUserAgentOverride(in String userAgent);
 
         [domain=Inspector] void getCookies(out Array cookies, out String cookiesString);
@@ -102,6 +101,7 @@ module core {
 
         [domain=Network] void cachedResources(out Object resources);
         [domain=Network] void resourceContent(in unsigned long frameId, in String url, in boolean base64Encode, out String content);
+        [domain=Network] void setExtraHeaders(in Object headers);
 
         [notify, domain=Network] void frameDetachedFromParent(out unsigned long frameId);
         [notify, domain=Network] void identifierForInitialRequest(out long identifier, out String url, out Object loader, out Value callStack);
index 65dd21a..ea4dc0f 100644 (file)
@@ -129,6 +129,14 @@ using namespace std;
 
 namespace WebCore {
 
+namespace InspectorAgentState {
+static const char searchingForNode[] = "searchingForNode";
+static const char timelineProfilerEnabled[] = "timelineProfilerEnabled";
+static const char userInitiatedProfiling[] = "userInitiatedProfiling";
+static const char debuggerEnabled[] = "debuggerEnabled";
+static const char profilerEnabled[] = "profilerEnabled";
+}
+
 const char* const InspectorAgent::ElementsPanel = "elements";
 const char* const InspectorAgent::ConsolePanel = "console";
 const char* const InspectorAgent::ScriptsPanel = "scripts";
@@ -193,7 +201,7 @@ bool InspectorAgent::enabled() const
 
 bool InspectorAgent::searchingForNodeInPage() const
 {
-    return m_state->getBoolean(InspectorState::searchingForNode);
+    return m_state->getBoolean(InspectorAgentState::searchingForNode);
 }
 
 void InspectorAgent::restoreInspectorStateFromCookie(const String& inspectorStateCookie)
@@ -210,13 +218,13 @@ void InspectorAgent::restoreInspectorStateFromCookie(const String& inspectorStat
 
     m_resourceAgent = InspectorResourceAgent::restore(m_inspectedPage, m_state.get(), m_frontend.get());
 
-    if (m_state->getBoolean(InspectorState::timelineProfilerEnabled))
+    if (m_state->getBoolean(InspectorAgentState::timelineProfilerEnabled))
         startTimelineProfiler();
 
 #if ENABLE(JAVASCRIPT_DEBUGGER)
     restoreDebugger(false);
     restoreProfiler(ProfilerRestoreResetAgent);
-    if (m_state->getBoolean(InspectorState::userInitiatedProfiling))
+    if (m_state->getBoolean(InspectorAgentState::userInitiatedProfiling))
         startUserInitiatedProfiling();
 #endif
 }
@@ -346,7 +354,7 @@ void InspectorAgent::setSearchingForNode(bool enabled)
 {
     if (searchingForNodeInPage() == enabled)
         return;
-    m_state->setBoolean(InspectorState::searchingForNode, enabled);
+    m_state->setBoolean(InspectorAgentState::searchingForNode, enabled);
     if (!enabled)
         hideHighlight();
 }
@@ -464,7 +472,6 @@ void InspectorAgent::disconnectFrontend()
 
     releaseFrontendLifetimeAgents();
     m_timelineAgent.clear();
-    m_extraHeaders.clear();
     m_userAgentOverride = "";
 }
 
@@ -567,7 +574,7 @@ void InspectorAgent::restoreDebugger(bool eraseStickyBreakpoints)
 {
     ASSERT(m_frontend);
 #if ENABLE(JAVASCRIPT_DEBUGGER)
-    if (m_state->getBoolean(InspectorState::debuggerEnabled))
+    if (m_state->getBoolean(InspectorAgentState::debuggerEnabled))
         enableDebugger(eraseStickyBreakpoints);
 #endif
 }
@@ -577,7 +584,7 @@ void InspectorAgent::restoreProfiler(ProfilerRestoreAction action)
     ASSERT(m_frontend);
 #if ENABLE(JAVASCRIPT_DEBUGGER)
     m_profilerAgent->setFrontend(m_frontend.get());
-    if (m_state->getBoolean(InspectorState::profilerEnabled))
+    if (m_state->getBoolean(InspectorAgentState::profilerEnabled))
         enableProfiler();
     if (action == ProfilerRestoreResetAgent)
         m_profilerAgent->resetFrontendProfiles();
@@ -687,27 +694,10 @@ void InspectorAgent::setUserAgentOverride(const String& userAgent)
     m_userAgentOverride = userAgent;
 }
 
-String InspectorAgent::userAgentOverride() const
-{
-    return m_userAgentOverride;
-}
-
-void InspectorAgent::willSendRequest(ResourceRequest& request)
+void InspectorAgent::applyUserAgentOverride(String* userAgent) const
 {
-    if (!enabled())
-        return;
-
-    if (m_frontend) {
-        // Only enable load timing and raw headers if front-end is attached, as otherwise we may produce overhead.
-        request.setReportLoadTiming(true);
-        request.setReportRawHeaders(true);
-
-        if (m_extraHeaders) {
-            HTTPHeaderMap::const_iterator end = m_extraHeaders->end();
-            for (HTTPHeaderMap::const_iterator it = m_extraHeaders->begin(); it != end; ++it)
-                request.setHTTPHeaderField(it->first, it->second);
-        }
-    }
+    if (!m_userAgentOverride.isEmpty())
+        *userAgent = m_userAgentOverride;
 }
 
 void InspectorAgent::startTimelineProfiler()
@@ -722,7 +712,7 @@ void InspectorAgent::startTimelineProfiler()
     if (m_frontend)
         m_frontend->timelineProfilerWasStarted();
 
-    m_state->setBoolean(InspectorState::timelineProfilerEnabled, true);
+    m_state->setBoolean(InspectorAgentState::timelineProfilerEnabled, true);
 }
 
 void InspectorAgent::stopTimelineProfiler()
@@ -737,7 +727,7 @@ void InspectorAgent::stopTimelineProfiler()
     if (m_frontend)
         m_frontend->timelineProfilerWasStopped();
 
-    m_state->setBoolean(InspectorState::timelineProfilerEnabled, false);
+    m_state->setBoolean(InspectorAgentState::timelineProfilerEnabled, false);
 }
 
 #if ENABLE(WORKERS)
@@ -973,7 +963,7 @@ void InspectorAgent::startUserInitiatedProfiling()
     if (!enabled())
         return;
     m_profilerAgent->startUserInitiatedProfiling();
-    m_state->setBoolean(InspectorState::userInitiatedProfiling, true);
+    m_state->setBoolean(InspectorAgentState::userInitiatedProfiling, true);
 }
 
 void InspectorAgent::stopUserInitiatedProfiling()
@@ -981,7 +971,7 @@ void InspectorAgent::stopUserInitiatedProfiling()
     if (!enabled())
         return;
     m_profilerAgent->stopUserInitiatedProfiling();
-    m_state->setBoolean(InspectorState::userInitiatedProfiling, false);
+    m_state->setBoolean(InspectorAgentState::userInitiatedProfiling, false);
 }
 
 bool InspectorAgent::profilerEnabled() const
@@ -993,13 +983,13 @@ void InspectorAgent::enableProfiler()
 {
     if (profilerEnabled())
         return;
-    m_state->setBoolean(InspectorState::profilerEnabled, true);
+    m_state->setBoolean(InspectorAgentState::profilerEnabled, true);
     m_profilerAgent->enable(false);
 }
 
 void InspectorAgent::disableProfiler()
 {
-    m_state->setBoolean(InspectorState::profilerEnabled, false);
+    m_state->setBoolean(InspectorAgentState::profilerEnabled, false);
     m_profilerAgent->disable();
 }
 #endif
@@ -1014,7 +1004,7 @@ void InspectorAgent::showAndEnableDebugger()
         return;
 
     if (!m_frontend) {
-        m_state->setBoolean(InspectorState::debuggerEnabled, true);
+        m_state->setBoolean(InspectorAgentState::debuggerEnabled, true);
         showPanel(ScriptsPanel);
     } else
         enableDebugger(true);
@@ -1024,16 +1014,11 @@ void InspectorAgent::enableDebugger(bool eraseStickyBreakpoints)
 {
     if (debuggerEnabled())
         return;
-    m_state->setBoolean(InspectorState::debuggerEnabled, true);
+    m_state->setBoolean(InspectorAgentState::debuggerEnabled, true);
     ASSERT(m_inspectedPage);
 
-    if (eraseStickyBreakpoints) {
-        m_state->setObject(InspectorState::javaScriptBreakpoints, InspectorObject::create());
-        m_state->setObject(InspectorState::browserBreakpoints, InspectorObject::create());
-    }
-
-    m_debuggerAgent = InspectorDebuggerAgent::create(this, m_frontend.get());
-    m_browserDebuggerAgent = InspectorBrowserDebuggerAgent::create(this);
+    m_debuggerAgent = InspectorDebuggerAgent::create(this, m_frontend.get(), eraseStickyBreakpoints);
+    m_browserDebuggerAgent = InspectorBrowserDebuggerAgent::create(this, eraseStickyBreakpoints);
 
     m_frontend->debuggerWasEnabled();
 }
@@ -1048,7 +1033,7 @@ void InspectorAgent::disableDebugger()
 
     if (m_frontend) {
         m_frontend->debuggerWasDisabled();
-        m_state->setBoolean(InspectorState::debuggerEnabled, false);
+        m_state->setBoolean(InspectorAgentState::debuggerEnabled, false);
     }
 }
 
@@ -1057,11 +1042,6 @@ void InspectorAgent::resume()
     if (m_debuggerAgent)
         m_debuggerAgent->resume();
 }
-
-void InspectorAgent::setAllBrowserBreakpoints(PassRefPtr<InspectorObject> breakpoints)
-{
-    m_state->setObject(InspectorState::browserBreakpoints, breakpoints);
-}
 #endif
 
 void InspectorAgent::evaluateForTestInFrontend(long callId, const String& script)
@@ -1378,18 +1358,6 @@ void InspectorAgent::reloadPage(bool ignoreCache)
     m_inspectedPage->mainFrame()->loader()->reload(ignoreCache);
 }
 
-void InspectorAgent::setExtraHeaders(PassRefPtr<InspectorObject> headers)
-{
-    m_extraHeaders = adoptPtr(new HTTPHeaderMap());
-    InspectorObject::const_iterator end = headers->end();
-    for (InspectorObject::const_iterator it = headers->begin(); it != end; ++it) {
-        String value;
-        if (!it->second->asString(&value))
-            continue;
-        m_extraHeaders->add(it->first, value);
-    }
-}
-
 } // namespace WebCore
 
 #endif // ENABLE(INSPECTOR)
index 987b77c..29116ca 100644 (file)
@@ -246,8 +246,6 @@ public:
     void disableDebugger();
     bool debuggerEnabled() const { return m_debuggerAgent; }
     void resume();
-
-    void setAllBrowserBreakpoints(PassRefPtr<InspectorObject>);
 #endif
 
     // Generic code called from custom implementations.
@@ -267,11 +265,8 @@ public:
     void setSearchingForNode(bool enabled, bool* newState);
     void didEvaluateForTestInFrontend(long callId, const String& jsonResult);
 
-    // InspectorInstrumentation API
-    void willSendRequest(ResourceRequest&);
-
     void setUserAgentOverride(const String& userAgent);
-    String userAgentOverride() const;
+    void applyUserAgentOverride(String* userAgent) const;
 
 private:
     void pushDataCollectedOffline();
@@ -351,7 +346,6 @@ private:
     OwnPtr<InspectorBrowserDebuggerAgent> m_browserDebuggerAgent;
     OwnPtr<InspectorProfilerAgent> m_profilerAgent;
 #endif
-    OwnPtr<HTTPHeaderMap> m_extraHeaders;
     String m_userAgentOverride;
 #if ENABLE(WORKERS)
     typedef HashMap<intptr_t, RefPtr<InspectorWorkerResource> > WorkersMap;
index 66d3cce..5fe9937 100644 (file)
@@ -61,10 +61,21 @@ const int domBreakpointDerivedTypeShift = 16;
 
 namespace WebCore {
 
-InspectorBrowserDebuggerAgent::InspectorBrowserDebuggerAgent(InspectorAgent* inspectorAgent)
+namespace BrowserDebuggerAgentState {
+static const char browserBreakpoints[] = "browserBreakpoints";
+}
+
+PassOwnPtr<InspectorBrowserDebuggerAgent> InspectorBrowserDebuggerAgent::create(InspectorAgent* inspectorAgent, bool eraseStickyBreakpoints)
+{
+    return adoptPtr(new InspectorBrowserDebuggerAgent(inspectorAgent, eraseStickyBreakpoints));
+}
+
+InspectorBrowserDebuggerAgent::InspectorBrowserDebuggerAgent(InspectorAgent* inspectorAgent, bool eraseStickyBreakpoints)
     : m_inspectorAgent(inspectorAgent)
     , m_hasXHRBreakpointWithEmptyURL(false)
 {
+    if (eraseStickyBreakpoints)
+        inspectorAgent->state()->setObject(BrowserDebuggerAgentState::browserBreakpoints, InspectorObject::create());
 }
 
 InspectorBrowserDebuggerAgent::~InspectorBrowserDebuggerAgent()
@@ -73,7 +84,7 @@ InspectorBrowserDebuggerAgent::~InspectorBrowserDebuggerAgent()
 
 void InspectorBrowserDebuggerAgent::setAllBrowserBreakpoints(PassRefPtr<InspectorObject> breakpoints)
 {
-    m_inspectorAgent->state()->setObject(InspectorState::browserBreakpoints, breakpoints);
+    m_inspectorAgent->state()->setObject(BrowserDebuggerAgentState::browserBreakpoints, breakpoints);
     inspectedURLChanged(m_inspectorAgent->inspectedURLWithoutFragment());
 }
 
@@ -83,7 +94,7 @@ void InspectorBrowserDebuggerAgent::inspectedURLChanged(const String& url)
     m_XHRBreakpoints.clear();
     m_hasXHRBreakpointWithEmptyURL = false;
 
-    RefPtr<InspectorObject> allBreakpoints = m_inspectorAgent->state()->getObject(InspectorState::browserBreakpoints);
+    RefPtr<InspectorObject> allBreakpoints = m_inspectorAgent->state()->getObject(BrowserDebuggerAgentState::browserBreakpoints);
     RefPtr<InspectorArray> breakpoints = allBreakpoints->getArray(url);
     if (!breakpoints)
         return;
index 0676c30..fac54bb 100644 (file)
@@ -51,10 +51,7 @@ class Node;
 class InspectorBrowserDebuggerAgent {
     WTF_MAKE_NONCOPYABLE(InspectorBrowserDebuggerAgent);
 public:
-    static PassOwnPtr<InspectorBrowserDebuggerAgent> create(InspectorAgent* inspectorAgent)
-    {
-        return adoptPtr(new InspectorBrowserDebuggerAgent(inspectorAgent));
-    }
+    static PassOwnPtr<InspectorBrowserDebuggerAgent> create(InspectorAgent*, bool eraseStickyBreakpoints);
 
     virtual ~InspectorBrowserDebuggerAgent();
 
@@ -79,7 +76,7 @@ public:
     void pauseOnNativeEventIfNeeded(const String& categoryType, const String& eventName, bool synchronous);
 
 private:
-    InspectorBrowserDebuggerAgent(InspectorAgent*);
+    InspectorBrowserDebuggerAgent(InspectorAgent*, bool eraseStickyBreakpoints);
 
     void restoreStickyBreakpoint(PassRefPtr<InspectorObject> breakpoint);
 
index 872cbb7..7d11a7a 100644 (file)
@@ -49,6 +49,11 @@ namespace WebCore {
 static const unsigned maximumConsoleMessages = 1000;
 static const unsigned expireConsoleMessagesStep = 100;
 
+namespace ConsoleAgentState {
+static const char monitoringXHR[] = "monitoringXHR";
+static const char consoleMessagesEnabled[] = "consoleMessagesEnabled";
+}
+
 InspectorConsoleAgent::InspectorConsoleAgent(InspectorAgent* inspectorAgent)
     : m_inspectorAgent(inspectorAgent)
     , m_frontend(0)
@@ -164,7 +169,7 @@ void InspectorConsoleAgent::resourceRetrievedByXMLHttpRequest(const String& url,
 {
     if (!m_inspectorAgent->enabled())
         return;
-    if (m_inspectorAgent->state()->getBoolean(InspectorState::monitoringXHR))
+    if (m_inspectorAgent->state()->getBoolean(ConsoleAgentState::monitoringXHR))
         addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, "XHR finished loading: \"" + url + "\".", sendLineNumber, sendURL);
 }
 
@@ -192,12 +197,12 @@ void InspectorConsoleAgent::didFailLoading(unsigned long identifier, const Resou
 
 void InspectorConsoleAgent::setMonitoringXHREnabled(bool enabled)
 {
-    m_inspectorAgent->state()->setBoolean(InspectorState::monitoringXHR, enabled);
+    m_inspectorAgent->state()->setBoolean(ConsoleAgentState::monitoringXHR, enabled);
 }
 
 void InspectorConsoleAgent::setConsoleMessagesEnabled(bool enabled)
 {
-    m_inspectorAgent->state()->setBoolean(InspectorState::consoleMessagesEnabled, enabled);
+    m_inspectorAgent->state()->setBoolean(ConsoleAgentState::consoleMessagesEnabled, enabled);
     if (!enabled || !m_frontend)
         return;
 
@@ -215,12 +220,12 @@ void InspectorConsoleAgent::addConsoleMessage(PassOwnPtr<ConsoleMessage> console
 
     if (m_previousMessage && m_previousMessage->isEqual(consoleMessage.get())) {
         m_previousMessage->incrementCount();
-        if (m_inspectorAgent->state()->getBoolean(InspectorState::consoleMessagesEnabled) && m_frontend)
+        if (m_inspectorAgent->state()->getBoolean(ConsoleAgentState::consoleMessagesEnabled) && m_frontend)
             m_previousMessage->updateRepeatCountInConsole(m_frontend);
     } else {
         m_previousMessage = consoleMessage.get();
         m_consoleMessages.append(consoleMessage);
-        if (m_inspectorAgent->state()->getBoolean(InspectorState::consoleMessagesEnabled) && m_frontend)
+        if (m_inspectorAgent->state()->getBoolean(ConsoleAgentState::consoleMessagesEnabled) && m_frontend)
             m_previousMessage->addToFrontend(m_frontend, m_inspectorAgent->injectedScriptHost());
     }
 
index e96c22b..e8b4ad5 100644 (file)
 
 namespace WebCore {
 
-PassOwnPtr<InspectorDebuggerAgent> InspectorDebuggerAgent::create(InspectorAgent* inspectorAgent, InspectorFrontend* frontend)
+namespace DebuggerAgentState {
+static const char javaScriptBreakpoints[] = "javaScriptBreakopints";
+};
+
+PassOwnPtr<InspectorDebuggerAgent> InspectorDebuggerAgent::create(InspectorAgent* inspectorAgent, InspectorFrontend* frontend, bool eraseStickyBreakpoints)
 {
-    OwnPtr<InspectorDebuggerAgent> agent = adoptPtr(new InspectorDebuggerAgent(inspectorAgent, frontend));
+    OwnPtr<InspectorDebuggerAgent> agent = adoptPtr(new InspectorDebuggerAgent(inspectorAgent, frontend, eraseStickyBreakpoints));
     ScriptDebugServer::shared().clearBreakpoints();
     // FIXME(WK44513): breakpoints activated flag should be synchronized between all front-ends
     ScriptDebugServer::shared().setBreakpointsActivated(true);
@@ -52,12 +56,14 @@ PassOwnPtr<InspectorDebuggerAgent> InspectorDebuggerAgent::create(InspectorAgent
     return agent.release();
 }
 
-InspectorDebuggerAgent::InspectorDebuggerAgent(InspectorAgent* inspectorAgent, InspectorFrontend* frontend)
+InspectorDebuggerAgent::InspectorDebuggerAgent(InspectorAgent* inspectorAgent, InspectorFrontend* frontend, bool eraseStickyBreakpoints)
     : m_inspectorAgent(inspectorAgent)
     , m_frontend(frontend)
     , m_pausedScriptState(0)
     , m_javaScriptPauseScheduled(false)
 {
+    if (eraseStickyBreakpoints)
+        inspectorAgent->state()->setObject(DebuggerAgentState::javaScriptBreakpoints, InspectorObject::create());
 }
 
 InspectorDebuggerAgent::~InspectorDebuggerAgent()
@@ -85,7 +91,7 @@ void InspectorDebuggerAgent::inspectedURLChanged(const String&)
 void InspectorDebuggerAgent::setJavaScriptBreakpoint(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(InspectorState::javaScriptBreakpoints);
+    RefPtr<InspectorObject> breakpointsCookie = m_inspectorAgent->state()->getObject(DebuggerAgentState::javaScriptBreakpoints);
     if (breakpointsCookie->find(breakpointId) != breakpointsCookie->end())
         return;
     RefPtr<InspectorObject> breakpointObject = InspectorObject::create();
@@ -95,7 +101,7 @@ void InspectorDebuggerAgent::setJavaScriptBreakpoint(const String& url, int line
     breakpointObject->setString("condition", condition);
     breakpointObject->setBoolean("enabled", enabled);
     breakpointsCookie->setObject(breakpointId, breakpointObject);
-    m_inspectorAgent->state()->setObject(InspectorState::javaScriptBreakpoints, breakpointsCookie);
+    m_inspectorAgent->state()->setObject(DebuggerAgentState::javaScriptBreakpoints, breakpointsCookie);
 
     ScriptBreakpoint breakpoint(lineNumber, columnNumber, condition, enabled);
     for (ScriptsMap::iterator it = m_scripts.begin(); it != m_scripts.end(); ++it) {
@@ -126,9 +132,9 @@ void InspectorDebuggerAgent::setJavaScriptBreakpointBySourceId(const String& sou
 
 void InspectorDebuggerAgent::removeJavaScriptBreakpoint(const String& breakpointId)
 {
-    RefPtr<InspectorObject> breakpointsCookie = m_inspectorAgent->state()->getObject(InspectorState::javaScriptBreakpoints);
+    RefPtr<InspectorObject> breakpointsCookie = m_inspectorAgent->state()->getObject(DebuggerAgentState::javaScriptBreakpoints);
     breakpointsCookie->remove(breakpointId);
-    m_inspectorAgent->state()->setObject(InspectorState::javaScriptBreakpoints, breakpointsCookie);
+    m_inspectorAgent->state()->setObject(DebuggerAgentState::javaScriptBreakpoints, breakpointsCookie);
 
     BreakpointIdToDebugServerBreakpointIdsMap::iterator debugServerBreakpointIdsIterator = m_breakpointIdToDebugServerBreakpointIds.find(breakpointId);
     if (debugServerBreakpointIdsIterator == m_breakpointIdToDebugServerBreakpointIds.end())
@@ -278,7 +284,7 @@ void InspectorDebuggerAgent::didParseSource(const String& sourceID, const String
     if (url.isEmpty())
         return;
 
-    RefPtr<InspectorObject> breakpointsCookie = m_inspectorAgent->state()->getObject(InspectorState::javaScriptBreakpoints);
+    RefPtr<InspectorObject> breakpointsCookie = m_inspectorAgent->state()->getObject(DebuggerAgentState::javaScriptBreakpoints);
     for (InspectorObject::iterator it = breakpointsCookie->begin(); it != breakpointsCookie->end(); ++it) {
         RefPtr<InspectorObject> breakpointObject = it->second->asObject();
         String breakpointURL;
index f4e7e41..644557f 100644 (file)
@@ -57,7 +57,7 @@ enum DebuggerEventType {
 class InspectorDebuggerAgent : public ScriptDebugListener {
     WTF_MAKE_NONCOPYABLE(InspectorDebuggerAgent); WTF_MAKE_FAST_ALLOCATED;
 public:
-    static PassOwnPtr<InspectorDebuggerAgent> create(InspectorAgent*, InspectorFrontend*);
+    static PassOwnPtr<InspectorDebuggerAgent> create(InspectorAgent*, InspectorFrontend*, bool eraseStickyBreakpoints);
     virtual ~InspectorDebuggerAgent();
 
     void inspectedURLChanged(const String& url);
@@ -86,7 +86,7 @@ public:
     void getCompletionsOnCallFrame(PassRefPtr<InspectorObject> callFrameId, const String& expression, bool includeCommandLineAPI, RefPtr<InspectorValue>* result);
 
 private:
-    InspectorDebuggerAgent(InspectorAgent*, InspectorFrontend*);
+    InspectorDebuggerAgent(InspectorAgent*, InspectorFrontend*, bool eraseStickyBreakpoints);
 
     PassRefPtr<InspectorValue> currentCallFrames();
 
index dbb472a..ca758a0 100644 (file)
@@ -381,9 +381,13 @@ void InspectorInstrumentation::identifierForInitialRequestImpl(InspectorAgent* i
         resourceAgent->identifierForInitialRequest(identifier, request.url(), loader);
 }
 
+void InspectorInstrumentation::applyUserAgentOverrideImpl(InspectorAgent* inspectorAgent, String* userAgent)
+{
+    inspectorAgent->applyUserAgentOverride(userAgent);
+}
+
 void InspectorInstrumentation::willSendRequestImpl(InspectorAgent* ic, unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse)
 {
-    ic->willSendRequest(request);
     if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(ic))
         timelineAgent->willSendResourceRequest(identifier, request);
     if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(ic))
index 02f5d3f..a437ba2 100644 (file)
@@ -108,6 +108,7 @@ public:
     static InspectorInstrumentationCookie willRecalculateStyle(Document*);
     static void didRecalculateStyle(const InspectorInstrumentationCookie&);
 
+    static void applyUserAgentOverride(Frame*, String*);
     static void identifierForInitialRequest(Frame*, unsigned long identifier, DocumentLoader*, const ResourceRequest&);
     static void willSendRequest(Frame*, unsigned long identifier, ResourceRequest&, const ResourceResponse& redirectResponse);
     static void markResourceAsCached(Page*, unsigned long identifier);
@@ -220,6 +221,8 @@ private:
     static void didPaintImpl(const InspectorInstrumentationCookie&);
     static InspectorInstrumentationCookie willRecalculateStyleImpl(InspectorAgent*);
     static void didRecalculateStyleImpl(const InspectorInstrumentationCookie&);
+
+    static void applyUserAgentOverrideImpl(InspectorAgent*, String*);
     static void identifierForInitialRequestImpl(InspectorAgent*, unsigned long identifier, DocumentLoader*, const ResourceRequest&);
     static void willSendRequestImpl(InspectorAgent*, unsigned long identifier, ResourceRequest&, const ResourceResponse& redirectResponse);
     static void markResourceAsCachedImpl(InspectorAgent*, unsigned long identifier);
@@ -597,6 +600,14 @@ inline void InspectorInstrumentation::identifierForInitialRequest(Frame* frame,
 #endif
 }
 
+inline void InspectorInstrumentation::applyUserAgentOverride(Frame* frame, String* userAgent)
+{
+#if ENABLE(INSPECTOR)
+    if (InspectorAgent* inspectorAgent = inspectorAgentWithFrontendForFrame(frame))
+        applyUserAgentOverrideImpl(inspectorAgent, userAgent);
+#endif
+}
+
 inline void InspectorInstrumentation::willSendRequest(Frame* frame, unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse)
 {
 #if ENABLE(INSPECTOR)
index d6e4ccf..3a69eef 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2011 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
 
 namespace WebCore {
 
+namespace ResourceAgentState {
+static const char resourceAgentEnabled[] = "resourceAgentEnabled";
+static const char extraRequestHeaders[] = "extraRequestHeaders";
+}
+
 PassRefPtr<InspectorResourceAgent> InspectorResourceAgent::restore(Page* page, InspectorState* state, InspectorFrontend* frontend)
 {
-    if (state->getBoolean(InspectorState::resourceAgentEnabled))
+    if (state->getBoolean(ResourceAgentState::resourceAgentEnabled))
         return create(page, state, frontend);
     return 0;
 }
@@ -287,7 +292,7 @@ static void populateObjectWithFrameResources(Frame* frame, PassRefPtr<InspectorO
 
 InspectorResourceAgent::~InspectorResourceAgent()
 {
-    m_state->setBoolean(InspectorState::resourceAgentEnabled, false);
+    m_state->setBoolean(ResourceAgentState::resourceAgentEnabled, false);
 }
 
 void InspectorResourceAgent::identifierForInitialRequest(unsigned long identifier, const KURL& url, DocumentLoader* loader)
@@ -302,8 +307,28 @@ void InspectorResourceAgent::identifierForInitialRequest(unsigned long identifie
     m_frontend->identifierForInitialRequest(identifier, url.string(), loaderObject, callStackValue);
 }
 
+void InspectorResourceAgent::setExtraHeaders(PassRefPtr<InspectorObject> headers)
+{
+    m_state->setObject(ResourceAgentState::extraRequestHeaders, headers);
+}
+
+
 void InspectorResourceAgent::willSendRequest(unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse)
 {
+    RefPtr<InspectorObject> headers = m_state->getObject(ResourceAgentState::extraRequestHeaders);
+
+    if (headers) {
+        InspectorObject::const_iterator end = headers->end();
+        for (InspectorObject::const_iterator it = headers->begin(); it != end; ++it) {
+            String value;
+            if (it->second->asString(&value))
+                request.setHTTPHeaderField(it->first, value);
+        }
+    }
+
+    request.setReportLoadTiming(true);
+    request.setReportRawHeaders(true);
+
     m_frontend->willSendRequest(identifier, currentTime(), buildObjectForResourceRequest(request), buildObjectForResourceResponse(redirectResponse));
 }
 
@@ -492,7 +517,7 @@ InspectorResourceAgent::InspectorResourceAgent(Page* page, InspectorState* state
     , m_state(state)
     , m_frontend(frontend)
 {
-    m_state->setBoolean(InspectorState::resourceAgentEnabled, true);
+    m_state->setBoolean(ResourceAgentState::resourceAgentEnabled, true);
 }
 
 } // namespace WebCore
index 6c2df24..23dbeee 100644 (file)
@@ -104,6 +104,7 @@ public:
     // Called from frontend 
     void cachedResources(RefPtr<InspectorObject>*);
     void resourceContent(unsigned long frameID, const String& url, bool base64Encode, String* content);
+    void setExtraHeaders(PassRefPtr<InspectorObject>);
 
 private:
     InspectorResourceAgent(Page* page, InspectorState*, InspectorFrontend* frontend);
index 779d464..b7e66e5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2011 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -37,124 +37,65 @@ namespace WebCore {
 
 InspectorState::InspectorState(InspectorClient* client)
     : m_client(client)
+    , m_properties(InspectorObject::create())
 {
-    // Pure reload state
-    registerBoolean(userInitiatedProfiling, false);
-    registerBoolean(timelineProfilerEnabled, false);
-    registerBoolean(searchingForNode, false);
-    registerBoolean(debuggerEnabled, false);
-    registerBoolean(profilerEnabled, false);
-    registerObject(javaScriptBreakpoints);
-    registerObject(browserBreakpoints);
-    registerBoolean(consoleMessagesEnabled, false);
-    registerBoolean(monitoringXHR, false);
-    registerBoolean(resourceAgentEnabled, false);
 }
 
 void InspectorState::restoreFromInspectorCookie(const String& json)
 {
     RefPtr<InspectorValue> jsonValue = InspectorValue::parseJSON(json);
-    if (!jsonValue)
-        return;
-
-    RefPtr<InspectorObject> jsonObject = jsonValue->asObject();
-    if (!jsonObject)
-        return;
-
-    for (InspectorObject::iterator i = jsonObject->begin(); i != jsonObject->end(); ++i) {
-        InspectorPropertyId id = (InspectorPropertyId)i->first.toInt();
-        ASSERT(id > 0 && id < lastPropertyId);
-        PropertyMap::iterator j = m_properties.find(id);
-        ASSERT(j != m_properties.end());
-        ASSERT(j->second.m_value->type() == i->second->type());
-        j->second.m_value = i->second;
-    }
+    if (jsonValue)
+        m_properties = jsonValue->asObject();
+    if (!m_properties)
+        m_properties = InspectorObject::create();
 }
 
 void InspectorState::updateCookie()
 {
-    RefPtr<InspectorObject> cookieObject = InspectorObject::create();
-    for (PropertyMap::iterator i = m_properties.begin(); i != m_properties.end(); ++i)
-        cookieObject->setValue(String::number(i->first), i->second.m_value);
-    m_client->updateInspectorStateCookie(cookieObject->toJSONString());
+    m_client->updateInspectorStateCookie(m_properties->toJSONString());
 }
 
-void InspectorState::setValue(InspectorPropertyId id, PassRefPtr<InspectorValue> value)
+void InspectorState::setValue(const String& propertyName, PassRefPtr<InspectorValue> value)
 {
-    PropertyMap::iterator i = m_properties.find(id);
-    ASSERT(i != m_properties.end());
-    i->second.m_value = value;
+    m_properties->setValue(propertyName, value);
     updateCookie();
 }
 
-bool InspectorState::getBoolean(InspectorPropertyId id)
+bool InspectorState::getBoolean(const String& propertyName)
 {
-    PropertyMap::iterator i = m_properties.find(id);
-    ASSERT(i != m_properties.end());
+    InspectorObject::iterator it = m_properties->find(propertyName);
     bool value = false;
-    i->second.m_value->asBoolean(&value);
+    if (it != m_properties->end())
+        it->second->asBoolean(&value);
     return value;
 }
 
-String InspectorState::getString(InspectorPropertyId id)
+String InspectorState::getString(const String& propertyName)
 {
-    PropertyMap::iterator i = m_properties.find(id);
-    ASSERT(i != m_properties.end());
+    InspectorObject::iterator it = m_properties->find(propertyName);
     String value;
-    i->second.m_value->asString(&value);
+    if (it != m_properties->end())
+        it->second->asString(&value);
     return value;
 }
 
-long InspectorState::getLong(InspectorPropertyId id)
+long InspectorState::getLong(const String& propertyName)
 {
-    PropertyMap::iterator i = m_properties.find(id);
-    ASSERT(i != m_properties.end());
+    InspectorObject::iterator it = m_properties->find(propertyName);
     long value = 0;
-    i->second.m_value->asNumber(&value);
+    if (it != m_properties->end())
+        it->second->asNumber(&value);
     return value;
 }
 
-PassRefPtr<InspectorObject> InspectorState::getObject(InspectorPropertyId id)
-{
-    PropertyMap::iterator i = m_properties.find(id);
-    ASSERT(i != m_properties.end());
-    return i->second.m_value->asObject();
-}
-
-void InspectorState::setObject(InspectorPropertyId id, PassRefPtr<InspectorObject> value)
+PassRefPtr<InspectorObject> InspectorState::getObject(const String& propertyName)
 {
-    PropertyMap::iterator i = m_properties.find(id);
-    ASSERT(i != m_properties.end());
-    Property& property = i->second;
-    property.m_value = value;
-    updateCookie();
-}
-
-void InspectorState::registerBoolean(InspectorPropertyId propertyId, bool value)
-{
-    m_properties.set(propertyId, Property::create(InspectorBasicValue::create(value)));
-}
-
-void InspectorState::registerString(InspectorPropertyId propertyId, const String& value)
-{
-    m_properties.set(propertyId, Property::create(InspectorString::create(value)));
-}
-
-void InspectorState::registerLong(InspectorPropertyId propertyId, long value)
-{
-    m_properties.set(propertyId, Property::create(InspectorBasicValue::create((double)value)));
-}
-
-void InspectorState::registerObject(InspectorPropertyId propertyId)
-{
-    m_properties.set(propertyId, Property::create(InspectorObject::create()));
-}
-
-InspectorState::Property InspectorState::Property::create(PassRefPtr<InspectorValue> value)
-{
-    Property property;
-    property.m_value = value;
-    return property;
+    InspectorObject::iterator it = m_properties->find(propertyName);
+    if (it == m_properties->end()) {
+        m_properties->setObject(propertyName, InspectorObject::create());
+        it = m_properties->find(propertyName);
+    }
+    return it->second->asObject();
 }
 
 } // namespace WebCore
index 90a2c17..2683a08 100644 (file)
@@ -1,29 +1,31 @@
 /*
- * Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2011 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ * modification, are permitted provided that the following conditions are
+ * met:
  *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY GOOGLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #ifndef InspectorState_h
@@ -43,51 +45,26 @@ class InspectorClient;
 
 class InspectorState {
 public:
-    enum InspectorPropertyId {
-        monitoringXHR = 1,
-        timelineProfilerEnabled,
-        searchingForNode,
-        consoleMessagesEnabled,
-        profilerEnabled,
-        userInitiatedProfiling,
-        debuggerEnabled,
-        javaScriptBreakpoints,
-        browserBreakpoints,
-        resourceAgentEnabled,
-        lastPropertyId
-    };
-
     InspectorState(InspectorClient* client);
 
     void restoreFromInspectorCookie(const String& jsonString);
 
-    bool getBoolean(InspectorPropertyId);
-    String getString(InspectorPropertyId);
-    long getLong(InspectorPropertyId);
-    PassRefPtr<InspectorObject> getObject(InspectorPropertyId);
+    bool getBoolean(const String& propertyName);
+    String getString(const String& propertyName);
+    long getLong(const String& propertyName);
+    PassRefPtr<InspectorObject> getObject(const String& propertyName);
 
-    void setBoolean(InspectorPropertyId propertyId, bool value) { setValue(propertyId, InspectorBasicValue::create(value)); }
-    void setString(InspectorPropertyId propertyId, const String& value) { setValue(propertyId, InspectorString::create(value)); }
-    void setLong(InspectorPropertyId propertyId, long value) { setValue(propertyId, InspectorBasicValue::create((double)value)); }
-    void setObject(InspectorPropertyId, PassRefPtr<InspectorObject> value);
+    void setBoolean(const String& propertyName, bool value) { setValue(propertyName, InspectorBasicValue::create(value)); }
+    void setString(const String& propertyName, const String& value) { setValue(propertyName, InspectorString::create(value)); }
+    void setLong(const String& propertyName, long value) { setValue(propertyName, InspectorBasicValue::create((double)value)); }
+    void setObject(const String& propertyName, PassRefPtr<InspectorObject> value) { setValue(propertyName, value); }
 
 private:
     void updateCookie();
-    void setValue(InspectorPropertyId, PassRefPtr<InspectorValue>);
-
-    struct Property {
-        static Property create(PassRefPtr<InspectorValue> value);
-        RefPtr<InspectorValue> m_value;
-    };
-    typedef HashMap<long, Property> PropertyMap;
-    PropertyMap m_properties;
-
-    void registerBoolean(InspectorPropertyId, bool value);
-    void registerString(InspectorPropertyId, const String& value);
-    void registerLong(InspectorPropertyId, long value);
-    void registerObject(InspectorPropertyId);
+    void setValue(const String& propertyName, PassRefPtr<InspectorValue>);
 
     InspectorClient* m_client;
+    RefPtr<InspectorObject> m_properties;
 };
 
 } // namespace WebCore
index 71f625c..f575c7f 100644 (file)
@@ -2555,14 +2555,9 @@ int FrameLoader::numPendingOrLoadingRequests(bool recurse) const
 
 String FrameLoader::userAgent(const KURL& url) const
 {
-#if ENABLE(INSPECTOR)
-    if (Page* page = m_frame->page()) {
-        String userAgentOverride = page->inspectorController()->userAgentOverride();
-        if (!userAgentOverride.isEmpty())
-            return userAgentOverride;
-    }
-#endif
-    return m_client->userAgent(url);
+    String userAgent = m_client->userAgent(url);
+    InspectorInstrumentation::applyUserAgentOverride(m_frame, &userAgent);
+    return userAgent;
 }
 
 void FrameLoader::handledOnloadEvents()