Skip to content

Commit

Permalink
fix page action issues #37 (comment)
Browse files Browse the repository at this point in the history
- FF56: the page action was getting displayed after a server-initiated redirection from HTTP to HTTPS, even when the site was excluded (which led to the user being offered the opportunity to exclude again)
- the same was happening with sites that use STS, but also in recent versions of FF
  • Loading branch information
claustromaniac committed Dec 5, 2019
1 parent f87d997 commit 849696f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
4 changes: 3 additions & 1 deletion src/bg/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ runtime.onMessage.addListener(async (msg, sender, sendResponse) => {
if (tabsData[tabId]) delete tabsData[tabId].loading;
await sAPI.loading;
if (
processed.has(msg.host) && msg.protocol === 'https:' ||
processed.has(msg.host) && msg.protocol === 'https:' &&
!isWhitelisted(msg.host) && !isIgnored(msg.host) ||
isWhitelisted(msg.host) && msg.protocol === 'http:'
) return pageAction.show(tabId);
else return pageAction.hide(tabId);
}
});
12 changes: 0 additions & 12 deletions src/bg/webRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,18 +136,6 @@ webReq.onBeforeRedirect.addListener(d => {
}
}, sfilter);

webReq.onBeforeRedirect.addListener(d => {
/* prevent showing the page action when something (anything) redirects a whitelisted or
ignored request from http to https
IMPORTANT: the documentation for this event says it is fired only on server-initiated
redirections, but it is wrong. Even this very extension fires this when upgrading */
const target = new URL(d.redirectUrl);
if (
target.protocol === 'https:' &&
( isWhitelisted(target.hostname) || isIgnored(target.hostname) )
) processed.delete(target.hostname);
}, filter);

webReq.onResponseStarted.addListener(d => {
// required only as part of the mechanism that detects non-standard redirections to http
const url = new URL(d.url);
Expand Down

0 comments on commit 849696f

Please sign in to comment.