Skip to content
Permalink
Browse files
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.


Canonical link: https://commits.webkit.org/95234@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@107362 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
xeenon committed Feb 10, 2012
1 parent 5cd6591 commit eee81e05b4bec93eef4ef28a4c89fc4962a1d3eb
Showing 5 changed files with 46 additions and 5 deletions.
@@ -1,3 +1,14 @@
2012-02-09 Timothy Hatcher <timothy@apple.com>

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 <danakj@chromium.org>

[Chromium] Assertion failure minX <= maxX in Region.cpp
@@ -159,10 +159,12 @@ void InspectorFrontendClientLocal::requestDetachWindow()

bool InspectorFrontendClientLocal::canAttachWindow()
{
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;
// 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();
unsigned maximumAttachedHeight = inspectedPageHeight * maximumAttachedHeightRatio;
return minimumAttachedHeight <= maximumAttachedHeight && !isInspectorPage;
}

void InspectorFrontendClientLocal::changeAttachedWindowHeight(unsigned height)
@@ -1,3 +1,20 @@
2012-02-09 Timothy Hatcher <timothy@apple.com>

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 <ap@apple.com>

Managed network proxy settings are not used in WebProcess
@@ -260,8 +260,17 @@ void WebInspectorProxy::inspectedURLChanged(const String& urlString)

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()
@@ -164,6 +164,8 @@ class WebInspectorProxy : public APIObject

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;

0 comments on commit eee81e0

Please sign in to comment.