Title: [101661] trunk/Source
Revision
101661
Author
[email protected]
Date
2011-12-01 05:33:53 -0800 (Thu, 01 Dec 2011)

Log Message

Web Inspector: restore WebKit2 Safari menu items after capabilities refactoring regression.
https://bugs.webkit.org/show_bug.cgi?id=73554

Reviewed by Yury Semikhatsky.

Source/WebCore:

* inspector/InspectorFrontendClientLocal.cpp:
(WebCore::InspectorFrontendClientLocal::frontendLoaded):
(WebCore::InspectorFrontendClientLocal::isDebuggingEnabled):
(WebCore::InspectorFrontendClientLocal::setDebuggingEnabled):
(WebCore::InspectorFrontendClientLocal::isTimelineProfilingEnabled):
(WebCore::InspectorFrontendClientLocal::setTimelineProfilingEnabled):
(WebCore::InspectorFrontendClientLocal::isProfilingJavaScript):
(WebCore::InspectorFrontendClientLocal::startProfilingJavaScript):
(WebCore::InspectorFrontendClientLocal::stopProfilingJavaScript):
(WebCore::InspectorFrontendClientLocal::showConsole):
(WebCore::InspectorFrontendClientLocal::evaluateOnLoad):
* inspector/InspectorFrontendClientLocal.h:
* inspector/front-end/InspectorFrontendAPI.js:
(InspectorFrontendAPI._pendingCommands.isDebuggingEnabled):
(InspectorFrontendAPI.setDebuggingEnabled):
(InspectorFrontendAPI.isTimelineProfilingEnabled):
(InspectorFrontendAPI.setTimelineProfilingEnabled):
(InspectorFrontendAPI.isProfilingJavaScript):
(InspectorFrontendAPI.startProfilingJavaScript):
(InspectorFrontendAPI.stopProfilingJavaScript):
(InspectorFrontendAPI.setAttachedWindow):
(InspectorFrontendAPI.showConsole):
(InspectorFrontendAPI.dispatch):
(InspectorFrontendAPI.loadCompleted):
* inspector/front-end/inspector.js:

Source/WebKit2:

* UIProcess/WebInspectorProxy.cpp:
(WebKit::WebInspectorProxy::didClose):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (101660 => 101661)


--- trunk/Source/WebCore/ChangeLog	2011-12-01 13:30:40 UTC (rev 101660)
+++ trunk/Source/WebCore/ChangeLog	2011-12-01 13:33:53 UTC (rev 101661)
@@ -1,3 +1,36 @@
+2011-12-01  Pavel Feldman  <[email protected]>
+
+        Web Inspector: restore WebKit2 Safari menu items after capabilities refactoring regression.
+        https://bugs.webkit.org/show_bug.cgi?id=73554
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/InspectorFrontendClientLocal.cpp:
+        (WebCore::InspectorFrontendClientLocal::frontendLoaded):
+        (WebCore::InspectorFrontendClientLocal::isDebuggingEnabled):
+        (WebCore::InspectorFrontendClientLocal::setDebuggingEnabled):
+        (WebCore::InspectorFrontendClientLocal::isTimelineProfilingEnabled):
+        (WebCore::InspectorFrontendClientLocal::setTimelineProfilingEnabled):
+        (WebCore::InspectorFrontendClientLocal::isProfilingJavaScript):
+        (WebCore::InspectorFrontendClientLocal::startProfilingJavaScript):
+        (WebCore::InspectorFrontendClientLocal::stopProfilingJavaScript):
+        (WebCore::InspectorFrontendClientLocal::showConsole):
+        (WebCore::InspectorFrontendClientLocal::evaluateOnLoad):
+        * inspector/InspectorFrontendClientLocal.h:
+        * inspector/front-end/InspectorFrontendAPI.js:
+        (InspectorFrontendAPI._pendingCommands.isDebuggingEnabled):
+        (InspectorFrontendAPI.setDebuggingEnabled):
+        (InspectorFrontendAPI.isTimelineProfilingEnabled):
+        (InspectorFrontendAPI.setTimelineProfilingEnabled):
+        (InspectorFrontendAPI.isProfilingJavaScript):
+        (InspectorFrontendAPI.startProfilingJavaScript):
+        (InspectorFrontendAPI.stopProfilingJavaScript):
+        (InspectorFrontendAPI.setAttachedWindow):
+        (InspectorFrontendAPI.showConsole):
+        (InspectorFrontendAPI.dispatch):
+        (InspectorFrontendAPI.loadCompleted):
+        * inspector/front-end/inspector.js:
+
 2011-12-01  Pavel Feldman  <[email protected]>
 
         Web Inspector: remove capabilities along with the MetaAgent

