Commit d5cd731
File polyfill: address non-controversial review nits from bghgary on BabylonJS#169
File.cpp
- Drop the misleading BABYLON_POLYFILL_USE_NAPI_JSI_EVAL macro and the
__has_include(<napi/env.h>) guard. <napi/env.h> exists on every backend
(V8, Chakra, JSC, JSI) and is pulled in transitively via
<Babylon/Polyfills/File.h>, so the include guard always succeeded and
the macro name implied a JSI-only path that doesn't exist — Napi::Eval
is declared on all four backends (the Shared N-API impl in env.cc is a
thin wrapper around env.RunScript). Call Napi::Eval directly.
- Reorder Initialize: check "already provided" (cheap no-op, common path
on platforms with a native File) before probing for Blob.
- Throw Napi::Error on missing Blob instead of silently bailing.
Consumers that wire up the File polyfill expect it to be installed;
silent failures are hard to debug.
FileReader.cpp
- MakeEvent: replace the dangling "JS polyfill that this C++
implementation replaces" reference (no such JS polyfill exists in this
PR) with a one-line description of the actual ProgressEvent contract.
- DefineClass: collapse the 14-line dual-StaticValue/InstanceValue
comment to one line pointing at JsRH#173. Per BabylonJS#173 this is the correct
WHATWG IDL `const` member exposure pattern, not a workaround that
needs in-line justification.
tests.ts
- Re-point the Chakra throw-from-constructor TODO at JsRH#175 (filed
today) so the disabled "throws when fewer than 2 arguments are passed"
test can be re-enabled atomically when that shim limitation is fixed.
No behavior change; pure cleanup. Local Chakra build clean.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 10930e2 commit d5cd731
3 files changed
Lines changed: 26 additions & 43 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | 9 | | |
15 | 10 | | |
16 | 11 | | |
| |||
26 | 21 | | |
27 | 22 | | |
28 | 23 | | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
34 | 29 | | |
35 | 30 | | |
36 | 31 | | |
| |||
55 | 50 | | |
56 | 51 | | |
57 | 52 | | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
67 | 56 | | |
68 | 57 | | |
69 | 58 | | |
70 | 59 | | |
71 | | - | |
72 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
73 | 69 | | |
74 | | - | |
| 70 | + | |
| 71 | + | |
75 | 72 | | |
76 | 73 | | |
77 | 74 | | |
| |||
91 | 88 | | |
92 | 89 | | |
93 | 90 | | |
94 | | - | |
95 | 91 | | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | 92 | | |
100 | 93 | | |
101 | 94 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
60 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
| |||
93 | 94 | | |
94 | 95 | | |
95 | 96 | | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
| 97 | + | |
| 98 | + | |
110 | 99 | | |
111 | 100 | | |
112 | 101 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1511 | 1511 | | |
1512 | 1512 | | |
1513 | 1513 | | |
1514 | | - | |
| 1514 | + | |
| 1515 | + | |
1515 | 1516 | | |
1516 | 1517 | | |
1517 | 1518 | | |
| |||
0 commit comments