@@ -993,11 +993,11 @@ not the raw header.
993993
994994### HTTP caching
995995
996- The loader fetches modules the way a browser fetches module scripts: while the
997- cache is on, the request carries no cache directives of its own (no
998- ` Cache-Control` , no ` Pragma` ), the URL is requested exactly as resolved, and connections are
999- persistent . Whether a stored response may answer a request is decided by the
1000- ** response** headers, so a dev server must send:
996+ The loader fetches modules the way a browser fetches module scripts: while
997+ the cache is on, the request carries no cache directives of its own (no
998+ ` Cache-Control` , no ` Pragma` ), the URL is requested exactly as resolved, and
999+ connections are persistent . Whether a stored response may answer a request is
1000+ decided by the ** response** headers, so a dev server must send:
10011001
10021002- ` Cache-Control: no-cache` (ideally with an ` ETag` or ` Last-Modified`
10031003 validator, so an unchanged module costs a ` 304` ) or ` Cache-Control: no-store`
@@ -1036,6 +1036,7 @@ remain:
10361036 burst of fetches fewer of them are reused than with OkHttp.
10371037- OkHttp negotiates HTTP / 2 with https servers that offer it, and then runs
10381038 concurrent fetches as streams on one connection.
1039+
10391040The OkHttp cache can answer a fresh response without a request, even after an
10401041app restart, and revalidates a stored response with its validator . The
10411042synchronous fallback fetch uses the same transport as the graph walk.
@@ -1059,11 +1060,12 @@ The cache is **on** unless something turns it off:
10591060| inspector ` Network.clearBrowserCache` | wipes it |
10601061| response header ` Clear-Site-Data: "cache"` (or ` "*"` ) on a module response | clears what the cache holds for that response' s origin |
10611062
1062- The app config and the launch options are read once per process, at startup;
1063- a `moduleHttpCache` that is not a boolean logs a warning and leaves the cache
1064- on. The process starts with the cache off when either the app config or the
1065- launch option says so; `setHttpCacheEnabled` overrides both from then on. `setHttpCacheEnabled` and
1066- `clearHttpCache` exist in debug and release builds.
1063+ The app config and the launch options are read once per process, at startup.
1064+ A numeric `moduleHttpCache` counts as `false` when it is `0` and as `true`
1065+ otherwise; any other value that is not a boolean logs a warning and leaves the
1066+ cache on. The process starts with the cache off when either the app config or
1067+ the launch option says so; `setHttpCacheEnabled` overrides both from then on.
1068+ `setHttpCacheEnabled` and `clearHttpCache` exist in debug and release builds.
10671069
10681070While the cache is off, a module fetch neither reads from nor writes to it,
10691071and its request carries `Cache-Control: no-cache` and `Pragma: no-cache` (what
@@ -1088,7 +1090,9 @@ origins count, since dev servers use them. The response's own entry goes too,
10881090so a cacheable carrier does not clear the cache again on every cache hit . On
10891091Android the cache can clear one origin only while the loader' s OkHttp client
10901092is open; otherwise (no OkHttp, or the platform transport fetched first) the
1091- header clears the whole cache directory.
1093+ header clears the whole cache directory. Only the final response' s header is
1094+ read, never one on a redirect, and an entry still being written when the
1095+ header arrives, such as a same- origin module fetched concurrently, survives.
10921096
10931097The cache is in effect when the setting above is on ** and** no connected
10941098inspector client has it disabled, so DevTools' "Disable cache" turns it off
@@ -1099,11 +1103,14 @@ session and even while paused, then passes a main-session command on to the
10991103JS `Network` domain handler registered with `__registerDomainDispatcher`
11001104(@nativescript/core registers one), which answers it. A command no JS handler
11011105answers, a worker session' s command, and any command arriving while paused
1102- get `{}` from the runtime: every command gets exactly one response. A
1106+ get ` {}` from the runtime: every command gets exactly one response . A JS
1107+ handler that throws makes that response an error (` -32000` ) with the thrown
1108+ message, and a command for a worker session that does not exist gets the
1109+ ` Session not found` error (` -32001` ) and changes nothing . A
11031110` Network.setCacheDisabled` without a boolean ` cacheDisabled` changes nothing,
11041111and where the runtime answers it, the answer is an invalid- parameters error
1105- (`-32602`). On Android
1106- the inspector serves one client at a time and exists only in debuggable apps.
1112+ (` -32602` ). On Android the inspector serves one client at a time and exists
1113+ only in debuggable apps.
11071114
11081115On Android a launch option is a file in ` /data/local/tmp` , named after the
11091116application id, that the CLI creates ** empty** before it starts the app, the
@@ -1118,7 +1125,9 @@ adb shell am start -n <appId>/<activity>
11181125Only an empty file is in effect . The runtime consumes it at startup by
11191126writing to it (an app cannot delete a file there), so it applies to one launch
11201127and the CLI recreates it for the next . When the write fails the option still
1121- applies, and keeps applying until the file is removed. Only the app' s default
1128+ applies, and keeps applying until the file is removed . The files the CLI
1129+ creates there are writable by every app on the device, so another app can
1130+ empty one to re- arm its option for the next launch . Only the app' s default
11221131process reads the options, in debug builds and in release builds that set
11231132`security.allowRemoteModules`; other release builds load no HTTP module and
11241133never look.
0 commit comments