Skip to content

[Web Inspector] Avoid redundant String copy of request URL in InspectorNetworkAgent::willSendRequest#69443

Open
Ahmad-S792 wants to merge 1 commit into
WebKit:mainfrom
Ahmad-S792:eng/Web-Inspector-Avoid-redundant-String-copy-of-request-URL-in-InspectorNetworkAgent-willSendRequest
Open

[Web Inspector] Avoid redundant String copy of request URL in InspectorNetworkAgent::willSendRequest#69443
Ahmad-S792 wants to merge 1 commit into
WebKit:mainfrom
Ahmad-S792:eng/Web-Inspector-Avoid-redundant-String-copy-of-request-URL-in-InspectorNetworkAgent-willSendRequest

Conversation

@Ahmad-S792

@Ahmad-S792 Ahmad-S792 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

c3b3392

[Web Inspector] Avoid redundant String copy of request URL in InspectorNetworkAgent::willSendRequest
https://bugs.webkit.org/show_bug.cgi?id=319456
rdar://182268053

Reviewed by NOBODY (OOPS!).

In willSendRequest(), the local `url` was declared as `String`, copying the
string returned by `DocumentLoader::url().string()` / `ResourceRequest::url().string()`.
Both accessors return a `const URL&` (LIFETIME_BOUND) and `URL::string()` returns
a `const String&`, so the value can be bound directly to a reference. Both the
loader and the request outlive the requestWillBeSent() dispatch, and the frontend
dispatcher takes `const String& documentURL`, so no copy is required.

Bind `url` with `auto&` (deduces to `const String&`) to drop the gratuitous
ref-count churn.

* Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp:
(WebCore::InspectorNetworkAgent::willSendRequest):

c3b3392

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows Apple Internal
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win ✅ 🛠 ios-apple
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 ⏳ 🧪 win-tests ✅ 🛠 mac-apple
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ⏳ 🧪 api-mac ✅ 🧪 api-wpe ✅ 🛠 vision-apple
✅ 🧪 ios-wk2-wpt ⏳ 🧪 api-mac-debug ✅ 🛠 gtk3-libwebrtc
✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🛠 gtk
⏳ 🛠 ios-safer-cpp ⏳ 🧪 mac-AS-debug-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision ✅ 🧪 api-gtk
✅ 🛠 vision-sim ⏳ 🧪 mac-intel-wk2 ⏳ 🛠 playstation
✅ 🧪 vision-wk2 ⏳ 🛠 mac-safer-cpp
✅ 🛠 tv ❌ 🧪 mac-site-isolation
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

…orNetworkAgent::willSendRequest

https://bugs.webkit.org/show_bug.cgi?id=319456
rdar://182268053

Reviewed by NOBODY (OOPS!).

In willSendRequest(), the local `url` was declared as `String`, copying the
string returned by `DocumentLoader::url().string()` / `ResourceRequest::url().string()`.
Both accessors return a `const URL&` (LIFETIME_BOUND) and `URL::string()` returns
a `const String&`, so the value can be bound directly to a reference. Both the
loader and the request outlive the requestWillBeSent() dispatch, and the frontend
dispatcher takes `const String& documentURL`, so no copy is required.

Bind `url` with `auto&` (deduces to `const String&`) to drop the gratuitous
ref-count churn.

* Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp:
(WebCore::InspectorNetworkAgent::willSendRequest):
@Ahmad-S792 Ahmad-S792 self-assigned this Jul 15, 2026
@Ahmad-S792 Ahmad-S792 added the Web Inspector Bugs related to the WebKit Web Inspector. label Jul 15, 2026
@Ahmad-S792 Ahmad-S792 marked this pull request as ready for review July 15, 2026 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Web Inspector Bugs related to the WebKit Web Inspector.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants