зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1802385 - Use NS_GetFinalChannelURI in FetchDriver r=rpl,valentin
Depends on D164656 Differential Revision: https://phabricator.services.mozilla.com/D166108
This commit is contained in:
Родитель
0c272cf6aa
Коммит
df4d1e4a94
|
@ -1170,14 +1170,6 @@ FetchDriver::OnStartRequest(nsIRequest* aRequest) {
|
|||
|
||||
response->InitChannelInfo(channel);
|
||||
|
||||
nsCOMPtr<nsIURI> channelURI;
|
||||
rv = channel->GetURI(getter_AddRefs(channelURI));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
FailWithNetworkError(rv);
|
||||
// Cancel request.
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsILoadInfo> loadInfo = channel->LoadInfo();
|
||||
// Propagate any tainting from the channel back to our response here. This
|
||||
// step is not reflected in the spec because the spec is written such that
|
||||
|
@ -1494,7 +1486,7 @@ FetchDriver::AsyncOnChannelRedirect(nsIChannel* aOldChannel,
|
|||
// Response.redirected to true if an internal redirect occurs. These
|
||||
// should be transparent to script.
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
MOZ_ALWAYS_SUCCEEDS(aNewChannel->GetURI(getter_AddRefs(uri)));
|
||||
MOZ_ALWAYS_SUCCEEDS(NS_GetFinalChannelURI(aNewChannel, getter_AddRefs(uri)));
|
||||
|
||||
nsCOMPtr<nsIURI> uriClone;
|
||||
nsresult rv = NS_GetURIWithoutRef(uri, getter_AddRefs(uriClone));
|
||||
|
|
|
@ -186,18 +186,16 @@ add_task(async function test_redirect_transform_scheme() {
|
|||
scheme: "moz-extension",
|
||||
host: location.hostname,
|
||||
});
|
||||
// See https://bugzilla.mozilla.org/show_bug.cgi?id=1745761#c7
|
||||
// When extensions.webextensions.remote is false (e.g. on Android),
|
||||
// a redirect to a moz-extension:-URL reveals the underlying jar/file
|
||||
// URL, instead of the moz-extension:-URL.
|
||||
// TODO bug 1802385: fix bug and also run the following part on Android.
|
||||
if (!navigator.userAgent.includes("Android")) {
|
||||
await testFetch(
|
||||
"http://from/war.txt",
|
||||
browser.runtime.getURL("war.txt"),
|
||||
"Scheme change to moz-extension:-URL"
|
||||
);
|
||||
}
|
||||
await testFetch(
|
||||
"http://from/war.txt",
|
||||
browser.runtime.getURL("war.txt"),
|
||||
"Scheme change to moz-extension:-URL"
|
||||
);
|
||||
await testNavigate(
|
||||
"http://from/war.txt",
|
||||
browser.runtime.getURL("war.txt"),
|
||||
"Scheme change to moz-extension:-URL (navigation)"
|
||||
);
|
||||
// While the initiator (extension) would be allowed to read the resource
|
||||
// due to it being same-origin, the pre-redirect URL (http://from) is not
|
||||
// matching web_accessible_resources[].matches, so the load is rejected.
|
||||
|
|
|
@ -632,20 +632,7 @@ add_task(async function redirect_request_with_dnr_to_extensionPath() {
|
|||
{
|
||||
let req = await fetch("http://redir/never_reached", { method: "post" });
|
||||
browser.test.assertEq(200, req.status, "redirected to extensionPath");
|
||||
if (navigator.userAgent.includes("Android")) {
|
||||
// See https://bugzilla.mozilla.org/show_bug.cgi?id=1745761#c7
|
||||
// When extensions.webextensions.remote is false (e.g. on Android),
|
||||
// a redirect to a moz-extension:-URL reveals the underlying jar/file
|
||||
// URL, instead of the moz-extension:-URL.
|
||||
// TODO bug 1802385: fix bug and remove this Android-only check.
|
||||
browser.test.assertTrue(req.url.endsWith("/war.txt?1"), req.url);
|
||||
browser.test.assertFalse(
|
||||
req.url.startsWith(location.origin),
|
||||
"Work-around for bug 1802385 only needed if URL is not moz-extension:"
|
||||
);
|
||||
} else {
|
||||
browser.test.assertEq(`${location.origin}/war.txt?1`, req.url);
|
||||
}
|
||||
browser.test.assertEq(`${location.origin}/war.txt?1`, req.url);
|
||||
browser.test.assertEq("war_ext_res", await req.text());
|
||||
}
|
||||
// Redirects to extensionPath that is not in web_accessible_resources.
|
||||
|
|
Загрузка…
Ссылка в новой задаче