2011-03-29 Ilya Tikhonovsky <loislo@chromium.org>
authorloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Mar 2011 18:01:10 +0000 (18:01 +0000)
committerloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Mar 2011 18:01:10 +0000 (18:01 +0000)
        Reviewed by Pavel Feldman.

        Web Inspector: extract InspectorPageAgent from InspectorAgent.
        https://bugs.webkit.org/show_bug.cgi?id=57327

        There are page related methods and inspector related methods in InspectorAgent.
        It would be nice to extract page specific methods for future usage the rest of methods in workers debugger.

        * GNUmakefile.am:
        * WebCore.gypi:
        * inspector/CodeGeneratorInspector.pm:
        * inspector/Inspector.json:
        * inspector/InspectorAgent.cpp:
        (WebCore::InspectorAgent::InspectorAgent):
        (WebCore::InspectorAgent::restoreInspectorStateFromCookie):
        (WebCore::InspectorAgent::didClearWindowObjectInWorld):
        (WebCore::InspectorAgent::setFrontend):
        (WebCore::InspectorAgent::disconnectFrontend):
        (WebCore::InspectorAgent::didCommitLoad):
        (WebCore::InspectorAgent::domContentLoadedEventFired):
        * inspector/InspectorAgent.h:
        (WebCore::InspectorAgent::pageAgent):
        * inspector/InspectorPageAgent.cpp: Added.
        (WebCore::InspectorPageAgent::create):
        (WebCore::InspectorPageAgent::InspectorPageAgent):
        (WebCore::InspectorPageAgent::setFrontend):
        (WebCore::InspectorPageAgent::clearFrontend):
        (WebCore::InspectorPageAgent::addScriptToEvaluateOnLoad):
        (WebCore::InspectorPageAgent::removeAllScriptsToEvaluateOnLoad):
        (WebCore::InspectorPageAgent::reloadPage):
        (WebCore::InspectorPageAgent::openInInspectedWindow):
        (WebCore::InspectorPageAgent::setUserAgentOverride):
        (WebCore::buildObjectForCookie):
        (WebCore::buildArrayForCookies):
        (WebCore::InspectorPageAgent::getCookies):
        (WebCore::InspectorPageAgent::deleteCookie):
        (WebCore::InspectorPageAgent::inspectedURLChanged):
        (WebCore::InspectorPageAgent::restore):
        (WebCore::InspectorPageAgent::didCommitLoad):
        (WebCore::InspectorPageAgent::domContentEventFired):
        (WebCore::InspectorPageAgent::loadEventFired):
        (WebCore::InspectorPageAgent::didClearWindowObjectInWorld):
        (WebCore::InspectorPageAgent::applyUserAgentOverride):
        * inspector/InspectorPageAgent.h: Added.
        * inspector/InspectorController.cpp:
        (WebCore::InspectorController::connectFrontend):
        * inspector/InspectorInstrumentation.cpp:
        (WebCore::InspectorInstrumentation::didClearWindowObjectInWorldImpl):
        (WebCore::InspectorInstrumentation::applyUserAgentOverrideImpl):
        (WebCore::InspectorInstrumentation::domContentLoadedEventFiredImpl):
        (WebCore::InspectorInstrumentation::loadEventFiredImpl):
        (WebCore::InspectorInstrumentation::didCommitLoadImpl):
        (WebCore::InspectorInstrumentation::retrievePageAgent):
        * inspector/InspectorInstrumentation.h:
        * inspector/InstrumentingAgents.h:
        (WebCore::InstrumentingAgents::InstrumentingAgents):
        (WebCore::InstrumentingAgents::inspectorPageAgent):
        (WebCore::InstrumentingAgents::setInspectorPageAgent):
        * inspector/front-end/AuditsPanel.js:
        (WebInspector.AuditsPanel.prototype._reloadResources):
        * inspector/front-end/CookieItemsView.js:
        (WebInspector.CookieItemsView.prototype._deleteCookie):
        (WebInspector.Cookies.getCookiesAsync):
        * inspector/front-end/ExtensionServer.js:
        (WebInspector.ExtensionServer.prototype._onReload):
        * inspector/front-end/NetworkPanel.js:
        (WebInspector.NetworkDataGridNode.prototype._openInNewTab):
        * inspector/front-end/ResourcesPanel.js:
        (WebInspector.FrameResourceTreeElement.prototype.ondblclick):
        * inspector/front-end/WorkersSidebarPane.js:
        (WebInspector.WorkersSidebarPane.prototype.setInstrumentation):
        * inspector/front-end/inspector.js:
        (WebInspector.openResource):
        (WebInspector.documentKeyDown):

2011-03-29  Ilya Tikhonovsky  <loislo@chromium.org>

        Reviewed by Pavel Feldman.

        Web Inspector: extract InspectorPageAgent from InspectorAgent.
        https://bugs.webkit.org/show_bug.cgi?id=57327

        There are page related methods and inspector related methods in InspectorAgent.
        It would be nice to extract page specific methods for future usage the rest of methods in workers debugger.

        * http/tests/inspector/inspector-test.js:
        (initialize_InspectorTest.InspectorTest.reloadPage):

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

26 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/inspector/inspector-test.js
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.am
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.pro
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/inspector/CodeGeneratorInspector.pm
Source/WebCore/inspector/Inspector.json
Source/WebCore/inspector/InspectorAgent.cpp
Source/WebCore/inspector/InspectorAgent.h
Source/WebCore/inspector/InspectorController.cpp
Source/WebCore/inspector/InspectorInstrumentation.cpp
Source/WebCore/inspector/InspectorInstrumentation.h
Source/WebCore/inspector/InspectorPageAgent.cpp [new file with mode: 0644]
Source/WebCore/inspector/InspectorPageAgent.h [new file with mode: 0644]
Source/WebCore/inspector/InstrumentingAgents.h
Source/WebCore/inspector/front-end/AuditsPanel.js
Source/WebCore/inspector/front-end/CookieItemsView.js
Source/WebCore/inspector/front-end/ExtensionServer.js
Source/WebCore/inspector/front-end/NetworkPanel.js
Source/WebCore/inspector/front-end/ResourcesPanel.js
Source/WebCore/inspector/front-end/WorkersSidebarPane.js
Source/WebCore/inspector/front-end/inspector.js

index 2a34694f02e69e5be43f88535c8c9470f59d3c94..1d52ada8461fc338b64b159b1f784be8bcab4b11 100644 (file)
@@ -1,3 +1,16 @@
+2011-03-29  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: extract InspectorPageAgent from InspectorAgent.
+        https://bugs.webkit.org/show_bug.cgi?id=57327
+
+        There are page related methods and inspector related methods in InspectorAgent.
+        It would be nice to extract page specific methods for future usage the rest of methods in workers debugger.
+
+        * http/tests/inspector/inspector-test.js:
+        (initialize_InspectorTest.InspectorTest.reloadPage):
+
 2011-03-29  Philippe Normand  <pnormand@igalia.com>
 
         Unreviewed, skip failing test on GTK.
index c507f59b7804c1a8998307596a4996ef1ef81cfd..1e343f586a46145440c3bc7e0a3a9fc4180639cd 100644 (file)
@@ -137,7 +137,7 @@ InspectorTest.reloadPage = function(callback)
 
     if (WebInspector.panels.network)
         WebInspector.panels.network._reset();
-    InspectorAgent.reloadPage(false);
+    PageAgent.reloadPage(false);
 }
 
 InspectorTest.pageReloaded = function()
