react-native-minimal-webview 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +1 -1
- package/android/src/main/java/expo/modules/minimalwebview/Asks.kt +5 -11
- package/android/src/main/java/expo/modules/minimalwebview/Hooks.kt +17 -11
- package/android/src/main/java/expo/modules/minimalwebview/MinimalWebView.kt +64 -119
- package/android/src/main/java/expo/modules/minimalwebview/MinimalWebViewClients.kt +16 -31
- package/android/src/main/java/expo/modules/minimalwebview/MinimalWebViewModule.kt +4 -16
- package/android/src/main/java/expo/modules/minimalwebview/MinimalWebViewNavigation.kt +24 -38
- package/android/src/main/java/expo/modules/minimalwebview/MinimalWebViewScripts.kt +24 -36
- package/android/src/main/java/expo/modules/minimalwebview/NavigationRules.kt +19 -20
- package/android/src/main/java/expo/modules/minimalwebview/PlatformSettings.kt +25 -37
- package/android/src/main/java/expo/modules/minimalwebview/PullToRefresh.kt +14 -18
- package/android/src/main/java/expo/modules/minimalwebview/requests/Downloads.kt +12 -23
- package/android/src/main/java/expo/modules/minimalwebview/requests/FileUpload.kt +0 -1
- package/android/src/main/java/expo/modules/minimalwebview/requests/FullscreenVideo.kt +1 -4
- package/android/src/main/java/expo/modules/minimalwebview/requests/Permissions.kt +34 -24
- package/build/WebView.d.ts +8 -1
- package/build/WebView.d.ts.map +1 -1
- package/build/WebView.js +22 -68
- package/build/WebView.js.map +1 -1
- package/build/bridge/createBridge.d.ts +1 -5
- package/build/bridge/createBridge.d.ts.map +1 -1
- package/build/bridge/createBridge.js +3 -15
- package/build/bridge/createBridge.js.map +1 -1
- package/build/bridge/endpoint.d.ts +1 -2
- package/build/bridge/endpoint.d.ts.map +1 -1
- package/build/bridge/endpoint.js +5 -6
- package/build/bridge/endpoint.js.map +1 -1
- package/build/bridge/matchesOrigin.d.ts +11 -0
- package/build/bridge/matchesOrigin.d.ts.map +1 -0
- package/build/bridge/matchesOrigin.js +26 -0
- package/build/bridge/matchesOrigin.js.map +1 -0
- package/build/bridge/origins.d.ts +2 -13
- package/build/bridge/origins.d.ts.map +1 -1
- package/build/bridge/origins.js +1 -30
- package/build/bridge/origins.js.map +1 -1
- package/build/bridge/pageClient.generated.d.ts +1 -1
- package/build/bridge/pageClient.generated.d.ts.map +1 -1
- package/build/bridge/pageClient.generated.js +2 -2
- package/build/bridge/pageClient.generated.js.map +1 -1
- package/build/bridge/protocol.d.ts +3 -5
- package/build/bridge/protocol.d.ts.map +1 -1
- package/build/bridge/protocol.js +12 -14
- package/build/bridge/protocol.js.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.js +1 -1
- package/build/navigationRules.d.ts +0 -5
- package/build/navigationRules.d.ts.map +1 -1
- package/build/navigationRules.js +3 -12
- package/build/navigationRules.js.map +1 -1
- package/build/reactNativeWebViewDefaults.d.ts +0 -4
- package/build/reactNativeWebViewDefaults.d.ts.map +1 -1
- package/build/reactNativeWebViewDefaults.js +0 -4
- package/build/reactNativeWebViewDefaults.js.map +1 -1
- package/build/reactNativeWebViewMessages.d.ts.map +1 -1
- package/build/reactNativeWebViewMessages.js +0 -1
- package/build/reactNativeWebViewMessages.js.map +1 -1
- package/build/refStore.d.ts +0 -2
- package/build/refStore.d.ts.map +1 -1
- package/build/refStore.js +0 -6
- package/build/refStore.js.map +1 -1
- package/build/types.d.ts +25 -12
- package/build/types.d.ts.map +1 -1
- package/ios/Asks.swift +6 -9
- package/ios/DelegateProxy.swift +2 -19
- package/ios/DownloadName.swift +0 -2
- package/ios/Downloads.swift +0 -2
- package/ios/Hooks.swift +4 -6
- package/ios/Loads.swift +37 -19
- package/ios/MinimalWebView+Dialogs.swift +2 -6
- package/ios/MinimalWebView+Navigation.swift +17 -50
- package/ios/MinimalWebView+Scripts.swift +4 -16
- package/ios/MinimalWebView.podspec +1 -2
- package/ios/MinimalWebView.swift +62 -132
- package/ios/MinimalWebViewModule.swift +1 -18
- package/ios/NavigationRules.swift +2 -9
- package/ios/OriginRules.swift +4 -13
- package/ios/PlatformSettings.swift +9 -30
- package/ios/ReadAccess.swift +0 -2
- package/ios/Records.swift +18 -0
- package/ios/Recovery.swift +2 -8
- package/ios/SharedCookies.swift +10 -25
- package/package.json +4 -4
- package/src/WebView.tsx +34 -77
- package/src/bridge/createBridge.ts +5 -20
- package/src/bridge/endpoint.ts +6 -9
- package/src/bridge/matchesOrigin.ts +27 -0
- package/src/bridge/origins.ts +2 -30
- package/src/bridge/pageClient.generated.ts +2 -2
- package/src/bridge/pageClient.ts +1 -7
- package/src/bridge/protocol.ts +16 -18
- package/src/index.ts +1 -1
- package/src/navigationRules.ts +6 -12
- package/src/reactNativeWebViewDefaults.ts +0 -4
- package/src/reactNativeWebViewMessages.ts +0 -1
- package/src/refStore.ts +0 -7
- package/src/types.ts +25 -12
package/build/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,KAAK,EACV,kBAAkB,EAClB,OAAO,EACP,MAAM,EACN,MAAM,EACN,cAAc,EACd,YAAY,EACb,MAAM,sBAAsB,CAAC;AAE9B;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GACrB;IACE;;;;;;;OAOG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,GACD;IACE,IAAI,EAAE,MAAM,CAAC;IACb,+G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;;;;;;;;;;;;;;;;;OAuCG;IACH,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACzD;;;;;;;;OAQG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACxE,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,gEAAgE;IAChE,QAAQ,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI,CAAC;IACpC,kEAAkE;IAClE,QAAQ,IAAI,eAAe,CAAC;IAC5B;;;;OAIG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;CAC7C,CAAC"}
|
package/ios/Asks.swift
CHANGED
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
/// `answer` or native gives up (nil, and the core's `askCancelled` to JS): a Document end or a timeout. `send` puts an event
|
|
3
|
-
/// on the view's `onHookEvent`, which reaches the app's extensions' `onEvent`. Main thread only.
|
|
1
|
+
@MainActor
|
|
4
2
|
final class Asks {
|
|
5
3
|
private let send: ([String: Any]) -> Void
|
|
6
4
|
private var pending: [Int: (Any?) -> Void] = [:]
|
|
7
5
|
private var nextId = 0
|
|
8
|
-
/// The view closed: JS is unmounted, and a hook may still hold its context.
|
|
9
6
|
private var closed = false
|
|
10
7
|
|
|
11
8
|
init(send: @escaping ([String: Any]) -> Void) {
|
|
12
9
|
self.send = send
|
|
13
10
|
}
|
|
14
11
|
|
|
15
|
-
/// Sends the ask to JS and returns its id, for `cancel`. Once the view closed it answers nil at once.
|
|
12
|
+
/// Sends the ask to JS and returns its id, for `cancel`. Once the view closed it answers nil at once and returns nil.
|
|
16
13
|
@discardableResult
|
|
17
|
-
func ask(_ key: String, _ name: String, _ payload: [String: Any], _ onAnswer: @escaping (Any?) -> Void) -> Int {
|
|
14
|
+
func ask(_ key: String, _ name: String, _ payload: [String: Any], _ onAnswer: @escaping (Any?) -> Void) -> Int? {
|
|
18
15
|
guard !closed else {
|
|
19
16
|
onAnswer(nil)
|
|
20
|
-
return
|
|
17
|
+
return nil
|
|
21
18
|
}
|
|
22
19
|
nextId += 1
|
|
23
20
|
pending[nextId] = onAnswer
|
|
@@ -25,7 +22,7 @@ final class Asks {
|
|
|
25
22
|
return nextId
|
|
26
23
|
}
|
|
27
24
|
|
|
28
|
-
///
|
|
25
|
+
/// An answer for an ask that was answered or cancelled already is dropped.
|
|
29
26
|
func answer(_ id: Int, _ value: Any?) {
|
|
30
27
|
pending.removeValue(forKey: id)?(value)
|
|
31
28
|
}
|
|
@@ -37,7 +34,7 @@ final class Asks {
|
|
|
37
34
|
onAnswer(nil)
|
|
38
35
|
}
|
|
39
36
|
|
|
40
|
-
/// Cancels every pending ask
|
|
37
|
+
/// Cancels every pending ask, telling JS unless the view is closing.
|
|
41
38
|
func documentEnded(_ reason: DocumentEnd) {
|
|
42
39
|
if reason == .closing { closed = true }
|
|
43
40
|
pending.keys.forEach { cancel($0, tell: reason != .closing) }
|
package/ios/DelegateProxy.swift
CHANGED
|
@@ -1,22 +1,15 @@
|
|
|
1
1
|
import WebKit
|
|
2
2
|
|
|
3
|
-
/// The WKWebView's navigation and UI delegate. It implements the observation callbacks the core doesn't, to give them
|
|
4
|
-
/// to every hook delegate, and the authentication challenge, to offer it to each in turn; every other callback is
|
|
5
|
-
/// forwarded to the core (MinimalWebView) or to a hook delegate, by the rule in `WebViewContext`. `responds(to:)` says
|
|
6
|
-
/// yes for whatever any of them implements, which WebKit reads once, when the proxy is assigned as the delegate.
|
|
7
3
|
final class DelegateProxy: NSObject, WKNavigationDelegate, WKUIDelegate {
|
|
8
4
|
private weak var core: NSObject?
|
|
9
5
|
var navigationDelegates: [WKNavigationDelegate] = []
|
|
10
6
|
var uiDelegates: [WKUIDelegate] = []
|
|
11
|
-
/// Hears each action policy check a hook delegate takes: the core's own bookkeeping still needs it.
|
|
12
7
|
var hookDecides: (WKNavigationAction) -> Void = { _ in }
|
|
13
8
|
|
|
14
9
|
init(core: NSObject) {
|
|
15
10
|
self.core = core
|
|
16
11
|
}
|
|
17
12
|
|
|
18
|
-
/// The hook delegates for a callback: the list of the protocol that declares it. A selector neither protocol declares
|
|
19
|
-
/// (a private one) goes to both lists.
|
|
20
13
|
private func delegates(for selector: Selector) -> [NSObject] {
|
|
21
14
|
let navigation = Self.declares(WKNavigationDelegate.self, selector)
|
|
22
15
|
let ui = Self.declares(WKUIDelegate.self, selector)
|
|
@@ -80,9 +73,7 @@ final class DelegateProxy: NSObject, WKNavigationDelegate, WKUIDelegate {
|
|
|
80
73
|
|
|
81
74
|
private static let challenge = NSSelectorFromString("webView:didReceiveAuthenticationChallenge:completionHandler:")
|
|
82
75
|
|
|
83
|
-
///
|
|
84
|
-
/// WebKit calls only this variant once the delegate answers it, so the proxy answers it always and calls the owner's
|
|
85
|
-
/// own variant, which makes the order of the list decide whichever variants the delegates implement.
|
|
76
|
+
/// WebKit calls only this variant when the delegate implements it: the proxy always does, and calls the owner's own.
|
|
86
77
|
func webView(
|
|
87
78
|
_ webView: WKWebView,
|
|
88
79
|
decidePolicyFor navigationAction: WKNavigationAction,
|
|
@@ -104,16 +95,12 @@ final class DelegateProxy: NSObject, WKNavigationDelegate, WKUIDelegate {
|
|
|
104
95
|
private static let actionPolicyWithPreferences =
|
|
105
96
|
NSSelectorFromString("webView:decidePolicyForNavigationAction:preferences:decisionHandler:")
|
|
106
97
|
|
|
107
|
-
/// The hook delegates that implement a decision, in order: the first one takes it.
|
|
108
98
|
private func takers(of decision: Selector) -> [NSObject] {
|
|
109
99
|
delegates(for: decision).filter {
|
|
110
100
|
$0.responds(to: decision) || decision == Self.actionPolicy && $0.responds(to: Self.actionPolicyWithPreferences)
|
|
111
101
|
}
|
|
112
102
|
}
|
|
113
103
|
|
|
114
|
-
/// The warnings about the decisions the hook delegates take that this proxy hasn't given yet: one for a decision
|
|
115
|
-
/// more than one of them implements, as only the first one gets it, and one for a decision the core makes from the
|
|
116
|
-
/// app's props or their defaults, naming what stops applying.
|
|
117
104
|
func newWarnings() -> [String] {
|
|
118
105
|
Self.decisions.flatMap { decision, lost in
|
|
119
106
|
let name = NSStringFromSelector(decision)
|
|
@@ -127,8 +114,6 @@ final class DelegateProxy: NSObject, WKNavigationDelegate, WKUIDelegate {
|
|
|
127
114
|
|
|
128
115
|
private var warned: Set<String> = []
|
|
129
116
|
|
|
130
|
-
/// The decision callbacks: a hook delegate that implements one owns it, and `lost` is what stops applying when the
|
|
131
|
-
/// core makes it from the props. WebKit never asks for the plain action policy, as the proxy answers the other variant.
|
|
132
117
|
private static let decisions: [(selector: Selector, lost: String?)] = [
|
|
133
118
|
(actionPolicy, "navigationRules, their defaults and onNavigationRequest don't apply to navigations"),
|
|
134
119
|
(
|
|
@@ -149,13 +134,11 @@ final class DelegateProxy: NSObject, WKNavigationDelegate, WKUIDelegate {
|
|
|
149
134
|
]
|
|
150
135
|
}
|
|
151
136
|
|
|
152
|
-
/// Hooks whose keys turn on together attach in registration order, which orders their delegates.
|
|
153
137
|
func inRegistrationOrder(_ keys: Set<String>, _ registered: [String]) -> [String] {
|
|
154
138
|
registered.filter(keys.contains) + keys.subtracting(registered).sorted()
|
|
155
139
|
}
|
|
156
140
|
|
|
157
|
-
///
|
|
158
|
-
/// must be on, and equal as JSON: `NSNumber(false).isEqual(NSNumber(0))` is true, at any depth, as Android's isn't.
|
|
141
|
+
/// `NSNumber(false).isEqual(NSNumber(0))` is true, so the values compare as JSON.
|
|
159
142
|
func staysOn(_ was: Any?, _ value: Any?) -> Bool {
|
|
160
143
|
guard let was, let value else { return false }
|
|
161
144
|
let json = { (value: Any) in try? JSONSerialization.data(withJSONObject: value, options: [.fragmentsAllowed, .sortedKeys]) }
|
package/ios/DownloadName.swift
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import Foundation
|
|
2
2
|
|
|
3
|
-
/// The name a download is saved under, in a directory of its own.
|
|
4
3
|
enum DownloadName {
|
|
5
|
-
/// `suggested` with each `/` replaced by `_`; a result that is empty, `.` or `..` becomes `download`, as on Android (`URLUtilCompat.guessFileName`, then `Downloads.safeName`).
|
|
6
4
|
static func safe(_ suggested: String) -> String {
|
|
7
5
|
let name = suggested.replacingOccurrences(of: "/", with: "_")
|
|
8
6
|
return name.isEmpty || name == "." || name == ".." ? "download" : name
|
package/ios/Downloads.swift
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import WebKit
|
|
2
2
|
|
|
3
|
-
/// The `onDownload` prop, through WKDownload. Without the prop, `openDownload` takes the URL.
|
|
4
3
|
final class Downloads: NSObject, WKDownloadDelegate {
|
|
5
4
|
private weak var view: MinimalWebView?
|
|
6
5
|
private var files: [ObjectIdentifier: (url: URL, mimeType: String)] = [:]
|
|
@@ -9,7 +8,6 @@ final class Downloads: NSObject, WKDownloadDelegate {
|
|
|
9
8
|
self.view = view
|
|
10
9
|
}
|
|
11
10
|
|
|
12
|
-
/// A main-frame response that is a file, not a page.
|
|
13
11
|
static func isDownload(_ response: WKNavigationResponse) -> Bool {
|
|
14
12
|
let disposition = (response.response as? HTTPURLResponse)?.value(forHTTPHeaderField: "Content-Disposition") ?? ""
|
|
15
13
|
return response.isForMainFrame && (disposition.lowercased().hasPrefix("attachment") || !response.canShowMIMEType)
|
package/ios/Hooks.swift
CHANGED
|
@@ -151,8 +151,8 @@ public protocol WebViewContext: AnyObject {
|
|
|
151
151
|
/// Sends an event to JS: the extension with the hook's key gets `{ name, payload }` in its `onEvent`. It is dropped
|
|
152
152
|
/// while the hook is off.
|
|
153
153
|
func emit(_ name: String, _ payload: [String: Any])
|
|
154
|
-
/// Sends the event as ``emit(_:_:)`` does,
|
|
155
|
-
/// promise awaited.
|
|
154
|
+
/// Sends the event as ``emit(_:_:)`` does, but to the extension's `onAsk` when it has one, and calls `onAnswer` with
|
|
155
|
+
/// that handler's return value, a promise awaited.
|
|
156
156
|
///
|
|
157
157
|
/// It answers nil when the handler throws or there is none, or when the Document ends first; there is no timeout. It
|
|
158
158
|
/// answers nil at once while the hook is off, and after the view closed.
|
|
@@ -217,7 +217,6 @@ public final class HookReply {
|
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
-
/// A hook's view of the WebView: the core's context with the hook's key on its events. The view owns it and routes the delegates of the contexts that are on.
|
|
221
220
|
final class HookContext: WebViewContext {
|
|
222
221
|
let hook: MinimalWebViewHooks.Hook
|
|
223
222
|
private weak var view: MinimalWebView?
|
|
@@ -303,8 +302,7 @@ final class HookContext: WebViewContext {
|
|
|
303
302
|
handlers.forEach { $0(.closing) }
|
|
304
303
|
}
|
|
305
304
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
if Thread.isMainThread { block() } else { DispatchQueue.main.async(execute: block) }
|
|
305
|
+
private func onMain(_ block: @escaping @MainActor () -> Void) {
|
|
306
|
+
if Thread.isMainThread { MainActor.assumeIsolated(block) } else { DispatchQueue.main.async(execute: block) }
|
|
309
307
|
}
|
|
310
308
|
}
|
package/ios/Loads.swift
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import Foundation
|
|
2
2
|
|
|
3
|
-
/// The main-frame loads' choices that need no WebView.
|
|
4
3
|
enum Loads {
|
|
5
|
-
/// Whether `a` and `b` are the same URL as WebKit reports one:
|
|
6
|
-
///
|
|
7
|
-
/// out our own loads (`ownLoads`), which skip the navigation rules: WebKit reports the load of a `source.uri`
|
|
8
|
-
/// of `https://Example.com:443` as `https://example.com/`.
|
|
4
|
+
/// Whether `a` and `b` are the same URL as WebKit reports one: WebKit reports a load of `https://Example.com:443` as
|
|
5
|
+
/// `https://example.com/`.
|
|
9
6
|
static func sameURL(_ a: URL, _ b: URL) -> Bool {
|
|
10
7
|
canonical(a.standardized) == canonical(b.standardized)
|
|
11
8
|
}
|
|
12
9
|
|
|
13
|
-
/// `url` in the form `sameURL` compares, dot segments aside
|
|
10
|
+
/// `url` in the form `sameURL` compares, dot segments aside.
|
|
14
11
|
static func canonical(_ url: URL) -> String {
|
|
15
12
|
guard var components = URLComponents(url: url, resolvingAgainstBaseURL: false) else { return url.absoluteString }
|
|
16
13
|
components.scheme = components.scheme?.lowercased()
|
|
@@ -20,26 +17,47 @@ enum Loads {
|
|
|
20
17
|
return components.string ?? url.absoluteString
|
|
21
18
|
}
|
|
22
19
|
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
enum Outcome: String {
|
|
21
|
+
case finished, failed, cancelled
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
static func ended(by error: NSError) -> (outcome: Outcome, kind: String?) {
|
|
25
25
|
switch (error.domain, error.code) {
|
|
26
|
-
//
|
|
27
|
-
// a download, a 204, a blocked redirect): not an error.
|
|
26
|
+
// WebKitErrorFrameLoadInterruptedByPolicyChange: a download, a 204, a blocked redirect.
|
|
28
27
|
case (NSURLErrorDomain, NSURLErrorCancelled), ("WebKitErrorDomain", 102):
|
|
29
|
-
return (outcome:
|
|
30
|
-
// WebKitErrorPlugInWillHandleLoad:
|
|
31
|
-
// the document's video loads the file itself (WebLocalFrameLoaderClient::committedLoad): the page shows, as on
|
|
32
|
-
// Android.
|
|
28
|
+
return (outcome: .cancelled, kind: nil)
|
|
29
|
+
// WebKitErrorPlugInWillHandleLoad: WebKit ends the load once a media document has committed, and its video loads the file.
|
|
33
30
|
case ("WebKitErrorDomain", 204):
|
|
34
|
-
return (outcome:
|
|
35
|
-
// The TLS handshake and certificate errors.
|
|
31
|
+
return (outcome: .finished, kind: nil)
|
|
36
32
|
case (NSURLErrorDomain, NSURLErrorClientCertificateRequired...NSURLErrorSecureConnectionFailed):
|
|
37
|
-
return (outcome:
|
|
33
|
+
return (outcome: .failed, kind: "ssl")
|
|
38
34
|
default:
|
|
39
|
-
return (outcome:
|
|
35
|
+
return (outcome: .failed, kind: "network")
|
|
40
36
|
}
|
|
41
37
|
}
|
|
42
38
|
}
|
|
43
39
|
|
|
44
|
-
/// The
|
|
40
|
+
/// The loads the view starts itself, which skip the navigation rules at their own main-frame policy check.
|
|
41
|
+
struct OwnLoads {
|
|
42
|
+
private var loads: [(url: URL, checksBefore: Int)] = []
|
|
43
|
+
private var checks = 0
|
|
44
|
+
|
|
45
|
+
mutating func started(_ url: URL) {
|
|
46
|
+
loads.append((url, checks))
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/// Counts a main-frame policy check for `target`, and reports whether it is an own load's, which it uses up.
|
|
50
|
+
mutating func check(_ target: URL) -> Bool {
|
|
51
|
+
checks += 1
|
|
52
|
+
guard let own = loads.firstIndex(where: { Loads.sameURL($0.url, target) }) else { return false }
|
|
53
|
+
loads.remove(at: own)
|
|
54
|
+
return true
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/// Drops each load that a check for another URL has passed over since it started.
|
|
58
|
+
mutating func committed() {
|
|
59
|
+
loads.removeAll { $0.checksBefore < checks }
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
45
63
|
private let defaultPorts = ["http": 80, "https": 443, "ws": 80, "wss": 443, "ftp": 21]
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import UIKit
|
|
2
2
|
import WebKit
|
|
3
3
|
|
|
4
|
-
/// JS alert, confirm and prompt as UIAlertControllers. Android's WebChromeClient shows them by default.
|
|
5
4
|
/// WebKit requires each completion handler to be called exactly once, including when no dialog can be shown.
|
|
6
5
|
extension MinimalWebView: WKUIDelegate {
|
|
7
6
|
func webView(
|
|
@@ -41,8 +40,6 @@ extension MinimalWebView: WKUIDelegate {
|
|
|
41
40
|
showDialog(alert) { completionHandler(nil) }
|
|
42
41
|
}
|
|
43
42
|
|
|
44
|
-
/// WebKit asks the OS itself, with the app's Info.plist strings; a grant from `onPermissionRequest` skips only
|
|
45
|
-
/// WebKit's own prompt.
|
|
46
43
|
func webView(
|
|
47
44
|
_ webView: WKWebView,
|
|
48
45
|
requestMediaCapturePermissionFor origin: WKSecurityOrigin,
|
|
@@ -63,7 +60,6 @@ extension MinimalWebView: WKUIDelegate {
|
|
|
63
60
|
}
|
|
64
61
|
}
|
|
65
62
|
|
|
66
|
-
/// The frame's host, or "JavaScript" when it has none (an opaque origin or `file:`), as Android titles a `data:` page's dialogs: a dialog must not look like the app's own alert.
|
|
67
63
|
private func dialogTitle(_ frame: WKFrameInfo) -> String {
|
|
68
64
|
let host = frame.securityOrigin.host
|
|
69
65
|
return host.isEmpty ? "JavaScript" : host
|
|
@@ -78,14 +74,14 @@ extension MinimalWebView: WKUIDelegate {
|
|
|
78
74
|
|
|
79
75
|
private func action(_ title: String, _ style: UIAlertAction.Style, _ complete: @escaping () -> Void) -> UIAlertAction {
|
|
80
76
|
UIAlertAction(title: title, style: style) { [weak self] action in
|
|
81
|
-
// UIKit runs this after the dismissal animation
|
|
77
|
+
// UIKit runs this after the dismissal animation, by when an unmount or a crash may have completed the dialog.
|
|
82
78
|
guard let self, dialog?.controller.actions.contains(action) == true else { return }
|
|
83
79
|
dialog = nil
|
|
84
80
|
complete()
|
|
85
81
|
}
|
|
86
82
|
}
|
|
87
83
|
|
|
88
|
-
///
|
|
84
|
+
/// UIKit only logs a present from a controller that has a presented one or is being presented.
|
|
89
85
|
private func showDialog(_ alert: UIAlertController, cancel: @escaping () -> Void) {
|
|
90
86
|
var top = window?.rootViewController
|
|
91
87
|
while let next = top?.presentedViewController, !next.isBeingDismissed { top = next }
|
|
@@ -2,13 +2,10 @@ import UIKit
|
|
|
2
2
|
import UIKit.UIGestureRecognizerSubclass
|
|
3
3
|
import WebKit
|
|
4
4
|
|
|
5
|
-
/// Navigation rules, `ask`, new windows and external opening. The decision handler is held while JS answers an
|
|
6
|
-
/// `ask`, called exactly once, and blocked after 1 s or when the WebView goes away.
|
|
7
5
|
extension MinimalWebView {
|
|
8
6
|
func decideNavigation(_ action: WKNavigationAction, decide: @escaping @MainActor (WKNavigationActionPolicy) -> Void) {
|
|
9
7
|
guard let target = action.request.url else { return decide(allowInPlace) }
|
|
10
|
-
//
|
|
11
|
-
// rules, as on Android (shouldOverrideUrlLoading is not called for them).
|
|
8
|
+
// A new window (no target frame) is decided in createWebViewWith.
|
|
12
9
|
guard let targetFrame = action.targetFrame else { return decide(allowInPlace) }
|
|
13
10
|
let mainFrame = targetFrame.isMainFrame
|
|
14
11
|
let own = takeOwnLoad(action)
|
|
@@ -19,8 +16,7 @@ extension MinimalWebView {
|
|
|
19
16
|
let request = NavigationRules.Request(
|
|
20
17
|
url: target.absoluteString, mainFrame: mainFrame, newWindow: false, userInitiated: userInitiated(action)
|
|
21
18
|
)
|
|
22
|
-
//
|
|
23
|
-
// http(s) one opens outside the WebView (openDownload): .allow would show it as a page.
|
|
19
|
+
// `.allow` would show a navigation WebKit marks as a download (`<a download>`, blob:) as a page.
|
|
24
20
|
let download = action.shouldPerformDownload && requestHandlers.contains("onDownload")
|
|
25
21
|
let dropped = action.shouldPerformDownload && !download
|
|
26
22
|
run(request) { [weak self] allowed in
|
|
@@ -33,33 +29,24 @@ extension MinimalWebView {
|
|
|
33
29
|
}
|
|
34
30
|
}
|
|
35
31
|
|
|
36
|
-
/// Counts a main-frame policy check, whoever decides it, and takes the own load (`ownLoads`) it is for: whether it is one.
|
|
37
32
|
func takeOwnLoad(_ action: WKNavigationAction) -> Bool {
|
|
38
33
|
guard action.targetFrame?.isMainFrame == true, let target = action.request.url else { return false }
|
|
39
|
-
|
|
40
|
-
guard let own = ownLoads.firstIndex(where: { Loads.sameURL($0.url, target) }) else { return false }
|
|
41
|
-
ownLoads.remove(at: own)
|
|
42
|
-
return true
|
|
34
|
+
return ownLoads.check(target)
|
|
43
35
|
}
|
|
44
36
|
|
|
45
|
-
///
|
|
46
|
-
///
|
|
47
|
-
/// including a link a script clicks (`element.click()`), and no public WKNavigationAction property tells a real one
|
|
48
|
-
/// apart.
|
|
37
|
+
/// WebKit reports a link a script clicks (`element.click()`) as `.linkActivated` too, and no public
|
|
38
|
+
/// WKNavigationAction property tells a real one apart.
|
|
49
39
|
private func userInitiated(_ action: WKNavigationAction) -> Bool {
|
|
50
40
|
action.navigationType == .linkActivated
|
|
51
41
|
&& (taps.recent || UIAccessibility.isVoiceOverRunning || UIAccessibility.isSwitchControlRunning)
|
|
52
42
|
}
|
|
53
43
|
|
|
54
|
-
/// A download no `onDownload` takes.
|
|
55
44
|
func openDownload(_ url: URL) {
|
|
56
45
|
guard ["http", "https"].contains(url.scheme?.lowercased()) else { return }
|
|
57
46
|
let request = NavigationRules.Request(url: url.absoluteString, mainFrame: true, newWindow: false, userInitiated: false)
|
|
58
47
|
finish(request, .external, nil) { _ in }
|
|
59
48
|
}
|
|
60
49
|
|
|
61
|
-
/// window.open and target=_blank. Never a second WKWebView: a popup model (presenting and closing a child,
|
|
62
|
-
/// `window.opener`, its own rules and bridge) is more than almost any app wants.
|
|
63
50
|
func webView(
|
|
64
51
|
_ webView: WKWebView,
|
|
65
52
|
createWebViewWith configuration: WKWebViewConfiguration,
|
|
@@ -76,7 +63,6 @@ extension MinimalWebView {
|
|
|
76
63
|
|
|
77
64
|
private func openWindow(_ request: URLRequest, _ userInitiated: Bool) {
|
|
78
65
|
guard let target = request.url else { return }
|
|
79
|
-
// This load is the app's, past WebKit's limits on what a page may load, so only an http(s) POST skips the rules.
|
|
80
66
|
if request.httpMethod == "POST", ["http", "https"].contains(target.scheme?.lowercased()) {
|
|
81
67
|
return loadProgrammatic(request)
|
|
82
68
|
}
|
|
@@ -90,8 +76,7 @@ extension MinimalWebView {
|
|
|
90
76
|
|
|
91
77
|
/// Applies the rules (and `ask`) to a request and reports the outcome; `completion` gets whether to load it here.
|
|
92
78
|
private func run(_ request: NavigationRules.Request, completion: @escaping (Bool) -> Void) {
|
|
93
|
-
//
|
|
94
|
-
// redirect flag, so a tap on that URL isn't asked again either; Android skips only redirects.
|
|
79
|
+
// WebKit has no redirect flag: a URL an `ask` allowed isn't asked again until the next main-frame commit.
|
|
95
80
|
let decision = NavigationRules.decide(
|
|
96
81
|
navigationRules, request, asked: askedAndAllowed[request.mainFrame] ?? [],
|
|
97
82
|
canAsk: requestHandlers.contains("onNavigationRequest")
|
|
@@ -100,14 +85,13 @@ extension MinimalWebView {
|
|
|
100
85
|
finish(request, decision.action, decision.rule, completion)
|
|
101
86
|
return
|
|
102
87
|
}
|
|
103
|
-
let
|
|
104
|
-
// The view can be gone: the decision handler must still be called.
|
|
88
|
+
let asked = asks.ask("core", "onNavigationRequest", request.payload) { [weak self] answer in
|
|
105
89
|
guard let self else { return completion(false) }
|
|
106
90
|
let action = NavigationRules.answer(answer)
|
|
107
91
|
if action == .allow { self.askedAndAllowed[request.mainFrame, default: []].insert(request.url) }
|
|
108
92
|
self.finish(request, action, decision.rule, completion)
|
|
109
93
|
}
|
|
110
|
-
|
|
94
|
+
guard let id = asked else { return }
|
|
111
95
|
DispatchQueue.main.asyncAfter(deadline: .now() + askTimeout) { [weak self] in
|
|
112
96
|
self?.asks.cancel(id)
|
|
113
97
|
}
|
|
@@ -119,13 +103,11 @@ extension MinimalWebView {
|
|
|
119
103
|
completion(action == .allow)
|
|
120
104
|
guard action == .external else { return report(request, action, rule) }
|
|
121
105
|
guard requestHandlers.contains("onOpenExternal") else { return open(request, rule) }
|
|
122
|
-
// A page that moved on first answers nil, which counts as opened. No timeout: nothing waits for the answer.
|
|
123
106
|
asks.ask("core", "onOpenExternal", request.payload) { [weak self] answer in
|
|
124
107
|
if answer as? Bool == false { self?.open(request, rule) } else { self?.report(request, .external, rule) }
|
|
125
108
|
}
|
|
126
109
|
}
|
|
127
110
|
|
|
128
|
-
/// Opens an `external` URL outside the WebView. As on Android, one that nothing opens is reported as blocked.
|
|
129
111
|
private func open(_ request: NavigationRules.Request, _ rule: Int?) {
|
|
130
112
|
guard let url = URL(string: request.url) else { return report(request, .block, rule) }
|
|
131
113
|
UIApplication.shared.open(url) { [weak self] opened in self?.report(request, opened ? .external : .block, rule) }
|
|
@@ -139,10 +121,7 @@ extension MinimalWebView {
|
|
|
139
121
|
|
|
140
122
|
private let askTimeout: TimeInterval = 1
|
|
141
123
|
|
|
142
|
-
///
|
|
143
|
-
/// async popup payment buttons do. WebKit needs a WKWebView for it, made from the configuration it passes. It is
|
|
144
|
-
/// never shown: it cancels its first navigation, hands the request on and goes. One that hasn't navigated within 5 s,
|
|
145
|
-
/// or that the page closes, goes unused.
|
|
124
|
+
/// WebKit needs a WKWebView made from the configuration it passes for a `window.open('')` the page navigates later.
|
|
146
125
|
private final class WindowCatcher: NSObject, WKNavigationDelegate, WKUIDelegate {
|
|
147
126
|
private var child: WKWebView?
|
|
148
127
|
private var caught: ((URLRequest) -> Void)?
|
|
@@ -153,7 +132,7 @@ private final class WindowCatcher: NSObject, WKNavigationDelegate, WKUIDelegate
|
|
|
153
132
|
child.navigationDelegate = catcher
|
|
154
133
|
child.uiDelegate = catcher
|
|
155
134
|
(catcher.child, catcher.caught) = (child, caught)
|
|
156
|
-
//
|
|
135
|
+
// WKWebView's delegates are weak: the timer holds the catcher.
|
|
157
136
|
DispatchQueue.main.asyncAfter(deadline: .now() + newWindowTimeout) { catcher.drop() }
|
|
158
137
|
return child
|
|
159
138
|
}
|
|
@@ -184,17 +163,12 @@ private final class WindowCatcher: NSObject, WKNavigationDelegate, WKUIDelegate
|
|
|
184
163
|
|
|
185
164
|
private let newWindowTimeout: TimeInterval = 5
|
|
186
165
|
|
|
187
|
-
/// WebKit's private `_WKNavigationActionPolicyAllowWithoutTryingAppLink` (allow + 2)
|
|
188
|
-
///
|
|
189
|
-
///
|
|
190
|
-
/// `?? .allow` only satisfies the type: nothing falls back if WebKit drops the value.
|
|
166
|
+
/// WebKit's private `_WKNavigationActionPolicyAllowWithoutTryingAppLink` (allow + 2): `.allow` would hand a tapped
|
|
167
|
+
/// link to an installed app that claims it as a universal link.
|
|
168
|
+
/// `init(rawValue:)` accepts any value, so the fallback never applies.
|
|
191
169
|
private let allowInPlace = WKNavigationActionPolicy(rawValue: WKNavigationActionPolicy.allow.rawValue + 2) ?? .allow
|
|
192
170
|
|
|
193
|
-
/// When a tap on the WKWebView last ended, for `userInitiated`. It only watches the view's touches and never
|
|
194
|
-
/// recognizes, so it cancels, delays and prevents nothing (scrolling, links, text selection and the pull-to-refresh
|
|
195
|
-
/// control work as without it). It fails at each touch's end, or as soon as the touch scrolls.
|
|
196
171
|
final class Taps: UIGestureRecognizer, UIGestureRecognizerDelegate {
|
|
197
|
-
/// System uptime, so a change of the device time doesn't affect it.
|
|
198
172
|
private var lastTap: TimeInterval = -.infinity
|
|
199
173
|
|
|
200
174
|
override init(target: Any?, action: Selector?) {
|
|
@@ -204,7 +178,6 @@ final class Taps: UIGestureRecognizer, UIGestureRecognizerDelegate {
|
|
|
204
178
|
delegate = self
|
|
205
179
|
}
|
|
206
180
|
|
|
207
|
-
/// A tap ended within `tapWindow`.
|
|
208
181
|
var recent: Bool { ProcessInfo.processInfo.systemUptime - lastTap <= tapWindow }
|
|
209
182
|
|
|
210
183
|
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent) {
|
|
@@ -223,9 +196,7 @@ final class Taps: UIGestureRecognizer, UIGestureRecognizerDelegate {
|
|
|
223
196
|
state = .failed
|
|
224
197
|
}
|
|
225
198
|
|
|
226
|
-
///
|
|
227
|
-
/// tap, as in Chromium, where lifting a finger after a scroll gives the page no user activation
|
|
228
|
-
/// (pointer_event_manager.cc).
|
|
199
|
+
/// WebKit gives the page and each scrollable box in it its own UIScrollView.
|
|
229
200
|
private func scrolls(_ touches: Set<UITouch>) -> Bool {
|
|
230
201
|
touches.contains { touch in
|
|
231
202
|
touch.gestureRecognizers?.contains { recognizer in
|
|
@@ -235,8 +206,7 @@ final class Taps: UIGestureRecognizer, UIGestureRecognizerDelegate {
|
|
|
235
206
|
}
|
|
236
207
|
}
|
|
237
208
|
|
|
238
|
-
///
|
|
239
|
-
/// this one watching instead of failing it.
|
|
209
|
+
/// WebKit's touch events recognizer begins at touch down, which would otherwise fail this one.
|
|
240
210
|
func gestureRecognizer(
|
|
241
211
|
_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith other: UIGestureRecognizer
|
|
242
212
|
) -> Bool {
|
|
@@ -244,9 +214,6 @@ final class Taps: UIGestureRecognizer, UIGestureRecognizerDelegate {
|
|
|
244
214
|
}
|
|
245
215
|
}
|
|
246
216
|
|
|
247
|
-
///
|
|
248
|
-
///
|
|
249
|
-
/// one that can zoom. The link's decision then follows from the web content process. The window covers a busy page
|
|
250
|
-
/// and a redirect of the tapped link. It stays short so a script has little time to ride on an unrelated tap;
|
|
251
|
-
/// Chromium's user activation lasts 5 s.
|
|
217
|
+
/// WebKit sends the click after its double-tap wait (about 350 ms) on a page that can zoom, and the link's decision
|
|
218
|
+
/// follows from the web content process.
|
|
252
219
|
private let tapWindow: TimeInterval = 1
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import ExpoModulesCore
|
|
2
2
|
import WebKit
|
|
3
3
|
|
|
4
|
-
/// The scripts the view runs in the page: the injected scripts, `evaluate`, and the bridge transport (page -> JS through a
|
|
5
|
-
/// WKScriptMessageHandler, JS -> page through callAsyncJavaScript). The bridge moves only the text, with the sender's
|
|
6
|
-
/// verified origin; the protocol (calls, results, events) is the page client's and createBridge's.
|
|
7
4
|
extension MinimalWebView {
|
|
8
|
-
/// The bridge's page client first, then the app's scripts in order, then the hooks' own. Changes take effect from the
|
|
9
|
-
/// next navigation.
|
|
10
5
|
func installScripts(_ controller: WKUserContentController) {
|
|
11
6
|
// WebKit can only remove every script: take the hooks' out and add them back after the core's.
|
|
12
7
|
let hooks = controller.userScripts.filter { script in !ownScripts.contains { $0 === script } }
|
|
@@ -22,8 +17,7 @@ extension MinimalWebView {
|
|
|
22
17
|
(ownScripts + hooks).forEach { controller.addUserScript($0) }
|
|
23
18
|
}
|
|
24
19
|
|
|
25
|
-
///
|
|
26
|
-
/// away seconds later or never.
|
|
20
|
+
/// WebKit settles a call whose page went away seconds later or never.
|
|
27
21
|
func evaluate(_ script: String, _ promise: Promise) {
|
|
28
22
|
guard let webView else { return promise.reject("unavailable", "No WebView") }
|
|
29
23
|
let id = nextEvaluation
|
|
@@ -31,12 +25,11 @@ extension MinimalWebView {
|
|
|
31
25
|
evaluations[id] = promise
|
|
32
26
|
let body = "return ((v) => { try { return JSON.stringify(v) ?? 'null' } catch { return 'null' } })(await (\n\(script)\n))"
|
|
33
27
|
webView.callAsyncJavaScript(body, arguments: [:], in: nil, in: .page) { [weak self] result in
|
|
34
|
-
// Already rejected when its page went away.
|
|
35
28
|
guard let promise = self?.evaluations.removeValue(forKey: id) else { return }
|
|
36
29
|
switch result {
|
|
37
30
|
case .success(let value): promise.resolve(value as? String ?? "null")
|
|
38
31
|
case .failure(let error):
|
|
39
|
-
//
|
|
32
|
+
// WebKit's localizedDescription is generic.
|
|
40
33
|
let message = (error as NSError).userInfo["WKJavaScriptExceptionMessage"] as? String ?? error.localizedDescription
|
|
41
34
|
// WebKit drops the call of a page being left, and (iOS 27) can say so before didCommit.
|
|
42
35
|
if message == Self.unreachable, self?.webView?.isLoading == true { return promise.reject("navigated", Self.navigated) }
|
|
@@ -45,7 +38,6 @@ extension MinimalWebView {
|
|
|
45
38
|
}
|
|
46
39
|
}
|
|
47
40
|
|
|
48
|
-
/// The page the waiting `evaluate` calls run in is gone.
|
|
49
41
|
func failEvaluations() {
|
|
50
42
|
let waiting = evaluations.values
|
|
51
43
|
evaluations = [:]
|
|
@@ -57,17 +49,13 @@ extension MinimalWebView {
|
|
|
57
49
|
|
|
58
50
|
func bridgeReceive(_ message: WKScriptMessage) {
|
|
59
51
|
let origin = OriginRules.origin(of: message.frameInfo.securityOrigin)
|
|
60
|
-
//
|
|
52
|
+
// A window.open('') view (WindowCatcher) shares the content controller.
|
|
61
53
|
guard message.webView === webView, message.frameInfo.isMainFrame, OriginRules.allows(bridgeOrigins, origin),
|
|
62
54
|
let text = message.body as? String else { return }
|
|
63
|
-
// `*` allows every document, opaque ones too (whose location.origin is "null"): nothing to compare.
|
|
64
55
|
bridgeOrigin = bridgeOrigins.contains("*") ? "*" : origin
|
|
65
56
|
onBridge(["message": text, "origin": origin])
|
|
66
57
|
}
|
|
67
58
|
|
|
68
|
-
/// Delivers a message from JS to the page. Only to the allowed document that last posted (its page client says
|
|
69
|
-
/// `ready` first). The page checks its origin again at delivery time: the document may have changed since the post
|
|
70
|
-
/// was queued. A message for a page that is gone is dropped.
|
|
71
59
|
func bridgePost(_ text: String) {
|
|
72
60
|
guard let bridgeOrigin else { return }
|
|
73
61
|
let deliver = "if (origin === '*' || location.origin === origin) window.nativeBridge?.__receive(message)"
|
|
@@ -75,7 +63,7 @@ extension MinimalWebView {
|
|
|
75
63
|
}
|
|
76
64
|
}
|
|
77
65
|
|
|
78
|
-
///
|
|
66
|
+
/// WKUserContentController retains its handlers.
|
|
79
67
|
final class WeakBridgeHandler: NSObject, WKScriptMessageHandler {
|
|
80
68
|
weak var view: MinimalWebView?
|
|
81
69
|
|
|
@@ -12,8 +12,7 @@ Pod::Spec.new do |s|
|
|
|
12
12
|
s.platforms = {
|
|
13
13
|
:ios => '17.0'
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
s.source = { git: repository.is_a?(Hash) ? repository['url'] : repository } # npm pkg fix makes it a Hash
|
|
15
|
+
s.source = { git: package['repository'] }
|
|
17
16
|
s.static_framework = true
|
|
18
17
|
|
|
19
18
|
s.dependency 'ExpoModulesCore'
|