parent
6bd092a948
commit
3c625790cc
@ -272,8 +272,8 @@ class TabbedBrowser(tabwidget.TabWidget):
|
|||||||
"""
|
"""
|
||||||
idx = self.indexOf(tab)
|
idx = self.indexOf(tab)
|
||||||
if idx == -1:
|
if idx == -1:
|
||||||
raise ValueError("tab {} is not contained in TabbedWidget!".format(
|
raise TabDeletedError("tab {} is not contained in "
|
||||||
tab))
|
"TabbedWidget!".format(tab))
|
||||||
if tab is self._now_focused:
|
if tab is self._now_focused:
|
||||||
self._now_focused = None
|
self._now_focused = None
|
||||||
if tab is objreg.get('last-focused-tab', None, scope='window',
|
if tab is objreg.get('last-focused-tab', None, scope='window',
|
||||||
@ -350,7 +350,11 @@ class TabbedBrowser(tabwidget.TabWidget):
|
|||||||
@pyqtSlot(webview.WebView)
|
@pyqtSlot(webview.WebView)
|
||||||
def on_window_close_requested(self, widget):
|
def on_window_close_requested(self, widget):
|
||||||
"""Close a tab with a widget given."""
|
"""Close a tab with a widget given."""
|
||||||
self.close_tab(widget)
|
try:
|
||||||
|
self.close_tab(widget)
|
||||||
|
except TabDeletedError:
|
||||||
|
log.webview.debug("Requested to close {!r} which does not "
|
||||||
|
"exist!".format(widget))
|
||||||
|
|
||||||
@pyqtSlot('QUrl', bool)
|
@pyqtSlot('QUrl', bool)
|
||||||
def tabopen(self, url=None, background=None, explicit=False):
|
def tabopen(self, url=None, background=None, explicit=False):
|
||||||
|
22
tests/integration/data/javascript/issue906.html
Normal file
22
tests/integration/data/javascript/issue906.html
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<button onclick="openWin()">Open "myWindow"</button>
|
||||||
|
<button onclick="closeWin()">Close "myWindow"</button>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
var myWindow;
|
||||||
|
|
||||||
|
function openWin() {
|
||||||
|
myWindow = window.open("", "myWindow", "width=200, height=100");
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeWin() {
|
||||||
|
myWindow.close();
|
||||||
|
myWindow.close();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
15
tests/integration/features/javascript.feature
Normal file
15
tests/integration/features/javascript.feature
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
Feature: Javascript stuff
|
||||||
|
|
||||||
|
Integration with javascript.
|
||||||
|
|
||||||
|
# https://github.com/The-Compiler/qutebrowser/issues/906
|
||||||
|
|
||||||
|
Scenario: Closing a JS window twice (issue 906)
|
||||||
|
When I open about:blank
|
||||||
|
And I open data/javascript/issue906.html in a new tab
|
||||||
|
And I run :hint
|
||||||
|
And I run :follow-hint a
|
||||||
|
And I run :tab-focus 2
|
||||||
|
And I run :hint
|
||||||
|
And I run :follow-hint s
|
||||||
|
Then "Requested to close * which does not exist!" should be logged
|
21
tests/integration/features/test_javascript.py
Normal file
21
tests/integration/features/test_javascript.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
|
||||||
|
|
||||||
|
# Copyright 2016 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
|
||||||
|
#
|
||||||
|
# This file is part of qutebrowser.
|
||||||
|
#
|
||||||
|
# qutebrowser is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# qutebrowser is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import pytest_bdd as bdd
|
||||||
|
bdd.scenarios('javascript.feature')
|
Loading…
Reference in New Issue
Block a user