Skip to content

Conversation

@TimvdLippe
Copy link
Contributor

This implements step 2 of the web-facing API's.
Now, the embedder receives a notification whether
a webpage wants to register/unregister a protocol
handler. They can't do anything with it yet, that's for a follow-up PR. But locally testing shows the
following debug log:

pid:35180 Requesting to Register for scheme web+test with url https://web-platform.test:8443/html/webappapis/system-state-and-capabilities/the-navigator-object/%s

Part of #40615

@TimvdLippe TimvdLippe requested a review from yezhizhen November 15, 2025 10:22
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Nov 15, 2025
@TimvdLippe TimvdLippe force-pushed the embedder-notification-protocolhandler branch from 08cf6fb to f30a538 Compare November 16, 2025 10:11
@TimvdLippe TimvdLippe requested a review from webbeef November 16, 2025 10:11
@TimvdLippe TimvdLippe force-pushed the embedder-notification-protocolhandler branch from f30a538 to 595c23b Compare November 16, 2025 10:13
@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Nov 16, 2025
@TimvdLippe TimvdLippe requested a review from jdm November 18, 2025 09:52
Copy link
Member

@mrobinson mrobinson left a comment

Choose a reason for hiding this comment

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

Sorry for the late review! Looks good apart from a couple things:

@servo-highfive servo-highfive added the S-needs-code-changes Changes have not yet been made that were requested by a reviewer. label Nov 19, 2025
@TimvdLippe TimvdLippe force-pushed the embedder-notification-protocolhandler branch from 595c23b to c8b9512 Compare November 19, 2025 15:05
@servo-highfive servo-highfive added S-awaiting-review There is new code that needs to be reviewed. S-needs-rebase There are merge conflict errors. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Nov 19, 2025
@TimvdLippe TimvdLippe marked this pull request as draft November 19, 2025 15:07
@TimvdLippe TimvdLippe force-pushed the embedder-notification-protocolhandler branch from c8b9512 to eacf9c2 Compare November 19, 2025 15:36
@mrobinson mrobinson changed the title Notify embedder of protocolhandler updates libservo: Notify embedder of protocol handler updates Nov 20, 2025
.url(
Url::parse(
"data:text/html,<!DOCTYPE html><script>\
window.navigator.registerProtocolHandler('web+test', 'http://localhost:8000/web/test/');\
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The test here doesn't work, because registerProtocolHandler can only be called for the same origin. However, none of the webview tests load a URL that has an origin. They call use data:text/html.

How can I refer to local resources so that we spin up a webserver and run that?

All of this is to say, I think instead of having a unit test for this, I rather rely on the WPT tests for these: https://github.com/servo/servo/blob/main/tests/wpt/tests/html/webappapis/system-state-and-capabilities/the-navigator-object/protocol-handler-fragment-nosw.https.html

Copy link
Member

Choose a reason for hiding this comment

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

Seems reasonable to me! Thanks for looking into this and sorry that it turned out to be a dead end.

FWIW, at some point we likely do need to support running tests from a small local server, but we don't have that built out in the unit tests yet and it seems like too much for this change.

@TimvdLippe TimvdLippe force-pushed the embedder-notification-protocolhandler branch from eacf9c2 to bd34b5a Compare November 21, 2025 15:19
@TimvdLippe TimvdLippe marked this pull request as ready for review November 21, 2025 15:19
@servo-highfive servo-highfive removed the S-needs-rebase There are merge conflict errors. label Nov 21, 2025
@TimvdLippe TimvdLippe force-pushed the embedder-notification-protocolhandler branch from 048b759 to bd34b5a Compare November 21, 2025 15:20
@TimvdLippe TimvdLippe requested a review from mrobinson November 21, 2025 15:20
Copy link
Member

@mrobinson mrobinson left a comment

Choose a reason for hiding this comment

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

Thanks for the changes here!

@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Nov 21, 2025
This implements step 2 of the web-facing API's.
Now, the embedder receives a notification whether
a webpage wants to register/unregister a protocol
handler. They can't do anything with it yet, that's
for a follow-up PR. But locally testing shows the
following debug log:

```
pid:35180 Requesting to Register for scheme web+test with url https://web-platform.test:8443/html/webappapis/system-state-and-capabilities/the-navigator-object/%s
```

Part of servo#40615

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
@TimvdLippe TimvdLippe force-pushed the embedder-notification-protocolhandler branch from bd34b5a to f549e87 Compare November 21, 2025 18:05
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Nov 21, 2025
@TimvdLippe TimvdLippe enabled auto-merge November 21, 2025 18:08
@TimvdLippe TimvdLippe added this pull request to the merge queue Nov 21, 2025
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Nov 21, 2025
Merged via the queue into servo:main with commit 69030f5 Nov 21, 2025
35 checks passed
@TimvdLippe TimvdLippe deleted the embedder-notification-protocolhandler branch November 21, 2025 18:59
@servo-highfive servo-highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Nov 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-awaiting-review There is new code that needs to be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants