Skip to content

Commit 00d7607

Browse files
committed
qt: use persisted profile, not off-the-record
When we upgraded from Qt 5.15 to Qt 6, the default profile seemed to have changed from being stored on disk to off-the-record: - https://doc.qt.io/qt-5/qwebengineprofile.html#defaultProfile - https://doc.qt.io/qt-6.5/qwebengineprofile.html#defaultProfile This made the third party widgets (MoonPay, Pocket, ...) lose their cookies/localstorage upon app restart. This commit switches our profile to be stored on disk once more. We choose a new storage name "BitBoxApp" (not "Default" which was used previously) to not run into potential conflicts or very old user sessions that get unexpectedly resumed.
1 parent 2c87545 commit 00d7607

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- Fix wrong estimated confirmation time for ERC20 tokens.
1010
- Enable unlock test wallet in testnet
1111
- Added support to show on the BitBox when a transaction's recipient is an address of a different account on the device.
12+
- Persist third party widget sessions
1213

1314
# v4.47.2
1415
- Linux: fix compatiblity with some versions of Mesa that are incompatible with the bundled wayland libraries

frontends/qt/main.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
// their CSP response headers.
6666
static const char* scheme = "bitboxapp";
6767

68+
static QWebEngineProfile* profile;
6869
static QWebEngineView* view;
6970
static QWebEnginePage* mainPage;
7071
static QWebEnginePage* externalPage;
@@ -91,7 +92,7 @@ class BitBoxApp : public SingleApplication
9192

9293
class WebEnginePage : public QWebEnginePage {
9394
public:
94-
WebEnginePage(QObject* parent) : QWebEnginePage(parent) {}
95+
WebEnginePage(QWebEngineProfile* profile) : QWebEnginePage(profile) {}
9596

9697
QWebEnginePage* createWindow(QWebEnginePage::WebWindowType type) {
9798
Q_UNUSED(type);
@@ -353,7 +354,8 @@ int main(int argc, char *argv[])
353354
}
354355

355356
externalPage = new QWebEnginePage(view);
356-
mainPage = new WebEnginePage(view);
357+
profile = new QWebEngineProfile("BitBoxApp");
358+
mainPage = new WebEnginePage(profile);
357359
view->setPage(mainPage);
358360

359361
pageLoaded = false;
@@ -459,6 +461,12 @@ int main(int argc, char *argv[])
459461
webClass = nullptr;
460462
delete view;
461463
view = nullptr;
464+
// Make sure mainPage is deleted before the profile. This is a requirement for the profile
465+
// to be able to flush to disk properly.
466+
delete mainPage;
467+
mainPage = nullptr;
468+
delete profile;
469+
profile = nullptr;
462470
webClassMutex.unlock();
463471
backendShutdown();
464472
});

0 commit comments

Comments
 (0)