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

Remove unlimited storage #1848

Merged
merged 5 commits into from
Jan 30, 2018
Merged
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 src/_locales/en_US/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@
"message": "Report an Error",
"description": ""
},
"extension_error_text": {
"message": "Please <a href='https://www.eff.org/privacybadger#faq-I-found-a-bug!-What-do-I-do-now?' target='_blank'>tell us</a> about the following error:",
"description": "Shown in the popup when there is a problem with the user's Privacy Badger extension that we want to encourage the user to tell us about."
},
"whitelist_form_domain_input_placeholder": {
"message": "e.g. www.domain.com, *.domain.net, domain.org",
"description": "Placeholder text for the Add domain input under the Whitelisted Domains tab on the options page."
Expand Down
8 changes: 7 additions & 1 deletion src/js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,12 @@ Badger.prototype = {
return;
}

if (badger.error) {
chrome.browserAction.setBadgeBackgroundColor({tabId: tab_id, color: "#cc0000"});
chrome.browserAction.setBadgeText({tabId: tab_id, text: "!"});
return;
}

// don't show the counter for any of these:
// - the counter is disabled
// - we don't have tabData for whatever reason (special browser pages)
Expand All @@ -602,7 +608,7 @@ Badger.prototype = {
if (count === 0) {
chrome.browserAction.setBadgeBackgroundColor({tabId: tab_id, color: "#00cc00"});
} else {
chrome.browserAction.setBadgeBackgroundColor({tabId: tab_id, color: "#cc0000"});
chrome.browserAction.setBadgeBackgroundColor({tabId: tab_id, color: "#ec9329"});
}

chrome.browserAction.setBadgeText({tabId: tab_id, text: count + ""});
Expand Down
5 changes: 5 additions & 0 deletions src/js/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ function showNagMaybe() {
_showNag();
}
});
} else if (badger.error) {
$('#instruction-text').hide();
$('#error-text').show().find('a').attr('id', 'firstRun').css('padding', '5px');
$('#error-message').text(badger.error);
_showNag();
}
}

Expand Down
10 changes: 9 additions & 1 deletion src/js/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -516,10 +516,18 @@ BadgerStorage.prototype = {
var _syncStorage = (function () {
var debouncedFuncs = {};

function cb() {
if (chrome.runtime.lastError) {
let err = chrome.runtime.lastError.message;
badger.error = err;
console.error("Error writing to chrome.storage.local:", err);
}
}

function sync(badgerStorage) {
var obj = {};
obj[badgerStorage.name] = badgerStorage._store;
chrome.storage.local.set(obj);
chrome.storage.local.set(obj, cb);
}

// Creates debounced versions of "sync" function,
Expand Down
3 changes: 1 addition & 2 deletions src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"webNavigation",
"storage",
"cookies",
"privacy",
"unlimitedStorage"
"privacy"
],
"background": {
"scripts": [
Expand Down
16 changes: 11 additions & 5 deletions src/skin/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,21 @@
<div id="instruction-outer">
</div>
<div id="instruction" class="overlay">
<img src='/icons/badger-48.png'>
<img id="instruction-logo" src='/icons/badger-48.png'>
<svg id="fittslaw" width="30" height="30" fill="white">
<line x1="5" y1="5" x2="20" y2="20" style="stroke:rgb(22,22,22);stroke-width:3;fill:transparent"/>
<line x1="5" y1="20" x2="20" y2="5" style="stroke:rgb(22,22,22);stroke-width:3;fill:transparent"/>
</svg>
<p class="i18n_intro_text"></p>
<br>
<div id="firstRun">
<p class="i18n_first_run_text"></p>
<div id="instruction-text">
<p class="i18n_intro_text"></p>
<br>
<div id="firstRun">
<p class="i18n_first_run_text"></p>
</div>
</div>
<div id="error-text" style="display:none">
<p><span class="i18n_extension_error_text"></span></p>
<p style="color:#cc0000" id="error-message"></p>
</div>
</div>
<div id="overlay" class="overlay">
Expand Down