Fixed redirections not appearing in Brave #253
This commit is contained in:
parent
ba162b6fe4
commit
ca9c5e04c0
|
@ -23,6 +23,7 @@
|
|||
"webRequest",
|
||||
"webRequestBlocking",
|
||||
"storage",
|
||||
"unlimitedStorage",
|
||||
"cookies",
|
||||
"contextMenus",
|
||||
"<all_urls>"
|
||||
|
|
|
@ -78,15 +78,15 @@ let BYPASSTABs = [];
|
|||
|
||||
browser.webRequest.onBeforeRequest.addListener(
|
||||
async details => {
|
||||
await wholeInit();
|
||||
const url = new URL(details.url);
|
||||
// console.info("url:", url.href, "type:", details.type);
|
||||
if (new RegExp(/^chrome-extension:\/{2}.*\/instances\/(blocklist|data).json$/).test(url.href) && details.type == 'xmlhttprequest') return;
|
||||
await wholeInit();
|
||||
let initiator;
|
||||
if (details.originUrl)
|
||||
initiator = new URL(details.originUrl);
|
||||
else if (details.initiator)
|
||||
initiator = new URL(details.initiator);
|
||||
|
||||
|
||||
let newUrl = youtubeHelper.redirect(url, details, initiator)
|
||||
if (youtubeMusicHelper.isYoutubeMusic(url, initiator)) newUrl = youtubeMusicHelper.redirect(url, details.type)
|
||||
|
||||
|
|
Loading…
Reference in New Issue