react-native-minimal-webview 1.2.1 → 1.3.1

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.
Files changed (96) hide show
  1. package/android/build.gradle +1 -1
  2. package/android/src/main/java/expo/modules/minimalwebview/Asks.kt +5 -11
  3. package/android/src/main/java/expo/modules/minimalwebview/Hooks.kt +17 -11
  4. package/android/src/main/java/expo/modules/minimalwebview/MinimalWebView.kt +67 -120
  5. package/android/src/main/java/expo/modules/minimalwebview/MinimalWebViewClients.kt +23 -32
  6. package/android/src/main/java/expo/modules/minimalwebview/MinimalWebViewModule.kt +8 -18
  7. package/android/src/main/java/expo/modules/minimalwebview/MinimalWebViewNavigation.kt +30 -49
  8. package/android/src/main/java/expo/modules/minimalwebview/MinimalWebViewScripts.kt +48 -36
  9. package/android/src/main/java/expo/modules/minimalwebview/NavigationRules.kt +19 -20
  10. package/android/src/main/java/expo/modules/minimalwebview/PlatformSettings.kt +30 -40
  11. package/android/src/main/java/expo/modules/minimalwebview/PullToRefresh.kt +14 -18
  12. package/android/src/main/java/expo/modules/minimalwebview/requests/Downloads.kt +12 -23
  13. package/android/src/main/java/expo/modules/minimalwebview/requests/FileUpload.kt +0 -1
  14. package/android/src/main/java/expo/modules/minimalwebview/requests/FullscreenVideo.kt +1 -4
  15. package/android/src/main/java/expo/modules/minimalwebview/requests/Permissions.kt +34 -24
  16. package/build/WebView.d.ts +8 -1
  17. package/build/WebView.d.ts.map +1 -1
  18. package/build/WebView.js +30 -80
  19. package/build/WebView.js.map +1 -1
  20. package/build/bridge/createBridge.d.ts +1 -5
  21. package/build/bridge/createBridge.d.ts.map +1 -1
  22. package/build/bridge/createBridge.js +3 -15
  23. package/build/bridge/createBridge.js.map +1 -1
  24. package/build/bridge/endpoint.d.ts +1 -2
  25. package/build/bridge/endpoint.d.ts.map +1 -1
  26. package/build/bridge/endpoint.js +5 -6
  27. package/build/bridge/endpoint.js.map +1 -1
  28. package/build/bridge/matchesOrigin.d.ts +11 -0
  29. package/build/bridge/matchesOrigin.d.ts.map +1 -0
  30. package/build/bridge/matchesOrigin.js +26 -0
  31. package/build/bridge/matchesOrigin.js.map +1 -0
  32. package/build/bridge/origins.d.ts +2 -13
  33. package/build/bridge/origins.d.ts.map +1 -1
  34. package/build/bridge/origins.js +1 -30
  35. package/build/bridge/origins.js.map +1 -1
  36. package/build/bridge/pageClient.generated.d.ts +1 -1
  37. package/build/bridge/pageClient.generated.d.ts.map +1 -1
  38. package/build/bridge/pageClient.generated.js +2 -2
  39. package/build/bridge/pageClient.generated.js.map +1 -1
  40. package/build/bridge/protocol.d.ts +3 -5
  41. package/build/bridge/protocol.d.ts.map +1 -1
  42. package/build/bridge/protocol.js +12 -14
  43. package/build/bridge/protocol.js.map +1 -1
  44. package/build/index.d.ts +1 -1
  45. package/build/index.js +1 -1
  46. package/build/navigationRules.d.ts +0 -5
  47. package/build/navigationRules.d.ts.map +1 -1
  48. package/build/navigationRules.js +3 -12
  49. package/build/navigationRules.js.map +1 -1
  50. package/build/reactNativeWebViewDefaults.d.ts +0 -4
  51. package/build/reactNativeWebViewDefaults.d.ts.map +1 -1
  52. package/build/reactNativeWebViewDefaults.js +0 -4
  53. package/build/reactNativeWebViewDefaults.js.map +1 -1
  54. package/build/reactNativeWebViewMessages.d.ts.map +1 -1
  55. package/build/reactNativeWebViewMessages.js +0 -1
  56. package/build/reactNativeWebViewMessages.js.map +1 -1
  57. package/build/refStore.d.ts +0 -2
  58. package/build/refStore.d.ts.map +1 -1
  59. package/build/refStore.js +0 -6
  60. package/build/refStore.js.map +1 -1
  61. package/build/types.d.ts +33 -16
  62. package/build/types.d.ts.map +1 -1
  63. package/ios/Asks.swift +6 -9
  64. package/ios/DelegateProxy.swift +6 -20
  65. package/ios/DownloadName.swift +0 -2
  66. package/ios/Downloads.swift +0 -2
  67. package/ios/Hooks.swift +6 -7
  68. package/ios/Loads.swift +37 -19
  69. package/ios/MinimalWebView+Dialogs.swift +2 -6
  70. package/ios/MinimalWebView+Navigation.swift +25 -57
  71. package/ios/MinimalWebView+Scripts.swift +4 -16
  72. package/ios/MinimalWebView.podspec +1 -2
  73. package/ios/MinimalWebView.swift +58 -144
  74. package/ios/MinimalWebViewModule.swift +1 -18
  75. package/ios/NavigationRules.swift +2 -9
  76. package/ios/OriginRules.swift +4 -13
  77. package/ios/PlatformSettings.swift +19 -38
  78. package/ios/ReadAccess.swift +0 -2
  79. package/ios/Records.swift +18 -0
  80. package/ios/Recovery.swift +2 -8
  81. package/ios/SharedCookies.swift +10 -25
  82. package/package.json +4 -4
  83. package/src/WebView.tsx +45 -95
  84. package/src/bridge/createBridge.ts +5 -20
  85. package/src/bridge/endpoint.ts +6 -9
  86. package/src/bridge/matchesOrigin.ts +27 -0
  87. package/src/bridge/origins.ts +2 -30
  88. package/src/bridge/pageClient.generated.ts +2 -2
  89. package/src/bridge/pageClient.ts +1 -7
  90. package/src/bridge/protocol.ts +16 -18
  91. package/src/index.ts +1 -1
  92. package/src/navigationRules.ts +6 -12
  93. package/src/reactNativeWebViewDefaults.ts +0 -4
  94. package/src/reactNativeWebViewMessages.ts +0 -1
  95. package/src/refStore.ts +0 -7
  96. package/src/types.ts +33 -16
