Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add web navigation errors to breakage reports #2358

Merged
merged 1 commit into from
Nov 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions shared/js/background/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -469,12 +469,17 @@ browser.alarms.onAlarm.addListener(async alarmEvent => {
}
})

// Count https upgrade failures to allow bad data to be removed from lists
browser.webNavigation.onErrorOccurred.addListener(e => {
// If not main frame ignore
if (e.frameId !== 0) return
const tab = tabManager.get({ tabId: e.tabId })
tab.errorDescriptions.push(e.error)
})

browser.webRequest.onErrorOccurred.addListener(e => {
if (!(e.type === 'main_frame')) return

const tab = tabManager.get({ tabId: e.tabId })

tab.errorDescriptions.push(e.error)

// We're only looking at failed main_frame upgrades. A tab can send multiple
Expand All @@ -483,6 +488,7 @@ browser.webRequest.onErrorOccurred.addListener(e => {
return
}

// Count https upgrade failures to allow bad data to be removed from lists
if (e.error && e.url.match(/^https/)) {
const errCode = constants.httpsErrorCodes[e.error]
tab.hasHttpsError = true
Expand Down