Web Inspector: Remove InspectorFrontendHost.setInjectedScriptForOrigin
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Dec 2013 06:22:58 +0000 (06:22 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Dec 2013 06:22:58 +0000 (06:22 +0000)
https://bugs.webkit.org/show_bug.cgi?id=125906

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2013-12-17
Reviewed by Timothy Hatcher.

Source/WebCore:

Remove stale code related to a since removed feature,
Inspector extensions. This allows us to remove a number
of entry points into InspectorAgent.

* inspector/InspectorAgent.cpp:
(WebCore::InspectorAgent::InspectorAgent):
(WebCore::InspectorAgent::willDestroyFrontendAndBackend):
* inspector/InspectorAgent.h:
(WebCore::InspectorAgent::create):
Remove setInjectedScriptForOrigin and InjectedScript management.

* inspector/InspectorController.cpp:
(WebCore::InspectorController::InspectorController):
* inspector/InspectorController.h:
* inspector/InspectorFrontendHost.cpp:
* inspector/InspectorFrontendHost.h:
* inspector/InspectorFrontendHost.idl:
Remove the API and calling through InspectorController.

* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::didClearWindowObjectInWorldImpl):
(WebCore::InspectorInstrumentation::domContentLoadedEventFiredImpl):
(WebCore::InspectorInstrumentation::didCommitLoadImpl):
Remove now unnecessary calls into InspectorAgent.

LayoutTests:

* http/tests/inspector/injected-script-for-origin-expected.txt: Removed.
* http/tests/inspector/injected-script-for-origin.html: Removed.
* http/tests/inspector/resources/injected-script-for-origin-frame.html: Removed.

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

13 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/inspector/injected-script-for-origin-expected.txt [deleted file]
LayoutTests/http/tests/inspector/injected-script-for-origin.html [deleted file]
LayoutTests/http/tests/inspector/resources/injected-script-for-origin-frame.html [deleted file]
Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorAgent.cpp
Source/WebCore/inspector/InspectorAgent.h
Source/WebCore/inspector/InspectorController.cpp
Source/WebCore/inspector/InspectorController.h
Source/WebCore/inspector/InspectorFrontendHost.cpp
Source/WebCore/inspector/InspectorFrontendHost.h
Source/WebCore/inspector/InspectorFrontendHost.idl
Source/WebCore/inspector/InspectorInstrumentation.cpp

index 5845956..8811953 100644 (file)
@@ -1,3 +1,14 @@
+2013-12-17  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Remove InspectorFrontendHost.setInjectedScriptForOrigin
+        https://bugs.webkit.org/show_bug.cgi?id=125906
+
+        Reviewed by Timothy Hatcher.
+
+        * http/tests/inspector/injected-script-for-origin-expected.txt: Removed.
+        * http/tests/inspector/injected-script-for-origin.html: Removed.
+        * http/tests/inspector/resources/injected-script-for-origin-frame.html: Removed.
+
 2013-12-17  Eric Carlson  <eric.carlson@apple.com>
 
         ASSERT setting pseudoID with registered DOMSubtreeModified listener
