In a48ea597d0 we fixed settings in private
QtWebEngine windows.
However, this means we also enable local storage for private windows, which was
disabled in QtWebEngine by default:
4ef5831a39 (diff-44ac7d27348388501944f6a8e2e67d8dR207)
It should be safe to enable it, as we get the same behavior as in Chromium, i.e.
a working local storage which entirely lives in RAM.
This also makes those tests work on QtWebKit-NG, presumably because private
browsing for cookies is implemented there.
It also adds a test to at least check whether local storage is isolated from
non-private tabs. I tried writing a test which ensures nothing lands on the hard
disk, but due to QTBUG-52121 this might not happen at all:
https://bugreports.qt.io/browse/QTBUG-52121
Turns out QWebEngineSettings.globalSettings() only sets things on the default
profile. We now get everything from the default profile settings, but set it on
both the default and the private profile.
Fixes#2638
(cherry picked from commit b11a4388cd10b6ff2fd917fca689ebdc50d581ae)
If we don't wait here, we might end up running the subsequent commands (like
:command-history-prev) on the old window while it's still closing, causing an
exception at least on AppVeyor:
Traceback (most recent call last):
File "C:\projects\qutebrowser\qutebrowser\app.py", line 110, in <lambda>
target_arg=target_arg))
File "C:\projects\qutebrowser\qutebrowser\app.py", line 265, in process_pos_args
win_id = mainwindow.get_window(via_ipc, force_tab=True)
File "C:\projects\qutebrowser\qutebrowser\mainwindow\mainwindow.py", line 89, in get_window
window.setWindowState(window.windowState() & ~Qt.WindowMinimized)
RuntimeError: wrapped C/C++ object of type MainWindow has been deleted
This tried to assert that we never create a DiskCache object when private
browsing is turned on. However, when initializing, we still create a global
DiskCache, so this will hit when qutebrowser is started with private browsing
turned on via the config.
We could just not create the DiskCache at all when started in private browsing
mode, however we might still need it later when opening a non-private window.
There's only one global DownloadManager with its own NAM (for downloads not
associated with a page). We can't really decide whether that should be private
or not, so as a best-effort approximation we simply make it private if private
browsing was turned on when starting qutebrowser.
If we simply use sorted() on a dict, we define insert before private-command,
which means the statusbar isn't going to be green when in insert mode while
private browsing.