[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

pfeldman at chromium.org pfeldman at chromium.org
Thu Oct 29 20:38:38 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit 9ed9884e51aa4465b72ac0192a0ada1a09a4a384
Author: pfeldman at chromium.org <pfeldman at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Oct 3 10:27:48 2009 +0000

    2009-10-02  Pavel Feldman  <pfeldman at chromium.org>
    
            Reviewed by Timothy Hatcher.
    
            Web Inspector: prepare InspectorController for being used from layout tests.
            This change adds evaluateForTestInFrontend method with the callback that
            allows evaluating arbitrary code in the frontend context.
    
            https://bugs.webkit.org/show_bug.cgi?id=30008
    
            * WebCore.Inspector.exp:
            * WebCore.order:
            * inspector/InspectorBackend.cpp:
            (WebCore::InspectorBackend::didEvaluateForTestInFrontend):
            * inspector/InspectorBackend.h:
            * inspector/InspectorBackend.idl:
            * inspector/InspectorController.cpp:
            (WebCore::InspectorController::populateScriptObjects):
            (WebCore::InspectorController::evaluateForTestInFrontend):
            (WebCore::InspectorController::didEvaluateForTestInFrontend):
            * inspector/InspectorController.h:
            * inspector/InspectorFrontend.cpp:
            (WebCore::InspectorFrontend::evaluateForTestInFrontend):
            * inspector/InspectorFrontend.h:
            * inspector/front-end/inspector.js:
            (WebInspector.evaluateForTestInFrontend):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49064 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index edf56eb..d9397f7 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -2,6 +2,33 @@
 
         Reviewed by Timothy Hatcher.
 
+        Web Inspector: prepare InspectorController for being used from layout tests.
+        This change adds evaluateForTestInFrontend method with the callback that
+        allows evaluating arbitrary code in the frontend context.
+
+        https://bugs.webkit.org/show_bug.cgi?id=30008
+
+        * WebCore.Inspector.exp:
+        * WebCore.order:
+        * inspector/InspectorBackend.cpp:
+        (WebCore::InspectorBackend::didEvaluateForTestInFrontend):
+        * inspector/InspectorBackend.h:
+        * inspector/InspectorBackend.idl:
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::populateScriptObjects):
+        (WebCore::InspectorController::evaluateForTestInFrontend):
+        (WebCore::InspectorController::didEvaluateForTestInFrontend):
+        * inspector/InspectorController.h:
+        * inspector/InspectorFrontend.cpp:
+        (WebCore::InspectorFrontend::evaluateForTestInFrontend):
+        * inspector/InspectorFrontend.h:
+        * inspector/front-end/inspector.js:
+        (WebInspector.evaluateForTestInFrontend):
+
+2009-10-02  Pavel Feldman  <pfeldman at chromium.org>
+
+        Reviewed by Timothy Hatcher.
+
         Web Inspector: Node search mode is not getting reset on element selection.
 
         https://bugs.webkit.org/show_bug.cgi?id=30016
diff --git a/WebCore/WebCore.Inspector.exp b/WebCore/WebCore.Inspector.exp
index f79348f..576994f 100644
--- a/WebCore/WebCore.Inspector.exp
+++ b/WebCore/WebCore.Inspector.exp
@@ -12,6 +12,7 @@ __ZN7WebCore19InspectorController4showEv
 __ZN7WebCore19InspectorController5closeEv
 __ZN7WebCore19InspectorController7inspectEPNS_4NodeE
 __ZN7WebCore19InspectorController9showPanelENS0_13SpecialPanelsE
+__ZN7WebCore19InspectorController25evaluateForTestInFrontendElRKNS_6StringE
 __ZNK7WebCore19InspectorController17drawNodeHighlightERNS_15GraphicsContextE
 __ZNK7WebCore19InspectorController7enabledEv
 __ZNK7WebCore19InspectorController7settingERKNS_6StringE
