Bug 1921119 - Add canceledReason to RemoteWebProgressRequest r=nika

The canceledReason is added to the RequestData used to build the
RemoteWebProgressRequest. This canceledReason is useful for consumers such
as WebDriverBiDi which need to emit different error messages depending on
the reason why a specific navigation request was canceled.

Differential Revision: https://phabricator.services.mozilla.com/D223174
This commit is contained in:
Julian Descottes 2024-09-25 21:25:40 +00:00
parent 0836ed262c
commit 4f0b654a19
3 changed files with 7 additions and 0 deletions

View File

@ -3890,6 +3890,9 @@ nsresult BrowserChild::PrepareRequestData(nsIRequest* aRequest,
getter_AddRefs(aRequestData.originalRequestURI()));
NS_ENSURE_SUCCESS(rv, rv);
rv = channel->GetCanceledReason(aRequestData.canceledReason());
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIClassifiedChannel> classifiedChannel = do_QueryInterface(channel);
if (classifiedChannel) {
rv = classifiedChannel->GetMatchedList(aRequestData.matchedList());

View File

@ -2958,6 +2958,7 @@ mozilla::ipc::IPCResult BrowserParent::RecvOnStateChange(
request = MakeAndAddRef<RemoteWebProgressRequest>(
aRequestData.requestURI(), aRequestData.originalRequestURI(),
aRequestData.matchedList());
request->SetCanceledReason(aRequestData.canceledReason());
}
if (aStateChangeData.isSome()) {
@ -3017,6 +3018,7 @@ mozilla::ipc::IPCResult BrowserParent::RecvOnLocationChange(
request = MakeAndAddRef<RemoteWebProgressRequest>(
aRequestData.requestURI(), aRequestData.originalRequestURI(),
aRequestData.matchedList());
request->SetCanceledReason(aRequestData.canceledReason());
}
browsingContext->SetCurrentRemoteURI(aLocation);
@ -3124,6 +3126,7 @@ mozilla::ipc::IPCResult BrowserParent::RecvNotifyContentBlockingEvent(
nsCOMPtr<nsIRequest> request = MakeAndAddRef<RemoteWebProgressRequest>(
aRequestData.requestURI(), aRequestData.originalRequestURI(),
aRequestData.matchedList());
request->SetCanceledReason(aRequestData.canceledReason());
wgp->NotifyContentBlockingEvent(
aEvent, request, aBlocked, aTrackingOrigin, aTrackingFullHashes, aReason,

View File

@ -127,6 +127,7 @@ struct RequestData
nullable nsIURI requestURI;
nullable nsIURI originalRequestURI;
nsCString matchedList;
nsCString canceledReason;
};
struct WebProgressStateChangeData