diff --git a/LayoutTests/http/tests/inspector/injected-script-for-origin-expected.txt b/LayoutTests/http/tests/inspector/injected-script-for-origin-expected.txt
deleted file mode 100644 (file)
index 80665e2..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-Tests that different scripts are injected inso subframes of inspector window depending on the origin
-
-{
-    0 : "http://127.0.0.1:8000/inspector/resources/injected-script-for-origin-frame.html, data: 127.0.0.1"
-    1 : "http://localhost:8000/inspector/resources/injected-script-for-origin-frame.html, data: localhost"
-}
-
diff --git a/LayoutTests/http/tests/inspector/injected-script-for-origin.html b/LayoutTests/http/tests/inspector/injected-script-for-origin.html
deleted file mode 100644 (file)
index bf45662..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<html>
-<head>
-<script src="inspector-test.js"></script>
-
-<script>
-function test()
-{
-    var messages = [];
-    function onMessage(event)
-    {
-        messages.push(event.data);
-        if (messages.length === 2) {
-            top.removeEventListener("message", onMessage, false);
-            messages.sort();
-            InspectorTest.addObject(messages);
-            InspectorTest.completeTest();
-        }
-    }
-    top.addEventListener("message", onMessage, false);
-    InspectorFrontendHost.setInjectedScriptForOrigin("http://127.0.0.1:8000", "(function() { window.foo = '127.0.0.1'; return {}})");
-    InspectorFrontendHost.setInjectedScriptForOrigin("http://localhost:8000", "(function() { window.foo = 'localhost'; return {}})");
-    function addSubframe(url)
-    {
-        var iframe = document.createElement("iframe");
-        iframe.src = url;
-        document.body.appendChild(iframe);
-    }
-    addSubframe("http://127.0.0.1:8000/inspector/resources/injected-script-for-origin-frame.html");
-    addSubframe("http://localhost:8000/inspector/resources/injected-script-for-origin-frame.html");
-}
-</script>
-</head>
-<body onload="runTest()">
-<p>
-Tests that different scripts are injected inso subframes of inspector window depending on the origin
-</p>
-</body>
-</html>
diff --git a/LayoutTests/http/tests/inspector/resources/injected-script-for-origin-frame.html b/LayoutTests/http/tests/inspector/resources/injected-script-for-origin-frame.html
deleted file mode 100644 (file)
index d04a96e..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<html>
-<head>
-<script type="text/javascript">
-top.postMessage(location.href + ", data: " + window.foo, "*");
-</script>
-</head>
-</html>
index 5970e62..8e48474 100644 (file)
@@ -1,3 +1,35 @@
+2013-12-17  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Remove InspectorFrontendHost.setInjectedScriptForOrigin
+        https://bugs.webkit.org/show_bug.cgi?id=125906
+
+        Reviewed by Timothy Hatcher.
+
+        Remove stale code related to a since removed feature,
+        Inspector extensions. This allows us to remove a number
+        of entry points into InspectorAgent.
+
+        * inspector/InspectorAgent.cpp:
+        (WebCore::InspectorAgent::InspectorAgent):
+        (WebCore::InspectorAgent::willDestroyFrontendAndBackend):
+        * inspector/InspectorAgent.h:
+        (WebCore::InspectorAgent::create):
+        Remove setInjectedScriptForOrigin and InjectedScript management.
+
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::InspectorController):
+        * inspector/InspectorController.h:
+        * inspector/InspectorFrontendHost.cpp:
+        * inspector/InspectorFrontendHost.h:
+        * inspector/InspectorFrontendHost.idl:
+        Remove the API and calling through InspectorController.
+
+        * inspector/InspectorInstrumentation.cpp:
+        (WebCore::InspectorInstrumentation::didClearWindowObjectInWorldImpl):
+        (WebCore::InspectorInstrumentation::domContentLoadedEventFiredImpl):
+        (WebCore::InspectorInstrumentation::didCommitLoadImpl):
+        Remove now unnecessary calls into InspectorAgent.
+
 2013-12-17  Jer Noble  <jer.noble@apple.com>
 
         Fix TimeRanges::intersectWith
index 890e40e..bcae41c 100644 (file)
 
 #include "InspectorAgent.h"
 
-#include "Document.h"
-#include "DocumentLoader.h"
-#include "GraphicsContext.h"
-#include "InjectedScriptHost.h"
-#include "InjectedScriptManager.h"
-#include "InspectorController.h"
-#include "InspectorInstrumentation.h"
 #include "InstrumentingAgents.h"
-#include "MainFrame.h"
 #include "Page.h"
-#include "ResourceRequest.h"
-#include "ScriptController.h"
-#include "SecurityOrigin.h"
 #include "Settings.h"
 #include <bindings/ScriptValue.h>
 #include <inspector/InspectorJSFrontendDispatchers.h>
@@ -58,10 +47,9 @@ using namespace Inspector;
 
 namespace WebCore {
 
-InspectorAgent::InspectorAgent(Page* page, InjectedScriptManager* injectedScriptManager, InstrumentingAgents* instrumentingAgents)
+InspectorAgent::InspectorAgent(Page* page, InstrumentingAgents* instrumentingAgents)
     : InspectorAgentBase(ASCIILiteral("Inspector"), instrumentingAgents)
     , m_inspectedPage(page)
-    , m_injectedScriptManager(injectedScriptManager)
     , m_enabled(false)
 {
     ASSERT_ARG(page, page);
@@ -73,27 +61,6 @@ InspectorAgent::~InspectorAgent()
     m_instrumentingAgents->setInspectorAgent(0);
 }
 
-void InspectorAgent::didClearWindowObjectInWorld(Frame* frame, DOMWrapperWorld& world)
-{
-    if (&world != &mainThreadNormalWorld())
-        return;
-
-    if (m_injectedScriptForOrigin.isEmpty())
-        return;
-
-    String origin = frame->document()->securityOrigin()->toRawString();
-    String script = m_injectedScriptForOrigin.get(origin);
-    if (script.isEmpty())
-        return;
-    int injectedScriptId = m_injectedScriptManager->injectedScriptIdFor(mainWorldExecState(frame));
-    StringBuilder scriptSource;
-    scriptSource.append(script);
-    scriptSource.append("(");
-    scriptSource.appendNumber(injectedScriptId);
-    scriptSource.append(")");
-    frame->script().executeScript(scriptSource.toString());
-}
-
 void InspectorAgent::didCreateFrontendAndBackend(Inspector::InspectorFrontendChannel* frontendChannel, InspectorBackendDispatcher* backendDispatcher)
 {
     m_frontendDispatcher = std::make_unique<InspectorInspectorFrontendDispatcher>(frontendChannel);
@@ -106,16 +73,11 @@ void InspectorAgent::willDestroyFrontendAndBackend()
     m_backendDispatcher.clear();
 
     m_pendingEvaluateTestCommands.clear();
-    m_injectedScriptManager->discardInjectedScripts();
+
     ErrorString error;
     disable(&error);
 }
 
-void InspectorAgent::didCommitLoad()
-{
-    m_injectedScriptManager->discardInjectedScripts();
-}
-
 void InspectorAgent::enable(ErrorString*)
 {
     m_enabled = true;
@@ -133,11 +95,6 @@ void InspectorAgent::disable(ErrorString*)
     m_enabled = false;
 }
 
-void InspectorAgent::domContentLoadedEventFired()
-{
-    m_injectedScriptManager->injectedScriptHost()->clearInspectedObjects();
-}
-
 void InspectorAgent::evaluateForTestInFrontend(long callId, const String& script)
 {
     if (m_enabled && m_frontendDispatcher)
@@ -146,11 +103,6 @@ void InspectorAgent::evaluateForTestInFrontend(long callId, const String& script
         m_pendingEvaluateTestCommands.append(pair<long, String>(callId, script));
 }
 
-void InspectorAgent::setInjectedScriptForOrigin(const String& origin, const String& source)
-{
-    m_injectedScriptForOrigin.set(origin, source);
-}
-
 void InspectorAgent::inspect(PassRefPtr<Inspector::TypeBuilder::Runtime::RemoteObject> objectToInspect, PassRefPtr<InspectorObject> hints)
 {
     if (m_enabled && m_frontendDispatcher) {
index 93017d3..e11120a 100644 (file)
@@ -47,7 +47,6 @@ namespace WebCore {
 class DOMWrapperWorld;
 class DocumentLoader;
 class Frame;
-class InjectedScriptManager;
 class InstrumentingAgents;
 class Page;
 
@@ -56,9 +55,9 @@ typedef String ErrorString;
 class InspectorAgent : public InspectorAgentBase, public Inspector::InspectorInspectorBackendDispatcherHandler {
     WTF_MAKE_NONCOPYABLE(InspectorAgent);
 public:
-    static PassOwnPtr<InspectorAgent> create(Page* page, InjectedScriptManager* injectedScriptManager, InstrumentingAgents* instrumentingAgents)
+    static PassOwnPtr<InspectorAgent> create(Page* page, InstrumentingAgents* instrumentingAgents)
     {
-        return adoptPtr(new InspectorAgent(page, injectedScriptManager, instrumentingAgents));
+        return adoptPtr(new InspectorAgent(page, instrumentingAgents));
     }
 
     virtual ~InspectorAgent();
@@ -72,31 +71,22 @@ public:
     virtual void didCreateFrontendAndBackend(Inspector::InspectorFrontendChannel*, Inspector::InspectorBackendDispatcher*) OVERRIDE;
     virtual void willDestroyFrontendAndBackend() OVERRIDE;
 
-    void didClearWindowObjectInWorld(Frame*, DOMWrapperWorld&);
-
-    void didCommitLoad();
-    void domContentLoadedEventFired();
-
     bool hasFrontend() const { return !!m_frontendDispatcher; }
 
     // Generic code called from custom implementations.
     void evaluateForTestInFrontend(long testCallId, const String& script);
 
-    void setInjectedScriptForOrigin(const String& origin, const String& source);
-
     void inspect(PassRefPtr<Inspector::TypeBuilder::Runtime::RemoteObject> objectToInspect, PassRefPtr<Inspector::InspectorObject> hints);
 
 private:
-    InspectorAgent(Page*, InjectedScriptManager*, InstrumentingAgents*);
+    InspectorAgent(Page*, InstrumentingAgents*);
 
     Page* m_inspectedPage;
     std::unique_ptr<Inspector::InspectorInspectorFrontendDispatcher> m_frontendDispatcher;
     RefPtr<Inspector::InspectorInspectorBackendDispatcher> m_backendDispatcher;
-    InjectedScriptManager* m_injectedScriptManager;
 
     Vector<pair<long, String>> m_pendingEvaluateTestCommands;
     pair<RefPtr<Inspector::TypeBuilder::Runtime::RemoteObject>, RefPtr<Inspector::InspectorObject>> m_pendingInspectData;
-    HashMap<String, String> m_injectedScriptForOrigin;
 
     bool m_enabled;
 };
index d0b55c8..e0957f2 100644 (file)
@@ -89,7 +89,7 @@ InspectorController::InspectorController(Page* page, InspectorClient* inspectorC
     , m_hasRemoteFrontend(false)
 #endif
 {
-    OwnPtr<InspectorAgent> inspectorAgentPtr(InspectorAgent::create(page, m_injectedScriptManager.get(), m_instrumentingAgents.get()));
+    OwnPtr<InspectorAgent> inspectorAgentPtr(InspectorAgent::create(page, m_instrumentingAgents.get()));
     m_inspectorAgent = inspectorAgentPtr.get();
     m_agents.append(inspectorAgentPtr.release());
 
@@ -359,11 +359,6 @@ Page* InspectorController::inspectedPage() const
     return m_page;
 }
 
-void InspectorController::setInjectedScriptForOrigin(const String& origin, const String& source)
-{
-    m_inspectorAgent->setInjectedScriptForOrigin(origin, source);
-}
-
 void InspectorController::dispatchMessageFromFrontend(const String& message)
 {
     if (m_inspectorBackendDispatcher)
index f6e6d84..475d511 100644 (file)
@@ -89,7 +89,6 @@ public:
     void setInspectorFrontendClient(PassOwnPtr<InspectorFrontendClient>);
     bool hasInspectorFrontendClient() const;
     void didClearWindowObjectInWorld(Frame*, DOMWrapperWorld&);
-    void setInjectedScriptForOrigin(const String& origin, const String& source);
 
     void dispatchMessageFromFrontend(const String& message);
 
index de3a913..95a1efa 100644 (file)
@@ -43,8 +43,6 @@
 #include "FrameLoader.h"
 #include "HitTestResult.h"
 #include "HTMLFrameOwnerElement.h"
-#include "InspectorAgent.h"
-#include "InspectorController.h"
 #include "InspectorFrontendClient.h"
 #include "JSMainThreadExecState.h"
 #include "MainFrame.h"
@@ -218,12 +216,6 @@ void InspectorFrontendHost::moveWindowBy(float x, float y) const
         m_client->moveWindowBy(x, y);
 }
 
-void InspectorFrontendHost::setInjectedScriptForOrigin(const String& origin, const String& script)
-{
-    ASSERT(m_frontendPage->inspectorController());
-    m_frontendPage->inspectorController()->setInjectedScriptForOrigin(origin, script);
-}
-
 String InspectorFrontendHost::localizedStringsURL()
 {
     return m_client ? m_client->localizedStringsURL() : "";
index a61126a..606c105 100644 (file)
@@ -66,7 +66,6 @@ public:
     void setToolbarHeight(unsigned);
 
     void moveWindowBy(float x, float y) const;
-    void setInjectedScriptForOrigin(const String& origin, const String& script);
 
     String localizedStringsURL();
 
index 9a27b42..f2ba6b1 100644 (file)
@@ -48,7 +48,6 @@
     void setToolbarHeight(float height);
 
     void moveWindowBy(float x, float y);
-    void setInjectedScriptForOrigin(DOMString origin, DOMString script);
 
     DOMString localizedStringsURL();
 
index 117db15..4fa1458 100644 (file)
@@ -144,8 +144,6 @@ void InspectorInstrumentation::didClearWindowObjectInWorldImpl(InstrumentingAgen
     InspectorPageAgent* pageAgent = instrumentingAgents->inspectorPageAgent();
     if (pageAgent)
         pageAgent->didClearWindowObjectInWorld(frame, world);
-    if (InspectorAgent* inspectorAgent = instrumentingAgents->inspectorAgent())
-        inspectorAgent->didClearWindowObjectInWorld(frame, world);
 #if ENABLE(JAVASCRIPT_DEBUGGER)
     if (PageDebuggerAgent* debuggerAgent = instrumentingAgents->pageDebuggerAgent()) {
         if (pageAgent && &world == &mainThreadNormalWorld() && frame == pageAgent->mainFrame())
@@ -862,9 +860,6 @@ void InspectorInstrumentation::domContentLoadedEventFiredImpl(InstrumentingAgent
     if (&frame->page()->mainFrame() != frame)
         return;
 
-    if (InspectorAgent* inspectorAgent = instrumentingAgents->inspectorAgent())
-        inspectorAgent->domContentLoadedEventFired();
-
     if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
         domAgent->mainFrameDOMContentLoaded();
 
@@ -922,7 +917,6 @@ void InspectorInstrumentation::didCommitLoadImpl(InstrumentingAgents* instrument
         if (InspectorLayerTreeAgent* layerTreeAgent = instrumentingAgents->inspectorLayerTreeAgent())
             layerTreeAgent->reset();
 #endif
-        inspectorAgent->didCommitLoad();
     }
     if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
         domAgent->didCommitLoad(loader->frame()->document());