|
7 | 7 | * |
8 | 8 | * Required features (determined from caniuse-lite against the app's CSS/JS): |
9 | 9 | * CSS Grid, CSS Custom Properties, position:sticky (or -webkit-sticky) |
10 | | - * ES2020 syntax used by the bundle, currently optional chaining and nullish coalescing |
11 | 10 | * |
12 | 11 | * Chromium version is still checked via UA for WebView2 on Windows, where the |
13 | 12 | * version string is accurate and ES module support (Chrome 61+) is the constraint. |
|
16 | 15 | var unsupported = false; |
17 | 16 | var body = ''; |
18 | 17 |
|
19 | | - function canParse(source) { |
20 | | - try { |
21 | | - new Function(source); |
22 | | - return true; |
23 | | - } catch (e) { |
24 | | - return false; |
25 | | - } |
26 | | - } |
27 | | - |
28 | 18 | /* CSS feature detection -------------------------------------------------- */ |
29 | 19 | if (typeof CSS === 'undefined' || !CSS.supports) { |
30 | 20 | unsupported = true; |
|
42 | 32 | } |
43 | 33 | } |
44 | 34 |
|
45 | | - if (!unsupported) { |
46 | | - var missingJs = []; |
47 | | - if (!canParse('var value = ({ a: 1 })?.a;')) missingJs.push('optional chaining'); |
48 | | - if (!canParse('var value = null ?? 1;')) missingJs.push('nullish coalescing'); |
49 | | - if (missingJs.length > 0) { |
50 | | - unsupported = true; |
51 | | - body = 'Missing required JavaScript features: <strong style="color:#e2e4eb;">' + missingJs.join(', ') + '</strong>.'; |
52 | | - } |
53 | | - } |
| 35 | + /* |
| 36 | + * ES2020 syntax probes are disabled for now. Tauri's CSP can block |
| 37 | + * Function() even when the webview supports the syntax, which makes this |
| 38 | + * check report a false unsupported browser. |
| 39 | + * |
| 40 | + * function canParse(source) { |
| 41 | + * try { |
| 42 | + * new Function(source); |
| 43 | + * return true; |
| 44 | + * } catch (e) { |
| 45 | + * return false; |
| 46 | + * } |
| 47 | + * } |
| 48 | + * |
| 49 | + * if (!unsupported) { |
| 50 | + * var missingJs = []; |
| 51 | + * if (!canParse('var value = ({ a: 1 })?.a;')) missingJs.push('optional chaining'); |
| 52 | + * if (!canParse('var value = null ?? 1;')) missingJs.push('nullish coalescing'); |
| 53 | + * if (missingJs.length > 0) { |
| 54 | + * unsupported = true; |
| 55 | + * body = 'Missing required JavaScript features: <strong style="color:#e2e4eb;">' + missingJs.join(', ') + '</strong>.'; |
| 56 | + * } |
| 57 | + * } |
| 58 | + */ |
54 | 59 |
|
55 | 60 | /* Chromium version check (WebView2 on Windows only) ---------------------- */ |
56 | 61 | if (!unsupported) { |
|
0 commit comments