Title: [160751] trunk
Revision
160751
Author
[email protected]
Date
2013-12-17 22:22:58 -0800 (Tue, 17 Dec 2013)

Log Message

Web Inspector: Remove InspectorFrontendHost.setInjectedScriptForOrigin
https://bugs.webkit.org/show_bug.cgi?id=125906

Patch by Joseph Pecoraro <[email protected]> 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.

Modified Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (160750 => 160751)


--- trunk/LayoutTests/ChangeLog	2013-12-18 06:04:51 UTC (rev 160750)
+++ trunk/LayoutTests/ChangeLog	2013-12-18 06:22:58 UTC (rev 160751)
@@ -1,3 +1,14 @@
+2013-12-17  Joseph Pecoraro  <[email protected]>
+
+        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  <[email protected]>
 
         ASSERT setting pseudoID with registered DOMSubtreeModified listener

Deleted: trunk/LayoutTests/http/tests/inspector/injected-script-for-origin-expected.txt (160750 => 160751)


--- trunk/LayoutTests/http/tests/inspector/injected-script-for-origin-expected.txt	2013-12-18 06:04:51 UTC (rev 160750)
+++ trunk/LayoutTests/http/tests/inspector/injected-script-for-origin-expected.txt	2013-12-18 06:22:58 UTC (rev 160751)
@@ -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"
-}
-

Deleted: trunk/LayoutTests/http/tests/inspector/injected-script-for-origin.html (160750 => 160751)


--- trunk/LayoutTests/http/tests/inspector/injected-script-for-origin.html	2013-12-18 06:04:51 UTC (rev 160750)
+++ trunk/LayoutTests/http/tests/inspector/injected-script-for-origin.html	2013-12-18 06:22:58 UTC (rev 160751)
@@ -1,38 +0,0 @@
-<html>
-<head>
-<script src=""
-
-<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 = ""
-        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>

Deleted: trunk/LayoutTests/http/tests/inspector/resources/injected-script-for-origin-frame.html (160750 => 160751)


--- trunk/LayoutTests/http/tests/inspector/resources/injected-script-for-origin-frame.html	2013-12-18 06:04:51 UTC (rev 160750)
+++ trunk/LayoutTests/http/tests/inspector/resources/injected-script-for-origin-frame.html	2013-12-18 06:22:58 UTC (rev 160751)
@@ -1,7 +0,0 @@
-<html>
-<head>
-<script type="text/_javascript_">
-top.postMessage(location.href + ", data: " + window.foo, "*");
-</script>
-</head>
-</html>

Modified: trunk/Source/WebCore/ChangeLog (160750 => 160751)


--- trunk/Source/WebCore/ChangeLog	2013-12-18 06:04:51 UTC (rev 160750)
+++ trunk/Source/WebCore/ChangeLog	2013-12-18 06:22:58 UTC (rev 160751)
@@ -1,3 +1,35 @@
+2013-12-17  Joseph Pecoraro  <[email protected]>
+
+        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  <[email protected]>
 
         Fix TimeRanges::intersectWith

Modified: trunk/Source/WebCore/inspector/InspectorAgent.cpp (160750 => 160751)


--- trunk/Source/WebCore/inspector/InspectorAgent.cpp	2013-12-18 06:04:51 UTC (rev 160750)
+++ trunk/Source/WebCore/inspector/InspectorAgent.cpp	2013-12-18 06:22:58 UTC (rev 160751)
@@ -34,19 +34,8 @@
 
 #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 @@
 
 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 @@
     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 @@
     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 @@
     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 @@
         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) {

Modified: trunk/Source/WebCore/inspector/InspectorAgent.h (160750 => 160751)


--- trunk/Source/WebCore/inspector/InspectorAgent.h	2013-12-18 06:04:51 UTC (rev 160750)
+++ trunk/Source/WebCore/inspector/InspectorAgent.h	2013-12-18 06:22:58 UTC (rev 160751)
@@ -47,7 +47,6 @@
 class DOMWrapperWorld;
 class DocumentLoader;
 class Frame;
-class InjectedScriptManager;
 class InstrumentingAgents;
 class Page;
 
@@ -56,9 +55,9 @@
 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 @@
     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;
 };