index 226572da545f0c6874d67188f3a21f4e2c03c959..807f55ddc37f5dc07812a79d5e13125f85345dbb 100644 (file)
@@ -885,6 +885,7 @@ SET(WebCore_SOURCES
     inspector/InjectedScriptManager.cpp
     inspector/InspectorAgent.cpp
     inspector/InspectorApplicationCacheAgent.cpp
+    inspector/InspectorPageAgent.cpp
     inspector/InspectorBrowserDebuggerAgent.cpp
     inspector/InspectorCSSAgent.cpp
     inspector/InspectorClient.cpp
index fb2653c22a084aa9cc41f600643802b13428b5f9..615a6b5cb76e42505ee86e42591f594d1e90f6f0 100644 (file)
@@ -1,3 +1,80 @@
+2011-03-29  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: extract InspectorPageAgent from InspectorAgent.
+        https://bugs.webkit.org/show_bug.cgi?id=57327
+
+        There are page related methods and inspector related methods in InspectorAgent.
+        It would be nice to extract page specific methods for future usage the rest of methods in workers debugger.
+
+        * GNUmakefile.am:
+        * WebCore.gypi:
+        * inspector/CodeGeneratorInspector.pm:
+        * inspector/Inspector.json:
+        * inspector/InspectorAgent.cpp:
+        (WebCore::InspectorAgent::InspectorAgent):
+        (WebCore::InspectorAgent::restoreInspectorStateFromCookie):
+        (WebCore::InspectorAgent::didClearWindowObjectInWorld):
+        (WebCore::InspectorAgent::setFrontend):
+        (WebCore::InspectorAgent::disconnectFrontend):
+        (WebCore::InspectorAgent::didCommitLoad):
+        (WebCore::InspectorAgent::domContentLoadedEventFired):
+        * inspector/InspectorAgent.h:
+        (WebCore::InspectorAgent::pageAgent):
+        * inspector/InspectorPageAgent.cpp: Added.
+        (WebCore::InspectorPageAgent::create):
+        (WebCore::InspectorPageAgent::InspectorPageAgent):
+        (WebCore::InspectorPageAgent::setFrontend):
+        (WebCore::InspectorPageAgent::clearFrontend):
+        (WebCore::InspectorPageAgent::addScriptToEvaluateOnLoad):
+        (WebCore::InspectorPageAgent::removeAllScriptsToEvaluateOnLoad):
+        (WebCore::InspectorPageAgent::reloadPage):
+        (WebCore::InspectorPageAgent::openInInspectedWindow):
+        (WebCore::InspectorPageAgent::setUserAgentOverride):
+        (WebCore::buildObjectForCookie):
+        (WebCore::buildArrayForCookies):
+        (WebCore::InspectorPageAgent::getCookies):
+        (WebCore::InspectorPageAgent::deleteCookie):
+        (WebCore::InspectorPageAgent::inspectedURLChanged):
+        (WebCore::InspectorPageAgent::restore):
+        (WebCore::InspectorPageAgent::didCommitLoad):
+        (WebCore::InspectorPageAgent::domContentEventFired):
+        (WebCore::InspectorPageAgent::loadEventFired):
+        (WebCore::InspectorPageAgent::didClearWindowObjectInWorld):
+        (WebCore::InspectorPageAgent::applyUserAgentOverride):
+        * inspector/InspectorPageAgent.h: Added.
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::connectFrontend):
+        * inspector/InspectorInstrumentation.cpp:
+        (WebCore::InspectorInstrumentation::didClearWindowObjectInWorldImpl):
+        (WebCore::InspectorInstrumentation::applyUserAgentOverrideImpl):
+        (WebCore::InspectorInstrumentation::domContentLoadedEventFiredImpl):
+        (WebCore::InspectorInstrumentation::loadEventFiredImpl):
+        (WebCore::InspectorInstrumentation::didCommitLoadImpl):
+        (WebCore::InspectorInstrumentation::retrievePageAgent):
+        * inspector/InspectorInstrumentation.h:
+        * inspector/InstrumentingAgents.h:
+        (WebCore::InstrumentingAgents::InstrumentingAgents):
+        (WebCore::InstrumentingAgents::inspectorPageAgent):
+        (WebCore::InstrumentingAgents::setInspectorPageAgent):
+        * inspector/front-end/AuditsPanel.js:
+        (WebInspector.AuditsPanel.prototype._reloadResources):
+        * inspector/front-end/CookieItemsView.js:
+        (WebInspector.CookieItemsView.prototype._deleteCookie):
+        (WebInspector.Cookies.getCookiesAsync):
+        * inspector/front-end/ExtensionServer.js:
+        (WebInspector.ExtensionServer.prototype._onReload):
+        * inspector/front-end/NetworkPanel.js:
+        (WebInspector.NetworkDataGridNode.prototype._openInNewTab):
+        * inspector/front-end/ResourcesPanel.js:
+        (WebInspector.FrameResourceTreeElement.prototype.ondblclick):
+        * inspector/front-end/WorkersSidebarPane.js:
+        (WebInspector.WorkersSidebarPane.prototype.setInstrumentation):
+        * inspector/front-end/inspector.js:
+        (WebInspector.openResource):
+        (WebInspector.documentKeyDown):
+
 2011-03-29  David Hyatt  <hyatt@apple.com>
 
         Reviewed by Darin Adler.
index 856db06e0964797405f503ad58bbec5cd8345cb7..58368bdd9f286d7a1b2d8c6bec4e9e3ab8d140df 100644 (file)
@@ -2024,6 +2024,8 @@ webcore_sources += \
        Source/WebCore/inspector/InspectorFrontendHost.h \
        Source/WebCore/inspector/InspectorInstrumentation.cpp \
        Source/WebCore/inspector/InspectorInstrumentation.h \
+       Source/WebCore/inspector/InspectorPageAgent.cpp \
+       Source/WebCore/inspector/InspectorPageAgent.h \
        Source/WebCore/inspector/InspectorProfilerAgent.cpp \
        Source/WebCore/inspector/InspectorProfilerAgent.h \
        Source/WebCore/inspector/InspectorResourceAgent.cpp \
index d218f4730fcffe660a3611a952d6e8a43721635c..8f89cda167f7a517f143b61ef92fbc985d374074 100644 (file)
             'inspector/InspectorFrontendHost.h',
             'inspector/InspectorInstrumentation.cpp',
             'inspector/InspectorInstrumentation.h',
+            'inspector/InspectorPageAgent.cpp',
+            'inspector/InspectorPageAgent.h',
             'inspector/InspectorProfilerAgent.cpp',
             'inspector/InspectorProfilerAgent.h',
             'inspector/InspectorResourceAgent.cpp',
index 4251d7385915c393b08dfccd74bc29132a51487b..330678a4cf794a7dceb16a32a1f036a69fd5c049 100644 (file)
@@ -808,7 +808,7 @@ SOURCES += \
     inspector/InjectedScriptManager.cpp \
     inspector/InspectorAgent.cpp \
     inspector/InspectorApplicationCacheAgent.cpp \
-    inspector/InspectorBrowserDebuggerAgent.cpp \
+    inspector/InspectorBrowseebuggerAgent.cpp \
     inspector/InspectorCSSAgent.cpp \
     inspector/InspectorClient.cpp \
     inspector/InspectorConsoleAgent.cpp \
@@ -822,6 +822,7 @@ SOURCES += \
     inspector/InspectorFrontendClientLocal.cpp \
     inspector/InspectorFrontendHost.cpp \
     inspector/InspectorInstrumentation.cpp \
+    inspector/InspectorPageAgent.cpp \
     inspector/InspectorProfilerAgent.cpp \
     inspector/InspectorResourceAgent.cpp \
     inspector/InspectorRuntimeAgent.cpp \
@@ -1746,6 +1747,7 @@ HEADERS += \
     inspector/InspectorFrontendClientLocal.h \
     inspector/InspectorFrontendHost.h \
     inspector/InspectorInstrumentation.h \
+    inspector/InspectorPageAgent.h \
     inspector/InspectorProfilerAgent.h \
     inspector/InspectorResourceAgent.h \
     inspector/InspectorRuntimeAgent.h \
index 7c31f5f2914216b9c0b88d9e7b6d675d31655062..9b7406069be48f6ea1b30183969ede538cd1ec84 100755 (executable)
                                RelativePath="..\inspector\InspectorProfilerAgent.cpp"
                                >
                        </File>
+                       <File
+                               RelativePath="..\inspector\InspectorPageAgent.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\inspector\InspectorPageAgent.h"
+                               >
+                       </File>
                        <File
                                RelativePath="..\inspector\InspectorProfilerAgent.h"
                                >
index 3d655335f6d5dfe2eb351c254eb1ddcfdc161cac..4e21f989d4468f1cda96e72d439a5203e4cdab05 100644 (file)
                4F3289B511A42AAB005ABE7E /* InspectorValues.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4F3289B311A42AAB005ABE7E /* InspectorValues.cpp */; };
                4F3289B611A42AAB005ABE7E /* InspectorValues.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F3289B411A42AAB005ABE7E /* InspectorValues.h */; settings = {ATTRIBUTES = (Private, ); }; };
                4F4F5FFB11CBD2E100A186BF /* InspectorFrontend.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4F4F5FFA11CBD2D200A186BF /* InspectorFrontend.cpp */; };