Modified: trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp (101660 => 101661)


--- trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp	2011-12-01 13:30:40 UTC (rev 101660)
+++ trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp	2011-12-01 13:33:53 UTC (rev 101661)
@@ -134,8 +134,9 @@
 {
     bringToFront();
     m_frontendLoaded = true;
-    if (!m_evaluateOnLoad.isEmpty())
-        evaluateOnLoad(m_evaluateOnLoad);
+    for (Vector<String>::iterator it = m_evaluateOnLoad.begin(); it != m_evaluateOnLoad.end(); ++it)
+        evaluateOnLoad(*it);
+    m_evaluateOnLoad.clear();
 }
 
 void InspectorFrontendClientLocal::requestAttachWindow()
@@ -195,47 +196,47 @@
 bool InspectorFrontendClientLocal::isDebuggingEnabled()
 {
     if (m_frontendLoaded)
-        return evaluateAsBoolean("InspectorFrontendAPI.isDebuggingEnabled()");
+        return evaluateAsBoolean("[\"isDebuggingEnabled\"]");
     return false;
 }
 
 void InspectorFrontendClientLocal::setDebuggingEnabled(bool enabled)
 {
-    evaluateOnLoad(String::format("InspectorFrontendAPI.setDebuggingEnabled(%s)", enabled ? "true" : "false"));
+    evaluateOnLoad(String::format("[\"setDebuggingEnabled\", %s]", enabled ? "true" : "false"));
 }
 
 bool InspectorFrontendClientLocal::isTimelineProfilingEnabled()
 {
     if (m_frontendLoaded)
-        return evaluateAsBoolean("InspectorFrontendAPI.isTimelineProfilingEnabled()");
+        return evaluateAsBoolean("[\"isTimelineProfilingEnabled\"]");
     return false;
 }
 
 void InspectorFrontendClientLocal::setTimelineProfilingEnabled(bool enabled)
 {
-    evaluateOnLoad(String::format("InspectorFrontendAPI.setTimelineProfilingEnabled(%s)", enabled ? "true" : "false"));
+    evaluateOnLoad(String::format("[\"setTimelineProfilingEnabled\", %s]", enabled ? "true" : "false"));
 }
 
 bool InspectorFrontendClientLocal::isProfilingJavaScript()
 {
     if (m_frontendLoaded)
-        return evaluateAsBoolean("InspectorFrontendAPI.isProfilingJavaScript()");
+        return evaluateAsBoolean("[\"isProfilingJavaScript\"]");
     return false;
 }
 
 void InspectorFrontendClientLocal::startProfilingJavaScript()
 {
-    evaluateOnLoad("InspectorFrontendAPI.startProfilingJavaScript()");
+    evaluateOnLoad("[\"startProfilingJavaScript\"]");
 }
 
 void InspectorFrontendClientLocal::stopProfilingJavaScript()
 {
-    evaluateOnLoad("InspectorFrontendAPI.stopProfilingJavaScript()");
+    evaluateOnLoad("[\"stopProfilingJavaScript\"]");
 }
 
 void InspectorFrontendClientLocal::showConsole()
 {
-    evaluateOnLoad("InspectorFrontendAPI.showConsole()");
+    evaluateOnLoad("[\"showConsole\"]");
 }
 
 unsigned InspectorFrontendClientLocal::constrainedAttachedWindowHeight(unsigned preferredHeight, unsigned totalWindowHeight)
