parent
530721522a
commit
483a5f8103
@ -90,6 +90,7 @@ Fixed
|
||||
- Fix for tab indicators getting lost when moving tabs
|
||||
- Fixed handling of backspace in number hinting mode
|
||||
- Fixed `FileNotFoundError` when starting in some cases on old Qt versions
|
||||
- Fixed sharing of cookies between tabs when `private-browsing` is enabled
|
||||
|
||||
v0.6.2
|
||||
------
|
||||
|
@ -426,7 +426,9 @@ def _init_modules(args, crash_handler):
|
||||
proxy.init()
|
||||
log.init.debug("Initializing cookies...")
|
||||
cookie_jar = cookies.CookieJar(qApp)
|
||||
ram_cookie_jar = cookies.RAMCookieJar(qApp)
|
||||
objreg.register('cookie-jar', cookie_jar)
|
||||
objreg.register('ram-cookie-jar', ram_cookie_jar)
|
||||
log.init.debug("Initializing cache...")
|
||||
diskcache = cache.DiskCache(standarddir.cache(), parent=qApp)
|
||||
objreg.register('cache', diskcache)
|
||||
|
@ -31,7 +31,6 @@ from PyQt5.QtNetwork import (QNetworkAccessManager, QNetworkReply, QSslError,
|
||||
from qutebrowser.config import config
|
||||
from qutebrowser.utils import (message, log, usertypes, utils, objreg, qtutils,
|
||||
urlutils, debug)
|
||||
from qutebrowser.browser import cookies
|
||||
from qutebrowser.browser.network import qutescheme, networkreply
|
||||
from qutebrowser.browser.network import filescheme
|
||||
|
||||
@ -184,15 +183,15 @@ class NetworkManager(QNetworkAccessManager):
|
||||
private: Whether we're currently in private browsing mode.
|
||||
"""
|
||||
if private:
|
||||
cookie_jar = cookies.RAMCookieJar(self)
|
||||
self.setCookieJar(cookie_jar)
|
||||
cookie_jar = objreg.get('ram-cookie-jar')
|
||||
else:
|
||||
# We have a shared cookie jar - we restore its parent so we don't
|
||||
# take ownership of it.
|
||||
app = QCoreApplication.instance()
|
||||
cookie_jar = objreg.get('cookie-jar')
|
||||
self.setCookieJar(cookie_jar)
|
||||
cookie_jar.setParent(app)
|
||||
|
||||
# We have a shared cookie jar - we restore its parent so we don't
|
||||
# take ownership of it.
|
||||
self.setCookieJar(cookie_jar)
|
||||
app = QCoreApplication.instance()
|
||||
cookie_jar.setParent(app)
|
||||
|
||||
def _set_cache(self):
|
||||
"""Set the cache of the NetworkManager correctly.
|
||||
|
@ -455,3 +455,12 @@ Feature: Various utility commands.
|
||||
When I run :set-cmd-text :message-i "Hello World"
|
||||
And I run :command-accept
|
||||
Then the message "Hello World" should be shown
|
||||
|
||||
## https://github.com/The-Compiler/qutebrowser/issues/1219
|
||||
|
||||
Scenario: Sharing cookies with private browsing
|
||||
When I set general -> private-browsing to true
|
||||
And I open cookies/set?qute-test=42 without waiting
|
||||
And I wait until cookies is loaded
|
||||
And I open cookies in a new tab
|
||||
Then the cookie qute-test should be set to 42
|
||||
|
@ -18,6 +18,7 @@
|
||||
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import sys
|
||||
import json
|
||||
import os.path
|
||||
import subprocess
|
||||
|
||||
@ -60,3 +61,15 @@ def update_documentation():
|
||||
def pdfjs_available():
|
||||
if not pdfjs.is_available():
|
||||
pytest.skip("No pdfjs installation found.")
|
||||
|
||||
|
||||
@bdd.then(bdd.parsers.parse('the cookie {name} should be set to {value}'))
|
||||
def check_cookie(quteproc, name, value):
|
||||
"""Check if a given cookie is set correctly.
|
||||
|
||||
This assumes we're on the httpbin cookies page.
|
||||
"""
|
||||
content = quteproc.get_content()
|
||||
data = json.loads(content)
|
||||
print(data)
|
||||
assert data['cookies'][name] == value
|
||||
|
@ -70,6 +70,7 @@ class Request(testprocess.Line):
|
||||
[http.client.UNAUTHORIZED, http.client.OK],
|
||||
'/redirect-to': [http.client.FOUND],
|
||||
'/status/404': [http.client.NOT_FOUND],
|
||||
'/cookies/set': [http.client.FOUND],
|
||||
}
|
||||
|
||||
sanitized = QUrl('http://localhost' + self.path).path() # Remove ?foo
|
||||
|
@ -34,6 +34,7 @@ import pytest
|
||||
import helpers.stubs as stubsmod
|
||||
from qutebrowser.config import config
|
||||
from qutebrowser.utils import objreg
|
||||
from qutebrowser.browser import cookies
|
||||
|
||||
from PyQt5.QtCore import QEvent, QSize, Qt
|
||||
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QVBoxLayout
|
||||
@ -281,11 +282,14 @@ def fake_keyevent_factory():
|
||||
def cookiejar_and_cache(stubs):
|
||||
"""Fixture providing a fake cookie jar and cache."""
|
||||
jar = QNetworkCookieJar()
|
||||
ram_jar = cookies.RAMCookieJar()
|
||||
cache = stubs.FakeNetworkCache()
|
||||
objreg.register('cookie-jar', jar)
|
||||
objreg.register('ram-cookie-jar', ram_jar)
|
||||
objreg.register('cache', cache)
|
||||
yield
|
||||
objreg.delete('cookie-jar')
|
||||
objreg.delete('ram-cookie-jar')
|
||||
objreg.delete('cache')
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user