diff --git a/WebCore/WebCore.order b/WebCore/WebCore.order
index ff42e26..c1040e2 100644
--- a/WebCore/WebCore.order
+++ b/WebCore/WebCore.order
@@ -7851,6 +7851,7 @@ __ZN3WTF9HashTableIPN7WebCore4PageES3_NS_17IdentityExtractorIS3_EENS_7PtrHashIS3
 __ZN3WTF9HashTableIPN7WebCore4PageES3_NS_17IdentityExtractorIS3_EENS_7PtrHashIS3_EENS_10HashTraitsIS3_EES9_E47removeAndInvalida
 __ZN3WTF9HashTableIPN7WebCore4PageES3_NS_17IdentityExtractorIS3_EENS_7PtrHashIS3_EENS_10HashTraitsIS3_EES9_E6removeEPS3_
 __ZN7WebCore19InspectorController22inspectedPageDestroyedEv
+__ZN7WebCore19InspectorController25evaluateForTestInFrontendElRKNS_6StringE
 __ZN7WebCore19InspectorController5closeEv
 __ZN7WebCore15BackForwardList5closeEv
 __ZN3WTF6VectorINS_6RefPtrIN7WebCore11HistoryItemEEELm0EE14shrinkCapacityEm
diff --git a/WebCore/inspector/InspectorBackend.cpp b/WebCore/inspector/InspectorBackend.cpp
index 752ec0c..06289bc 100644
--- a/WebCore/inspector/InspectorBackend.cpp
+++ b/WebCore/inspector/InspectorBackend.cpp
@@ -543,6 +543,12 @@ void InspectorBackend::removeDOMStorageItem(long callId, long storageId, const S
 }
 #endif
 
+void InspectorBackend::didEvaluateForTestInFrontend(long callId, const String& jsonResult)
+{
+    if (m_inspectorController)
+        m_inspectorController->didEvaluateForTestInFrontend(callId, jsonResult);
+}
+
 InspectorDOMAgent* InspectorBackend::inspectorDOMAgent()
 {
     if (!m_inspectorController)
diff --git a/WebCore/inspector/InspectorBackend.h b/WebCore/inspector/InspectorBackend.h
index 72278a3..4a3aa1e 100644
--- a/WebCore/inspector/InspectorBackend.h
+++ b/WebCore/inspector/InspectorBackend.h
@@ -157,6 +157,7 @@ public:
     void setDOMStorageItem(long callId, long storageId, const String& key, const String& value);
     void removeDOMStorageItem(long callId, long storageId, const String& key);
 #endif
+    void didEvaluateForTestInFrontend(long callId, const String& jsonResult);
 
 private:
     InspectorBackend(InspectorController* inspectorController, InspectorClient* client);
diff --git a/WebCore/inspector/InspectorBackend.idl b/WebCore/inspector/InspectorBackend.idl
index 5c6babb..56f66b9 100644
--- a/WebCore/inspector/InspectorBackend.idl
+++ b/WebCore/inspector/InspectorBackend.idl
@@ -127,5 +127,6 @@ module core {
         void setDOMStorageItem(in long callId, in long storageId, in DOMString key, in DOMString value);
         void removeDOMStorageItem(in long callId, in long storageId, in DOMString key);
 #endif
+        void didEvaluateForTestInFrontend(in long callId, in DOMString jsonResult);
     };
 }
diff --git a/WebCore/inspector/InspectorController.cpp b/WebCore/inspector/InspectorController.cpp
index 6c22295..29a9e28 100644
--- a/WebCore/inspector/InspectorController.cpp
+++ b/WebCore/inspector/InspectorController.cpp
@@ -673,6 +673,11 @@ void InspectorController::populateScriptObjects()
 #endif
 
     m_frontend->populateInterface();
+
+    // Dispatch pending frontend commands
+    for (Vector<pair<long, String> >::iterator it = m_pendingEvaluateTestCommands.begin(); it != m_pendingEvaluateTestCommands.end(); ++it)
+        m_frontend->evaluateForTestInFrontend((*it).first, (*it).second);
+    m_pendingEvaluateTestCommands.clear();
 }
 
 void InspectorController::resetScriptObjects()
@@ -1447,6 +1452,25 @@ void InspectorController::didContinue()
 
 #endif
 
