Skip to content
This repository has been archived by the owner on Jan 10, 2019. It is now read-only.

set downgrade flag and return #206

Open
wants to merge 1 commit into
base: beta
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,12 @@ chrome.webRequest.onBeforeRequest.addListener(
// Avoid redirect loops
if (thisTab.httpsRedirects[requestData.requestId] >= 7) {
console.log('HTTPS: cancel https upgrade. redirect limit exceeded for url: \n' + requestData.url)
thisTab.downgraded = true
return {redirectUrl: thisTab.downgradeHttpsUpgradeRequest(requestData)}
}
else if (thisTab.downgraded) {
return
}

// Fetch upgrade rule from db
return new Promise ((resolve) => {
Expand Down
1 change: 1 addition & 0 deletions js/tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class Tab {
this.status = tabData.status
this.site = new Site(utils.extractHostFromURL(tabData.url))
this.statusCode // statusCode is set when headers are recieved in tabManager.js
this.downgraded = false // https downgrade status

// set the new tab icon to the dax logo
chrome.browserAction.setIcon({path: 'img/icon_48.png', tabId: tabData.tabId})
Expand Down