From b5ef2d0105d6e5fa34cbac90bf1c19a0d3b18fe7 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Tue, 11 Sep 2018 08:42:02 -0400 Subject: [PATCH] code review for https://github.com/gorhill/uBlock/commit/0322d03303cd -- fix handling of rc versions --- src/js/start.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/js/start.js b/src/js/start.js index 01507486d..078e1bd0e 100644 --- a/src/js/start.js +++ b/src/js/start.js @@ -144,7 +144,7 @@ var onVersionReady = function(lastVersion) { } else if ( pstr.startsWith('.') || pstr.startsWith('b') ) { pint = parseInt(pstr.slice(1), 10); } else if ( pstr.startsWith('rc') ) { - pint = parseInt(pstr.slice(2), 10) * 100; + pint = parseInt(pstr.slice(2), 10) + 100; } else { pint = parseInt(pstr, 10); } @@ -153,14 +153,16 @@ var onVersionReady = function(lastVersion) { return vint; }; - if ( intFromVersion(lastVersion) <= 1016021007 ) { + let lastVersionInt = intFromVersion(lastVersion); + + if ( lastVersionInt <= 1016021007 ) { µb.sessionSwitches.toggle('no-scripting', 'behind-the-scene', 2); µb.permanentSwitches.toggle('no-scripting', 'behind-the-scene', 2); µb.saveHostnameSwitches(); } // https://github.com/uBlockOrigin/uBlock-issues/issues/212#issuecomment-419741324 - if ( intFromVersion(lastVersion) <= 1015024000 ) { + if ( lastVersionInt <= 1015024000 ) { if ( µb.hiddenSettings.manualUpdateAssetFetchPeriod === 2000 ) { µb.hiddenSettings.manualUpdateAssetFetchPeriod = 500; µb.saveHiddenSettings();