Skip to content

Commit 264cddb

Browse files
committed
reviews
1 parent bd13796 commit 264cddb

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

src/modules/shared/utility/utility.service.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,8 @@ export class UtilityService {
195195
}
196196

197197
getUniqueishId(): string {
198-
return window.crypto.getRandomValues(new Uint32Array(1))[0].toString(36);
198+
// crypto is available globally in both window and service worker contexts
199+
return crypto.getRandomValues(new Uint32Array(1))[0].toString(36);
199200
}
200201

201202
@boundMethod
@@ -211,7 +212,7 @@ export class UtilityService {
211212
}
212213

213214
isBraveBrowser(): boolean {
214-
return !angular.isUndefined(window.navigator.brave);
215+
return typeof navigator !== 'undefined' && !angular.isUndefined((navigator as any).brave);
215216
}
216217

217218
@boundMethod

src/modules/webext/webext-background/webext-background.service.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,15 @@ export class WebExtBackgroundService {
193193
// Strip html tags from message
194194
const urlRegex = new RegExp(Globals.URL.ValidUrlRegex, 'i');
195195
const urlInAlert = alert.message.match(urlRegex)?.find(Boolean);
196+
// Strip HTML tags from message for notification display
196197
let messageToDisplay = alert.message;
197-
if (urlInAlert && typeof DOMParser !== 'undefined') {
198+
if (typeof DOMParser !== 'undefined') {
198199
messageToDisplay =
199200
new DOMParser().parseFromString(`<span>${alert.message}</span>`, 'text/xml').firstElementChild.textContent ??
200201
alert.message;
202+
} else {
203+
// Fallback for service worker context: strip tags with regex
204+
messageToDisplay = alert.message.replace(/<[^>]*>/g, '');
201205
}
202206
const options: Notifications.CreateNotificationOptions = {
203207
iconUrl: `${Globals.PathToAssets}/notification.svg`,

webpack/firefox.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ module.exports = (env, argv) => {
8787
}
8888
};
8989

90-
// Background config: service worker entry point with angular shims (no DOM)
90+
// Background config: background script entry point with angular shims (no DOM)
9191
const backgroundConfig = {
9292
...webExtConfig,
9393
name: 'firefox-background',

0 commit comments

Comments
 (0)