From 50edb185ef92658eba3e7ea556abd8e56bccbf95 Mon Sep 17 00:00:00 2001 From: Julien Wajsberg Date: Mon, 23 Sep 2024 13:59:55 +0200 Subject: [PATCH] Support profiling from the toolbox in Thunderbird Release Thunderbird Releases doesn't include the Firefox/ string in its userAgent, therefore we neeed to match Thunderbird/ as well. See also the discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=1920387. --- src/app-logic/browser-connection.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/app-logic/browser-connection.js b/src/app-logic/browser-connection.js index 340e25cdb5..04ede410ad 100644 --- a/src/app-logic/browser-connection.js +++ b/src/app-logic/browser-connection.js @@ -183,8 +183,19 @@ class BrowserConnectionImpl implements BrowserConnection { } } +// Should work with: +// Firefox Desktop: "Mozilla/5.0 (X11; Linux x86_64; rv:132.0) Gecko/20100101 Firefox/132.0" +// Thunderbird: "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Thunderbird/128.2.3" +// Firefox Android: "Mozilla/5.0 (Android 12; Mobile; rv:132.0) Gecko/132.0 Firefox/132.0" +// Should not work with: +// Chrome: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36' +// Safari: 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Mobile/15E148 Safari/604.1' +// +// We could match for Gecko/ but do all Gecko-based browsers support the +// WebChannel? Probably not. Therefore specifically Firefox and Thunderbird are +// looked for, until we find that we need a broader net. function _isFirefox(userAgent: string): boolean { - return Boolean(userAgent.match(/Firefox\/\d+\.\d+/)); + return userAgent.includes('Firefox/') || userAgent.includes('Thunderbird/'); } class TimeoutError extends Error {