Skip to content

Improve handling of about: URLs#10721

Merged
AtkinsSJ merged 4 commits into
LadybirdBrowser:masterfrom
AtkinsSJ:about-url-comfiness
Jul 17, 2026
Merged

Improve handling of about: URLs#10721
AtkinsSJ merged 4 commits into
LadybirdBrowser:masterfrom
AtkinsSJ:about-url-comfiness

Conversation

@AtkinsSJ

Copy link
Copy Markdown
Member

Firstly, fix the error reporting for invalid about:foo URLs. We had code to detect and report these, but weren't actually hitting it, and instead just produced a blank white page. Now we get an error.

Screenshot_20260716_171315

And then, show about: URLs in the autocomplete suggestions. When the input starts with about:, other suggestions are disabled.

image

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9066ff2a-89d1-42eb-b866-b297789dfbef

📥 Commits

Reviewing files that changed from the base of the PR and between bf163f9 and f2900fe.

📒 Files selected for processing (11)
  • Libraries/LibWeb/Loader/ResourceLoader.cpp
  • Libraries/LibWeb/Loader/ResourceLoader.h
  • Libraries/LibWebView/Autocomplete.cpp
  • Libraries/LibWebView/Autocomplete.h
  • Libraries/LibWebView/WebUI.cpp
  • Libraries/LibWebView/WebUI.h
  • Tests/LibWeb/TestConfig.ini
  • Tests/LibWeb/Text/input/HTML/HTMLObjectElement-contentWindow.html
  • Tests/LibWeb/Text/input/HTML/focus-navigable-container.html
  • Tests/LibWebView/TestAutocomplete.cpp
  • Tests/LibWebView/TestOmnibox.cpp
📝 Walkthrough

Walkthrough

WebUI page metadata is centralized and exposed for lookup. About-page loading separates success and error callbacks. Autocomplete now suggests matching about: WebUI pages, skips remote queries for that prefix, and includes coverage for matching, completion, loading, and URL commits.

Changes

About pages and autocomplete

Layer / File(s) Summary
WebUI page registry
Libraries/LibWebView/WebUI.h, Libraries/LibWebView/WebUI.cpp
Adds page metadata, page lookup APIs, and registry-based dynamic WebUI creation.
About resource loading
Libraries/LibWeb/Loader/ResourceLoader.h, Libraries/LibWeb/Loader/ResourceLoader.cpp
Separates about-page success and error handlers, forwarding generated resources or deferred missing-page errors.
WebUI autocomplete flow
Libraries/LibWebView/Autocomplete.h, Libraries/LibWebView/Autocomplete.cpp, Tests/LibWebView/TestAutocomplete.cpp, Tests/LibWebView/TestOmnibox.cpp
Adds WebUI autocomplete suggestions, suppresses remote queries for about:, supports inline URL completion, and tests matching and committed results.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Omnibox
  participant Autocomplete
  participant WebUI_pages
  participant RemoteAutocomplete
  Omnibox->>Autocomplete: query about:set
  Autocomplete->>WebUI_pages: enumerate matching pages
  WebUI_pages-->>Autocomplete: return about:settings suggestion
  Autocomplete->>RemoteAutocomplete: skip remote query
  Autocomplete-->>Omnibox: deliver WebUI suggestion
Loading

Suggested reviewers: awesomekling, trflynn89

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The description matches the implemented about: error handling and autocomplete changes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
Libraries/LibWebView/WebUI.cpp (1)

61-81: 🩺 Stability & Availability | 🔵 Trivial | 🏗️ Heavy lift

Avoid making registry additions crash the process.

