summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJocelyn Turcotte <jocelyn.turcotte@digia.com>2014-04-11 15:12:26 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-04-15 13:55:53 +0200
commit4d1d33022a431c3108c4eb33a60d23b0f013d9b8 (patch)
tree926d53c30f686371a01c6d08e318efccb070aed2 /tests
parent57df12f215cb02e05ee8f197e0843bebd4574a53 (diff)
Fix how NewPopupDisposition is exposed in QQuickWebEngineView
I initially misintepreted the meaning of the enum, assuming that it meant that the window should possibly be blocked. The user_gesture parameter in WebContentsDelegate::AddNewContents is actually doing this, while the popup disposition means that JavaScript requested the window to be opened without one of the standard decoration (i.e. status bar, menu bar, tool bar, etc.). Update the QtQuick API to reflect this, renaming the "isPopup" parameter to a more familiar "isUserInitiated". The popup disposition is named "dialog" to match the previous QWebPage::WebModalDialog enum. Change-Id: Ib0c4bc53671fcf0dd9499aa1be2bbc8c494ba49e Reviewed-by: Michael Bruning <michael.bruning@digia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/quicktestbrowser/quickwindow.qml19
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/quicktestbrowser/quickwindow.qml b/tests/quicktestbrowser/quickwindow.qml
index 891ab5792..f77fec582 100644
--- a/tests/quicktestbrowser/quickwindow.qml
+++ b/tests/quicktestbrowser/quickwindow.qml
@@ -235,6 +235,20 @@ ApplicationWindow {
Component.onCompleted: createEmptyTab()
Component {
+ id: dialogComponent
+ Window {
+ property Item webView: _webView
+ width: 800
+ height: 600
+ visible: true
+ WebEngineView {
+ id: _webView
+ anchors.fill: parent
+ }
+ }
+ }
+
+ Component {
id: tabComponent
WebEngineView {
id: webEngineView
@@ -268,11 +282,14 @@ ApplicationWindow {
}
onNewViewRequested: {
- if (request.popup)
+ if (!request.userInitiated)
print("Warning: Blocked a popup window.")
else if (request.destination == WebEngineView.NewViewInTab) {
var tab = tabs.createEmptyTab()
request.openIn(tab.item)
+ } else if (request.destination == WebEngineView.NewViewInDialog) {
+ var dialog = dialogComponent.createObject()
+ request.openIn(dialog.webView)
} else {
var component = Qt.createComponent("quickwindow.qml")
var window = component.createObject()