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

Screenshot overhaul #1238

Merged
merged 18 commits into from
Oct 18, 2020
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
promoted expression to switch-case and added signal for loading block…
…list
thegreatsuspender committed Oct 8, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 83397e841187bd60db4965f117534ffe67bc70e1
60 changes: 30 additions & 30 deletions src/js/background.js
Original file line number Diff line number Diff line change
@@ -1610,37 +1610,37 @@ var tgs = (function() {
request.action
);

if (request.action === 'reportTabState') {
var contentScriptStatus =
request && request.status ? request.status : null;
if (
contentScriptStatus === 'formInput' ||
contentScriptStatus === 'tempWhitelist'
) {
chrome.tabs.update(sender.tab.id, { autoDiscardable: false });
} else if (!sender.tab.autoDiscardable) {
chrome.tabs.update(sender.tab.id, { autoDiscardable: true });
}
// If tab is currently visible then update popup icon
if (sender.tab && isCurrentFocusedTab(sender.tab)) {
calculateTabStatus(sender.tab, contentScriptStatus, function(status) {
setIconStatus(status, sender.tab.id);
});
}
sendResponse();
return false;
}

if (request.action === 'savePreviewData') {
gsTabSuspendManager.handlePreviewImageResponse(
sender.tab,
request.previewUrl,
request.errorMsg
); // async. unhandled promise
sendResponse();
return false;
switch (request.action) {
case 'loadCleanScreencaptureBlocklist':
gsCleanScreencaps.loadList()
case 'reportTabState':
var contentScriptStatus =
request && request.status ? request.status : null;
if (
contentScriptStatus === 'formInput' ||
contentScriptStatus === 'tempWhitelist'
) {
chrome.tabs.update(sender.tab.id, { autoDiscardable: false });
} else if (!sender.tab.autoDiscardable) {
chrome.tabs.update(sender.tab.id, { autoDiscardable: true });
}
// If tab is currently visible then update popup icon
if (sender.tab && isCurrentFocusedTab(sender.tab)) {
calculateTabStatus(sender.tab, contentScriptStatus, function (status) {
setIconStatus(status, sender.tab.id);
});
}
sendResponse();
return false;
case 'savePreviewData':
gsTabSuspendManager.handlePreviewImageResponse(
sender.tab,
request.previewUrl,
request.errorMsg
); // async. unhandled promise
sendResponse();
return false;
}

// Fallback to empty response to ensure callback is made
sendResponse();
return false;