Bug 1354248 - Part 3: Supply LoadInfoArgs through the RemoteStreamGetter mechanism. r=necko-reviewers,kershaw

The LoadArgs are wrapped in a Maybe, since that seems to be what the conversion utilities
(LoadInfoToLoadInfoArgs and LoadInfoArgsToLoadInfo) seem to expect. It's really up to the
users of RemoteStreamGetter to determine whether or not they're willing to accept requests
without LoadArgs.

Differential Revision: https://phabricator.services.mozilla.com/D147334
This commit is contained in:
Mike Conley 2022-06-03 15:17:33 +00:00
Родитель 9162e50177
Коммит 545db4aaa0
5 изменённых файлов: 18 добавлений и 10 удалений

Просмотреть файл

@ -830,7 +830,8 @@ mozilla::ipc::IPCResult NeckoParent::RecvEnsureHSTSData(
}
mozilla::ipc::IPCResult NeckoParent::RecvGetPageThumbStream(
nsIURI* aURI, GetPageThumbStreamResolver&& aResolver) {
nsIURI* aURI, const Maybe<LoadInfoArgs>& aLoadInfoArgs,
GetPageThumbStreamResolver&& aResolver) {
// Only the privileged about content process is allowed to access
// things over the moz-page-thumb protocol. Any other content process
// that tries to send this should have been blocked via the

Просмотреть файл

@ -193,7 +193,8 @@ class NeckoParent : public PNeckoParent {
/* Page thumbnails remote resource loading */
mozilla::ipc::IPCResult RecvGetPageThumbStream(
nsIURI* aURI, GetPageThumbStreamResolver&& aResolve);
nsIURI* aURI, const Maybe<LoadInfoArgs>& aLoadInfoArgs,
GetPageThumbStreamResolver&& aResolve);
PClassifierDummyChannelParent* AllocPClassifierDummyChannelParent(
nsIURI* aURI, nsIURI* aTopWindowURI, const nsresult& aTopWindowURIResult,

Просмотреть файл

@ -149,7 +149,7 @@ parent:
/**
* Page thumbnails remote resource loading
*/
async GetPageThumbStream(nsIURI uri) returns (RemoteStreamInfo? info);
async GetPageThumbStream(nsIURI uri, LoadInfoArgs? loadInfo) returns (RemoteStreamInfo? info);
child:
/* Predictor Methods */

Просмотреть файл

@ -36,13 +36,19 @@ RequestOrReason RemoteStreamGetter::GetAsync(nsIStreamListener* aListener,
nsCOMPtr<nsICancelable> cancelableRequest(this);
RefPtr<RemoteStreamGetter> self = this;
Maybe<LoadInfoArgs> loadInfoArgs;
nsresult rv = ipc::LoadInfoToLoadInfoArgs(mLoadInfo, &loadInfoArgs);
if (NS_FAILED(rv)) {
return Err(rv);
}
(gNeckoChild->*aMethod)(mURI)->Then(
GetMainThreadSerialEventTarget(), __func__,
[self](const Maybe<RemoteStreamInfo>& info) { self->OnStream(info); },
[self](const mozilla::ipc::ResponseRejectReason) {
self->OnStream(Nothing());
});
(gNeckoChild->*aMethod)(mURI, loadInfoArgs)
->Then(
GetMainThreadSerialEventTarget(), __func__,
[self](const Maybe<RemoteStreamInfo>& info) { self->OnStream(info); },
[self](const mozilla::ipc::ResponseRejectReason) {
self->OnStream(Nothing());
});
return RequestOrCancelable(WrapNotNull(cancelableRequest));
}

Просмотреть файл

@ -26,7 +26,7 @@ using RemoteStreamPromise =
mozilla::MozPromise<RemoteStreamInfo, nsresult, false>;
using Method = RefPtr<
MozPromise<Maybe<RemoteStreamInfo>, ipc::ResponseRejectReason, true>> (
PNeckoChild::*)(nsIURI*);
PNeckoChild::*)(nsIURI*, const Maybe<LoadInfoArgs>&);
/**
* Helper class used with SimpleChannel to asynchronously obtain an input