@@ -260,9 +261,9 @@
 void InspectorFrontendClientLocal::evaluateOnLoad(const String& _expression_)
 {
     if (m_frontendLoaded)
-        m_frontendPage->mainFrame()->script()->executeScript(_expression_);
+        m_frontendPage->mainFrame()->script()->executeScript("InspectorFrontendAPI.dispatch(" + _expression_ + ")");
     else
-        m_evaluateOnLoad = "setTimeout(function() { " + _expression_ + "; }, 0)";
+        m_evaluateOnLoad.append(_expression_);
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.h (101660 => 101661)


--- trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.h	2011-12-01 13:30:40 UTC (rev 101660)
+++ trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.h	2011-12-01 13:33:53 UTC (rev 101661)
@@ -107,7 +107,7 @@
     RefPtr<InspectorFrontendHost> m_frontendHost;
     OwnPtr<InspectorFrontendClientLocal::Settings> m_settings;
     bool m_frontendLoaded;
-    String m_evaluateOnLoad;
+    Vector<String> m_evaluateOnLoad;
     OwnPtr<InspectorBackendDispatchTask> m_dispatchTask;
 };
 

Modified: trunk/Source/WebCore/inspector/front-end/InspectorFrontendAPI.js (101660 => 101661)


--- trunk/Source/WebCore/inspector/front-end/InspectorFrontendAPI.js	2011-12-01 13:30:40 UTC (rev 101660)
+++ trunk/Source/WebCore/inspector/front-end/InspectorFrontendAPI.js	2011-12-01 13:33:53 UTC (rev 101661)
@@ -28,58 +28,76 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
- InspectorFrontendAPI = {
-     isDebuggingEnabled: function()
-     {
-         return WebInspector.panels.scripts.debuggingEnabled;
-     },
+InspectorFrontendAPI = {
+    _pendingCommands: [],
 
-     setDebuggingEnabled: function(enabled)
-     {
-         if (enabled) {
-             WebInspector.panels.scripts.enableDebugging();
-             WebInspector.inspectorView.setCurrentPanel(WebInspector.panels.scripts);
-         } else
-             WebInspector.panels.scripts.disableDebugging();
-     },
+    isDebuggingEnabled: function()
+    {
+        return WebInspector.panels.scripts.debuggingEnabled;
+    },
 
-     isTimelineProfilingEnabled: function()
-     {
-         return WebInspector.panels.timeline.timelineProfilingEnabled;
-     },
+    setDebuggingEnabled: function(enabled)
+    {
+        if (enabled) {
+            WebInspector.panels.scripts.enableDebugging();
+            WebInspector.inspectorView.setCurrentPanel(WebInspector.panels.scripts);
+        } else
+            WebInspector.panels.scripts.disableDebugging();
+    },
 
-     setTimelineProfilingEnabled: function(enabled)
-     {
-         WebInspector.panels.timeline.setTimelineProfilingEnabled(enabled);
-     },
+    isTimelineProfilingEnabled: function()
+    {
+        return WebInspector.panels.timeline.timelineProfilingEnabled;
+    },
 
-     isProfilingJavaScript: function()
-     {
-         return WebInspector.CPUProfileType.instance && WebInspector.CPUProfileType.instance.isRecordingProfile();
-     },
+    setTimelineProfilingEnabled: function(enabled)
+    {
+        WebInspector.panels.timeline.setTimelineProfilingEnabled(enabled);
+    },
 
-     startProfilingJavaScript: function()
-     {
-         WebInspector.panels.profiles.enableProfiler();
-         WebInspector.inspectorView.setCurrentPanel(WebInspector.panels.profiles);
-         if (WebInspector.CPUProfileType.instance)
-             WebInspector.CPUProfileType.instance.startRecordingProfile();
-     },
+    isProfilingJavaScript: function()
+    {
+        return WebInspector.CPUProfileType.instance && WebInspector.CPUProfileType.instance.isRecordingProfile();
+    },
 
-     stopProfilingJavaScript: function()
-     {
-         if (WebInspector.CPUProfileType.instance)
-             WebInspector.CPUProfileType.instance.stopRecordingProfile();
-         WebInspector.inspectorView.setCurrentPanel(WebInspector.panels.profiles);
-     },
+    startProfilingJavaScript: function()
+    {
+        WebInspector.panels.profiles.enableProfiler();
+        WebInspector.inspectorView.setCurrentPanel(WebInspector.panels.profiles);
+        if (WebInspector.CPUProfileType.instance)
+            WebInspector.CPUProfileType.instance.startRecordingProfile();
+    },
 
-     setAttachedWindow: function(attached)
-     {
-         WebInspector.attached = attached;
-     },
+    stopProfilingJavaScript: function()
+    {
+        if (WebInspector.CPUProfileType.instance)
+            WebInspector.CPUProfileType.instance.stopRecordingProfile();
+        WebInspector.inspectorView.setCurrentPanel(WebInspector.panels.profiles);
+    },
 
-     showConsole: function()
-     {
-         WebInspector.inspectorView.setCurrentPanel(WebInspector.panels.console);
-     }
- }
+    setAttachedWindow: function(attached)
+    {
+        WebInspector.attached = attached;
+    },
+
+    showConsole: function()
+    {
+        WebInspector.inspectorView.setCurrentPanel(WebInspector.panels.console);
+    },
+
+    dispatch: function(signature)
+    {
+        if (WebInspector.panels) {
+            var methodName = signature.shift();
+            return InspectorFrontendAPI[methodName].apply(InspectorFrontendAPI, signature);
+        }
+        InspectorFrontendAPI._pendingCommands.push(signature);
+    },
+
+    loadCompleted: function()
+    {
+        for (var i = 0; i < InspectorFrontendAPI._pendingCommands.length; ++i)
+            InspectorFrontendAPI.dispatch(InspectorFrontendAPI._pendingCommands[i]);
+        InspectorFrontendAPI._pendingCommands = [];
+    }
+}