package/build/types.d.ts CHANGED
@@ -186,7 +186,12 @@ export type NavigationState = {
186
186
  loading: boolean;
187
187
  /** From 0 to 1. */
188
188
  progress: number;
189
+ /**
190
+ * On Android, an iframe's history entry updates it from Android System WebView 102, except a `pushState` or hash
191
+ * change in an iframe with an opaque origin, such as a sandboxed one.
192
+ */
189
193
  canGoBack: boolean;
194
+ /** On Android, an iframe's history entry updates it as it does `canGoBack`. */
190
195
  canGoForward: boolean;
191
196
  /**
192
197
  * How the last main-frame load ended; null while one is loading, and before the first.
@@ -514,8 +519,11 @@ export type Download = {
514
519
  * - `network`: connecting or reading the response failed, or a redirect was refused.
515
520
  * - `http`: the response had an error status (Android only: iOS saves what the server sent).
516
521
  * - `data` (the content): a bad `data:` or `blob:` URL, the page not reading its blob, an unsupported scheme, or
517
- * (Android) a file above 100 MB or a `blob:` URL the main frame can't read (a cross-origin iframe's, or one already
522
+ * (Android) a file above 100 MiB or a `blob:` URL the main frame can't read (a cross-origin iframe's, or one already
518
523
  * revoked).
524
+ *
525
+ * On Android a disk error while saving, such as a full disk, is `network` for an http(s) download and `data` for a
526
+ * `data:` or `blob:` one.
519
527
  * @group Page requests
520
528
  */
521
529
  export type DownloadFailure = {
@@ -593,7 +601,9 @@ export type IOSPrivateSettingKeys = {
593
601
  * `webView.opaque`, is skipped the same way: set it with `call('webView.setOpaque:', [false])`.
594
602
  *
595
603
  * A root's default keys are the package's, and yours go over them. A key the package doesn't set keeps WebKit's
596
- * default; a key you remove goes back to the value it had before you first set it.
604
+ * default; a key you remove goes back to the value it had before you first set it. For
605
+ * `webView.underPageBackgroundColor`, which WebKit derives from the page, that value is the color derived then, and it
606
+ * stays: set the key to `null` instead of removing it to go back to WebKit's default.
597
607
  *
598
608
  * WebKit has no mixed-content setting: it applies its own policy.
599
609
  * @ios
@@ -694,7 +704,8 @@ export type HookEvent<N extends string = string, P = Record<string, unknown>> =
694
704
  *
695
705
  * A package with a native hook exports a function that returns one, so that an app turns the hook on by putting it in
696
706
  * `extensions`.
697
- * @typeParam E - The hook's events, to type `onEvent`: a union of {@link HookEvent}s, which nothing checks at runtime.
707
+ * @typeParam E - The hook's events, to type `onEvent` and `onAsk`: a union of {@link HookEvent}s, which nothing checks
708
+ * at runtime.
698
709
  * @see [Native hooks guide](https://rasmuskard.github.io/react-native-minimal-webview/guides/native-hooks/)
699
710
  * @group Native hooks
700
711
  */
@@ -714,14 +725,19 @@ export type HookExtension<E extends HookEvent = HookEvent> = {
714
725
  */
715
726
  options?: unknown;
716
727
  /**
717
- * Each of the hook's events: it goes to the extension with the hook's key, and one no extension owns is dropped. For
718
- * an `ask`, the return value (a promise is awaited) is the answer, and `undefined`, or a value JSON can't encode,
719
- * answers null. `signal` is set only for an `ask`, and aborts when the core stops waiting for the answer: an ask has
720
- * no timeout, but one still open when the page goes away is answered null.
728
+ * Each of the hook's events: it goes to the extension with the hook's key, and one no extension owns is dropped. An
729
+ * `ask` goes to {@link HookExtension.onAsk} instead when the extension has one; without it, an `ask` comes here with
730
+ * `signal` set, and the return value is the answer as `onAsk` describes. `signal` is undefined for an `emit`.
721
731
  *
722
- * The latest `onEvent` always takes the events: a render with new handlers sends the core nothing.
732
+ * The latest `onEvent` and `onAsk` always take the events: a render with new handlers sends the core nothing.
723
733
  */
724
734
  onEvent?(event: E, signal?: AbortSignal): unknown;
735
+ /**
736
+ * Each of the hook's asks, in place of {@link HookExtension.onEvent}. The return value (a promise is awaited) is the
737
+ * answer, and `undefined`, or a value JSON can't encode, answers null. `signal` aborts when the core stops waiting
738
+ * for the answer: an ask has no timeout, but one still open when the page goes away is answered null.
739
+ */
740
+ onAsk?(event: E, signal: AbortSignal): unknown;
725
741
  };
726
742
  /**
727
743
  * A fullscreen change, for `onFullscreenChange`.
@@ -786,7 +802,7 @@ export type CodedError = Error & {
786
802
  * - `onOpenExternal`: null (the core opens nothing)
787
803
  * - `onFileRequest`: cancel
788
804
  * - `onPermissionRequest`: deny
789
- * - an extension's `onEvent`: null
805
+ * - an extension's `onAsk` or `onEvent`: null
790
806
  *
791
807
  * The `signal` such a callback gets aborts when the core stops waiting for its answer (the page moved on, crashed or
792
808
  * unmounted), and a late answer is dropped.
@@ -798,8 +814,8 @@ export type CodedError = Error & {
798
814
  * (`data:`, sandboxed, `file:`). One shows at a time; one that comes while another shows is cancelled.
799
815
  * - Android dialogs: WebView's own. One still on screen when its WebView unmounts stays there, and a WebView older
800
816
  * than 149 then gets no touches until the app restarts. The `dialogs` extension shows no native dialog.
801
- * - HTTP auth: cancelled on Android. On iOS WebKit's default handling applies, so without a stored credential the
802
- * site's 401 page shows.
817
+ * - HTTP auth: cancelled on Android. On iOS WebKit's default handling applies, which sends a stored credential; once
818
+ * the site has rejected one, the site's 401 page shows.
803
819
  * @sortStrategy source-order
804
820
  * @group WebView
805
821
  */
@@ -912,8 +928,9 @@ export interface WebViewProps extends Omit<ViewProps, 'children'> {
912
928
  * A false, null or undefined entry is left out, so `on && extension(…)` switches one on and off; see
913
929
  * {@link HookExtension.options} for what off means. A hook attaches when its key first appears, and a later change of
914
930
  * its `options` reaches it live, without recreating the WebView. A key turned on after the WebView was created
915
- * attaches its hook then, unless the hook has a `configure` step or its own WebView class (`webViewClass`,
916
- * `webViewFactory`): that one attaches only to a WebView mounted with its key on, and a warning says so.
931
+ * attaches its hook then, unless the hook attaches only to a WebView mounted with its key on, and a warning says so.
932
+ * The [guide's Lifecycle table](https://rasmuskard.github.io/react-native-minimal-webview/guides/native-hooks/#lifecycle)
933
+ * says which hooks do.
917
934
  * @see [Native hooks guide](https://rasmuskard.github.io/react-native-minimal-webview/guides/native-hooks/)
918
935
  */
919
936
  extensions?: readonly (HookExtension | false | null | undefined)[];
@@ -947,8 +964,7 @@ export interface WebViewProps extends Omit<ViewProps, 'children'> {
947
964
  * Until the answer settles, the page's next file request waits.
948
965
  *
949
966
  * Without it, the system file chooser opens and ignores `capture`. It handles one request at a time for the whole
950
- * app: a request while one is open is cancelled. If the chooser's activity died without returning a result, every
951
- * request is cancelled until the app restarts.
967
+ * app: a request while one is open is cancelled.
952
968
  *
953
969
  * iOS always shows WebKit's picker, whose camera option needs `NSCameraUsageDescription`.
954
970
  * @android
@@ -1034,7 +1050,8 @@ export interface WebViewProps extends Omit<ViewProps, 'children'> {
1034
1050
  /**
1035
1051
  * The renderer died; see {@link ProcessGoneEvent} for the recovery.
1036
1052
  *
1037
- * Android's WebViews share one renderer, so each of them reports its death.
1053
+ * Android's WebViews share one renderer, so each of them reports its death. On Android it comes before the
1054
+ * {@link WebViewProps.onLoadEnd | onLoadEnd} that fails the load the crash cut off.
1038
1055
  */
1039
1056
  onProcessGone?: (event: ProcessGoneEvent) => void;
1040
1057
  /** {@link NavigationState.loading | loading} went true. */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["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CHANGED
@@ -1,23 +1,20 @@
1
- /// Every `ask` (a page request, a navigation request or a hook's) waits here, by id, until JS answers it through
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 0 // no ask: cancel(0) finds nothing
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
- /// JS's answer. One for an ask that was answered or cancelled already is dropped.
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. At closing JS isn't told: it aborts its own handlers at unmount.
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) }
@@ -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)
@@ -71,7 +64,10 @@ final class DelegateProxy: NSObject, WKNavigationDelegate, WKUIDelegate {
71
64
  _ takers: ArraySlice<WKNavigationDelegate>,
72
65
  _ completionHandler: @escaping @MainActor (URLSession.AuthChallengeDisposition, URLCredential?) -> Void
73
66
  ) {
74
- guard let taker = takers.first else { return completionHandler(.performDefaultHandling, nil) }
67
+ guard let taker = takers.first else {
68
+ // WebKit's default handling sends a rejected credential again, and again on each rejection.
69
+ return completionHandler(challenge.previousFailureCount > 0 ? .rejectProtectionSpace : .performDefaultHandling, nil)
70
+ }
75
71
  taker.webView?(webView, didReceive: challenge) { disposition, credential in
76
72
  guard disposition == .performDefaultHandling else { return completionHandler(disposition, credential) }
77
73
  offer(challenge, webView, takers.dropFirst(), completionHandler)
@@ -80,9 +76,7 @@ final class DelegateProxy: NSObject, WKNavigationDelegate, WKUIDelegate {
80
76
 
81
77
  private static let challenge = NSSelectorFromString("webView:didReceiveAuthenticationChallenge:completionHandler:")
82
78
 
83
- /// The action policy, a decision the first navigation delegate that implements either variant owns, else the core.
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.
79
+ /// WebKit calls only this variant when the delegate implements it: the proxy always does, and calls the owner's own.
86
80
  func webView(
87
81
  _ webView: WKWebView,
88
82
  decidePolicyFor navigationAction: WKNavigationAction,
@@ -104,16 +98,12 @@ final class DelegateProxy: NSObject, WKNavigationDelegate, WKUIDelegate {
104
98
  private static let actionPolicyWithPreferences =
105
99
  NSSelectorFromString("webView:decidePolicyForNavigationAction:preferences:decisionHandler:")
106
100
 
107
- /// The hook delegates that implement a decision, in order: the first one takes it.
108
101
  private func takers(of decision: Selector) -> [NSObject] {
109
102
  delegates(for: decision).filter {
110
103
  $0.responds(to: decision) || decision == Self.actionPolicy && $0.responds(to: Self.actionPolicyWithPreferences)
111
104
  }
112
105
  }
113
106
 
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
107
  func newWarnings() -> [String] {
118
108
  Self.decisions.flatMap { decision, lost in
119
109
  let name = NSStringFromSelector(decision)
@@ -127,8 +117,6 @@ final class DelegateProxy: NSObject, WKNavigationDelegate, WKUIDelegate {
127
117
 
128
118
  private var warned: Set<String> = []
129
119
 
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
120
  private static let decisions: [(selector: Selector, lost: String?)] = [
133
121
  (actionPolicy, "navigationRules, their defaults and onNavigationRequest don't apply to navigations"),
134
122
  (
@@ -149,13 +137,11 @@ final class DelegateProxy: NSObject, WKNavigationDelegate, WKUIDelegate {
149
137
  ]
150
138
  }
151
139
 
152
- /// Hooks whose keys turn on together attach in registration order, which orders their delegates.
153
140
  func inRegistrationOrder(_ keys: Set<String>, _ registered: [String]) -> [String] {
154
141
  registered.filter(keys.contains) + keys.subtracting(registered).sorted()
155
142
  }
156
143
 
157
- /// Whether a `hookOptions` change leaves the hook on with the same value, so its hook has nothing to hear. Both values
158
- /// must be on, and equal as JSON: `NSNumber(false).isEqual(NSNumber(0))` is true, at any depth, as Android's isn't.
144
+ /// `NSNumber(false).isEqual(NSNumber(0))` is true, so the values compare as JSON.
159
145
  func staysOn(_ was: Any?, _ value: Any?) -> Bool {
160
146
  guard let was, let value else { return false }
161
147
  let json = { (value: Any) in try? JSONSerialization.data(withJSONObject: value, options: [.fragmentsAllowed, .sortedKeys]) }
@@ -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
@@ -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
@@ -114,7 +114,8 @@ public protocol WebViewContext: AnyObject {
114
114
  /// core. Either action policy variant, with or without `preferences`, counts, and that delegate's own variant is
115
115
  /// called.
116
116
  /// - The authentication challenge goes to each delegate that implements it, in order, until one answers other than
117
- /// `.performDefaultHandling`; when none does, WebKit's default handling. Each must call its completion handler
117
+ /// `.performDefaultHandling`; when none does, WebKit's default handling, or `.rejectProtectionSpace` once the
118
+ /// site has rejected a credential, so its 401 page loads. Each must call its completion handler
118
119
  /// exactly once, and the next delegate gets the challenge only after that.
119
120
  /// - Every other callback the core implements reaches the core, then each delegate that implements it.
120
121
  /// - `didStartProvisionalNavigation` and `didReceiveServerRedirectForProvisionalNavigation` reach each delegate that
@@ -151,8 +152,8 @@ public protocol WebViewContext: AnyObject {
151
152
  /// Sends an event to JS: the extension with the hook's key gets `{ name, payload }` in its `onEvent`. It is dropped
152
153
  /// while the hook is off.
153
154
  func emit(_ name: String, _ payload: [String: Any])
154
- /// Sends the event as ``emit(_:_:)`` does, and calls `onAnswer` with the extension's `onEvent` return value, a
155
- /// promise awaited.
155
+ /// Sends the event as ``emit(_:_:)`` does, but to the extension's `onAsk` when it has one, and calls `onAnswer` with
156
+ /// that handler's return value, a promise awaited.
156
157
  ///
157
158
  /// It answers nil when the handler throws or there is none, or when the Document ends first; there is no timeout. It
158
159
  /// answers nil at once while the hook is off, and after the view closed.
@@ -217,7 +218,6 @@ public final class HookReply {
217
218
  }
218
219
  }
219
220
 
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
221
  final class HookContext: WebViewContext {
222
222
  let hook: MinimalWebViewHooks.Hook
223
223
  private weak var view: MinimalWebView?
@@ -303,8 +303,7 @@ final class HookContext: WebViewContext {
303
303
  handlers.forEach { $0(.closing) }
304
304
  }
305
305
 
306
- // A hook's own background work (a URLSession completion) may emit or ask; the view's asks are main-thread state.
307
- private func onMain(_ block: @escaping () -> Void) {
308
- if Thread.isMainThread { block() } else { DispatchQueue.main.async(execute: block) }
306
+ private func onMain(_ block: @escaping @MainActor () -> Void) {
307
+ if Thread.isMainThread { MainActor.assumeIsolated(block) } else { DispatchQueue.main.async(execute: block) }
309
308
  }
310
309
  }
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: with the scheme and host lowercase, the scheme's
6
- /// default port dropped, dot segments removed and an empty path `/`. The rest (userinfo, path, query, fragment) compares exactly. It picks
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 (Recovery compares them as Android does).
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
- /// How a main-frame load WebKit ended with `error` went: its outcome, and the `onError` kind when it failed.
24
- static func ended(by error: NSError) -> (outcome: String, kind: String?) {
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
- // Superseded or stopped (NSURLErrorCancelled), or a policy cancel (WebKitErrorFrameLoadInterruptedByPolicyChange:
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: "cancelled", kind: nil)
30
- // WebKitErrorPlugInWillHandleLoad: a media file. WebKit ends the load once its media document has committed, and
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: "finished", kind: nil)
35
- // The TLS handshake and certificate errors.
31
+ return (outcome: .finished, kind: nil)
36
32
  case (NSURLErrorDomain, NSURLErrorClientCertificateRequired...NSURLErrorSecureConnectionFailed):
37
- return (outcome: "failed", kind: "ssl")
33
+ return (outcome: .failed, kind: "ssl")
38
34
  default:
39
- return (outcome: "failed", kind: "network")
35
+ return (outcome: .failed, kind: "network")
40
36
  }
41
37
  }
42
38
  }
43
39
 
44
- /// The special schemes' default ports, which WebKit drops from a URL (the WHATWG URL Standard's).
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: an unmount or a crash meanwhile has completed the dialog.
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
- /// Presents from the top of this view's window. If the top controller still has a presented one (one being dismissed) or is itself being presented, UIKit only logs and the page would stay blocked, so the dialog is cancelled instead.
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 }