Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(424)

Unified Diff: third_party/WebKit/Source/web/ChromeClientImpl.cpp

Issue 2773573002: window.open() should gate new tab/new popup based on toolbar visibility. (Closed)
Patch Set: buttons Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/web/ChromeClientImpl.cpp
diff --git a/third_party/WebKit/Source/web/ChromeClientImpl.cpp b/third_party/WebKit/Source/web/ChromeClientImpl.cpp
index cf15d6dd1d0e6dbf307d6ffaf2fd2589d005ffde..c654d6be30177c1b2ac4bedb8d36b8f2f446c579 100644
--- a/third_party/WebKit/Source/web/ChromeClientImpl.cpp
+++ b/third_party/WebKit/Source/web/ChromeClientImpl.cpp
@@ -331,12 +331,19 @@ void updatePolicyForEvent(const WebInputEvent* inputEvent,
}
WebNavigationPolicy getNavigationPolicy(const WindowFeatures& features) {
- // If our default configuration was modified by a script or wasn't
- // created by a user gesture, then show as a popup. Else, let this
- // new window be opened as a toplevel window.
- bool asPopup = !features.toolBarVisible || !features.statusBarVisible ||
- !features.scrollbarsVisible || !features.menuBarVisible ||
- !features.resizable;
+ // If the window features didn't enable the toolbar, or this window wasn't
+ // created by a user gesture, show as a popup instead of a new tab.
+ //
+ // Note: this previously also checked that menubar, resizable, scrollbar, and
+ // statusbar are enabled too. When no feature string is specified, these
+ // features default to enabled (and the window opens as a new tab). However,
+ // when a feature string is specified, any *unspecified* features default to
+ // disabled, often causing the window to open as a popup instead.
+ //
+ // As specifying menubar, resizable, scrollbar, and statusbar have no effect
+ // on the UI, just ignore them and only consider whether or not the toolbar is
+ // enabled, which matches Firefox's behavior.
+ bool asPopup = !features.toolBarVisible;
NavigationPolicy policy = NavigationPolicyNewForegroundTab;
if (asPopup)

Powered by Google App Engine
This is Rietveld 408576698