Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions internal/js/modules/k6/browser/common/network_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -558,15 +558,16 @@ func (m *NetworkManager) onRequest(event *network.EventRequestWillBeSent,
m.logger.Errorf("NetworkManager", "creating request: %s", err)
return
}
// Skip data and blob URLs, since they're internal to the browser.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Of course this would break TestURLSkipRequest, as that test is precisely preventing regressions on these lines.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Arguably this would be a breaking change, so we might need to consider carefully, and perhaps leave it up to k6 v2.0, if we really want to ship it.

if isInternalURL(req.url) {
m.logger.Debugf("NetworkManager", "skipping request handling of %s URL", req.url.Scheme)
return
}

m.reqsMu.Lock()
m.reqIDToRequest[event.RequestID] = req
m.reqsMu.Unlock()
m.emitRequestMetrics(req)

// Skip data and blob URLs, since they're internal to the browser.
if !isInternalURL(req.url) {
m.emitRequestMetrics(req)
}
Comment on lines +566 to +569
Copy link
Contributor Author

Choose a reason for hiding this comment

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

What I don't know, because I lack the historical context from the original PR, is: do we want to skip handling local requests at all, or only to not emit metrics for those requests?

Because with the former, k6 differs from Playwright behavior, in the sense that if a request is supposed to fail, like:
blob:something, for which Chrome (and Playwright) throws net::ERR_FILE_NOT_FOUND at blob:something, k6 doesn't, and the error wouldn't get any error.

While, with the changeset suggested here, the error would be surfaces, as with PW+Chrome, while we would still not emit request metrics for those URLs.


m.frameManager.requestStarted(req)

m.eventInterceptor.onRequest(req)
Expand Down
Loading