Skip to content

[SwiftUI] Improve the ergonomics of loading simple web content in WebPage #47102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

rr-codes
Copy link
Contributor

@rr-codes rr-codes commented Jun 24, 2025

e409318

[SwiftUI] Improve the ergonomics of loading simple web content in WebPage
https://bugs.webkit.org/show_bug.cgi?id=294885
rdar://152904248

Reviewed by Abrar Rahman Protyasha and Aditya Keerthi.

Improve the set of loading APIs in a few ways:

1. Add an overload of `load(_:)` that accepts a `URL?` to make it more convenient to load URLs
without having to create a URLRequest directly. Consequently, a new error case is added to handle
an unexpected `nil` URL.

2. Add a default value of `about:blank` to the `baseURL` parameter for loading an HTML string so that
the client doesn't have to repeatedly type this value.

* Source/WebKit/UIProcess/API/Swift/WebPage+Navigation.swift:
* Source/WebKit/UIProcess/API/Swift/WebPage.swift:
(load(_:)):
(load(_:baseURL:)):
(toNavigationSequence(_:)):

Canonical link: https://commits.webkit.org/296599@main

a1e3e40

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win
✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 ⏳ 🧪 win-tests
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe
✅ 🧪 ios-wk2-wpt ✅ 🛠 wpe-cairo
✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🛠 gtk
✅ 🛠 vision ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress ✅ 🧪 api-gtk
✅ 🧪 vision-wk2 ✅ 🧪 mac-intel-wk2 ✅ 🛠 playstation
✅ 🛠 🧪 unsafe-merge ✅ 🛠 tv ✅ 🛠 mac-safer-cpp
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

@rr-codes rr-codes self-assigned this Jun 24, 2025
@rr-codes rr-codes added the WebKit Misc. For miscellaneous bugs in the WebKit framework (and not JavaScriptCore or WebCore). label Jun 24, 2025
@rr-codes rr-codes added the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Jun 25, 2025
…Page

https://bugs.webkit.org/show_bug.cgi?id=294885
rdar://152904248

Reviewed by Abrar Rahman Protyasha and Aditya Keerthi.

Improve the set of loading APIs in a few ways:

1. Add an overload of `load(_:)` that accepts a `URL?` to make it more convenient to load URLs
without having to create a URLRequest directly. Consequently, a new error case is added to handle
an unexpected `nil` URL.

2. Add a default value of `about:blank` to the `baseURL` parameter for loading an HTML string so that
the client doesn't have to repeatedly type this value.

* Source/WebKit/UIProcess/API/Swift/WebPage+Navigation.swift:
* Source/WebKit/UIProcess/API/Swift/WebPage.swift:
(load(_:)):
(load(_:baseURL:)):
(toNavigationSequence(_:)):

Canonical link: https://commits.webkit.org/296599@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/SwiftUI-Improve-the-ergonomics-of-loading-simple-web-content-in-WebPage branch from a1e3e40 to e409318 Compare June 25, 2025 02:47
@webkit-commit-queue
Copy link
Collaborator

Committed 296599@main (e409318): https://commits.webkit.org/296599@main

Reviewed commits have been landed. Closing PR #47102 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit e409318 into WebKit:main Jun 25, 2025
@webkit-commit-queue webkit-commit-queue removed the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Jun 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WebKit Misc. For miscellaneous bugs in the WebKit framework (and not JavaScriptCore or WebCore).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants