Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: a26f36bbc1ecbb91308959a32095b57bc33ed265
https://github.com/WebKit/WebKit/commit/a26f36bbc1ecbb91308959a32095b57bc33ed265
Author: Ahmad Saleem <[email protected]>
Date: 2026-07-14 (Tue, 14 Jul 2026)
Changed paths:
A
LayoutTests/http/tests/inspector/network/har/har-remote-address-port-expected.txt
A LayoutTests/http/tests/inspector/network/har/har-remote-address-port.html
M Source/WebInspectorUI/UserInterface/Controllers/HARBuilder.js
Log Message:
-----------
Web Inspector: HAR export reports a bogus port for remote addresses that have
no port
https://bugs.webkit.org/show_bug.cgi?id=319366
rdar://182171465
Reviewed by Devin Rousso.
WI.HARBuilder.port() guarded its "no port present" case with `if (!index)`
after `remoteAddress.lastIndexOf(":")`. That guard only fires when the colon
is at index 0 (a leading-colon address); it never fires for the not-found
case, because lastIndexOf() returns -1, which is truthy. As a result, an
address with no trailing ":port" fell through to substring(-1 + 1) ==
substring(0) and parsed the entire string, e.g. parseInt("12.34.56.78")
yields 12, so the HAR entry recorded a nonsensical serverPort.
Fix the guard to test `index === -1` so an address without a port correctly
returns undefined.
Test: http/tests/inspector/network/har/har-remote-address-port.html
* Source/WebInspectorUI/UserInterface/Controllers/HARBuilder.js:
(WI.HARBuilder.port):
* LayoutTests/http/tests/inspector/network/har/har-remote-address-port.html:
Added.
*
LayoutTests/http/tests/inspector/network/har/har-remote-address-port-expected.txt:
Added.
Canonical link: https://commits.webkit.org/317155@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications