Skip to content

Commit 3d8182b

Browse files
v136 (#392)
Is behind a pref enabled for several releases: if someone flips that pref then we will not get the "correct" version if they are 136, but this adds entropy as the window/css/navigator/element properties (a giant feature detection which changes each release by default) won't match the default values of the version we end up on.
1 parent 44ddbc7 commit 3d8182b

File tree

3 files changed

+36
-6
lines changed

3 files changed

+36
-6
lines changed

js/generic.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ function get_isVer(METRIC) {
434434
let t0 = nowFn()
435435

436436
isVer = cascade()
437-
if (isVer == 135) {isVerExtra = '+'} else if (isVer == 114) {isVerExtra = ' or lower'}
437+
if (isVer == 136) {isVerExtra = '+'} else if (isVer == 114) {isVerExtra = ' or lower'}
438438
log_perf(SECTG, METRIC, t0,'', isVer + isVerExtra)
439439
// gecko block mode
440440
isBlock = isVer < isBlockMin
@@ -449,6 +449,10 @@ function get_isVer(METRIC) {
449449
// old-timey check: avoid false postives: must be 115 or higher
450450
if (!CanvasRenderingContext2D.prototype.hasOwnProperty('letterSpacing')) return 114 // 1778909
451451
// now cascade
452+
try {
453+
// fastpath: FF132+: javascript.options.experimental.regexp_modifiers
454+
if (eval("/(?i:[A-Z]{4})/.test('abcd')")) return 136 // 1939533
455+
} catch(e) {}
452456
try {
453457
test = new Intl.NumberFormat('en-US', {style:'currency', currency:'USD', notation:'scientific'})
454458
if (0 == test.resolvedOptions().minimumFractionDigits) return 135 // 1930464

tests/testgeneric.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -554,10 +554,14 @@ const get_isVer = () => new Promise(resolve => {
554554
output(cascade())
555555

556556
function cascade() {
557-
isVerMax = 135
557+
isVerMax = 136
558558

559559
// old-timey check: avoid false postives
560560
if (CanvasRenderingContext2D.prototype.hasOwnProperty('letterSpacing')) {
561+
try {
562+
// fastpath: FF132+: javascript.options.experimental.regexp_modifiers
563+
if (eval("/(?i:[A-Z]{4})/.test('abcd')")) return 136 // 1939533
564+
} catch(e) {}
561565
try {
562566
let test135 = new Intl.NumberFormat('en-US', {style:'currency', currency:'USD', notation:'scientific'})
563567
if (0 == test135.resolvedOptions().minimumFractionDigits) return 135 // 1930464

tests/versions.html

+26-4
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@
203203
if (debug.length) {dom.debug.innerHTML = debug.join("<br>")}
204204
}
205205

206-
let countTZP = 0, expectTZP = 86, maxVer = 135, oTZP = {}, oResults = {}
206+
let countTZP = 0, expectTZP = 87, maxVer = 136, oTZP = {}, oResults = {}
207207
function run_tzp() {
208208
// start global timer
209209
gTZP = performance.now()
@@ -265,12 +265,24 @@
265265
}
266266
}
267267

268+
// 136: 1939533
269+
// pref enabled since FF132: javascript.options.experimental.regexp_modifiers
270+
// note: TB slider's `javascript.options.native_regexp` (requires restart) has no effect
271+
let t136 = performance.now(), ver136
272+
try {
273+
ver136 = eval("/(?i:[A-Z]{4})/.test('abcd')")
274+
} catch(e) {
275+
// FF131 or lower: SyntaxError: invalid regexp group
276+
console.log(e)
277+
}
278+
rec(136, 136, "1939533", ver136, performance.now()-t136, 'p') // 0.02ms
279+
268280
// 135: 1930464
269281
let t135 = performance.now(), ver135
270282
try {
271283
// returns 2 in FF52 but lets avoid any possible old-timey regressions/changes
272284
// tested FF115-135
273-
if (CanvasRenderingContext2D.prototype.hasOwnProperty("letterSpacing")) { // FF115+
285+
if (CanvasRenderingContext2D.prototype.hasOwnProperty('letterSpacing')) { // FF115+
274286
let test135 = new Intl.NumberFormat('en-US', {style:'currency', currency:'USD', notation:'scientific'})
275287
ver135 = 0 == test135.resolvedOptions().minimumFractionDigits
276288
}
@@ -281,7 +293,7 @@
281293
let t134 = performance.now(), ver134
282294
try {
283295
// avoid old timey false positives e.g FF78-109
284-
if (CanvasRenderingContext2D.prototype.hasOwnProperty("letterSpacing")) { // FF115+
296+
if (CanvasRenderingContext2D.prototype.hasOwnProperty('letterSpacing')) { // FF115+
285297
ver134 = '$1.00' == (1).toLocaleString('en-CA', {style: 'currency', currencyDisplay: 'narrowSymbol', currency: 'USD'})
286298
}
287299
} catch(e) {}
@@ -755,7 +767,7 @@
755767
}
756768
run_tzp()
757769

758-
let countOther = 0, expectOther = 61, oOther = {}
770+
let countOther = 0, expectOther = 62, oOther = {}
759771
function run_other() {
760772
// start global timer
761773
gOther = performance.now()
@@ -773,6 +785,16 @@
773785
}
774786
}
775787

788+
// 135: 1775215
789+
let t135a = performance.now(), ver135a
790+
try {
791+
eval('var else')
792+
} catch(e) {
793+
// SyntaxError: missing variable name, got keyword 'else'
794+
ver135a = (e+'').includes('else')
795+
}
796+
rec(135.1, 135, "1775215", ver135a, performance.now()-t135a) // 0.05ms
797+
776798
// 135: 1930466
777799
let t135 = performance.now(), ver135 = false
778800
try {

0 commit comments

Comments
 (0)