Microsoft has acquired GitHub. Decentraleyes has left GitHub. Welcome to its new home!

To participate, please register, or sign in with an existing GitLab.com, Bitbucket, or GitHub account.

Past contributions on GitHub? Be sure to reclaim your Comments, Issues, and Pull Requests.

Verified Commit e1b80f73 authored by Thomas Rientjes's avatar Thomas Rientjes
Browse files

Apply fixes and optimizations

parent 81f60022
......@@ -52,11 +52,19 @@ main._initializeOptions = function () {
main._showReleaseNotes = function (details) {
let location = chrome.extension.getURL('pages/welcome/welcome.html');
let location, previousVersion;
location = chrome.extension.getURL('pages/welcome/welcome.html');
if (details.reason === chrome.runtime.OnInstalledReason.INSTALL ||
details.reason === chrome.runtime.OnInstalledReason.UPDATE) {
previousVersion = details.previousVersion;
if (previousVersion && previousVersion.charAt(0) === '2') {
return; // Do not show release notes after minor updates.
}
if (details.temporary !== true) {
chrome.storage.local.get({
......
......@@ -116,7 +116,7 @@ stateManager._createTab = function (tab) {
let tab = stateManager.tabs[tabIdentifier].details || {};
return interceptor.handleRequest(requestDetails, tabIdentifier, tab);
}, requestFilters, [WebRequest.BLOCKING]);
};
......@@ -237,10 +237,10 @@ chrome.tabs.onRemoved.addListener(stateManager._removeTab);
chrome.webRequest.onBeforeRequest.addListener(function (requestDetails) {
if (requestDetails.tabId !== -1) {
stateManager.tabs[requestDetails.tabId].details = {
'url': requestDetails.url
}
};
}
}, {'types': ['main_frame'], 'urls': [Address.ANY]});
......@@ -269,8 +269,14 @@ chrome.webRequest.onBeforeRedirect.addListener(function (requestDetails) {
}, {'urls': [Address.ANY]});
chrome.webRequest.onBeforeSendHeaders.addListener(stateManager._stripMetadata, {
'urls': stateManager.validHosts
}, [WebRequest.BLOCKING, WebRequest.HEADERS]);
chrome.storage.local.get({'stripMetadata': true}, function (options) {
if (options === null || options.stripMetadata !== false) {
chrome.webRequest.onBeforeSendHeaders.addListener(stateManager._stripMetadata, {
'urls': stateManager.validHosts
}, [WebRequest.BLOCKING, WebRequest.HEADERS]);
}
});
chrome.storage.onChanged.addListener(stateManager._handleStorageChanged);
......@@ -27,7 +27,7 @@ document.addEventListener('DOMContentLoaded', function () {
let version, optionsButtonElement, scriptDirection;
version = helpers.formatVersion(browser.runtime.getManifest().version);
version = helpers.formatVersion(chrome.runtime.getManifest().version);
document.getElementById('version-label').innerText = version;
scriptDirection = helpers.determineScriptDirection(navigator.language);
......@@ -204,6 +204,7 @@ document.addEventListener('DOMContentLoaded', function () {
});
optionsButtonElement.addEventListener('mouseup', function () {
chrome.runtime.openOptionsPage();
return window.close();
});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment