diff --git a/qutebrowser/browser/webengine/webenginesettings.py b/qutebrowser/browser/webengine/webenginesettings.py index 4b5c03555..eadc4c540 100644 --- a/qutebrowser/browser/webengine/webenginesettings.py +++ b/qutebrowser/browser/webengine/webenginesettings.py @@ -240,7 +240,7 @@ MAPPINGS = { Attribute(QWebEngineSettings.AutoLoadImages), 'content.javascript.enabled': Attribute(QWebEngineSettings.JavascriptEnabled), - 'content.javascript.can_open_windows_automatically': + 'content.javascript.can_open_tabs_automatically': Attribute(QWebEngineSettings.JavascriptCanOpenWindows), 'content.javascript.can_access_clipboard': Attribute(QWebEngineSettings.JavascriptCanAccessClipboard), diff --git a/qutebrowser/browser/webkit/webkitsettings.py b/qutebrowser/browser/webkit/webkitsettings.py index ef01adc5c..a5803cbd6 100644 --- a/qutebrowser/browser/webkit/webkitsettings.py +++ b/qutebrowser/browser/webkit/webkitsettings.py @@ -155,9 +155,9 @@ MAPPINGS = { Attribute(QWebSettings.AutoLoadImages), 'content.javascript.enabled': Attribute(QWebSettings.JavascriptEnabled), - 'content.javascript.can_open_windows_automatically': + 'content.javascript.can_open_tabs_automatically': Attribute(QWebSettings.JavascriptCanOpenWindows), - 'content.javascript.can_close_windows': + 'content.javascript.can_close_tabs': Attribute(QWebSettings.JavascriptCanCloseWindows), 'content.javascript.can_access_clipboard': Attribute(QWebSettings.JavascriptCanAccessClipboard), diff --git a/qutebrowser/config/configdata.yml b/qutebrowser/config/configdata.yml index 5195b5f77..a9c8cb1c9 100644 --- a/qutebrowser/config/configdata.yml +++ b/qutebrowser/config/configdata.yml @@ -368,17 +368,16 @@ content.javascript.can_access_clipboard: With QtWebEngine, writing the clipboard as response to a user interaction is always allowed. -content.javascript.can_close_windows: +content.javascript.can_close_tabs: default: false type: Bool backend: QtWebKit - desc: Whether JavaScript programs can close windows. + desc: Whether JavaScript can close tabs. -content.javascript.can_open_windows_automatically: +content.javascript.can_open_tabs_automatically: default: false type: Bool - desc: Whether JavaScript programs can open new windows without user - interaction. + desc: Whether JavaScript can open new tabs without user interaction. content.javascript.enabled: default: true diff --git a/tests/end2end/features/javascript.feature b/tests/end2end/features/javascript.feature index 4f479d0ca..99ab9ce69 100644 --- a/tests/end2end/features/javascript.feature +++ b/tests/end2end/features/javascript.feature @@ -55,16 +55,16 @@ Feature: Javascript stuff And I wait for "Focus object changed: *" in the log Then no crash should happen - Scenario: Opening window without user interaction with javascript-can-open-windows-automatically set to true + Scenario: Opening window without user interaction with javascript-can-open-tabs-automatically set to true When I open data/hello.txt - And I set content.javascript.can_open_windows_automatically to true + And I set content.javascript.can_open_tabs_automatically to true And I run :tab-only And I run :jseval if (window.open('about:blank')) { console.log('window opened'); } else { console.log('error while opening window'); } Then the javascript message "window opened" should be logged - Scenario: Opening window without user interaction with javascript-can-open-windows-automatically set to false + Scenario: Opening window without user interaction with javascript-can-open-tabs-automatically set to false When I open data/hello.txt - And I set content.javascript.can_open_windows_automatically to false + And I set content.javascript.can_open_tabs_automatically to false And I run :tab-only And I run :jseval if (window.open('about:blank')) { console.log('window opened'); } else { console.log('error while opening window'); } Then the javascript message "error while opening window" should be logged