mirror of
https://github.com/zero-peak/ZeroOmega.git
synced 2025-01-22 15:08:12 -05:00
Optimize firefox startup
This commit is contained in:
parent
480b1ae4a8
commit
8cdd8257f0
@ -23,17 +23,26 @@ import "./js/background.js" // zeroBackground
|
||||
const isFirefox = !!globalThis.localStorage
|
||||
|
||||
function detectPrivateMode(cb) {
|
||||
var db,
|
||||
var db, tempMode,
|
||||
on = cb.bind(null, true),
|
||||
off = cb.bind(null, false)
|
||||
if (isFirefox) {
|
||||
db = indexedDB.open("zeroOmega-test"), db.onerror = on, db.onsuccess = off
|
||||
// in private mode, localStorage will be erased when browser restart
|
||||
tempMode = localStorage.getItem('zeroOmega.isPrivateMode')
|
||||
if (tempMode) {
|
||||
tempMode == 'true' ? on() : off()
|
||||
} else {
|
||||
db = indexedDB.open("zeroOmega-test"), db.onerror = on, db.onsuccess = off
|
||||
}
|
||||
} else {
|
||||
off()
|
||||
}
|
||||
}
|
||||
|
||||
detectPrivateMode(function (isPrivateMode) {
|
||||
if (isFirefox) {
|
||||
localStorage.setItem('zeroOmega.isPrivateMode', isPrivateMode ? 'true' : 'false')
|
||||
}
|
||||
|
||||
if (isPrivateMode && isFirefox) {
|
||||
// fake indexedDB
|
||||
|
Loading…
Reference in New Issue
Block a user