Modified: trunk/Source/WebCore/inspector/InspectorController.cpp (160750 => 160751)


--- trunk/Source/WebCore/inspector/InspectorController.cpp	2013-12-18 06:04:51 UTC (rev 160750)
+++ trunk/Source/WebCore/inspector/InspectorController.cpp	2013-12-18 06:22:58 UTC (rev 160751)
@@ -89,7 +89,7 @@
     , 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 @@
     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)

Modified: trunk/Source/WebCore/inspector/InspectorController.h (160750 => 160751)


--- trunk/Source/WebCore/inspector/InspectorController.h	2013-12-18 06:04:51 UTC (rev 160750)
+++ trunk/Source/WebCore/inspector/InspectorController.h	2013-12-18 06:22:58 UTC (rev 160751)
@@ -89,7 +89,6 @@
     void setInspectorFrontendClient(PassOwnPtr<InspectorFrontendClient>);
     bool hasInspectorFrontendClient() const;
     void didClearWindowObjectInWorld(Frame*, DOMWrapperWorld&);
-    void setInjectedScriptForOrigin(const String& origin, const String& source);
 
     void dispatchMessageFromFrontend(const String& message);
 

Modified: trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp (160750 => 160751)


--- trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp	2013-12-18 06:04:51 UTC (rev 160750)
+++ trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp	2013-12-18 06:22:58 UTC (rev 160751)
@@ -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 @@
         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() : "";

Modified: trunk/Source/WebCore/inspector/InspectorFrontendHost.h (160750 => 160751)


--- trunk/Source/WebCore/inspector/InspectorFrontendHost.h	2013-12-18 06:04:51 UTC (rev 160750)
+++ trunk/Source/WebCore/inspector/InspectorFrontendHost.h	2013-12-18 06:22:58 UTC (rev 160751)
@@ -66,7 +66,6 @@
     void setToolbarHeight(unsigned);
 
     void moveWindowBy(float x, float y) const;
-    void setInjectedScriptForOrigin(const String& origin, const String& script);
 
     String localizedStringsURL();
 

Modified: trunk/Source/WebCore/inspector/InspectorFrontendHost.idl (160750 => 160751)


--- trunk/Source/WebCore/inspector/InspectorFrontendHost.idl	2013-12-18 06:04:51 UTC (rev 160750)
+++ trunk/Source/WebCore/inspector/InspectorFrontendHost.idl	2013-12-18 06:22:58 UTC (rev 160751)
@@ -48,7 +48,6 @@
     void setToolbarHeight(float height);
 
     void moveWindowBy(float x, float y);
-    void setInjectedScriptForOrigin(DOMString origin, DOMString script);
 
     DOMString localizedStringsURL();
 

Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp (160750 => 160751)


--- trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp	2013-12-18 06:04:51 UTC (rev 160750)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp	2013-12-18 06:22:58 UTC (rev 160751)
@@ -144,8 +144,6 @@
     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 @@
     if (&frame->page()->mainFrame() != frame)
         return;
 
-    if (InspectorAgent* inspectorAgent = instrumentingAgents->inspectorAgent())
-        inspectorAgent->domContentLoadedEventFired();
-
     if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
         domAgent->mainFrameDOMContentLoaded();
 
@@ -922,7 +917,6 @@
         if (InspectorLayerTreeAgent* layerTreeAgent = instrumentingAgents->inspectorLayerTreeAgent())
             layerTreeAgent->reset();
 #endif
-        inspectorAgent->didCommitLoad();
     }
     if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
         domAgent->didCommitLoad(loader->frame()->document());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to