Cap scroll count to 5000

Fixes #1694
This commit is contained in:
Florian Bruhin 2017-02-11 22:26:37 +01:00
parent b73cda22de
commit a4f04db848
3 changed files with 2 additions and 7 deletions

View File

@ -252,9 +252,6 @@ class WebEngineScroller(browsertab.AbstractScroller):
"""QtWebEngine implementations related to scrolling."""
# FIXME:qtwebengine
# using stuff here with a big count/argument causes memory leaks and hangs
def __init__(self, tab, parent=None):
super().__init__(tab, parent)
self._pos_perc = (0, 0)
@ -271,8 +268,7 @@ class WebEngineScroller(browsertab.AbstractScroller):
self._pos_perc = (None, None)
def _key_press(self, key, count=1):
# FIXME:qtwebengine Abort scrolling if the minimum/maximum was reached.
for _ in range(count):
for _ in range(min(count, 5000)):
press_evt = QKeyEvent(QEvent.KeyPress, key, Qt.NoModifier, 0, 0, 0)
release_evt = QKeyEvent(QEvent.KeyRelease, key, Qt.NoModifier,
0, 0, 0)

View File

@ -443,7 +443,7 @@ class WebKitScroller(browsertab.AbstractScroller):
# FIXME:qtwebengine needed?
# self._widget.setFocus()
for _ in range(count):
for _ in range(min(count, 5000)):
press_evt = QKeyEvent(QEvent.KeyPress, key, Qt.NoModifier, 0, 0, 0)
release_evt = QKeyEvent(QEvent.KeyRelease, key, Qt.NoModifier,
0, 0, 0)

View File

@ -142,7 +142,6 @@ Feature: Scrolling
And I wait until the scroll position changed to 0/0
Then the page should not be scrolled
@qtwebengine_skip: Causes memory leak...
Scenario: Scrolling down with a very big count
When I run :scroll down with count 99999999999
And I wait until the scroll position changed