+               4F6FDD641341DEDD001F8EE3 /* InspectorPageAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4F6FDD621341DEDD001F8EE3 /* InspectorPageAgent.cpp */; };
+               4F6FDD651341DEDD001F8EE3 /* InspectorPageAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F6FDD631341DEDD001F8EE3 /* InspectorPageAgent.h */; };
                4F707A9911EF679400ACDA69 /* InspectorBackendDispatcher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4F707A9711EF679400ACDA69 /* InspectorBackendDispatcher.cpp */; };
                4F707A9A11EF679400ACDA69 /* InspectorBackendDispatcher.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F707A9811EF679400ACDA69 /* InspectorBackendDispatcher.h */; };
                4FA3B90A125CD12200300BAD /* InspectorState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4FA3B908125CD12100300BAD /* InspectorState.cpp */; };
                4F3289B411A42AAB005ABE7E /* InspectorValues.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorValues.h; sourceTree = "<group>"; };
                4F4F5FFA11CBD2D200A186BF /* InspectorFrontend.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorFrontend.cpp; sourceTree = "<group>"; };
                4F4F5FFC11CBD30100A186BF /* InspectorFrontend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorFrontend.h; sourceTree = "<group>"; };
+               4F6FDD621341DEDD001F8EE3 /* InspectorPageAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorPageAgent.cpp; sourceTree = "<group>"; };
+               4F6FDD631341DEDD001F8EE3 /* InspectorPageAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorPageAgent.h; sourceTree = "<group>"; };
                4F707A9711EF679400ACDA69 /* InspectorBackendDispatcher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorBackendDispatcher.cpp; sourceTree = "<group>"; };
                4F707A9811EF679400ACDA69 /* InspectorBackendDispatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorBackendDispatcher.h; sourceTree = "<group>"; };
                4FA3B908125CD12100300BAD /* InspectorState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorState.cpp; sourceTree = "<group>"; };
                                7A0E770D10C00A8800A0276E /* InspectorFrontendHost.idl */,
                                20D629241253690B00081543 /* InspectorInstrumentation.cpp */,
                                20D629251253690B00081543 /* InspectorInstrumentation.h */,
+                               4F6FDD621341DEDD001F8EE3 /* InspectorPageAgent.cpp */,
+                               4F6FDD631341DEDD001F8EE3 /* InspectorPageAgent.h */,
                                9F0D6B2C121BFEBA006C0288 /* InspectorProfilerAgent.cpp */,
                                9F0D6B2D121BFEBA006C0288 /* InspectorProfilerAgent.h */,
                                82AB1771125C826700C5069D /* InspectorResourceAgent.cpp */,
                                BC772E131331620C001EC9CE /* CSSLineBoxContainValue.h in Headers */,
                                4F1442291339FD6200E0D6F8 /* DOMNodeHighlighter.h in Headers */,
                                59B0EEA7132A6F2A004331C7 /* JavaType.h in Headers */,
+                               4F6FDD651341DEDD001F8EE3 /* InspectorPageAgent.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                7E37EF2E1339208800B29250 /* SubresourceLoaderCF.cpp in Sources */,
                                4F1442281339FD6200E0D6F8 /* DOMNodeHighlighter.cpp in Sources */,
                                84B62685133138F90095A489 /* FontPlatformData.cpp in Sources */,
