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

Commit

Permalink
Fix #2623, make https://screenshots.firefox.com/ /privacy, etc. shoot…
Browse files Browse the repository at this point in the history
…able
  • Loading branch information
ianb committed Apr 10, 2017
1 parent ccab9b6 commit bdac9a3
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion addon/webextension/background/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,28 @@ window.main = (function () {
if (shouldOpenMyShots(url)) {
return true;
}
if (url.startsWith(backend) || /^(?:about|data|moz-extension):/i.test(url)) {
if (isShotOrMyShotPage(url) || /^(?:about|data|moz-extension):/i.test(url)) {
return false;
}
return true;
}

function isShotOrMyShotPage(url) {
// It's okay to take a shot of any pages except shot pages and My Shots
if (! url.startsWith(backend)) {
return false;
}
let path = url.substr(backend.length).replace(/^\/*/, "").replace(/#.*/, "").replace(/\?.*/, "");
if (path == "shots") {
return true;
}
if (/^[^/]+\/[^/]+$/.test(url)) {
// Blocks {:id}/{:domain}, but not /, /privacy, etc
return true;
}
return false;
}

browser.tabs.onUpdated.addListener(catcher.watchFunction((id, info, tab) => {
if (info.url && tab.selected) {
if (urlEnabled(info.url)) {
Expand Down

0 comments on commit bdac9a3

Please sign in to comment.