Merge pull request #5090 from Rob--W/crx-feature-detect-downgrade

Re-run feature detection after downgrading the Chromium browser.
This commit is contained in:
Tim van der Meij 2014-07-30 21:30:16 +02:00
commit 5b9d78820b

View File

@ -33,13 +33,20 @@ chrome.storage.local.get(Features, function(features) {
// Browser not upgraded, so the features did probably not change. // Browser not upgraded, so the features did probably not change.
return; return;
} }
// In case of a downgrade, the features must be tested again.
var lastVersion = /Chrome\/\d+\.0\.(\d+)/.exec(features.featureDetectLastUA);
lastVersion = lastVersion ? parseInt(lastVersion[1], 10) : 0;
var newVersion = /Chrome\/\d+\.0\.(\d+)/.exec(navigator.userAgent);
var isDowngrade = newVersion && parseInt(newVersion[1], 10) < lastVersion;
var inconclusiveTestCount = 0; var inconclusiveTestCount = 0;
if (!features.extensionSupportsFTP) { if (isDowngrade || !features.extensionSupportsFTP) {
features.extensionSupportsFTP = featureTestFTP(); features.extensionSupportsFTP = featureTestFTP();
} }
if (!features.webRequestRedirectUrl) { if (isDowngrade || !features.webRequestRedirectUrl) {
++inconclusiveTestCount; ++inconclusiveTestCount;
// Relatively expensive (and asynchronous) test: // Relatively expensive (and asynchronous) test:
featureTestRedirectOnHeadersReceived(function(result) { featureTestRedirectOnHeadersReceived(function(result) {