Title: [192064] trunk/Source
Revision
192064
Author
[email protected]
Date
2015-11-05 11:31:35 -0800 (Thu, 05 Nov 2015)

Log Message

Web Inspector: Clean up InjectedScript uses
https://bugs.webkit.org/show_bug.cgi?id=150921

Patch by Joseph Pecoraro <[email protected]> on 2015-11-05
Reviewed by Timothy Hatcher.

Source/_javascript_Core:

* inspector/InjectedScript.cpp:
(Inspector::InjectedScript::wrapCallFrames):
* inspector/InjectedScript.h:
* inspector/InjectedScriptBase.cpp:
(Inspector::InjectedScriptBase::initialize): Deleted.
* inspector/InjectedScriptBase.h:
* inspector/InjectedScriptManager.cpp:
(Inspector::InjectedScriptManager::didCreateInjectedScript):
* inspector/InjectedScriptManager.h:
* inspector/InjectedScriptModule.cpp:
(Inspector::InjectedScriptModule::ensureInjected):
* inspector/InjectedScriptModule.h:
* inspector/agents/InspectorDebuggerAgent.cpp:
(Inspector::InspectorDebuggerAgent::currentCallFrames):
* inspector/agents/InspectorDebuggerAgent.h:

Source/WebCore:

* inspector/CommandLineAPIModule.cpp:
(WebCore::CommandLineAPIModule::injectIfNeeded):
(WebCore::CommandLineAPIModule::CommandLineAPIModule):
* inspector/CommandLineAPIModule.h:
* inspector/WebInjectedScriptManager.cpp:
(WebCore::WebInjectedScriptManager::didCreateInjectedScript):
* inspector/WebInjectedScriptManager.h:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (192063 => 192064)


--- trunk/Source/_javascript_Core/ChangeLog	2015-11-05 19:27:37 UTC (rev 192063)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-11-05 19:31:35 UTC (rev 192064)
@@ -1,5 +1,28 @@
 2015-11-05  Joseph Pecoraro  <[email protected]>
 
+        Web Inspector: Clean up InjectedScript uses
+        https://bugs.webkit.org/show_bug.cgi?id=150921
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector/InjectedScript.cpp:
+        (Inspector::InjectedScript::wrapCallFrames):
+        * inspector/InjectedScript.h:
+        * inspector/InjectedScriptBase.cpp:
+        (Inspector::InjectedScriptBase::initialize): Deleted.
+        * inspector/InjectedScriptBase.h:
+        * inspector/InjectedScriptManager.cpp:
+        (Inspector::InjectedScriptManager::didCreateInjectedScript):
+        * inspector/InjectedScriptManager.h:
+        * inspector/InjectedScriptModule.cpp:
+        (Inspector::InjectedScriptModule::ensureInjected):
+        * inspector/InjectedScriptModule.h:
+        * inspector/agents/InspectorDebuggerAgent.cpp:
+        (Inspector::InspectorDebuggerAgent::currentCallFrames):
+        * inspector/agents/InspectorDebuggerAgent.h:
+
+2015-11-05  Joseph Pecoraro  <[email protected]>
+
         Web Inspector: Put ScriptDebugServer into InspectorEnvironment and cleanup duplicate references
         https://bugs.webkit.org/show_bug.cgi?id=150869
 

Modified: trunk/Source/_javascript_Core/inspector/InjectedScript.cpp (192063 => 192064)


--- trunk/Source/_javascript_Core/inspector/InjectedScript.cpp	2015-11-05 19:27:37 UTC (rev 192063)
+++ trunk/Source/_javascript_Core/inspector/InjectedScript.cpp	2015-11-05 19:31:35 UTC (rev 192064)
@@ -194,7 +194,7 @@
         *savedResultIndex = savedResultIndexInt;
 }
 
-Ref<Array<Inspector::Protocol::Debugger::CallFrame>> InjectedScript::wrapCallFrames(const Deprecated::ScriptValue& callFrames)
+Ref<Array<Inspector::Protocol::Debugger::CallFrame>> InjectedScript::wrapCallFrames(const Deprecated::ScriptValue& callFrames) const
 {
     ASSERT(!hasNoValue());
     Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("wrapCallFrames"), inspectorEnvironment()->functionCallHandler());

Modified: trunk/Source/_javascript_Core/inspector/InjectedScript.h (192063 => 192064)


