Skip to content

Commit

Permalink
Send all settings in single object to popup too
Browse files Browse the repository at this point in the history
  • Loading branch information
ghostwords committed May 14, 2021
1 parent 9089db1 commit 8cd7315
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
10 changes: 5 additions & 5 deletions src/js/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ function showNagMaybe() {
if (POPUP_DATA.showLearningPrompt) {
_showLearningPrompt();

} else if (!POPUP_DATA.seenComic) {
} else if (!POPUP_DATA.settings.seenComic) {
chrome.tabs.query({active: true, currentWindow: true}, function (focusedTab) {
// Show the popup instruction if the active tab is not firstRun.html page
if (!focusedTab[0].url.startsWith(intro_page_url)) {
Expand Down Expand Up @@ -202,7 +202,7 @@ function init() {

// show sliders when sliders were shown last
// or when there is at least one breakage warning
if (POPUP_DATA.showExpandedTrackingSection || (
if (POPUP_DATA.settings.showExpandedTrackingSection || (
POPUP_DATA.cookieblocked && Object.keys(POPUP_DATA.cookieblocked).some(
d => POPUP_DATA.origins[d] == constants.USER_BLOCK)
)) {
Expand Down Expand Up @@ -589,7 +589,7 @@ function refreshPopup() {
// show "no trackers" message
$("#instructions-no-trackers").show();

if (POPUP_DATA.learnLocally && POPUP_DATA.showNonTrackingDomains) {
if (POPUP_DATA.settings.learnLocally && POPUP_DATA.settings.showNonTrackingDomains) {
// show the "no third party resources on this site" message
$("#no-third-parties").show();
}
Expand Down Expand Up @@ -632,7 +632,7 @@ function refreshPopup() {
// show breakage warning sliders at the top of the list
printable = printableWarningSliders.concat(printable);

if (POPUP_DATA.learnLocally && unblockedTrackers.length) {
if (POPUP_DATA.settings.learnLocally && unblockedTrackers.length) {
printable.push(
'<div class="clicker tooltip" id="not-yet-blocked-header" title="' +
chrome.i18n.getMessage("intro_not_an_adblocker_paragraph") +
Expand All @@ -647,7 +647,7 @@ function refreshPopup() {
});
}

if (POPUP_DATA.learnLocally && POPUP_DATA.showNonTrackingDomains && nonTracking.length) {
if (POPUP_DATA.settings.learnLocally && POPUP_DATA.settings.showNonTrackingDomains && nonTracking.length) {
printable.push(
'<div class="clicker tooltip" id="non-trackers-header" title="' +
chrome.i18n.getMessage("non_tracker_tip") +
Expand Down
10 changes: 3 additions & 7 deletions src/js/webrequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -1020,8 +1020,7 @@ function dispatcher(request, sender, sendResponse) {

let tab_host = window.extractHostFromURL(request.tabUrl),
origins = badger.tabData[tab_id].origins,
cookieblocked = {},
isOnFirstParty = utils.firstPartyProtectionsEnabled(tab_host);
cookieblocked = {};

for (let origin in origins) {
// see if origin would be cookieblocked if not for user override
Expand All @@ -1035,14 +1034,11 @@ function dispatcher(request, sender, sendResponse) {
criticalError: badger.criticalError,
enabled: badger.isPrivacyBadgerEnabled(tab_host),
errorText: badger.tabData[tab_id].errorText,
isOnFirstParty: isOnFirstParty,
learnLocally: badger.getSettings().getItem("learnLocally"),
isOnFirstParty: utils.firstPartyProtectionsEnabled(tab_host),
noTabData: false,
origins,
seenComic: badger.getSettings().getItem("seenComic"),
showExpandedTrackingSection: badger.getSettings().getItem("showExpandedTrackingSection"),
showLearningPrompt: badger.getPrivateSettings().getItem("showLearningPrompt"),
showNonTrackingDomains: badger.getSettings().getItem("showNonTrackingDomains"),
settings: badger.getSettings().getItemClones(),
tabHost: tab_host,
tabId: tab_id,
tabUrl: request.tabUrl,
Expand Down

0 comments on commit 8cd7315

Please sign in to comment.