Title: [105600] trunk/Source
Revision
105600
Author
[email protected]
Date
2012-01-23 02:04:10 -0800 (Mon, 23 Jan 2012)

Log Message

Web Inspector: PageAgent.open() dosen't belong to the protocol.
https://bugs.webkit.org/show_bug.cgi?id=74790

Reviewed by Yury Semikhatsky.

Source/WebCore:

* inspector/Inspector.json:
* inspector/InspectorFrontendClient.h:
* inspector/InspectorFrontendClientLocal.cpp:
(WebCore::InspectorFrontendClientLocal::openInNewTab):
* inspector/InspectorFrontendClientLocal.h:
* inspector/InspectorFrontendHost.cpp:
(WebCore::InspectorFrontendHost::openInNewTab):
* inspector/InspectorFrontendHost.h:
* inspector/InspectorFrontendHost.idl:
* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::navigate):
* inspector/InspectorPageAgent.h:
* inspector/front-end/ImageView.js:
(WebInspector.ImageView.prototype._openInNewTab):
* inspector/front-end/InspectorFrontendHostStub.js:
(.WebInspector.InspectorFrontendHostStub.prototype.openInNewTab):
* inspector/front-end/NetworkPanel.js:
(WebInspector.NetworkDataGridNode.prototype._openInNewTab):
* inspector/front-end/ResourcesPanel.js:
(WebInspector.FrameResourceTreeElement.prototype.ondblclick):
* inspector/front-end/inspector.js:
(WebInspector.openResource):

Source/WebKit/chromium:

* public/WebDevToolsFrontendClient.h:
(WebKit::WebDevToolsFrontendClient::openInNewTab):
* src/InspectorFrontendClientImpl.cpp:
(WebKit::InspectorFrontendClientImpl::openInNewTab):
(WebKit::InspectorFrontendClientImpl::saveAs):
* src/InspectorFrontendClientImpl.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (105599 => 105600)


--- trunk/Source/WebCore/ChangeLog	2012-01-23 09:59:08 UTC (rev 105599)
+++ trunk/Source/WebCore/ChangeLog	2012-01-23 10:04:10 UTC (rev 105600)
@@ -1,3 +1,33 @@
+2012-01-20  Pavel Feldman  <[email protected]>
+
+        Web Inspector: PageAgent.open() dosen't belong to the protocol.
+        https://bugs.webkit.org/show_bug.cgi?id=74790
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/Inspector.json:
+        * inspector/InspectorFrontendClient.h:
+        * inspector/InspectorFrontendClientLocal.cpp:
+        (WebCore::InspectorFrontendClientLocal::openInNewTab):
+        * inspector/InspectorFrontendClientLocal.h:
+        * inspector/InspectorFrontendHost.cpp:
+        (WebCore::InspectorFrontendHost::openInNewTab):
+        * inspector/InspectorFrontendHost.h:
+        * inspector/InspectorFrontendHost.idl:
+        * inspector/InspectorPageAgent.cpp:
+        (WebCore::InspectorPageAgent::navigate):
+        * inspector/InspectorPageAgent.h:
+        * inspector/front-end/ImageView.js:
+        (WebInspector.ImageView.prototype._openInNewTab):
+        * inspector/front-end/InspectorFrontendHostStub.js:
+        (.WebInspector.InspectorFrontendHostStub.prototype.openInNewTab):
+        * inspector/front-end/NetworkPanel.js:
+        (WebInspector.NetworkDataGridNode.prototype._openInNewTab):
+        * inspector/front-end/ResourcesPanel.js:
+        (WebInspector.FrameResourceTreeElement.prototype.ondblclick):
+        * inspector/front-end/inspector.js:
+        (WebInspector.openResource):
+
 2012-01-23  Ilya Tikhonovsky  <[email protected]>
 
         Web Inspector: DetailedHeapSnapshot: Replace the list of retainers with the expandable tree (to get rid of cycles)

Modified: trunk/Source/WebCore/inspector/Inspector.json (105599 => 105600)


--- trunk/Source/WebCore/inspector/Inspector.json	2012-01-23 09:59:08 UTC (rev 105599)
+++ trunk/Source/WebCore/inspector/Inspector.json	2012-01-23 10:04:10 UTC (rev 105600)
@@ -225,13 +225,11 @@
                 "description": "Reloads given page optionally ignoring the cache."
             },
             {
-                "name": "open",
+                "name": "navigate",
                 "parameters": [
-                    { "name": "url", "type": "string", "description": "URL to open." },
-                    { "name": "newWindow", "optional": true, "type": "boolean", "description": "If true, opens given URL in a new window or tab." }
+                    { "name": "url", "type": "string", "description": "URL to navigate the page to." }
                 ],
-                "description": "Opens given URL either in the inspected page or in a new tab / window.",
-                "hidden": true
+                "description": "Navigates current page to the given URL."
             },
             {
                 "name": "getCookies",

Modified: trunk/Source/WebCore/inspector/InspectorFrontendClient.h (105599 => 105600)


--- trunk/Source/WebCore/inspector/InspectorFrontendClient.h	2012-01-23 09:59:08 UTC (rev 105599)
+++ trunk/Source/WebCore/inspector/InspectorFrontendClient.h	2012-01-23 10:04:10 UTC (rev 105600)
@@ -58,6 +58,7 @@
     virtual void requestDetachWindow() = 0;
     virtual void requestSetDockSide(const String&) = 0;
     virtual void changeAttachedWindowHeight(unsigned) = 0;
+    virtual void openInNewTab(const String& url) = 0;
     virtual bool canSaveAs() = 0;
     virtual void saveAs(const WTF::String& fileName, const WTF::String& content) = 0;
 

Modified: trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp (105599 => 105600)


--- trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp	2012-01-23 09:59:08 UTC (rev 105599)
+++ trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp	2012-01-23 10:04:10 UTC (rev 105600)
@@ -36,6 +36,8 @@
 #include "Chrome.h"
 #include "FloatRect.h"
 #include "Frame.h"
+#include "FrameLoadRequest.h"
+#include "FrameLoader.h"
 #include "FrameView.h"
 #include "InspectorBackendDispatcher.h"
 #include "InspectorController.h"
@@ -46,6 +48,8 @@
 #include "ScriptObject.h"
 #include "Settings.h"
 #include "Timer.h"
+#include "UserGestureIndicator.h"
+#include "WindowFeatures.h"
 #include <wtf/Deque.h>
 
 namespace WebCore {
@@ -169,6 +173,26 @@
     setAttachedWindowHeight(attachedHeight);
 }
 
+void InspectorFrontendClientLocal::openInNewTab(const String& url)
+{
+    UserGestureIndicator indicator(DefinitelyProcessingUserGesture);
+    Page* page = m_inspectorController->inspectedPage();
+    Frame* mainFrame = page->mainFrame();
+    FrameLoadRequest request(mainFrame->document()->securityOrigin(), ResourceRequest(), "_blank");
+
+    bool created;
+    WindowFeatures windowFeatures;
+    Frame* frame = WebCore::createWindow(mainFrame, mainFrame, request, windowFeatures, created);
+    if (!frame)
+        return;
+
+    frame->loader()->setOpener(mainFrame);
+    frame->page()->setOpenedByDOM();
+
+    // FIXME: Why does one use mainFrame and the other frame?
+    frame->loader()->changeLocation(mainFrame->document()->securityOrigin(), frame->document()->completeURL(url), "", false, false);
+}
+
 void InspectorFrontendClientLocal::moveWindowBy(float x, float y)
 {
     FloatRect frameRect = m_frontendPage->chrome()->windowRect();

Modified: trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.h (105599 => 105600)


--- trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.h	2012-01-23 09:59:08 UTC (rev 105599)
+++ trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.h	2012-01-23 10:04:10 UTC (rev 105600)
@@ -67,6 +67,7 @@
     virtual void requestDetachWindow();
     virtual void requestSetDockSide(const String&) { }
     virtual void changeAttachedWindowHeight(unsigned);
+    virtual void openInNewTab(const String& url);
     virtual bool canSaveAs() { return false; }
     virtual void saveAs(const String&, const String&) { }
 

Modified: trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp (105599 => 105600)


--- trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp	2012-01-23 09:59:08 UTC (rev 105599)
+++ trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp	2012-01-23 10:04:10 UTC (rev 105600)
@@ -220,6 +220,12 @@
     Pasteboard::generalPasteboard()->writePlainText(text);
 }
 
+void InspectorFrontendHost::openInNewTab(const String& url)
+{
+    if (m_client)
+        m_client->openInNewTab(url);
+}
+
 bool InspectorFrontendHost::canSaveAs()
 {
     if (m_client)

Modified: trunk/Source/WebCore/inspector/InspectorFrontendHost.h (105599 => 105600)


--- trunk/Source/WebCore/inspector/InspectorFrontendHost.h	2012-01-23 09:59:08 UTC (rev 105599)
+++ trunk/Source/WebCore/inspector/InspectorFrontendHost.h	2012-01-23 10:04:10 UTC (rev 105600)
@@ -73,6 +73,7 @@
     String hiddenPanels();
 
     void copyText(const String& text);
+    void openInNewTab(const String& url);
     bool canSaveAs();
     void saveAs(const String& fileName, const String& content);
 

Modified: trunk/Source/WebCore/inspector/InspectorFrontendHost.idl (105599 => 105600)


--- trunk/Source/WebCore/inspector/InspectorFrontendHost.idl	2012-01-23 09:59:08 UTC (rev 105599)
+++ trunk/Source/WebCore/inspector/InspectorFrontendHost.idl	2012-01-23 10:04:10 UTC (rev 105600)
@@ -50,6 +50,7 @@
         DOMString hiddenPanels();
 
         void copyText(in DOMString text);
+        void openInNewTab(in DOMString url);
         boolean canSaveAs();
         void saveAs(in DOMString fileName, in DOMString content);
 

Modified: trunk/Source/WebCore/inspector/InspectorPageAgent.cpp (105599 => 105600)


--- trunk/Source/WebCore/inspector/InspectorPageAgent.cpp	2012-01-23 09:59:08 UTC (rev 105599)
+++ trunk/Source/WebCore/inspector/InspectorPageAgent.cpp	2012-01-23 10:04:10 UTC (rev 105600)
@@ -46,7 +46,6 @@
 #include "Document.h"
 #include "DocumentLoader.h"
 #include "Frame.h"
-#include "FrameLoadRequest.h"
 #include "FrameView.h"
 #include "HTMLFrameOwnerElement.h"
 #include "HTMLNames.h"
@@ -61,10 +60,10 @@
 #include "Page.h"
 #include "RegularExpression.h"
 #include "ScriptObject.h"
+#include "SecurityOrigin.h"
 #include "SharedBuffer.h"
 #include "TextEncoding.h"
 #include "UserGestureIndicator.h"
-#include "WindowFeatures.h"
 
 #include <wtf/CurrentTime.h>
 #include <wtf/ListHashSet.h>
@@ -349,28 +348,11 @@
     m_page->mainFrame()->loader()->reload(optionalIgnoreCache ? *optionalIgnoreCache : false);
 }
 
-void InspectorPageAgent::open(ErrorString*, const String& url, const bool* const inNewWindow)
+void InspectorPageAgent::navigate(ErrorString*, const String& url)
 {
     UserGestureIndicator indicator(DefinitelyProcessingUserGesture);
-
-    Frame* mainFrame = m_page->mainFrame();
-    Frame* frame;
-    if (inNewWindow && *inNewWindow) {
-        FrameLoadRequest request(mainFrame->document()->securityOrigin(), ResourceRequest(), "_blank");
-
-        bool created;
-        WindowFeatures windowFeatures;
-        frame = WebCore::createWindow(mainFrame, mainFrame, request, windowFeatures, created);
-        if (!frame)
-            return;
-
-        frame->loader()->setOpener(mainFrame);
-        frame->page()->setOpenedByDOM();
-    } else
-        frame = mainFrame;
-
-    // FIXME: Why does one use mainFrame and the other frame?
-    frame->loader()->changeLocation(mainFrame->document()->securityOrigin(), frame->document()->completeURL(url), "", false, false);
+    Frame* frame = m_page->mainFrame();
+    frame->loader()->changeLocation(frame->document()->securityOrigin(), frame->document()->completeURL(url), "", false, false);
 }
 
 static PassRefPtr<InspectorObject> buildObjectForCookie(const Cookie& cookie)

Modified: trunk/Source/WebCore/inspector/InspectorPageAgent.h (105599 => 105600)


--- trunk/Source/WebCore/inspector/InspectorPageAgent.h	2012-01-23 09:59:08 UTC (rev 105599)
+++ trunk/Source/WebCore/inspector/InspectorPageAgent.h	2012-01-23 10:04:10 UTC (rev 105600)
@@ -92,7 +92,7 @@
     void addScriptToEvaluateOnLoad(ErrorString*, const String& source, String* result);
     void removeScriptToEvaluateOnLoad(ErrorString*, const String& identifier);
     void reload(ErrorString*, const bool* const optionalIgnoreCache, const String* optionalScriptToEvaluateOnLoad);
-    void open(ErrorString*, const String& url, const bool* const inNewWindow);
+    void navigate(ErrorString*, const String& url);
     void getCookies(ErrorString*, RefPtr<InspectorArray>& cookies, WTF::String* cookiesString);
     void deleteCookie(ErrorString*, const String& cookieName, const String& domain);
     void getResourceTree(ErrorString*, RefPtr<InspectorObject>&);

Modified: trunk/Source/WebCore/inspector/front-end/ImageView.js (105599 => 105600)


--- trunk/Source/WebCore/inspector/front-end/ImageView.js	2012-01-23 09:59:08 UTC (rev 105599)
+++ trunk/Source/WebCore/inspector/front-end/ImageView.js	2012-01-23 10:04:10 UTC (rev 105600)
@@ -139,7 +139,7 @@
 
     _openInNewTab: function(event)
     {
-        PageAgent.open(this.resource.url, true);
+        InspectorFrontendHost.openInNewTab(this.resource.url);
     }
 }
 

Modified: trunk/Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js (105599 => 105600)


--- trunk/Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js	2012-01-23 09:59:08 UTC (rev 105599)
+++ trunk/Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js	2012-01-23 10:04:10 UTC (rev 105600)
@@ -116,6 +116,11 @@
     {
     },
 
+    openInNewTab: function(url)
+    {
+        window.open(url, "_blank");
+    },
+
     canSaveAs: function(fileName, content)
     {
         return true;

Modified: trunk/Source/WebCore/inspector/front-end/NetworkPanel.js (105599 => 105600)


--- trunk/Source/WebCore/inspector/front-end/NetworkPanel.js	2012-01-23 09:59:08 UTC (rev 105599)
+++ trunk/Source/WebCore/inspector/front-end/NetworkPanel.js	2012-01-23 10:04:10 UTC (rev 105600)
@@ -1722,7 +1722,7 @@
 
     _openInNewTab: function()
     {
-        PageAgent.open(this._resource.url, true);
+        InspectorFrontendHost.openInNewTab(this._resource.url);
     },
 
     get selectable()

Modified: trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js (105599 => 105600)


--- trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js	2012-01-23 09:59:08 UTC (rev 105599)
+++ trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js	2012-01-23 10:04:10 UTC (rev 105600)
@@ -1197,7 +1197,7 @@
 
     ondblclick: function(event)
     {
-        PageAgent.open(this._resource.url, true);
+        InspectorFrontendHost.openInNewTab(this._resource.url);
     },
 
     onattach: function()

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


--- trunk/Source/WebCore/inspector/front-end/inspector.js	2012-01-23 09:59:08 UTC (rev 105599)
+++ trunk/Source/WebCore/inspector/front-end/inspector.js	2012-01-23 10:04:10 UTC (rev 105600)
@@ -586,7 +586,7 @@
         WebInspector.panels.resources.showResource(resource);
         WebInspector.showPanel("resources");
     } else
-        PageAgent.open(resourceURL, true);
+        InspectorFrontendHost.openInNewTab(resourceURL);
 }
 
 WebInspector.openRequestInNetworkPanel = function(resource)

Modified: trunk/Source/WebKit/chromium/ChangeLog (105599 => 105600)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-01-23 09:59:08 UTC (rev 105599)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-01-23 10:04:10 UTC (rev 105600)
@@ -1,3 +1,17 @@
+2012-01-20  Pavel Feldman  <[email protected]>
+
+        Web Inspector: PageAgent.open() dosen't belong to the protocol.
+        https://bugs.webkit.org/show_bug.cgi?id=74790
+
+        Reviewed by Yury Semikhatsky.
+
+        * public/WebDevToolsFrontendClient.h:
+        (WebKit::WebDevToolsFrontendClient::openInNewTab):
+        * src/InspectorFrontendClientImpl.cpp:
+        (WebKit::InspectorFrontendClientImpl::openInNewTab):
+        (WebKit::InspectorFrontendClientImpl::saveAs):
+        * src/InspectorFrontendClientImpl.h:
+
 2012-01-21  David Reveman  <[email protected]>
 
         [Chromium] Incremental texture updates are not atomic.

Modified: trunk/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp (105599 => 105600)


--- trunk/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp	2012-01-23 09:59:08 UTC (rev 105599)
+++ trunk/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp	2012-01-23 10:04:10 UTC (rev 105600)
@@ -124,9 +124,9 @@
     // Do nothing;
 }
 
-void InspectorFrontendClientImpl::saveAs(const String& fileName, const String& content)
+void InspectorFrontendClientImpl::openInNewTab(const String& url)
 {
-    m_client->saveAs(fileName, content);
+    m_client->openInNewTab(url);
 }
 
 bool InspectorFrontendClientImpl::canSaveAs()
@@ -134,6 +134,11 @@
     return true;
 }
 
+void InspectorFrontendClientImpl::saveAs(const String& fileName, const String& content)
+{
+    m_client->saveAs(fileName, content);
+}
+
 void InspectorFrontendClientImpl::inspectedURLChanged(const String& url)
 {
     m_frontendPage->mainFrame()->document()->setTitle("Developer Tools - " + url);

Modified: trunk/Source/WebKit/chromium/src/InspectorFrontendClientImpl.h (105599 => 105600)


--- trunk/Source/WebKit/chromium/src/InspectorFrontendClientImpl.h	2012-01-23 09:59:08 UTC (rev 105599)
+++ trunk/Source/WebKit/chromium/src/InspectorFrontendClientImpl.h	2012-01-23 10:04:10 UTC (rev 105600)
@@ -66,6 +66,9 @@
     virtual void requestDetachWindow();
     virtual void requestSetDockSide(const String&);
     virtual void changeAttachedWindowHeight(unsigned);
+
+    virtual void openInNewTab(const String& url);
+
     virtual bool canSaveAs();
     virtual void saveAs(const WTF::String& fileName, const WTF::String& content);
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to