--- trunk/Source/_javascript_Core/inspector/InjectedScript.h	2015-11-05 19:27:37 UTC (rev 192063)
+++ trunk/Source/_javascript_Core/inspector/InjectedScript.h	2015-11-05 19:31:35 UTC (rev 192064)
@@ -62,7 +62,7 @@
     void getCollectionEntries(ErrorString&, const String& objectId, const String& objectGroup, int startIndex, int numberToFetch, RefPtr<Protocol::Array<Protocol::Runtime::CollectionEntry>>* entries);
     void saveResult(ErrorString&, const String& callArgumentJSON, Inspector::Protocol::OptOutput<int>* savedResultIndex);
 
-    Ref<Protocol::Array<Protocol::Debugger::CallFrame>> wrapCallFrames(const Deprecated::ScriptValue&);
+    Ref<Protocol::Array<Protocol::Debugger::CallFrame>> wrapCallFrames(const Deprecated::ScriptValue&) const;
     RefPtr<Protocol::Runtime::RemoteObject> wrapObject(const Deprecated::ScriptValue&, const String& groupName, bool generatePreview = false) const;
     RefPtr<Protocol::Runtime::RemoteObject> wrapTable(const Deprecated::ScriptValue& table, const Deprecated::ScriptValue& columns) const;
 

Modified: trunk/Source/_javascript_Core/inspector/InjectedScriptBase.cpp (192063 => 192064)


--- trunk/Source/_javascript_Core/inspector/InjectedScriptBase.cpp	2015-11-05 19:27:37 UTC (rev 192063)
+++ trunk/Source/_javascript_Core/inspector/InjectedScriptBase.cpp	2015-11-05 19:31:35 UTC (rev 192064)
@@ -58,12 +58,6 @@
 {
 }
 
-void InjectedScriptBase::initialize(Deprecated::ScriptObject injectedScriptObject, InspectorEnvironment* environment)
-{
-    m_injectedScriptObject = injectedScriptObject;
-    m_environment = environment;
-}
-
 bool InjectedScriptBase::hasAccessToInspectedScriptState() const
 {
     return m_environment && m_environment->canAccessInspectedScriptState(m_injectedScriptObject.scriptState());

Modified: trunk/Source/_javascript_Core/inspector/InjectedScriptBase.h (192063 => 192064)


--- trunk/Source/_javascript_Core/inspector/InjectedScriptBase.h	2015-11-05 19:27:37 UTC (rev 192063)
+++ trunk/Source/_javascript_Core/inspector/InjectedScriptBase.h	2015-11-05 19:31:35 UTC (rev 192064)
@@ -60,7 +60,6 @@
 
     InspectorEnvironment* inspectorEnvironment() const { return m_environment; }
 
-    void initialize(Deprecated::ScriptObject, InspectorEnvironment*);
     bool hasAccessToInspectedScriptState() const;
 
     const Deprecated::ScriptObject& injectedScriptObject() const;

Modified: trunk/Source/_javascript_Core/inspector/InjectedScriptManager.cpp (192063 => 192064)


--- trunk/Source/_javascript_Core/inspector/InjectedScriptManager.cpp	2015-11-05 19:27:37 UTC (rev 192063)
+++ trunk/Source/_javascript_Core/inspector/InjectedScriptManager.cpp	2015-11-05 19:31:35 UTC (rev 192064)
@@ -189,7 +189,7 @@
     return result;
 }
 
-void InjectedScriptManager::didCreateInjectedScript(InjectedScript)
+void InjectedScriptManager::didCreateInjectedScript(const InjectedScript&)
 {
     // Intentionally empty. This allows for subclasses to inject additional scripts.
 }

Modified: trunk/Source/_javascript_Core/inspector/InjectedScriptManager.h (192063 => 192064)


--- trunk/Source/_javascript_Core/inspector/InjectedScriptManager.h	2015-11-05 19:27:37 UTC (rev 192063)
+++ trunk/Source/_javascript_Core/inspector/InjectedScriptManager.h	2015-11-05 19:31:35 UTC (rev 192064)
@@ -67,7 +67,7 @@
     void clearExceptionValue();
 
 protected:
-    virtual void didCreateInjectedScript(InjectedScript);
+    virtual void didCreateInjectedScript(const InjectedScript&);
 
     HashMap<int, InjectedScript> m_idToInjectedScript;
     HashMap<JSC::ExecState*, int> m_scriptStateToId;

Modified: trunk/Source/_javascript_Core/inspector/InjectedScriptModule.cpp (192063 => 192064)


--- trunk/Source/_javascript_Core/inspector/InjectedScriptModule.cpp	2015-11-05 19:27:37 UTC (rev 192063)
+++ trunk/Source/_javascript_Core/inspector/InjectedScriptModule.cpp	2015-11-05 19:31:35 UTC (rev 192064)
@@ -54,7 +54,7 @@
     ensureInjected(injectedScriptManager, injectedScript);
 }
 
