Skip to content

Commit

Permalink
Disabling onHeadersReceived for temporarily #992
Browse files Browse the repository at this point in the history
  • Loading branch information
ManeraKai committed Sep 14, 2024
1 parent d13715e commit 94cb2e4
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions src/pages/background/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,29 +117,29 @@ browser.webRequest.onBeforeRequest.addListener(
["blocking"]
)

browser.webRequest.onHeadersReceived.addListener(
details => {
if (details.statusCode >= 501 || details.statusCode == 429 || details.statusCode == 403) {
const url = new URL(details.url)
const r = servicesHelper.computeFrontend(url)
if (!r) return
const { service, frontend } = r
const params = new URLSearchParams({
message: "server_error",
code: details.statusCode,
url: url.href,
frontend: frontend,
service: service,
})
setTimeout(() => {
browser.tabs.update({
url: browser.runtime.getURL(`/pages/messages/index.html?${params.toString()}`),
})
}, 2000)
}
},
{ urls: ["<all_urls>"] }
)
// browser.webRequest.onHeadersReceived.addListener(
// details => {
// if (details.statusCode >= 501 || details.statusCode == 429 || details.statusCode == 403) {
// const url = new URL(details.url)
// const r = servicesHelper.computeFrontend(url)
// if (!r) return
// const { service, frontend } = r
// const params = new URLSearchParams({
// message: "server_error",
// code: details.statusCode,
// url: url.href,
// frontend: frontend,
// service: service,
// })
// setTimeout(() => {
// browser.tabs.update({
// url: browser.runtime.getURL(`/pages/messages/index.html?${params.toString()}`),
// })
// }, 2000)
// }
// },
// { urls: ["<all_urls>"] }
// )

browser.tabs.onRemoved.addListener(tabId => {
if (tabIdRedirects[tabId] != undefined) {
Expand Down

0 comments on commit 94cb2e4

Please sign in to comment.