+void InspectorController::evaluateForTestInFrontend(long callId, const String& script)
+{
+    if (m_frontend && windowVisible())
+        m_frontend->evaluateForTestInFrontend(callId, script);
+    else
+        m_pendingEvaluateTestCommands.append(pair<long, String>(callId, script));
+}
+
+void InspectorController::didEvaluateForTestInFrontend(long callId, const String& jsonResult)
+{
+    ScriptState* scriptState = scriptStateFromPage(m_inspectedPage);
+    ScriptObject window;
+    ScriptGlobalObject::get(scriptState, "window", window);
+    ScriptFunctionCall function(scriptState, window, "didEvaluateForTestInFrontend");
+    function.appendArgument(static_cast<int>(callId));
+    function.appendArgument(jsonResult);
+    function.call();
+}
+
 static Path quadToPath(const FloatQuad& quad)
 {
     Path quadPath;
diff --git a/WebCore/inspector/InspectorController.h b/WebCore/inspector/InspectorController.h
index 59be2ff..0c86b1e 100644
--- a/WebCore/inspector/InspectorController.h
+++ b/WebCore/inspector/InspectorController.h
@@ -283,6 +283,8 @@ public:
     virtual void didContinue();
 #endif
 
+    void evaluateForTestInFrontend(long callId, const String& script);
+
 private:
     friend class InspectorBackend;
     // Following are used from InspectorBackend and internally.
@@ -331,6 +333,8 @@ private:
 
     SpecialPanels specialPanelForJSName(const String& panelName);
 
+    void didEvaluateForTestInFrontend(long callId, const String& jsonResult);
+
     Page* m_inspectedPage;
     InspectorClient* m_client;
     OwnPtr<InspectorFrontend> m_frontend;
@@ -365,6 +369,7 @@ private:
     RefPtr<InspectorBackend> m_inspectorBackend;
     HashMap<String, ScriptValue> m_idToConsoleObject;
     long m_lastBoundObjectId;
+    Vector<pair<long, String> > m_pendingEvaluateTestCommands;
 #if ENABLE(JAVASCRIPT_DEBUGGER)
     bool m_debuggerEnabled;
     bool m_attachDebuggerWhenShown;
diff --git a/WebCore/inspector/InspectorFrontend.cpp b/WebCore/inspector/InspectorFrontend.cpp
index 63bb6e2..9944e3c 100644
--- a/WebCore/inspector/InspectorFrontend.cpp
+++ b/WebCore/inspector/InspectorFrontend.cpp
@@ -459,6 +459,14 @@ void InspectorFrontend::addNodesToSearchResult(const String& nodeIds)
     function->call();
 }
 
+void InspectorFrontend::evaluateForTestInFrontend(int callId, const String& script)
+{
+    OwnPtr<ScriptFunctionCall> function(newFunctionCall("evaluateForTestInFrontend"));
+    function->appendArgument(callId);
+    function->appendArgument(script);
+    function->call();
+}
+
 PassOwnPtr<ScriptFunctionCall> InspectorFrontend::newFunctionCall(const String& functionName)
 {
     ScriptFunctionCall* function = new ScriptFunctionCall(m_scriptState, m_webInspector, "dispatch");
diff --git a/WebCore/inspector/InspectorFrontend.h b/WebCore/inspector/InspectorFrontend.h
index 51f17fb..b414c7c 100644
--- a/WebCore/inspector/InspectorFrontend.h
+++ b/WebCore/inspector/InspectorFrontend.h
@@ -129,6 +129,7 @@ namespace WebCore {
 
         ScriptState* scriptState() const { return m_scriptState; }
 
+        void evaluateForTestInFrontend(int callId, const String& script);
     private:
         PassOwnPtr<ScriptFunctionCall> newFunctionCall(const String& functionName);
         void callSimpleFunction(const String& functionName);
diff --git a/WebCore/inspector/front-end/inspector.js b/WebCore/inspector/front-end/inspector.js
index e9e4dd3..8a0cf86 100644
--- a/WebCore/inspector/front-end/inspector.js
+++ b/WebCore/inspector/front-end/inspector.js
@@ -1615,6 +1615,11 @@ WebInspector._toolbarItemClicked = function(event)
     this.currentPanel = toolbarItem.panel;
 }
 
+WebInspector.evaluateForTestInFrontend = function(callId, script)
+{
+    InspectorController.didEvaluateForTestInFrontend(callId, JSON.stringify(window.eval(script)));
+}
+
 // This table maps MIME types to the Resource.Types which are valid for them.
 // The following line:
 //    "text/html":                {0: 1},

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list