-void InjectedScriptModule::ensureInjected(InjectedScriptManager* injectedScriptManager, InjectedScript injectedScript)
+void InjectedScriptModule::ensureInjected(InjectedScriptManager* injectedScriptManager, const InjectedScript& injectedScript)
 {
     ASSERT(!injectedScript.hasNoValue());
     if (injectedScript.hasNoValue())
@@ -73,16 +73,11 @@
         function.appendArgument(source());
         function.appendArgument(host(injectedScriptManager, injectedScript.scriptState()));
         resultValue = injectedScript.callFunctionWithEvalEnabled(function, hadException);
-        if (hadException || (returnsObject() && (resultValue.hasNoValue() || !resultValue.isObject()))) {
+        if (hadException) {
             ASSERT_NOT_REACHED();
             return;
         }
     }
-
-    if (returnsObject()) {
-        Deprecated::ScriptObject moduleObject(injectedScript.scriptState(), resultValue);
-        initialize(moduleObject, &injectedScriptManager->inspectorEnvironment());
-    }
 }
 
 } // namespace Inspector

Modified: trunk/Source/_javascript_Core/inspector/InjectedScriptModule.h (192063 => 192064)


--- trunk/Source/_javascript_Core/inspector/InjectedScriptModule.h	2015-11-05 19:27:37 UTC (rev 192063)
+++ trunk/Source/_javascript_Core/inspector/InjectedScriptModule.h	2015-11-05 19:31:35 UTC (rev 192064)
@@ -49,15 +49,14 @@
     virtual ~InjectedScriptModule();
     virtual String source() const = 0;
     virtual JSC::JSValue host(InjectedScriptManager*, JSC::ExecState*) const = 0;
-    virtual bool returnsObject() const = 0;
 
 protected:
     // Do not expose constructor in the child classes as well. Instead provide
     // a static factory method that would create a new instance of the class
     // and call its ensureInjected() method immediately.
-    InjectedScriptModule(const String& name);
+    explicit InjectedScriptModule(const String& name);
     void ensureInjected(InjectedScriptManager*, JSC::ExecState*);
-    void ensureInjected(InjectedScriptManager*, InjectedScript);
+    void ensureInjected(InjectedScriptManager*, const InjectedScript&);
 };
 
 } // namespace Inspector

Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorDebuggerAgent.cpp (192063 => 192064)


--- trunk/Source/_javascript_Core/inspector/agents/InspectorDebuggerAgent.cpp	2015-11-05 19:27:37 UTC (rev 192063)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorDebuggerAgent.cpp	2015-11-05 19:31:35 UTC (rev 192064)
@@ -594,7 +594,7 @@
         breakProgram(DebuggerFrontendDispatcher::Reason::CSPViolation, buildCSPViolationPauseReason(directiveText));
 }
 
-Ref<Inspector::Protocol::Array<Inspector::Protocol::Debugger::CallFrame>> InspectorDebuggerAgent::currentCallFrames(InjectedScript injectedScript)
+Ref<Inspector::Protocol::Array<Inspector::Protocol::Debugger::CallFrame>> InspectorDebuggerAgent::currentCallFrames(const InjectedScript& injectedScript)
 {
     ASSERT(!injectedScript.hasNoValue());
     if (injectedScript.hasNoValue())

Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorDebuggerAgent.h (192063 => 192064)


--- trunk/Source/_javascript_Core/inspector/agents/InspectorDebuggerAgent.h	2015-11-05 19:27:37 UTC (rev 192063)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorDebuggerAgent.h	2015-11-05 19:31:35 UTC (rev 192064)
@@ -125,7 +125,7 @@
     void didClearGlobalObject();
 
 private:
-    Ref<Inspector::Protocol::Array<Inspector::Protocol::Debugger::CallFrame>> currentCallFrames(InjectedScript);
+    Ref<Inspector::Protocol::Array<Inspector::Protocol::Debugger::CallFrame>> currentCallFrames(const InjectedScript&);
 
     virtual void didParseSource(JSC::SourceID, const Script&) override final;
     virtual void failedToParseSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage) override final;

Modified: trunk/Source/WebCore/ChangeLog (192063 => 192064)


--- trunk/Source/WebCore/ChangeLog	2015-11-05 19:27:37 UTC (rev 192063)
+++ trunk/Source/WebCore/ChangeLog	2015-11-05 19:31:35 UTC (rev 192064)
@@ -1,5 +1,20 @@
 2015-11-05  Joseph Pecoraro  <[email protected]>
 
