Title: Loader hardening follow-ups surfaced by the Android parity port (android#1965) · Issue #443 · NativeScript/ios · GitHub
Open Graph Title: Loader hardening follow-ups surfaced by the Android parity port (android#1965) · Issue #443 · NativeScript/ios
X Title: Loader hardening follow-ups surfaced by the Android parity port (android#1965) · Issue #443 · NativeScript/ios
Description: The Android parity port of the loader overhaul (NativeScript/android#1965, mirroring #383) included several adversarial review passes that compared both implementations function-by-function. A number of defects and cleanups surfaced on t...
Open Graph Description: The Android parity port of the loader overhaul (NativeScript/android#1965, mirroring #383) included several adversarial review passes that compared both implementations function-by-function. A numb...
X Description: The Android parity port of the loader overhaul (NativeScript/android#1965, mirroring #383) included several adversarial review passes that compared both implementations function-by-function. A numb...
Opengraph URL: https://github.com/NativeScript/ios/issues/443
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Loader hardening follow-ups surfaced by the Android parity port (android#1965)","articleBody":"The Android parity port of the loader overhaul (NativeScript/android#1965, mirroring #383) included several adversarial review passes that compared both implementations function-by-function. A number of defects and cleanups surfaced on the **iOS** side. Android has already fixed its analogues where they were shared; this issue catalogues what remains to fix here. Line anchors are against `main` at `ee51d741`/`3a6332a7`.\n\n## Bugs\n\n- [ ] **Worker entry rejection is swallowed.** `Worker.mm:264` attaches the same handler as both fulfill and reject (`Then(onSettled, onSettled)`), which marks a TLA entry's rejection handled — it never reaches the worker's `onerror` nor the parent's Worker error event. Android's fix routes it through the web's order (worker scope `onerror` first, then the parent). Most serious item on this list.\n- [ ] **Five `.Check()` sites in `ImportModuleDynamicallyCallback` can abort the process from user code.** `ModuleInternalCallbacks.mm:3133-3134, 3151, 3284-3287, 3291, 3296-3299`. The bare `Resolve(...GetModuleNamespace()).Check()` at `:3291` is reachable by a namespace exporting a TDZ-able `then` (import cycle): `Resolve` returns `Nothing` → CHECK-abort. The preceding guard only probes `default`, never `then`. Android converted these to `FromMaybe`/reject-with-thrown-reason.\n- [ ] **No pump honors `IsExecutionTerminating`.** All three pump loops (`NativeScript.mm:68-85`, `ModuleInternalCallbacks.mm:1671-1683`, `ModuleInternal.mm:1400-1425`) spin to their deadline after `worker.terminate()`, then throw from a terminating isolate.\n- [ ] **`deadlineSeconds: NaN/Infinity` accepted natively → infinite pump** (`ModuleInternal.mm:346-348`). The JS mint-time validation covers `ns:module`, but the native layer re-validates nothing.\n- [ ] **Dynamic-import failure tail leaks a pending exception and rejects with a bare message** (`mm:2281, 2381-2383` — `\"HTTP fetch/compile failed\"` with no URL, no cause). Android routes the classifier's `failureReason`.\n- [ ] **Import map is applied twice on dynamic import, and the second pass drops scopes** (`mm:2473-2492`, then `mm:3088` with an empty referrer). Android resolves once through the shared seam.\n- [ ] **Sync transport clears a pending cache-bust mark on any 2xx before classification** (`HttpLoader.mm:744`) — a `200 text/html` SPA fallback consumes the eviction nonce. The async path (and the contract) clear only on an ok-classified response.\n- [ ] **CJS cache key strips extensions**: `require('./config.json')` after `require('./config.js')` returns the JS module's exports (`mm:673-681`).\n- [ ] **Static `import './x.js?v=1'` from a local referrer throws** — the resolver probes a file literally named `x.js?v=1` (`mm:2443-2452` handles this for dynamic import only). Android strips query/fragment in the shared resolution seam.\n- [ ] **Registry-key replacement leaks require-facades and identity-index entries** (`mm:463, 1540, 2106, 2252`): eviction unhooks them, replacement does not — one leaked facade + two Globals per HMR reload of a required module. Android hooks the drop into its shared unindex helper so replacement and eviction behave identically; adopt the same shape.\n- [ ] **`ThrowException` with a possibly-empty handle** (`mm:1280-1281`).\n- [ ] **Failed Node-API addon `require` silently returns `undefined`** (`mm:500-507`).\n- [ ] **Require failures are re-wrapped, destroying the original error's identity/class** (`mm:622-667`). Android rethrows unchanged.\n- [ ] **Worker `.mjs` entries get 6 prepended lines** (`mm:1694-1713`): stack line numbers shift by 6, and an entry declaring its own `const self` becomes a SyntaxError.\n\n## Principle / parity cleanups\n\n- [ ] **Webpack client vocabulary residue**: the `__webpack_ids__` probe and a hardcoded `file:///app/runtime.mjs` in the dynamic-import path (`mm:3211-3273`) survived the vocabulary purge — a direct \"mechanism in the runtime, vocabulary from the client\" violation. Android's runtime is grep-clean of bundler strings.\n- [ ] **Rejection detail is debug-only**: release builds throw a bare `\"Module evaluation promise rejected\"` (`ModuleInternal.mm:1203-1283`), violating loud-identical-failures. Android splices path + reason unconditionally.\n- [ ] **Boot backstop logs its failures and never evicts** (`NativeScript.mm:88-96`); its \"never settled\" fatal string also diverges from the shared contract doc's wording. Android throws both documented fatals and evicts the entry.\n- [ ] **Fetch-yield complex** (`HttpLoader.mm:897-918`, `t_bootEvaluationDepth`, `BootEvalScope`): `RegisterHttpFetchYield` has no callers, and the default yield fires *after* the sync fetch it claims to overlap. Android deleted the whole complex; decide whether the cold-boot placeholder-repaint value is real here or delete likewise.\n- [ ] **`importMap` object branch uses the patchable global `JSON.stringify`** (`mm:3441-3448`); the C++ `v8::JSON` API is tamper-immune (Android switched, with a throwing-`toJSON` propagation fix worth mirroring).\n- [ ] **The non-pumping TLA wait burns a blind 1ms `usleep` per iteration**; Android now waits on its event loop's fds (instant wakeup on fetch completions/platform tasks, same 10ms cap). The analogous CFRunLoop-source wait may be worth it.\n- [ ] **`import.meta.dirname` is inconsistent with the base-stripped `import.meta.url`** (`Runtime.mm:94-95` vs `:136-142`).\n- [ ] **Doc/comment fixes**: `getLoadedModuleUrls`'s URL-like filter and the `preserveQueryFor`-before-dev-prefix ordering are implemented identically on both platforms but documented only on Android; `primordials.js:5` says \"second parameter\" (it's the fifth); the doc's `inspect` quoting example shows single quotes while `inspect.js` (byte-identical on both platforms) emits `JSON.stringify` double quotes.\n- [ ] **Port the two pump timer specs** from android#1965 (`timer-tla` under `pumpRunLoop: true`; the default-options does-not-settle contract spec) — iOS's behavior already matches the agreed contract; the specs just don't exist here.\n\n## Shared items tracked elsewhere\n\nThe require(esm) facade evaluating under sync-strict (bogus TLA refusal naming `ns:require-facade:` for `createPumpingRequire` of a settled TLA module with a default export), the `validatePumpingOptions` prototype-chain reads, the `createRequire` `file:` parser vs `node:url` disagreement, the JSON-module textual `__proto__` wrap, and the per-isolate graph-work counter are **shared** defects/decisions coordinated from the Android side — see NativeScript/android#2020.\n","author":{"url":"https://github.com/edusperoni","@type":"Person","name":"edusperoni"},"datePublished":"2026-08-20T02:49:07Z","url":"https://github.com/NativeScript/ios/issues/443"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:28c05fb8-2d06-6ea7-32bc-390f15e033f3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9F0E:2E124E:18E9967:1FC39E4:6B014AED |
| html-safe-nonce | 9760c4ff223e99d740b8df6de521b3f783557e450fc0babb120f5febbf01acc7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RjBFOjJFMTI0RToxOEU5OTY3OjFGQzM5RTQ6NkIwMTRBRUQiLCJ2aXNpdG9yX2lkIjoiMTk3NjI5NjU0ODQxMzI5NTM0MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 790c10f77c527b2e485d60b9188d99c8d27f8bc1854598f52c8c8adb077adc3a |
| hovercard-subject-tag | issue:5199134788 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/NativeScript/ios/443/issue_layout |
| twitter:image | https://opengraph.githubassets.com/59b3f04f4f18064b1a0a0531aee35804d307f8c784de140bd11ac7041a6db094/NativeScript/ios/issues/443 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/59b3f04f4f18064b1a0a0531aee35804d307f8c784de140bd11ac7041a6db094/NativeScript/ios/issues/443 |
| og:image:alt | The Android parity port of the loader overhaul (NativeScript/android#1965, mirroring #383) included several adversarial review passes that compared both implementations function-by-function. A numb... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | edusperoni |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/NativeScript/ios git https://github.com/NativeScript/ios.git |
| octolytics-dimension-user_id | 7392261 |
| octolytics-dimension-user_login | NativeScript |
| octolytics-dimension-repository_id | 172934359 |
| octolytics-dimension-repository_nwo | NativeScript/ios |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 172934359 |
| octolytics-dimension-repository_network_root_nwo | NativeScript/ios |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width