Skip to content

Commit

Permalink
Uplift of #26434 (squashed) to release
Browse files Browse the repository at this point in the history
  • Loading branch information
brave-builds committed Nov 7, 2024
1 parent 52163bc commit 6adbb96
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ public class InternalSchemeHandler: NSObject, WKURLSchemeHandler {

let path = url.path.starts(with: "/") ? String(url.path.dropFirst()) : url.path

if activeTasks.object(forKey: urlSchemeTask) != nil {
// Already a task ongoing, technically this shouldn't happen.
return
}

let task = Task {
// For non-main doc URL, try load it as a resource
if !urlSchemeTask.request.isPrivileged,
Expand Down Expand Up @@ -168,5 +173,7 @@ public class InternalSchemeHandler: NSObject, WKURLSchemeHandler {
activeTasks.setObject(TaskHolder(task: task), forKey: urlSchemeTask)
}

public func webView(_ webView: WKWebView, stop urlSchemeTask: WKURLSchemeTask) {}
public func webView(_ webView: WKWebView, stop urlSchemeTask: WKURLSchemeTask) {
activeTasks.removeObject(forKey: urlSchemeTask)
}
}

0 comments on commit 6adbb96

Please sign in to comment.