+        Web Inspector: Clean up InjectedScript uses
+        https://bugs.webkit.org/show_bug.cgi?id=150921
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector/CommandLineAPIModule.cpp:
+        (WebCore::CommandLineAPIModule::injectIfNeeded):
+        (WebCore::CommandLineAPIModule::CommandLineAPIModule):
+        * inspector/CommandLineAPIModule.h:
+        * inspector/WebInjectedScriptManager.cpp:
+        (WebCore::WebInjectedScriptManager::didCreateInjectedScript):
+        * inspector/WebInjectedScriptManager.h:
+
+2015-11-05  Joseph Pecoraro  <[email protected]>
+
         Web Inspector: Put ScriptDebugServer into InspectorEnvironment and cleanup duplicate references
         https://bugs.webkit.org/show_bug.cgi?id=150869
 

Modified: trunk/Source/WebCore/inspector/CommandLineAPIModule.cpp (192063 => 192064)


--- trunk/Source/WebCore/inspector/CommandLineAPIModule.cpp	2015-11-05 19:27:37 UTC (rev 192063)
+++ trunk/Source/WebCore/inspector/CommandLineAPIModule.cpp	2015-11-05 19:31:35 UTC (rev 192064)
@@ -37,15 +37,15 @@
 
 namespace WebCore {
 
-CommandLineAPIModule::CommandLineAPIModule()
-    : InjectedScriptModule(ASCIILiteral("CommandLineAPI"))
+void CommandLineAPIModule::injectIfNeeded(InjectedScriptManager* injectedScriptManager, const InjectedScript& injectedScript)
 {
+    CommandLineAPIModule module;
+    module.ensureInjected(injectedScriptManager, injectedScript);
 }
 
-void CommandLineAPIModule::injectIfNeeded(InjectedScriptManager* injectedScriptManager, InjectedScript injectedScript)
+CommandLineAPIModule::CommandLineAPIModule()
+    : InjectedScriptModule(ASCIILiteral("CommandLineAPI"))
 {
-    CommandLineAPIModule module;
-    module.ensureInjected(injectedScriptManager, injectedScript);
 }
 
 String CommandLineAPIModule::source() const

Modified: trunk/Source/WebCore/inspector/CommandLineAPIModule.h (192063 => 192064)


--- trunk/Source/WebCore/inspector/CommandLineAPIModule.h	2015-11-05 19:27:37 UTC (rev 192063)
+++ trunk/Source/WebCore/inspector/CommandLineAPIModule.h	2015-11-05 19:31:35 UTC (rev 192064)
@@ -36,9 +36,8 @@
 
     virtual String source() const override;
     virtual JSC::JSValue host(Inspector::InjectedScriptManager*, JSC::ExecState*) const override;
-    virtual bool returnsObject() const override { return false; }
 
-    static void injectIfNeeded(Inspector::InjectedScriptManager*, Inspector::InjectedScript);
+    static void injectIfNeeded(Inspector::InjectedScriptManager*, const Inspector::InjectedScript&);
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/inspector/WebInjectedScriptManager.cpp (192063 => 192064)


--- trunk/Source/WebCore/inspector/WebInjectedScriptManager.cpp	2015-11-05 19:27:37 UTC (rev 192063)
+++ trunk/Source/WebCore/inspector/WebInjectedScriptManager.cpp	2015-11-05 19:31:35 UTC (rev 192064)
@@ -47,7 +47,7 @@
     m_commandLineAPIHost = nullptr;
 }
 
-void WebInjectedScriptManager::didCreateInjectedScript(InjectedScript injectedScript)
+void WebInjectedScriptManager::didCreateInjectedScript(const Inspector::InjectedScript& injectedScript)
 {
     CommandLineAPIModule::injectIfNeeded(this, injectedScript);
 }

Modified: trunk/Source/WebCore/inspector/WebInjectedScriptManager.h (192063 => 192064)


--- trunk/Source/WebCore/inspector/WebInjectedScriptManager.h	2015-11-05 19:27:37 UTC (rev 192063)
+++ trunk/Source/WebCore/inspector/WebInjectedScriptManager.h	2015-11-05 19:31:35 UTC (rev 192064)
@@ -46,7 +46,7 @@
     void discardInjectedScriptsFor(DOMWindow*);
 
 protected:
-    virtual void didCreateInjectedScript(Inspector::InjectedScript) override;
+    virtual void didCreateInjectedScript(const Inspector::InjectedScript&) override;
 
 private:
     RefPtr<CommandLineAPIHost> m_commandLineAPIHost;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to