+                               4F6FDD641341DEDD001F8EE3 /* InspectorPageAgent.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 6b9b4abe1eabb4ad95e5585247f443bd9450efc7..ea65f2e1e07063497c1700df56ae7d1d931ebd23 100644 (file)
@@ -25,6 +25,11 @@ $typeTransform{"Console"} = {
     "header" => "InspectorConsoleAgent.h",
     "domainAccessor" => "m_consoleAgent",
 };
+$typeTransform{"Page"} = {
+    "forward" => "InspectorPageAgent",
+    "header" => "InspectorPageAgent.h",
+    "domainAccessor" => "m_pageAgent",
+};
 $typeTransform{"Debugger"} = {
     "forward" => "InspectorDebuggerAgent",
     "header" => "InspectorDebuggerAgent.h",
index b7d9a9c7f7ee7e733e39aeed7e3bdf147b5c1785..0e8246632e7d30891050eb155636f7175b12957d 100644 (file)
         "types": [],
         "commands": [
             {
-                "name": "addScriptToEvaluateOnLoad",
+                "name": "didEvaluateForTestInFrontend",
                 "parameters": [
-                    { "name": "scriptSource", "type": "string" }
+                    { "name": "testCallId", "type": "integer" },
+                    { "name": "jsonResult", "type": "string" }
                 ]
+            }
+        ],
+        "events": [
+            {
+                "name": "frontendReused"
             },
             {
-                "name": "removeAllScriptsToEvaluateOnLoad"
+                "name": "bringToFront"
             },
             {
-                "name": "reloadPage",
-                "parameters": [
-                    { "name": "ignoreCache", "type": "boolean" }
-                ]
+                "name": "disconnectFromBackend"
             },
             {
-                "name": "openInInspectedWindow",
+                "name": "reset"
+            },
+            {
+                "name": "showPanel",
                 "parameters": [
-                    { "name": "url", "type": "string" }
+                    { "name": "panel", "type": "string" }
                 ]
             },
             {
-                "name": "didEvaluateForTestInFrontend",
+                "name": "startUserInitiatedDebugging"
+            },
+            {
+                "name": "evaluateForTestInFrontend",
                 "parameters": [
                     { "name": "testCallId", "type": "integer" },
-                    { "name": "jsonResult", "type": "string" }
+                    { "name": "script", "type": "string" }
                 ]
             },
             {
-                "name": "setUserAgentOverride",
+                "name": "inspect",
                 "parameters": [
-                    { "name": "userAgent", "type": "string" }
+                    { "name": "object", "$ref": "RemoteObject" },
+                    { "name": "hints", "type": "object" }
                 ]
             },
             {
-                "name": "getCookies",
-                "returns": [
-                    { "name": "cookies", "type": "array", "items": { "$ref" : "Cookie"} },
-                    { "name": "cookiesString", "type": "string" }
+                "name": "didCreateWorker",
+                "parameters": [
+                    { "name": "id", "type": "integer" },
+                    { "name": "url", "type": "string" },
+                    { "name": "isShared", "type": "boolean" }
                 ]
             },
             {
-                "name": "deleteCookie",
+                "name": "didDestroyWorker",
                 "parameters": [
-                    { "name": "cookieName", "type": "string" },
-                    { "name": "domain", "type": "string" }
+                    { "name": "id", "type": "integer" }
                 ]
             }
-        ],
-        "events": [
-            {
-                "name": "frontendReused"
-            },
+        ]
+    },
+    {
+        "domain": "Page",
+        "types": [],
+        "commands": [
             {
-                "name": "bringToFront"
+                "name": "addScriptToEvaluateOnLoad",
+                "parameters": [
+                    { "name": "scriptSource", "type": "string" }
+                ]
             },
             {
-                "name": "disconnectFromBackend"
+                "name": "removeAllScriptsToEvaluateOnLoad"
             },
             {
-                "name": "inspectedURLChanged",
+                "name": "reloadPage",
                 "parameters": [
-                    { "name": "url", "type": "string" }
+                    { "name": "ignoreCache", "type": "boolean" }
                 ]
             },
             {
-                "name": "domContentEventFired",
+                "name": "openInInspectedWindow",
                 "parameters": [
-                    { "name": "time", "type": "number" }
+                    { "name": "url", "type": "string" }
                 ]
             },
             {
-                "name": "loadEventFired",
+                "name": "setUserAgentOverride",
                 "parameters": [
-                    { "name": "time", "type": "number" }
+                    { "name": "userAgent", "type": "string" }
                 ]
             },
             {
-                "name": "reset"
-            },
-            {
-                "name": "showPanel",
-                "parameters": [
-                    { "name": "panel", "type": "string" }
+                "name": "getCookies",
+                "returns": [
+                    { "name": "cookies", "type": "array", "items": { "$ref" : "Cookie"} },
+                    { "name": "cookiesString", "type": "string" }
                 ]
             },
             {
-                "name": "startUserInitiatedDebugging"
-            },
-            {
-                "name": "evaluateForTestInFrontend",
+                "name": "deleteCookie",
                 "parameters": [
-                    { "name": "testCallId", "type": "integer" },
-                    { "name": "script", "type": "string" }
+                    { "name": "cookieName", "type": "string" },
+                    { "name": "domain", "type": "string" }
                 ]
-            },
+            }
+        ],
+        "events": [
             {
-                "name": "inspect",
+                "name": "inspectedURLChanged",
                 "parameters": [
-                    { "name": "object", "$ref": "RemoteObject" },
-                    { "name": "hints", "type": "object" }
+                    { "name": "url", "type": "string" }
                 ]
             },
             {
-                "name": "didCreateWorker",
+                "name": "domContentEventFired",
                 "parameters": [
-                    { "name": "id", "type": "integer" },
-                    { "name": "url", "type": "string" },
-                    { "name": "isShared", "type": "boolean" }
+                    { "name": "time", "type": "number" }
                 ]
             },
             {
-                "name": "didDestroyWorker",
+                "name": "loadEventFired",
                 "parameters": [
-                    { "name": "id", "type": "integer" }
+                    { "name": "time", "type": "number" }
                 ]
             }
         ]
index 22f46e50541cea81c4f8e88e4f77c559cb5f9f11..f550211f9c27a0ba4bb22f090ee7b3cae87e9ae8 100644 (file)
 
 #if ENABLE(INSPECTOR)
 
-#include "CachedResourceLoader.h"
-#include "CookieJar.h"
 #include "Document.h"
 #include "DocumentLoader.h"
 #include "Frame.h"
-#include "FrameLoadRequest.h"
 #include "GraphicsContext.h"
 #include "InjectedScriptHost.h"
 #include "InjectedScriptManager.h"
@@ -50,6 +47,7 @@
 #include "InspectorDebuggerAgent.h"
 #include "InspectorFrontend.h"
 #include "InspectorInstrumentation.h"
+#include "InspectorPageAgent.h"
 #include "InspectorProfilerAgent.h"
 #include "InspectorResourceAgent.h"
 #include "InspectorRuntimeAgent.h"
@@ -64,9 +62,6 @@
 #include "ScriptObject.h"
 #include "ScriptState.h"
 #include "Settings.h"
-#include "UserGestureIndicator.h"
-#include "WindowFeatures.h"
-#include <wtf/CurrentTime.h>
 
 #if ENABLE(DATABASE)
 #include "InspectorDatabaseAgent.h"
@@ -100,6 +95,7 @@ InspectorAgent::InspectorAgent(Page* page, InspectorClient* client, InjectedScri
     , m_instrumentingAgents(new InstrumentingAgents())
     , m_injectedScriptManager(injectedScriptManager)
     , m_state(new InspectorState(client))
+    , m_pageAgent(InspectorPageAgent::create(m_instrumentingAgents.get(), page, injectedScriptManager))
     , m_domAgent(InspectorDOMAgent::create(m_instrumentingAgents.get(), page, m_client, m_state.get(), injectedScriptManager))
     , m_cssAgent(new InspectorCSSAgent(m_instrumentingAgents.get(), m_domAgent.get()))
 #if ENABLE(DATABASE)
@@ -174,7 +170,7 @@ void InspectorAgent::restoreInspectorStateFromCookie(const String& inspectorStat
     m_state->loadFromCookie(inspectorStateCookie);
 
     m_frontend->inspector()->frontendReused();
-    m_frontend->inspector()->inspectedURLChanged(inspectedURL().string());
+    m_pageAgent->restore();
 
     m_domAgent->restore();
     m_resourceAgent->restore();
@@ -191,19 +187,6 @@ void InspectorAgent::didClearWindowObjectInWorld(Frame* frame, DOMWrapperWorld*
     if (world != mainThreadNormalWorld())
         return;
 
-    if (enabled()) {
-        if (m_frontend && frame == m_inspectedPage->mainFrame())
-            m_injectedScriptManager->discardInjectedScripts();
-
-        if (m_scriptsToEvaluateOnLoad.size()) {
-            ScriptState* scriptState = mainWorldScriptState(frame);
-            for (Vector<String>::iterator it = m_scriptsToEvaluateOnLoad.begin();
-                  it != m_scriptsToEvaluateOnLoad.end(); ++it) {
-                m_injectedScriptManager->injectScript(*it, scriptState);
-            }
-        }
-    }
-
     if (!m_inspectorExtensionAPI.isEmpty())
         m_injectedScriptManager->injectScript(m_inspectorExtensionAPI, mainWorldScriptState(frame));
 }
@@ -219,6 +202,7 @@ void InspectorAgent::setFrontend(InspectorFrontend* inspectorFrontend)
 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
     m_applicationCacheAgent->setFrontend(m_frontend);
 #endif
+    m_pageAgent->setFrontend(m_frontend);
     m_domAgent->setFrontend(m_frontend);
     m_consoleAgent->setFrontend(m_frontend);
     m_timelineAgent->setFrontend(m_frontend);
@@ -233,8 +217,6 @@ void InspectorAgent::setFrontend(InspectorFrontend* inspectorFrontend)
 #if ENABLE(DOM_STORAGE)
     m_domStorageAgent->setFrontend(m_frontend);
 #endif
-    // Initialize Web Inspector title.
-    m_frontend->inspector()->inspectedURLChanged(inspectedURL().string());
 
     if (!m_showPanelAfterVisible.isEmpty()) {
         m_frontend->inspector()->showPanel(m_showPanelAfterVisible);
@@ -285,9 +267,9 @@ void InspectorAgent::disconnectFrontend()
 #if ENABLE(DOM_STORAGE)
     m_domStorageAgent->clearFrontend();
 #endif
+    m_pageAgent->clearFrontend();
 
     releaseFrontendLifetimeAgents();
-    m_userAgentOverride = "";
 }
 
 void InspectorAgent::createFrontendLifetimeAgents()
@@ -302,10 +284,9 @@ void InspectorAgent::releaseFrontendLifetimeAgents()
 
 void InspectorAgent::didCommitLoad(DocumentLoader* loader)
 {
-    if (m_frontend) {
-        m_frontend->inspector()->inspectedURLChanged(loader->url().string());
+    if (m_frontend)
         m_frontend->inspector()->reset();
-    }
+
     m_injectedScriptManager->discardInjectedScripts();
 #if ENABLE(WORKERS)
     m_workers.clear();
@@ -314,33 +295,7 @@ void InspectorAgent::didCommitLoad(DocumentLoader* loader)
 
 void InspectorAgent::domContentLoadedEventFired(DocumentLoader* loader, const KURL& url)
 {
-    if (!enabled() || !isMainResourceLoader(loader, url))
-        return;
-
     m_injectedScriptManager->injectedScriptHost()->clearInspectedNodes();
-    if (InspectorDOMAgent* domAgent = m_instrumentingAgents->inspectorDOMAgent())
-        domAgent->mainFrameDOMContentLoaded();
-    if (InspectorTimelineAgent* timelineAgent = m_instrumentingAgents->inspectorTimelineAgent())
-        timelineAgent->didMarkDOMContentEvent();
-    if (m_frontend)
-        m_frontend->inspector()->domContentEventFired(currentTime());
-}
-
-void InspectorAgent::loadEventFired(DocumentLoader* loader, const KURL& url)
-{
-    if (!enabled())
-        return;
-
-    if (InspectorDOMAgent* domAgent = m_instrumentingAgents->inspectorDOMAgent())
-        domAgent->loadEventFired(loader->frame()->document());
-
-    if (!isMainResourceLoader(loader, url))
-        return;
-
-    if (InspectorTimelineAgent* timelineAgent = m_instrumentingAgents->inspectorTimelineAgent())
-        timelineAgent->didMarkLoadEvent();
-    if (m_frontend)
-        m_frontend->inspector()->loadEventFired(currentTime());
 }
 
 bool InspectorAgent::isMainResourceLoader(DocumentLoader* loader, const KURL& requestUrl)
@@ -348,17 +303,6 @@ bool InspectorAgent::isMainResourceLoader(DocumentLoader* loader, const KURL& re
     return loader->frame() == m_inspectedPage->mainFrame() && requestUrl == loader->requestURL();
 }
 
-void InspectorAgent::setUserAgentOverride(ErrorString*, const String& userAgent)
-{
-    m_userAgentOverride = userAgent;
-}
-
-void InspectorAgent::applyUserAgentOverride(String* userAgent) const
-{
-    if (!m_userAgentOverride.isEmpty())
-        *userAgent = m_userAgentOverride;
-}
-
 #if ENABLE(WORKERS)
 class PostWorkerNotificationToFrontendTask : public ScriptExecutionContext::Task {
 public:
@@ -428,90 +372,6 @@ void InspectorAgent::didDestroyWorker(intptr_t id)
 }
 #endif // ENABLE(WORKERS)
 
-void InspectorAgent::getCookies(ErrorString*, RefPtr<InspectorArray>* cookies, WTF::String* cookiesString)
-{
-    // If we can get raw cookies.
-    ListHashSet<Cookie> rawCookiesList;
-
-    // If we can't get raw cookies - fall back to String representation
-    String stringCookiesList;
-
-    // Return value to getRawCookies should be the same for every call because
-    // the return value is platform/network backend specific, and the call will
-    // always return the same true/false value.
-    bool rawCookiesImplemented = false;
-
-    for (Frame* frame = m_inspectedPage->mainFrame(); frame; frame = frame->tree()->traverseNext(m_inspectedPage->mainFrame())) {
-        Document* document = frame->document();
-        const CachedResourceLoader::DocumentResourceMap& allResources = document->cachedResourceLoader()->allCachedResources();
-        CachedResourceLoader::DocumentResourceMap::const_iterator end = allResources.end();
-        for (CachedResourceLoader::DocumentResourceMap::const_iterator it = allResources.begin(); it != end; ++it) {
-            Vector<Cookie> docCookiesList;
-            rawCookiesImplemented = getRawCookies(document, KURL(ParsedURLString, it->second->url()), docCookiesList);
-
-            if (!rawCookiesImplemented) {
-                // FIXME: We need duplication checking for the String representation of cookies.
-                ExceptionCode ec = 0;
-                stringCookiesList += document->cookie(ec);
-                // Exceptions are thrown by cookie() in sandboxed frames. That won't happen here
-                // because "document" is the document of the main frame of the page.
-                ASSERT(!ec);
-            } else {
-                int cookiesSize = docCookiesList.size();
-                for (int i = 0; i < cookiesSize; i++) {
-                    if (!rawCookiesList.contains(docCookiesList[i]))
-                        rawCookiesList.add(docCookiesList[i]);
-                }
-            }
-        }
-    }
-
-    if (rawCookiesImplemented)
-        *cookies = buildArrayForCookies(rawCookiesList);
-    else
-        *cookiesString = stringCookiesList;
-}
-
-PassRefPtr<InspectorArray> InspectorAgent::buildArrayForCookies(ListHashSet<Cookie>& cookiesList)
-{
-    RefPtr<InspectorArray> cookies = InspectorArray::create();
-
-    ListHashSet<Cookie>::iterator end = cookiesList.end();
-    ListHashSet<Cookie>::iterator it = cookiesList.begin();
-    for (int i = 0; it != end; ++it, i++)
-        cookies->pushObject(buildObjectForCookie(*it));
-
-    return cookies;
-}
-
-PassRefPtr<InspectorObject> InspectorAgent::buildObjectForCookie(const Cookie& cookie)
-{
-    RefPtr<InspectorObject> value = InspectorObject::create();
-    value->setString("name", cookie.name);
-    value->setString("value", cookie.value);
-    value->setString("domain", cookie.domain);
-    value->setString("path", cookie.path);
-    value->setNumber("expires", cookie.expires);
-    value->setNumber("size", (cookie.name.length() + cookie.value.length()));
-    value->setBoolean("httpOnly", cookie.httpOnly);
-    value->setBoolean("secure", cookie.secure);
-    value->setBoolean("session", cookie.session);
-    return value;
-}
-
-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();
-        if (document->url().host() != domain)
-            continue;
-        const CachedResourceLoader::DocumentResourceMap& allResources = document->cachedResourceLoader()->allCachedResources();
-        CachedResourceLoader::DocumentResourceMap::const_iterator end = allResources.end();
-        for (CachedResourceLoader::DocumentResourceMap::const_iterator it = allResources.begin(); it != end; ++it)
-            WebCore::deleteCookie(document, KURL(ParsedURLString, it->second->url()), cookieName);
-    }
-}
-
 #if ENABLE(JAVASCRIPT_DEBUGGER)
 void InspectorAgent::showProfilesPanel()
 {
@@ -537,34 +397,6 @@ void InspectorAgent::didEvaluateForTestInFrontend(ErrorString*, long callId, con
     function.call();
 }
 
-void InspectorAgent::openInInspectedWindow(ErrorString*, const String& url)
-{
-    Frame* mainFrame = m_inspectedPage->mainFrame();
-
-    FrameLoadRequest request(mainFrame->document()->securityOrigin(), ResourceRequest(), "_blank");
-
-    bool created;
-    WindowFeatures windowFeatures;
-    Frame* newFrame = WebCore::createWindow(mainFrame, mainFrame, request, windowFeatures, created);
-    if (!newFrame)
-        return;
-
-    UserGestureIndicator indicator(DefinitelyProcessingUserGesture);
-    newFrame->loader()->setOpener(mainFrame);
-    newFrame->page()->setOpenedByDOM();
-    newFrame->loader()->changeLocation(mainFrame->document()->securityOrigin(), newFrame->loader()->completeURL(url), "", false, false);
-}
-
-void InspectorAgent::addScriptToEvaluateOnLoad(ErrorString*, const String& source)
-{
-    m_scriptsToEvaluateOnLoad.append(source);
-}
-
-void InspectorAgent::removeAllScriptsToEvaluateOnLoad(ErrorString*)
-{
-    m_scriptsToEvaluateOnLoad.clear();
-}
-
 void InspectorAgent::setInspectorExtensionAPI(const String& source)
 {
     m_inspectorExtensionAPI = source;
@@ -582,11 +414,6 @@ KURL InspectorAgent::inspectedURLWithoutFragment() const
     return url;
 }
 
-void InspectorAgent::reloadPage(ErrorString*, bool ignoreCache)
-{
-    m_inspectedPage->mainFrame()->loader()->reload(ignoreCache);
-}
-
 bool InspectorAgent::enabled() const
 {
     if (!m_inspectedPage)
index 9a525a48f565f29312e827d6e10b2c873bb864e5..c52d159e6971ba2d09f4d4bbcc54e2594b0f5711 100644 (file)
 
 #include "CharacterData.h"
 #include "Console.h"
-#include "Cookie.h"
 #include "Page.h"
 #include "PlatformString.h"
 #include <wtf/HashMap.h>
-#include <wtf/HashSet.h>
-#include <wtf/ListHashSet.h>
 #include <wtf/RefCounted.h>
 #include <wtf/Vector.h>
 #include <wtf/text/StringHash.h>
 
 namespace WebCore {
 
-class CachedResource;
 class CharacterData;
 class Database;
 class DOMWrapperWorld;
@@ -66,6 +62,7 @@ class InspectorDebuggerAgent;
 class InspectorFrontend;
 class InspectorFrontendClient;
 class InspectorObject;
+class InspectorPageAgent;
 class InspectorProfilerAgent;
 class InspectorResourceAgent;
 class InspectorRuntimeAgent;
@@ -121,7 +118,7 @@ public:
 
     InstrumentingAgents* instrumentingAgents() const { return m_instrumentingAgents.get(); }
 
-    InspectorAgent* inspectorAgent() { return this; }
+    InspectorPageAgent* pageAgent() { return m_pageAgent.get(); }
     InspectorConsoleAgent* consoleAgent() { return m_consoleAgent.get(); }
     InspectorCSSAgent* cssAgent() { return m_cssAgent.get(); }
     InspectorDOMAgent* domAgent() { return m_domAgent.get(); }
@@ -147,11 +144,7 @@ public:
 
     void didCommitLoad(DocumentLoader*);
 
-    void getCookies(ErrorString*, RefPtr<InspectorArray>* cookies, WTF::String* cookiesString);
-    void deleteCookie(ErrorString*, const String& cookieName, const String& domain);
-
     void domContentLoadedEventFired(DocumentLoader*, const KURL&);
-    void loadEventFired(DocumentLoader*, const KURL&);
 
 #if ENABLE(WORKERS)
     enum WorkerAction { WorkerCreated, WorkerDestroyed };
@@ -163,7 +156,6 @@ public:
 
     bool hasFrontend() const { return m_frontend; }
 
-    void openInInspectedWindow(ErrorString*, const String& url);
 
 #if ENABLE(JAVASCRIPT_DEBUGGER)
     void showProfilesPanel();
@@ -172,8 +164,6 @@ public:
     // Generic code called from custom implementations.
     void evaluateForTestInFrontend(long testCallId, const String& script);
 
-    void addScriptToEvaluateOnLoad(ErrorString*, const String& source);
-    void removeAllScriptsToEvaluateOnLoad(ErrorString*);
     void setInspectorExtensionAPI(const String& source);
 
     InspectorState* state() { return m_state.get(); }
@@ -184,9 +174,6 @@ public:
     // Following are used from InspectorBackend and internally.
     void didEvaluateForTestInFrontend(ErrorString*, long callId, const String& jsonResult);
 
-    void setUserAgentOverride(ErrorString*, const String& userAgent);
-    void applyUserAgentOverride(String* userAgent) const;
-
 private:
     void showPanel(const String& panel);
     void unbindAllResources();
@@ -198,9 +185,6 @@ private:
     void toggleRecordButton(bool);
 #endif
 
-    PassRefPtr<InspectorObject> buildObjectForCookie(const Cookie&);
-    PassRefPtr<InspectorArray> buildArrayForCookies(ListHashSet<Cookie>&);
-
     bool isMainResourceLoader(DocumentLoader*, const KURL& requestUrl);
     void issueEvaluateForTestCommands();
 
@@ -210,6 +194,7 @@ private:
     OwnPtr<InstrumentingAgents> m_instrumentingAgents;
     InjectedScriptManager* m_injectedScriptManager;
     OwnPtr<InspectorState> m_state;
+    OwnPtr<InspectorPageAgent> m_pageAgent;
     OwnPtr<InspectorDOMAgent> m_domAgent;
     OwnPtr<InspectorCSSAgent> m_cssAgent;
 
@@ -234,14 +219,12 @@ private:
 
     Vector<pair<long, String> > m_pendingEvaluateTestCommands;
     String m_showPanelAfterVisible;
-    Vector<String> m_scriptsToEvaluateOnLoad;
     String m_inspectorExtensionAPI;
 #if ENABLE(JAVASCRIPT_DEBUGGER)
     OwnPtr<InspectorDebuggerAgent> m_debuggerAgent;
     OwnPtr<InspectorBrowserDebuggerAgent> m_browserDebuggerAgent;
     OwnPtr<InspectorProfilerAgent> m_profilerAgent;
 #endif
-    String m_userAgentOverride;
 #if ENABLE(WORKERS)
     typedef HashMap<intptr_t, RefPtr<InspectorWorkerResource> > WorkersMap;
     WorkersMap m_workers;
index fe5f06a65290fe28c184c67d9981eb528510db1a..62b22ee8d03726794943f886cb2b36ecbd9ee523 100644 (file)
@@ -134,6 +134,7 @@ void InspectorController::connectFrontend()
 #endif
         m_inspectorAgent.get(),
         m_inspectorAgent->resourceAgent(),
+        m_inspectorAgent->pageAgent(),
 #if ENABLE(JAVASCRIPT_DEBUGGER)
         m_inspectorAgent->profilerAgent(),
 #endif
index 3e344243f7f17319d570206b8ede15aa40a56b74..7f637ddad1a86d514255fa3b4fd4b68cc82f57c6 100644 (file)
@@ -47,6 +47,7 @@
 #include "InspectorDOMAgent.h"
 #include "InspectorDOMStorageAgent.h"
 #include "InspectorDebuggerAgent.h"
+#include "InspectorPageAgent.h"
 #include "InspectorProfilerAgent.h"
 #include "InspectorResourceAgent.h"
 #include "InspectorTimelineAgent.h"
@@ -92,6 +93,8 @@ static bool eventHasListeners(const AtomicString& eventType, DOMWindow* window,
 
 void InspectorInstrumentation::didClearWindowObjectInWorldImpl(InspectorAgent* inspectorAgent, Frame* frame, DOMWrapperWorld* world)
 {
+    if (InspectorPageAgent* pageAgent = inspectorAgent->instrumentingAgents()->inspectorPageAgent())
+        pageAgent->didClearWindowObjectInWorld(frame, world);
     inspectorAgent->didClearWindowObjectInWorld(frame, world);
 }
 
@@ -387,7 +390,8 @@ void InspectorInstrumentation::didRecalculateStyleImpl(const InspectorInstrument
 
 void InspectorInstrumentation::applyUserAgentOverrideImpl(InspectorAgent* inspectorAgent, String* userAgent)
 {
-    inspectorAgent->applyUserAgentOverride(userAgent);
+    if (InspectorPageAgent* pageAgent = retrievePageAgent(inspectorAgent))
+        pageAgent->applyUserAgentOverride(userAgent);
 }
 
 void InspectorInstrumentation::willSendRequestImpl(InspectorAgent* inspectorAgent, unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& redirectResponse)
@@ -491,12 +495,40 @@ void InspectorInstrumentation::scriptImportedImpl(InspectorAgent* inspectorAgent
 
 void InspectorInstrumentation::domContentLoadedEventFiredImpl(InspectorAgent* inspectorAgent, Frame* frame, const KURL& url)
 {
-    inspectorAgent->domContentLoadedEventFired(frame->loader()->documentLoader(), url);
+    DocumentLoader* documentLoader = frame->loader()->documentLoader();
+    ASSERT(documentLoader);
+
+    if (frame->page()->mainFrame() != frame || url != documentLoader->requestURL())
+        return;
+
+    inspectorAgent->domContentLoadedEventFired(documentLoader, url);
+
+    if (InspectorDOMAgent* domAgent = inspectorAgent->instrumentingAgents()->inspectorDOMAgent())
+        domAgent->mainFrameDOMContentLoaded();
+
+    if (InspectorTimelineAgent* timelineAgent = inspectorAgent->instrumentingAgents()->inspectorTimelineAgent())
+        timelineAgent->didMarkDOMContentEvent();
+
+    if (InspectorPageAgent* pageAgent = inspectorAgent->instrumentingAgents()->inspectorPageAgent())
+        pageAgent->domContentEventFired();
 }
 
 void InspectorInstrumentation::loadEventFiredImpl(InspectorAgent* inspectorAgent, Frame* frame, const KURL& url)
 {
-    inspectorAgent->loadEventFired(frame->loader()->documentLoader(), url);
+    DocumentLoader* documentLoader = frame->loader()->documentLoader();
+    ASSERT(documentLoader);
+
+    if (InspectorDOMAgent* domAgent = inspectorAgent->instrumentingAgents()->inspectorDOMAgent())
+        domAgent->loadEventFired(documentLoader->frame()->document());
+
+    if (frame->page()->mainFrame() != frame || url != documentLoader->requestURL())
+        return;
+
+    if (InspectorTimelineAgent* timelineAgent = inspectorAgent->instrumentingAgents()->inspectorTimelineAgent())
+        timelineAgent->didMarkLoadEvent();
+
+    if (InspectorPageAgent* pageAgent = inspectorAgent->instrumentingAgents()->inspectorPageAgent())
+        pageAgent->loadEventFired();
 }
 
 void InspectorInstrumentation::frameDetachedFromParentImpl(InspectorAgent* inspectorAgent, Frame* frame)
@@ -544,6 +576,10 @@ void InspectorInstrumentation::didCommitLoadImpl(Page* page, InspectorAgent* ins
 #endif
     if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
         domAgent->setDocument(mainFrame->document());
+
+    if (InspectorPageAgent* pageAgent = instrumentingAgents->inspectorPageAgent())
+        pageAgent->inspectedURLChanged(loader->url().string());
+
     inspectorAgent->didCommitLoad(loader);
 }
 
@@ -741,6 +777,11 @@ InspectorResourceAgent* InspectorInstrumentation::retrieveResourceAgent(Inspecto
     return inspectorAgent->instrumentingAgents()->inspectorResourceAgent();
 }
 
+InspectorPageAgent* InspectorInstrumentation::retrievePageAgent(InspectorAgent* inspectorAgent)
+{
+    return inspectorAgent->instrumentingAgents()->inspectorPageAgent();
+}
+
 } // namespace WebCore
 
 #endif // !ENABLE(INSPECTOR)
index 5ce4a0f838cd46fff3b8f091e250cc658cd0b86d..77c464e9199f42be4357dab7fa6ed0577a5f3680 100644 (file)
@@ -48,6 +48,7 @@ class EventContext;
 class DocumentLoader;
 class HitTestResult;
 class InspectorAgent;
+class InspectorPageAgent;
 class InspectorResourceAgent;
 class InspectorTimelineAgent;
 class KURL;
@@ -299,6 +300,7 @@ private:
     static InspectorTimelineAgent* retrieveTimelineAgent(InspectorAgent*);
     static InspectorTimelineAgent* retrieveTimelineAgent(const InspectorInstrumentationCookie&);
     static InspectorResourceAgent* retrieveResourceAgent(InspectorAgent*);
+    static InspectorPageAgent* retrievePageAgent(InspectorAgent*);
 
     static HashMap<Page*, InspectorAgent*>& inspectorAgents();
     static int s_frontendCounter;
diff --git a/Source/WebCore/inspector/InspectorPageAgent.cpp b/Source/WebCore/inspector/InspectorPageAgent.cpp
new file mode 100644 (file)
index 0000000..af053c9
--- /dev/null
@@ -0,0 +1,258 @@
+/*
+ * 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:
+ *
+ *     * 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 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.
+ */
+
+#include "config.h"
+
+#include "InspectorPageAgent.h"
+
+#if ENABLE(INSPECTOR) && ENABLE(JAVASCRIPT_DEBUGGER)
+
+#include "CachedResourceLoader.h"
+#include "Cookie.h"
+#include "CookieJar.h"
+#include "DocumentLoader.h"
+#include "Frame.h"
+#include "FrameLoadRequest.h"
+#include "InjectedScriptManager.h"
+#include "InspectorFrontend.h"
+#include "InspectorValues.h"
+#include "InstrumentingAgents.h"
+#include "Page.h"
+#include "ScriptObject.h"
+#include "UserGestureIndicator.h"
+#include "WindowFeatures.h"
+#include <wtf/CurrentTime.h>
+#include <wtf/ListHashSet.h>
+
+namespace WebCore {
+
+PassOwnPtr<InspectorPageAgent> InspectorPageAgent::create(InstrumentingAgents* instrumentingAgents, Page* inspectedPage, InjectedScriptManager* injectedScriptManager)
+{
+    return adoptPtr(new InspectorPageAgent(instrumentingAgents, inspectedPage, injectedScriptManager));
+}
+
+InspectorPageAgent::InspectorPageAgent(InstrumentingAgents* instrumentingAgents, Page* inspectedPage, InjectedScriptManager* injectedScriptManager)
+    : m_instrumentingAgents(instrumentingAgents)
+    , m_inspectedPage(inspectedPage)
+    , m_injectedScriptManager(injectedScriptManager)
+    , m_frontend(0)
+{
+}
+
+void InspectorPageAgent::setFrontend(InspectorFrontend* frontend)
+{
+    m_frontend = frontend;
+    m_instrumentingAgents->setInspectorPageAgent(this);
+
+    // Initialize Web Inspector title.
+    m_frontend->page()->inspectedURLChanged(m_inspectedPage->mainFrame()->document()->url().string());
+
+}
+
+void InspectorPageAgent::clearFrontend()
+{
+    m_instrumentingAgents->setInspectorPageAgent(0);
+    m_userAgentOverride = "";
+    m_frontend = 0;
+}
+
+void InspectorPageAgent::addScriptToEvaluateOnLoad(ErrorString*, const String& source)
+{
+    m_scriptsToEvaluateOnLoad.append(source);
+}
+
+void InspectorPageAgent::removeAllScriptsToEvaluateOnLoad(ErrorString*)
+{
+    m_scriptsToEvaluateOnLoad.clear();
+}
+
+void InspectorPageAgent::reloadPage(ErrorString*, bool ignoreCache)
+{
+    m_inspectedPage->mainFrame()->loader()->reload(ignoreCache);
+}
+
+void InspectorPageAgent::openInInspectedWindow(ErrorString*, const String& url)
+{
+    Frame* mainFrame = m_inspectedPage->mainFrame();
+
+    FrameLoadRequest request(mainFrame->document()->securityOrigin(), ResourceRequest(), "_blank");
+
+    bool created;
+    WindowFeatures windowFeatures;
+    Frame* newFrame = WebCore::createWindow(mainFrame, mainFrame, request, windowFeatures, created);
+    if (!newFrame)
+        return;
+
+    UserGestureIndicator indicator(DefinitelyProcessingUserGesture);
+    newFrame->loader()->setOpener(mainFrame);
+    newFrame->page()->setOpenedByDOM();
+    newFrame->loader()->changeLocation(mainFrame->document()->securityOrigin(), newFrame->loader()->completeURL(url), "", false, false);
+}
+
+void InspectorPageAgent::setUserAgentOverride(ErrorString*, const String& userAgent)
+{
+    m_userAgentOverride = userAgent;
+}
+
+void InspectorPageAgent::applyUserAgentOverride(String* userAgent) const
+{
+    if (!m_userAgentOverride.isEmpty())
+        *userAgent = m_userAgentOverride;
+}
+
+static PassRefPtr<InspectorObject> buildObjectForCookie(const Cookie& cookie)
+{
+    RefPtr<InspectorObject> value = InspectorObject::create();
+    value->setString("name", cookie.name);
+    value->setString("value", cookie.value);
+    value->setString("domain", cookie.domain);
+    value->setString("path", cookie.path);
+    value->setNumber("expires", cookie.expires);
+    value->setNumber("size", (cookie.name.length() + cookie.value.length()));
+    value->setBoolean("httpOnly", cookie.httpOnly);
+    value->setBoolean("secure", cookie.secure);
+    value->setBoolean("session", cookie.session);
+    return value;
+}
+
+static PassRefPtr<InspectorArray> buildArrayForCookies(ListHashSet<Cookie>& cookiesList)
+{
+    RefPtr<InspectorArray> cookies = InspectorArray::create();
+
+    ListHashSet<Cookie>::iterator end = cookiesList.end();
+    ListHashSet<Cookie>::iterator it = cookiesList.begin();
+    for (int i = 0; it != end; ++it, i++)
+        cookies->pushObject(buildObjectForCookie(*it));
+
+    return cookies;
+}
+
+void InspectorPageAgent::getCookies(ErrorString*, RefPtr<InspectorArray>* cookies, WTF::String* cookiesString)
+{
+    // If we can get raw cookies.
+    ListHashSet<Cookie> rawCookiesList;
+
+    // If we can't get raw cookies - fall back to String representation
+    String stringCookiesList;
+
+    // Return value to getRawCookies should be the same for every call because
+    // the return value is platform/network backend specific, and the call will
+    // always return the same true/false value.
+    bool rawCookiesImplemented = false;
+
+    for (Frame* frame = m_inspectedPage->mainFrame(); frame; frame = frame->tree()->traverseNext(m_inspectedPage->mainFrame())) {
+        Document* document = frame->document();
+        const CachedResourceLoader::DocumentResourceMap& allResources = document->cachedResourceLoader()->allCachedResources();
+        CachedResourceLoader::DocumentResourceMap::const_iterator end = allResources.end();
+        for (CachedResourceLoader::DocumentResourceMap::const_iterator it = allResources.begin(); it != end; ++it) {
+            Vector<Cookie> docCookiesList;
+            rawCookiesImplemented = getRawCookies(document, KURL(ParsedURLString, it->second->url()), docCookiesList);
+
+            if (!rawCookiesImplemented) {
+                // FIXME: We need duplication checking for the String representation of cookies.
+                ExceptionCode ec = 0;
+                stringCookiesList += document->cookie(ec);
+                // Exceptions are thrown by cookie() in sandboxed frames. That won't happen here
+                // because "document" is the document of the main frame of the page.
+                ASSERT(!ec);
+            } else {
+                int cookiesSize = docCookiesList.size();
+                for (int i = 0; i < cookiesSize; i++) {
+                    if (!rawCookiesList.contains(docCookiesList[i]))
+                        rawCookiesList.add(docCookiesList[i]);
+                }
+            }
+        }
+    }
+
+    if (rawCookiesImplemented)
+        *cookies = buildArrayForCookies(rawCookiesList);
+    else
+        *cookiesString = stringCookiesList;
+}
+
+void InspectorPageAgent::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();
+        if (document->url().host() != domain)
+            continue;
+        const CachedResourceLoader::DocumentResourceMap& allResources = document->cachedResourceLoader()->allCachedResources();
+        CachedResourceLoader::DocumentResourceMap::const_iterator end = allResources.end();
+        for (CachedResourceLoader::DocumentResourceMap::const_iterator it = allResources.begin(); it != end; ++it)
+            WebCore::deleteCookie(document, KURL(ParsedURLString, it->second->url()), cookieName);
+    }
+}
+
+void InspectorPageAgent::inspectedURLChanged(const String& url)
+{
+    m_frontend->page()->inspectedURLChanged(url);
+}
+
+void InspectorPageAgent::restore()
+{
+    inspectedURLChanged(m_inspectedPage->mainFrame()->document()->url().string());
+}
+
+void InspectorPageAgent::didCommitLoad(const String& url)
+{
+    inspectedURLChanged(url);
+}
+
+void InspectorPageAgent::domContentEventFired()
+{
+     m_frontend->page()->domContentEventFired(currentTime());
+}
+
+void InspectorPageAgent::loadEventFired()
+{
+     m_frontend->page()->loadEventFired(currentTime());
+}
+
+void InspectorPageAgent::didClearWindowObjectInWorld(Frame* frame, DOMWrapperWorld* world)
+{
+    if (world != mainThreadNormalWorld())
+        return;
+
+    if (frame == m_inspectedPage->mainFrame())
+        m_injectedScriptManager->discardInjectedScripts();
+
+    if (m_scriptsToEvaluateOnLoad.size()) {
+        ScriptState* scriptState = mainWorldScriptState(frame);
+        for (Vector<String>::iterator it = m_scriptsToEvaluateOnLoad.begin();
+             it != m_scriptsToEvaluateOnLoad.end(); ++it) {
+            m_injectedScriptManager->injectScript(*it, scriptState);
+        }
+    }
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(INSPECTOR) && ENABLE(JAVASCRIPT_DEBUGGER)
diff --git a/Source/WebCore/inspector/InspectorPageAgent.h b/Source/WebCore/inspector/InspectorPageAgent.h
new file mode 100644 (file)
index 0000000..bb6b96f
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ * 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:
+ *
+ *     * 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 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 InspectorPageAgent_h
+#define InspectorPageAgent_h
+
+#if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR)
+
+#include "PlatformString.h"
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class DOMWrapperWorld;
+class Frame;
+class Frontend;
+class InjectedScriptManager;
+class InspectorArray;
+class InspectorFrontend;
+class InstrumentingAgents;
+class Page;
+
+typedef String ErrorString;
+
+class InspectorPageAgent {
+    WTF_MAKE_NONCOPYABLE(InspectorPageAgent);
+public:
+    static PassOwnPtr<InspectorPageAgent> create(InstrumentingAgents*, Page*, InjectedScriptManager*);
+
+    // Page API for InspectorFrontend
+    void addScriptToEvaluateOnLoad(ErrorString*, const String& source);
+    void removeAllScriptsToEvaluateOnLoad(ErrorString*);
+    void reloadPage(ErrorString*, bool ignoreCache);
+    void openInInspectedWindow(ErrorString*, const String& url);
+    void setUserAgentOverride(ErrorString*, const String& userAgent);
+    void getCookies(ErrorString*, RefPtr<InspectorArray>* cookies, WTF::String* cookiesString);
+    void deleteCookie(ErrorString*, const String& cookieName, const String& domain);
+
+    // InspectorInstrumentation API
+    void inspectedURLChanged(const String& url);
+    void didCommitLoad(const String& url);
+    void didClearWindowObjectInWorld(Frame*, DOMWrapperWorld*);
+    void domContentEventFired();
+    void loadEventFired();
+
+    void setFrontend(InspectorFrontend*);
+    void clearFrontend();
+    void restore();
+    void applyUserAgentOverride(String* userAgent) const;
+
+private:
+    InspectorPageAgent(InstrumentingAgents*, Page*, InjectedScriptManager*);
+
+    InstrumentingAgents* m_instrumentingAgents;
+    Page* m_inspectedPage;
+    InjectedScriptManager* m_injectedScriptManager;
+    InspectorFrontend* m_frontend;
+    Vector<String> m_scriptsToEvaluateOnLoad;
+    String m_userAgentOverride;
+};
+
+
+} // namespace WebCore
+
+#endif // ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR)
+
+#endif // !defined(InspectorPageAgent_h)
index aa0b6d6c09abb8f3eb8352c4184146f439d8a55c..3b67edd8df8e2350156ed4dfefe1804c3e1c8a08 100644 (file)
@@ -38,6 +38,7 @@ namespace WebCore {
 
 class InspectorAgent;
 class InspectorApplicationCacheAgent;
+class InspectorPageAgent;
 class InspectorBrowserDebuggerAgent;
 class InspectorCSSAgent;
 class InspectorConsoleAgent;
@@ -56,6 +57,7 @@ class InstrumentingAgents {
 public:
     InstrumentingAgents()
         : m_inspectorAgent(0)
+        , m_inspectorPageAgent(0)
         , m_inspectorCSSAgent(0)
         , m_inspectorConsoleAgent(0)
         , m_inspectorDOMAgent(0)
@@ -82,6 +84,9 @@ public:
     InspectorAgent* inspectorAgent() const { return m_inspectorAgent; }
     void setInspectorAgent(InspectorAgent* agent) { m_inspectorAgent = agent; }
 
+    InspectorPageAgent* inspectorPageAgent() const { return m_inspectorPageAgent; }
+    void setInspectorPageAgent(InspectorPageAgent* agent) { m_inspectorPageAgent = agent; }
+
     InspectorCSSAgent* inspectorCSSAgent() const { return m_inspectorCSSAgent; }
     void setInspectorCSSAgent(InspectorCSSAgent* agent) { m_inspectorCSSAgent = agent; }
 
@@ -125,6 +130,7 @@ public:
 
 private:
     InspectorAgent* m_inspectorAgent;
+    InspectorPageAgent* m_inspectorPageAgent;
     InspectorCSSAgent* m_inspectorCSSAgent;
     InspectorConsoleAgent* m_inspectorConsoleAgent;
     InspectorDOMAgent* m_inspectorDOMAgent;
index 3144c788a6cb592930e0c710f219478f55025784..7f56f418596da4d0f6237b09f1f0181b4a5b17d0 100644 (file)
@@ -192,7 +192,7 @@ WebInspector.AuditsPanel.prototype = {
     _reloadResources: function(callback)
     {
         this._pageReloadCallback = callback;
-        InspectorAgent.reloadPage(false);
+        PageAgent.reloadPage(false);
     },
 
     _didMainResourceLoad: function()
index aaa47c18dc548482bf5919a40bbd014ee53d07bc..6bf3326f6875db1cbbb4edcc7df42d6dac43fb9c 100644 (file)
@@ -140,7 +140,7 @@ WebInspector.CookieItemsView.prototype = {
 
     _deleteCookie: function(cookie)
     {
-        InspectorAgent.deleteCookie(cookie.name, this._cookieDomain);
+        PageAgent.deleteCookie(cookie.name, this._cookieDomain);
         this._update();
     },
 
@@ -215,7 +215,7 @@ WebInspector.Cookies.getCookiesAsync = function(callback)
             callback(cookies, true);
     }
 
-    InspectorAgent.getCookies(mycallback);
+    PageAgent.getCookies(mycallback);
 }
 
 WebInspector.Cookies.buildCookiesFromString = function(rawCookieString)
index f75a8c21fc3632f1b0bc74259c3e608c3d08e795..9554dfa5a901a4931718c934d0c6b543ad9c68f5 100644 (file)
@@ -267,9 +267,9 @@ WebInspector.ExtensionServer.prototype = {
     _onReload: function(message)
     {
         if (typeof message.userAgent === "string")
-            InspectorAgent.setUserAgentOverride(message.userAgent);
+            PageAgent.setUserAgentOverride(message.userAgent);
 
-        InspectorAgent.reloadPage(false);
+        PageAgent.reloadPage(false);
         return this._status.OK();
     },
 
index b5e66db0acd7fa2cc42a2519354febc9fb4c41d4..3c497d62a143d8f76a5c2b345b634f7b088643d7 100644 (file)
@@ -1377,7 +1377,7 @@ WebInspector.NetworkDataGridNode.prototype = {
 
     _openInNewTab: function()
     {
-        InspectorAgent.openInInspectedWindow(this._resource.url);
+        PageAgent.openInInspectedWindow(this._resource.url);
     },
 
     get selectable()
index c3248bb7422077caae9e22ad6f744d640228ee2b..c65e6b7f82c236769c88814bd8a625fbf9ca4e1d 100644 (file)
@@ -1010,7 +1010,7 @@ WebInspector.FrameResourceTreeElement.prototype = {
 
     ondblclick: function(event)
     {
-        InspectorAgent.openInInspectedWindow(this._resource.url);
+        PageAgent.openInInspectedWindow(this._resource.url);
     },
 
     onattach: function()
index efdb936a4efbe419372f5d9957ef8038c3ef7e9b..e70db449db9bf0a71865b7577097b65cb7c1cf04 100644 (file)
@@ -74,9 +74,9 @@ WebInspector.WorkersSidebarPane.prototype = {
 
     setInstrumentation: function(enabled)
     {
-        InspectorAgent.removeAllScriptsToEvaluateOnLoad();
+        PageAgent.removeAllScriptsToEvaluateOnLoad();
         if (enabled)
-            InspectorAgent.addScriptToEvaluateOnLoad("(" + InjectedFakeWorker + ")");
+            PageAgent.addScriptToEvaluateOnLoad("(" + InjectedFakeWorker + ")");
     },
 
     reset: function()
index d8c8f5104565b910a997e966a129d67d4518d828..59171db2da856c01c821a592541dde3e27d536c7 100644 (file)
@@ -444,6 +444,7 @@ WebInspector.doLoadedDone = function()
     this.domAgent = new WebInspector.DOMAgent();
 
     InspectorBackend.registerDomainDispatcher("Inspector", this);
+    InspectorBackend.registerDomainDispatcher("Page", this);
 
     this.resourceCategories = {
         documents: new WebInspector.ResourceCategory("documents", WebInspector.UIString("Documents"), "rgb(47,102,236)"),
@@ -674,7 +675,7 @@ WebInspector.openResource = function(resourceURL, inResourcesPanel)
         WebInspector.panels.resources.showResource(resource);
         WebInspector.showPanel("resources");
     } else
-        InspectorAgent.openInInspectedWindow(resource ? resource.url : resourceURL);
+        PageAgent.openInInspectedWindow(resource ? resource.url : resourceURL);
 }
 
 WebInspector._registerShortcuts = function()
@@ -798,13 +799,13 @@ WebInspector.documentKeyDown = function(event)
 
         case "U+0052": // R key
             if ((event.metaKey && isMac) || (event.ctrlKey && !isMac)) {
-                InspectorAgent.reloadPage(event.shiftKey);
+                PageAgent.reloadPage(event.shiftKey);
                 event.preventDefault();
             }
             break;
         case "F5":
             if (!isMac)
-                InspectorAgent.reloadPage(event.ctrlKey || event.shiftKey);
+                PageAgent.reloadPage(event.ctrlKey || event.shiftKey);
             break;
     }
 }