[Pkg-javascript-commits] [pdf.js] 30/246: Feature detection after downgrading the browser.

David Prévot taffit at moszumanska.debian.org
Sun Sep 7 15:36:22 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit 87dacba9a69e1c599047cfd57c8dde3e8e7ca1b2
Author: Rob Wu <rob at robwu.nl>
Date:   Fri Jul 25 22:44:03 2014 +0200

    Feature detection after downgrading the browser.
    
    If a user downgrades from Chromium 35+ to 34, then the PDF Viewer
    extension will not work any more because the extension assumes
    that certain features were available based on the cached feature
    detection results.
    
    To resolve this problem, all feature detection scripts run again
    if the browser was downgraded.
---
 extensions/chromium/feature-detect.js | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/extensions/chromium/feature-detect.js b/extensions/chromium/feature-detect.js
index 121672c..5357378 100644
--- a/extensions/chromium/feature-detect.js
+++ b/extensions/chromium/feature-detect.js
@@ -33,13 +33,20 @@ chrome.storage.local.get(Features, function(features) {
     // Browser not upgraded, so the features did probably not change.
     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;
 
-  if (!features.extensionSupportsFTP) {
+  if (isDowngrade || !features.extensionSupportsFTP) {
     features.extensionSupportsFTP = featureTestFTP();
   }
 
-  if (!features.webRequestRedirectUrl) {
+  if (isDowngrade || !features.webRequestRedirectUrl) {
     ++inconclusiveTestCount;
     // Relatively expensive (and asynchronous) test:
     featureTestRedirectOnHeadersReceived(function(result) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git



More information about the Pkg-javascript-commits mailing list