Repository navigation
Expand file tree
/
Copy pathHttpLoader.h
More file actions
54 lines (45 loc) · 2.29 KB
/
Copy pathHttpLoader.h
File metadata and controls
54 lines (45 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#pragma once
#include <optional>
#include <string>
#include <vector>
#include "ns/http/ModuleFetch.h"
namespace tns {
// The HTTP module loader: policy, fetch orchestration and the cache switch are
// the shared core's (ns/http/ModuleFetch.h); this runtime supplies the
// NSURLSession transport and the per-isolate canonicalization vocabulary.
//
// V8's ResolveModuleCallback is synchronous (still true as of 14.9.207.39), so
// the fallback fetch HttpFetchModule has to block natively. Module bodies
// normally arrive through FetchModuleBodyAsync, driven by the module-graph walk
// (StartModuleGraphLoad in ns/loader/GraphLoad.h).
using nativescript::common::http::CacheOpResult;
using nativescript::common::http::CanonicalizationConfig;
using nativescript::common::http::ClearModuleHttpCache;
using nativescript::common::http::FetchModuleBodyAsync;
using nativescript::common::http::HttpFetchModule;
using nativescript::common::http::IsRemoteModulesAllowed;
using nativescript::common::http::IsRemoteUrlAllowed;
using nativescript::common::http::ModuleFetchDeadline;
using nativescript::common::http::ModuleFetchResult;
using nativescript::common::http::ModuleHttpCacheEnabled;
using nativescript::common::http::ModuleResponseKind;
using nativescript::common::http::RemoteModuleAllowlist;
using nativescript::common::http::RemoteModuleAllowlistFromConfig;
using nativescript::common::http::RemoteUrlAllowedByAllowlist;
using nativescript::common::http::SetModuleHttpCacheDisabledBy;
using nativescript::common::http::SetModuleHttpCacheEnabled;
// The module registry key of an HTTP(S) URL already spelled by
// NormalizeHttpModuleUrl, under the current isolate's vocabulary (ns:module
// `configureLoader({ canonicalization })`); without one only the fragment is
// stripped. Isolate thread only.
std::string CanonicalizeNormalizedHttpUrlKey(const std::string& normalizedUrl);
// The NSURLSession transport, for platform::HttpTransport(). Process lifetime.
nativescript::common::http::ModuleTransport& ModuleHttpTransport();
#ifdef __OBJC__
// The raw `security.remoteModuleAllowlist` value as the core reads it: nullopt
// unless an NSArray; each item nullopt unless an NSString with an exact UTF-8
// form.
std::optional<std::vector<std::optional<std::string>>>
RemoteModuleAllowlistItems(id value);
#endif
} // namespace tns