Disabling onHeadersReceived for temporarily https://github.com/libredirect/browser_extension/issues/992
This commit is contained in:
parent
d13715e83f
commit
94cb2e45de
|
@ -117,29 +117,29 @@ browser.webRequest.onBeforeRequest.addListener(
|
||||||
["blocking"]
|
["blocking"]
|
||||||
)
|
)
|
||||||
|
|
||||||
browser.webRequest.onHeadersReceived.addListener(
|
// browser.webRequest.onHeadersReceived.addListener(
|
||||||
details => {
|
// details => {
|
||||||
if (details.statusCode >= 501 || details.statusCode == 429 || details.statusCode == 403) {
|
// if (details.statusCode >= 501 || details.statusCode == 429 || details.statusCode == 403) {
|
||||||
const url = new URL(details.url)
|
// const url = new URL(details.url)
|
||||||
const r = servicesHelper.computeFrontend(url)
|
// const r = servicesHelper.computeFrontend(url)
|
||||||
if (!r) return
|
// if (!r) return
|
||||||
const { service, frontend } = r
|
// const { service, frontend } = r
|
||||||
const params = new URLSearchParams({
|
// const params = new URLSearchParams({
|
||||||
message: "server_error",
|
// message: "server_error",
|
||||||
code: details.statusCode,
|
// code: details.statusCode,
|
||||||
url: url.href,
|
// url: url.href,
|
||||||
frontend: frontend,
|
// frontend: frontend,
|
||||||
service: service,
|
// service: service,
|
||||||
})
|
// })
|
||||||
setTimeout(() => {
|
// setTimeout(() => {
|
||||||
browser.tabs.update({
|
// browser.tabs.update({
|
||||||
url: browser.runtime.getURL(`/pages/messages/index.html?${params.toString()}`),
|
// url: browser.runtime.getURL(`/pages/messages/index.html?${params.toString()}`),
|
||||||
})
|
// })
|
||||||
}, 2000)
|
// }, 2000)
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
{ urls: ["<all_urls>"] }
|
// { urls: ["<all_urls>"] }
|
||||||
)
|
// )
|
||||||
|
|
||||||
browser.tabs.onRemoved.addListener(tabId => {
|
browser.tabs.onRemoved.addListener(tabId => {
|
||||||
if (tabIdRedirects[tabId] != undefined) {
|
if (tabIdRedirects[tabId] != undefined) {
|
||||||
|
|
Loading…
Reference in New Issue