PageType::Dynamic allows a page into the creation path, but the creator dispatch remains a separate hard-coded chain. If a future dynamic page is added to s_pages without adding a branch here, line 80 reaches VERIFY(web_ui) and aborts. Couple each dynamic registry entry to its creator, or return a normal handled error for an unregistered implementation.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Libraries/LibWebView/WebUI.cpp` around lines 61 - 81, Update the WebUI
creation dispatch around create_web_ui and VERIFY(web_ui) so every
PageType::Dynamic entry from s_pages is guaranteed to have a corresponding
creator, or replace the VERIFY failure with a normal handled error for missing
implementations. Preserve the existing static-page rejection and registrations
while preventing unknown dynamic pages from aborting the process.
Tests/LibWebView/TestAutocomplete.cpp (1)

220-238: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

Make remote-query suppression observable.

The autocomplete engine is disabled globally, so this passes even if the about: early return is removed: the normal no-engine path also produces no remote search results. Configure an observable test engine/request hook and assert that an about:set query schedules zero remote requests.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Tests/LibWebView/TestAutocomplete.cpp` around lines 220 - 238, The
autocomplete test around about_query_completed currently cannot distinguish
about: suppression from the globally disabled engine path. Configure an
observable test autocomplete engine or request hook before invoking
query_autocomplete_engine, track remote requests, and assert that querying
"about:set" schedules zero remote requests while preserving the existing
suggestion assertions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@Libraries/LibWebView/WebUI.cpp`:
- Around line 61-81: Update the WebUI creation dispatch around create_web_ui and
VERIFY(web_ui) so every PageType::Dynamic entry from s_pages is guaranteed to
have a corresponding creator, or replace the VERIFY failure with a normal
handled error for missing implementations. Preserve the existing static-page
rejection and registrations while preventing unknown dynamic pages from aborting
the process.

In `@Tests/LibWebView/TestAutocomplete.cpp`:
- Around line 220-238: The autocomplete test around about_query_completed
currently cannot distinguish about: suppression from the globally disabled
engine path. Configure an observable test autocomplete engine or request hook
before invoking query_autocomplete_engine, track remote requests, and assert
that querying "about:set" schedules zero remote requests while preserving the
existing suggestion assertions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 308cb960-e570-4d96-aea3-709a03fa0f09

📥 Commits

Reviewing files that changed from the base of the PR and between 843554d and bf163f9.

📒 Files selected for processing (8)
  • Libraries/LibWeb/Loader/ResourceLoader.cpp
  • Libraries/LibWeb/Loader/ResourceLoader.h
  • Libraries/LibWebView/Autocomplete.cpp
  • Libraries/LibWebView/Autocomplete.h
  • Libraries/LibWebView/WebUI.cpp
  • Libraries/LibWebView/WebUI.h
  • Tests/LibWebView/TestAutocomplete.cpp
  • Tests/LibWebView/TestOmnibox.cpp

@AtkinsSJ
AtkinsSJ force-pushed the about-url-comfiness branch from bf163f9 to f2900fe Compare July 17, 2026 10:26
@AtkinsSJ

AtkinsSJ commented Jul 17, 2026

Copy link
Copy Markdown
Member Author

Rebased, and inserted a new commit at the start: with the previous changes, we now (correctly) error on invalid about: URLs, which includes about:srcdoc which a couple of tests were misusing. So, I've modified them to load a blank HTML file instead, which is what they actually wanted to do.

AtkinsSJ added 4 commits July 17, 2026 11:28
Setting an object's URL to `about:srcdoc` is not actually valid, and
relies on our current buggy behaviour of always returning a blank page
for unrecognized `about:` urls. Instead, point these at blank.html. For
the contentWindow test, we also need to mark it to load from the HTTP
server as otherwise, reading that property counts as accessing a
cross-origin frame.
Treat a missing backing resource for an about URL as a failed load.
This lets navigation create the existing error document instead of
parsing an empty HTML response.
Keep internal page names, titles, and handler requirements in one
registry. Handler creation now consults it, allowing other WebView
features to discover the available pages.
Offer case-insensitive prefix matches for known about pages and support
inline completion of those URLs. Keep about queries local instead of
sending them to a remote autocomplete provider.
@AtkinsSJ
AtkinsSJ force-pushed the about-url-comfiness branch from f2900fe to 67d1e6b Compare July 17, 2026 10:28
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
putComment timed out

@AtkinsSJ
AtkinsSJ merged commit 68fc223 into LadybirdBrowser:master Jul 17, 2026
13 checks passed
@AtkinsSJ
AtkinsSJ deleted the about-url-comfiness branch July 17, 2026 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant