Line data Source code
1 2355 : export function isSafeExtensionBoot(search: string): boolean {
2 2355 : const value = new URLSearchParams(search).get('safe')
3 2355 : return value === '' || value === '1' || value === 'true'
4 : }
5 :
6 2356 : let safeBootCaptured = false
7 :
8 : /** Takes `?safe` out of the URL before the router reads it, so it covers this load only. */
9 2355 : export function captureSafeExtensionBoot(): void {
10 2355 : const url = new URL(globalThis.location.href)
11 2355 : safeBootCaptured = isSafeExtensionBoot(url.search)
12 2355 : if (!safeBootCaptured) return
13 0 : url.searchParams.delete('safe')
14 0 : globalThis.history.replaceState(globalThis.history.state, '', url)
15 : }
16 :
17 : /** Whether this load skips every custom extension. */
18 2355 : export function isSafeExtensionBootActive(): boolean {
19 2355 : return safeBootCaptured
20 : }
|