Commit d65f853
`polyArrFindIndex` and `polyArrFindLastIndex` were using bitwise OR
(`|`) when resolving callback context, which coerced object `thisArg`
values and broke callback `this` binding. This updates both polyfills to
use logical fallback semantics as intended.
- **Polyfill callback context fix**
- Replaced `thisArg | theArray` with `thisArg || theArray` in:
- `lib/src/polyfills/array.ts` (`polyArrFindIndex`)
- `lib/src/polyfills/array.ts` (`polyArrFindLastIndex`)
- Effect: callback `this` now correctly uses the provided `thisArg`, and
falls back to `theArray` only when `thisArg` is not provided/falsy.
- **Regression coverage**
- Added focused tests in `lib/test/src/common/polyfills/array.test.ts`
for both functions to verify:
- explicit `thisArg` is preserved as callback `this`
- default fallback binds callback `this` to the source array
```ts
// before (buggy)
callbackFn[CALL](thisArg | theArray as any, value, index, theArray);
// after
callbackFn[CALL](thisArg || theArray as any, value, index, theArray);
```
> [!WARNING]
>
> <details>
> <summary>Firewall rules blocked me from connecting to one or more
addresses (expand for details)</summary>
>
> #### I tried to connect to the following addresses, but was blocked by
firewall rules:
>
> - `accounts.google.com`
> - Triggering command: `/proc/self/exe /proc/self/exe --type=utility
--utility-sub-type=network.mojom.NetworkService --lang=en-US
--service-sandbox-type=network --no-sandbox --disable-dev-shm-usage
--use-angle=swiftshader-webgl --crashpad-handler-pid=4244
--enable-crash-reporter=, --noerrdialogs
--user-data-dir=/tmp/karma-7608247 --change-stack-guard-on-fork=enable
--shared-files=network_parent_dirs_pipe:100,v8_context_snapshot_data:101
--field-trial-handle=3,i,17861204591039112903,10939758914733537520,262144
--disable-features=PaintHolding --variations-seed-version
--pseudonymization-salt-handle=7,i,16105935546789010716,16606217994416365594,4
--trace-process-track-uuid=3190708989122997041` (dns block)
> - Triggering command:
`/home/REDACTED/.cache/puppeteer/chrome/linux-148.0.7778.97/chrome-linux64/chrome
/home/REDACTED/.cache/puppeteer/chrome/linux-148.0.7778.97/chrome-linux64/chrome
--user-data-dir=/tmp/karma-7608247 --enable-automation
--no-default-browser-check --no-first-run --disable-default-apps
--disable-popup-blocking --disable-translate
--disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing
--disable-device-discovery-notifications --no-sandbox --disable-gpu
--disable-web-security --disable-dev-shm-usage
http://localhost:9876/?id=7608247 --headless --disable-gpu
--disable-dev-shm-usage --remote-debugging-port=9222` (dns block)
> - Triggering command: `/proc/self/exe /proc/self/exe --type=utility
--utility-sub-type=network.mojom.NetworkService --lang=en-US
--service-sandbox-type=network --no-sandbox --disable-dev-shm-usage
--use-angle=swiftshader-webgl --crashpad-handler-pid=4481
--enable-crash-reporter=, --noerrdialogs
--user-data-dir=/tmp/karma-68332849 --change-stack-guard-on-fork=enable
--shared-files=network_parent_dirs_pipe:100,v8_context_snapshot_data:101
--field-trial-handle=3,i,7502828240700176064,4166064653183156238,262144
--disable-features=PaintHolding --variations-seed-version
--pseudonymization-salt-handle=7,i,16762107709327361543,16977408465753334385,4
--trace-process-track-uuid=3190708989122997041` (dns block)
> - `clients2.google.com`
> - Triggering command: `/proc/self/exe /proc/self/exe --type=utility
--utility-sub-type=network.mojom.NetworkService --lang=en-US
--service-sandbox-type=network --no-sandbox --disable-dev-shm-usage
--use-angle=swiftshader-webgl --crashpad-handler-pid=4244
--enable-crash-reporter=, --noerrdialogs
--user-data-dir=/tmp/karma-7608247 --change-stack-guard-on-fork=enable
--shared-files=network_parent_dirs_pipe:100,v8_context_snapshot_data:101
--field-trial-handle=3,i,17861204591039112903,10939758914733537520,262144
--disable-features=PaintHolding --variations-seed-version
--pseudonymization-salt-handle=7,i,16105935546789010716,16606217994416365594,4
--trace-process-track-uuid=3190708989122997041` (dns block)
> - Triggering command:
`/home/REDACTED/.cache/puppeteer/chrome/linux-148.0.7778.97/chrome-linux64/chrome
/home/REDACTED/.cache/puppeteer/chrome/linux-148.0.7778.97/chrome-linux64/chrome
--user-data-dir=/tmp/karma-7608247 --enable-automation
--no-default-browser-check --no-first-run --disable-default-apps
--disable-popup-blocking --disable-translate
--disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing
--disable-device-discovery-notifications --no-sandbox --disable-gpu
--disable-web-security --disable-dev-shm-usage
http://localhost:9876/?id=7608247 --headless --disable-gpu
--disable-dev-shm-usage --remote-debugging-port=9222` (dns block)
> - Triggering command: `/proc/self/exe /proc/self/exe --type=utility
--utility-sub-type=network.mojom.NetworkService --lang=en-US
--service-sandbox-type=network --no-sandbox --disable-dev-shm-usage
--use-angle=swiftshader-webgl --crashpad-handler-pid=4481
--enable-crash-reporter=, --noerrdialogs
--user-data-dir=/tmp/karma-68332849 --change-stack-guard-on-fork=enable
--shared-files=network_parent_dirs_pipe:100,v8_context_snapshot_data:101
--field-trial-handle=3,i,7502828240700176064,4166064653183156238,262144
--disable-features=PaintHolding --variations-seed-version
--pseudonymization-salt-handle=7,i,16762107709327361543,16977408465753334385,4
--trace-process-track-uuid=3190708989122997041` (dns block)
> - `redirector.gvt1.com`
> - Triggering command: `/proc/self/exe /proc/self/exe --type=utility
--utility-sub-type=network.mojom.NetworkService --lang=en-US
--service-sandbox-type=network --no-sandbox --disable-dev-shm-usage
--use-angle=swiftshader-webgl --crashpad-handler-pid=4244
--enable-crash-reporter=, --noerrdialogs
--user-data-dir=/tmp/karma-7608247 --change-stack-guard-on-fork=enable
--shared-files=network_parent_dirs_pipe:100,v8_context_snapshot_data:101
--field-trial-handle=3,i,17861204591039112903,10939758914733537520,262144
--disable-features=PaintHolding --variations-seed-version
--pseudonymization-salt-handle=7,i,16105935546789010716,16606217994416365594,4
--trace-process-track-uuid=3190708989122997041` (dns block)
> - Triggering command:
`/home/REDACTED/.cache/puppeteer/chrome/linux-148.0.7778.97/chrome-linux64/chrome
/home/REDACTED/.cache/puppeteer/chrome/linux-148.0.7778.97/chrome-linux64/chrome
--user-data-dir=/tmp/karma-7608247 --enable-automation
--no-default-browser-check --no-first-run --disable-default-apps
--disable-popup-blocking --disable-translate
--disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing
--disable-device-discovery-notifications --no-sandbox --disable-gpu
--disable-web-security --disable-dev-shm-usage
http://localhost:9876/?id=7608247 --headless --disable-gpu
--disable-dev-shm-usage --remote-debugging-port=9222` (dns block)
> - Triggering command: `/proc/self/exe /proc/self/exe --type=utility
--utility-sub-type=network.mojom.NetworkService --lang=en-US
--service-sandbox-type=network --no-sandbox --disable-dev-shm-usage
--use-angle=swiftshader-webgl --crashpad-handler-pid=4481
--enable-crash-reporter=, --noerrdialogs
--user-data-dir=/tmp/karma-68332849 --change-stack-guard-on-fork=enable
--shared-files=network_parent_dirs_pipe:100,v8_context_snapshot_data:101
--field-trial-handle=3,i,7502828240700176064,4166064653183156238,262144
--disable-features=PaintHolding --variations-seed-version
--pseudonymization-salt-handle=7,i,16762107709327361543,16977408465753334385,4
--trace-process-track-uuid=3190708989122997041` (dns block)
> - `www.google.com`
> - Triggering command: `/proc/self/exe /proc/self/exe --type=utility
--utility-sub-type=network.mojom.NetworkService --lang=en-US
--service-sandbox-type=network --no-sandbox --disable-dev-shm-usage
--use-angle=swiftshader-webgl --crashpad-handler-pid=4244
--enable-crash-reporter=, --noerrdialogs
--user-data-dir=/tmp/karma-7608247 --change-stack-guard-on-fork=enable
--shared-files=network_parent_dirs_pipe:100,v8_context_snapshot_data:101
--field-trial-handle=3,i,17861204591039112903,10939758914733537520,262144
--disable-features=PaintHolding --variations-seed-version
--pseudonymization-salt-handle=7,i,16105935546789010716,16606217994416365594,4
--trace-process-track-uuid=3190708989122997041` (dns block)
> - Triggering command:
`/home/REDACTED/.cache/puppeteer/chrome/linux-148.0.7778.97/chrome-linux64/chrome
/home/REDACTED/.cache/puppeteer/chrome/linux-148.0.7778.97/chrome-linux64/chrome
--user-data-dir=/tmp/karma-7608247 --enable-automation
--no-default-browser-check --no-first-run --disable-default-apps
--disable-popup-blocking --disable-translate
--disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing
--disable-device-discovery-notifications --no-sandbox --disable-gpu
--disable-web-security --disable-dev-shm-usage
http://localhost:9876/?id=7608247 --headless --disable-gpu
--disable-dev-shm-usage --remote-debugging-port=9222` (dns block)
> - Triggering command: `/proc/self/exe /proc/self/exe --type=utility
--utility-sub-type=network.mojom.NetworkService --lang=en-US
--service-sandbox-type=network --no-sandbox --disable-dev-shm-usage
--use-angle=swiftshader-webgl --crashpad-handler-pid=4481
--enable-crash-reporter=, --noerrdialogs
--user-data-dir=/tmp/karma-68332849 --change-stack-guard-on-fork=enable
--shared-files=network_parent_dirs_pipe:100,v8_context_snapshot_data:101
--field-trial-handle=3,i,7502828240700176064,4166064653183156238,262144
--disable-features=PaintHolding --variations-seed-version
--pseudonymization-salt-handle=7,i,16762107709327361543,16977408465753334385,4
--trace-process-track-uuid=3190708989122997041` (dns block)
> - `www.googleapis.com`
> - Triggering command: `/usr/local/bin/node node install.js` (dns
block)
>
> If you need me to access, download, or install something from one of
these locations, you can either:
>
> - Configure [Actions setup
steps](https://gh.io/copilot/actions-setup-steps) to set up my
environment, which run before the firewall is enabled
> - Add the appropriate URLs or hosts to the custom allowlist in this
repository's [Copilot coding agent
settings](https://github.com/nevware21/ts-utils/settings/copilot/coding_agent)
(admins only)
>
> </details>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: MSNev <54870357+MSNev@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Nev <nev@nevware21.com>
1 parent 26b4766 commit d65f853
2 files changed
Lines changed: 126 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
161 | | - | |
| 161 | + | |
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| |||
272 | 272 | | |
273 | 273 | | |
274 | 274 | | |
275 | | - | |
| 275 | + | |
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
146 | 207 | | |
147 | 208 | | |
148 | 209 | | |
| |||
228 | 289 | | |
229 | 290 | | |
230 | 291 | | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
231 | 354 | | |
232 | 355 | | |
233 | 356 | | |
| |||
0 commit comments