Modified: trunk/Source/WebCore/inspector/front-end/inspector.js (101660 => 101661)


--- trunk/Source/WebCore/inspector/front-end/inspector.js	2011-12-01 13:30:40 UTC (rev 101660)
+++ trunk/Source/WebCore/inspector/front-end/inspector.js	2011-12-01 13:33:53 UTC (rev 101661)
@@ -417,6 +417,7 @@
 
     WebInspector.CSSCompletions.requestCSSNameCompletions();
     WebInspector.WorkerManager.loadCompleted();
+    InspectorFrontendAPI.loadCompleted();
 }
 
 WebInspector.addPanel = function(panel)

Modified: trunk/Source/WebKit2/ChangeLog (101660 => 101661)


--- trunk/Source/WebKit2/ChangeLog	2011-12-01 13:30:40 UTC (rev 101660)
+++ trunk/Source/WebKit2/ChangeLog	2011-12-01 13:33:53 UTC (rev 101661)
@@ -1,3 +1,13 @@
+2011-12-01  Pavel Feldman  <[email protected]>
+
+        Web Inspector: restore WebKit2 Safari menu items after capabilities refactoring regression.
+        https://bugs.webkit.org/show_bug.cgi?id=73554
+
+        Reviewed by Yury Semikhatsky.
+
+        * UIProcess/WebInspectorProxy.cpp:
+        (WebKit::WebInspectorProxy::didClose):
+
 2011-11-30  Alexey Proskuryakov  <[email protected]>
 
         Remove an unneeded argument from FrameLoaderClient::download

Modified: trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp (101660 => 101661)


--- trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp	2011-12-01 13:30:40 UTC (rev 101660)
+++ trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp	2011-12-01 13:33:53 UTC (rev 101661)
@@ -230,6 +230,9 @@
 void WebInspectorProxy::didClose()
 {
     m_isVisible = false;
+    m_isDebuggingJavaScript = false;
+    m_isProfilingJavaScript = false;
+    m_isProfilingPage = false;
 
     if (m_isAttached) {
         // Detach here so we only need to have one code path that is responsible for cleaning up the inspector
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to