Skip to content

Commit

Permalink
Create youtube-theater-fix.js, fixes brave/brave-browser#29591
Browse files Browse the repository at this point in the history
adds a scriptlet to mirror the session cookie value in localstorage
  • Loading branch information
pes10k authored Jul 6, 2023
1 parent 5a949d7 commit 8b3914d
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions resources/youtube-theater-fix.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
(async _ => {
if (self.cookieStore === undefined) {
// do nothing on iOS. The problem doesn't exist there, and the
// solution wouldn't work anyway
return
}
const storeKey = 'brave::wide'
const cookieKey = 'wide'
if (localStorage[storeKey] !== undefined) {
await cookieStore.set(cookieKey, localStorage[storeKey])
}
setInterval(_ => {
try {
const wideCookie = await cookieStore(cookieKey)
localStorage[storeKey] = wideCookie.value
} catch () {
// swallow error from no cookie existing
}
}, 1000)
})();

0 comments on commit 8b3914d

Please sign in to comment.