Document how the virtual host name affects navigation time - #3880
Document how the virtual host name affects navigation time#3880Burakuslendera wants to merge 4 commits into
Conversation
|
@microsoft-github-policy-service agree |
|
Learn Build status updates of commit b8e92de: ✅ Validation status: passed
For more details, please refer to the build report. |
PoliCheck Scan ReportThe following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans. ✅ No issues foundMore information about PoliCheckInformation: PoliCheck | Severity Guidance | Term |
|
Learn Build status updates of commit 4852ff1: ✅ Validation status: passed
For more details, please refer to the build report. |
PoliCheck Scan ReportThe following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans. ✅ No issues foundMore information about PoliCheckInformation: PoliCheck | Severity Guidance | Term |
Rendered article sections for review:
Using local content in WebView2 apps > Considerations for loading local content by using virtual host name mapping > Choosing a virtual host name
/webview2/concepts/working-with-local-content.mdUsing local content in WebView2 apps > Considerations for loading local content by handling the WebResourceRequested event > Choosing a host name for the origin
/webview2/concepts/working-with-local-content.mdAB#63298553
What this PR adds
This PR adds two short subsections on choosing the host name for a synthetic origin, one under each approach on this page that uses one:
WebResourceRequestedapproach.Why
The host name is resolved by the network stack before the mapping is applied, so a name that doesn't resolve costs a DNS timeout on every navigation.
The page currently says nothing about this, and its own example maps
demo, which is such a name.The times are measured on WebView2 runtime 150.0.4078.83, on an app that serves its content through
WebResourceRequestedrather than folder mapping, so nothing needs the name resolved at all.A NetLog capture names the span:
That job covers exactly the interval between the main document being handed to
put_Responseand the renderer requesting the first subresource.Changing only the host name collapses it:
app.localapp.localhostThe distinction the new text draws is the one that matters in practice.
Reserved TLDs such as
.example,.testand.invaliddon't help, because RFC 2606 reserves them only against registration; the resolver still queries the network and still waits for the answer.RFC 6761 pins
.localhostto the loopback interface, so the resolver answers it without a query.Renaming to
.testwas measured first, and changed nothing.Related Issue
2 seconds delay is seen with Page navigation using WebView2 & SetVirtualHostNameToFolderMapping - Issue 2381 in the "MicrosoftEdge / WebView2Feedback" repo
This Issue reports the same delay for virtual host name mapping.
The Issue has been open since 2022.
The measurement above extends it to the
WebResourceRequestedpath, which suggests that the cost belongs to the synthetic origin itself, rather than to either API.