Title: [107362] trunk/Source
Revision
107362
Author
[email protected]
Date
2012-02-09 22:23:49 -0800 (Thu, 09 Feb 2012)

Log Message

Prevent attaching when inspecting the Web Inspector.

Source/WebCore:

https://webkit.org/b/78304

Reviewed by Brian Weinstein.

* inspector/InspectorFrontendClientLocal.cpp:
(WebCore::InspectorFrontendClientLocal::canAttachWindow): Prevent attaching when the page is an inspector page.

Source/WebKit2:

Also adds some comments about keeping in sync with InspectorFrontendClientLocal::canAttachWindow
and why there are two implementations of the same function.

https://webkit.org/b/78304

Reviewed by Brian Weinstein.

* UIProcess/WebInspectorProxy.cpp:
(WebKit::WebInspectorProxy::canAttach): Prevent attaching when the page is an inspector page.
Added comments about InspectorFrontendClientLocal::canAttachWindow.
* UIProcess/WebInspectorProxy.h:
(WebInspectorProxy): Added comment about keeping in sync with InspectorFrontendClientLocal.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (107361 => 107362)


--- trunk/Source/WebCore/ChangeLog	2012-02-10 06:18:09 UTC (rev 107361)
+++ trunk/Source/WebCore/ChangeLog	2012-02-10 06:23:49 UTC (rev 107362)
@@ -1,3 +1,14 @@
+2012-02-09  Timothy Hatcher  <[email protected]>
+
+        Prevent attaching when inspecting the Web Inspector.
+
+        https://webkit.org/b/78304
+
+        Reviewed by Brian Weinstein.
+
+        * inspector/InspectorFrontendClientLocal.cpp:
+        (WebCore::InspectorFrontendClientLocal::canAttachWindow): Prevent attaching when the page is an inspector page.
+
 2012-02-09  Dana Jansens  <[email protected]>
 
         [Chromium] Assertion failure minX <= maxX in Region.cpp

Modified: trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp (107361 => 107362)


--- trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp	2012-02-10 06:18:09 UTC (rev 107361)
+++ trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp	2012-02-10 06:23:49 UTC (rev 107362)
@@ -159,10 +159,12 @@
 
 bool InspectorFrontendClientLocal::canAttachWindow()
 {
+    // Don't allow the attach if the window would be too small to accommodate the minimum inspector height.
+    // Also don't allow attaching to another inspector -- two inspectors in one window is too much!
+    bool isInspectorPage = m_inspectorController->inspectedPage()->inspectorController()->hasInspectorFrontendClient();
     unsigned inspectedPageHeight = m_inspectorController->inspectedPage()->mainFrame()->view()->visibleHeight();
-
-    // Don't allow the attach if the window would be too small to accommodate the minimum inspector height.
-    return minimumAttachedHeight <= inspectedPageHeight * maximumAttachedHeightRatio;
+    unsigned maximumAttachedHeight = inspectedPageHeight * maximumAttachedHeightRatio;
+    return minimumAttachedHeight <= maximumAttachedHeight && !isInspectorPage;
 }
 
 void InspectorFrontendClientLocal::changeAttachedWindowHeight(unsigned height)

Modified: trunk/Source/WebKit2/ChangeLog (107361 => 107362)


--- trunk/Source/WebKit2/ChangeLog	2012-02-10 06:18:09 UTC (rev 107361)
+++ trunk/Source/WebKit2/ChangeLog	2012-02-10 06:23:49 UTC (rev 107362)
@@ -1,3 +1,20 @@
+2012-02-09  Timothy Hatcher  <[email protected]>
+
+        Prevent attaching when inspecting the Web Inspector.
+
+        Also adds some comments about keeping in sync with InspectorFrontendClientLocal::canAttachWindow
+        and why there are two implementations of the same function.
+
+        https://webkit.org/b/78304
+
+        Reviewed by Brian Weinstein.
+
+        * UIProcess/WebInspectorProxy.cpp:
+        (WebKit::WebInspectorProxy::canAttach): Prevent attaching when the page is an inspector page.
+        Added comments about InspectorFrontendClientLocal::canAttachWindow.
+        * UIProcess/WebInspectorProxy.h:
+        (WebInspectorProxy): Added comment about keeping in sync with InspectorFrontendClientLocal.
+
 2012-02-09  Alexey Proskuryakov  <[email protected]>
 
         Managed network proxy settings are not used in WebProcess

Modified: trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp (107361 => 107362)


--- trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp	2012-02-10 06:18:09 UTC (rev 107361)
+++ trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp	2012-02-10 06:23:49 UTC (rev 107362)
@@ -260,8 +260,17 @@
 
 bool WebInspectorProxy::canAttach()
 {
-    unsigned inspectedWindowHeight = platformInspectedWindowHeight();
-    return inspectedWindowHeight && minimumAttachedHeight <= (inspectedWindowHeight * 3 / 4);
+    // Keep this in sync with InspectorFrontendClientLocal::canAttachWindow. There are two implementations
+    // to make life easier in the multi-process world we have. WebInspectorProxy uses canAttach to decide if
+    // we can attach on open (on the UI process side). And InspectorFrontendClientLocal::canAttachWindow is
+    // used to decide if we can attach when the attach button is pressed (on the WebProcess side).
+
+    // Don't allow the attach if the window would be too small to accommodate the minimum inspector height.
+    // Also don't allow attaching to another inspector -- two inspectors in one window is too much!
+    bool isInspectorPage = m_page->pageGroup() == inspectorPageGroup();
+    unsigned inspectedPageHeight = platformInspectedWindowHeight();
+    unsigned maximumAttachedHeight = inspectedPageHeight * 3 / 4;
+    return minimumAttachedHeight <= maximumAttachedHeight && !isInspectorPage;
 }
 
 bool WebInspectorProxy::shouldOpenAttached()

Modified: trunk/Source/WebKit2/UIProcess/WebInspectorProxy.h (107361 => 107362)


--- trunk/Source/WebKit2/UIProcess/WebInspectorProxy.h	2012-02-10 06:18:09 UTC (rev 107361)
+++ trunk/Source/WebKit2/UIProcess/WebInspectorProxy.h	2012-02-10 06:23:49 UTC (rev 107362)
@@ -164,6 +164,8 @@
 
     static const unsigned initialWindowWidth = 750;
     static const unsigned initialWindowHeight = 650;
+
+    // Keep this in sync with the value in InspectorFrontendClientLocal.
     static const unsigned minimumAttachedHeight = 250;
 
     WebPageProxy* m_page;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to