mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1195173 - Convert ExtensionProtocolHandler to use channel->Open2() (r=maglione)
This commit is contained in:
parent
5a89bae2c9
commit
4372ffbfa4
@ -104,8 +104,9 @@ ExtensionProtocolHandler::SubstituteChannel(nsIURI* aURI,
|
|||||||
const char* kToType = "text/css";
|
const char* kToType = "text/css";
|
||||||
|
|
||||||
nsCOMPtr<nsIInputStream> inputStream;
|
nsCOMPtr<nsIInputStream> inputStream;
|
||||||
if (aLoadInfo && aLoadInfo->GetSecurityMode()) {
|
if (aLoadInfo &&
|
||||||
// Certain security checks require an async channel.
|
aLoadInfo->GetSecurityMode() == nsILoadInfo::SEC_REQUIRE_CORS_DATA_INHERITS) {
|
||||||
|
// If the channel needs to enforce CORS, we need to open the channel async.
|
||||||
|
|
||||||
nsCOMPtr<nsIOutputStream> outputStream;
|
nsCOMPtr<nsIOutputStream> outputStream;
|
||||||
rv = NS_NewPipe(getter_AddRefs(inputStream), getter_AddRefs(outputStream),
|
rv = NS_NewPipe(getter_AddRefs(inputStream), getter_AddRefs(outputStream),
|
||||||
@ -128,11 +129,14 @@ ExtensionProtocolHandler::SubstituteChannel(nsIURI* aURI,
|
|||||||
|
|
||||||
rv = (*result)->AsyncOpen2(converter);
|
rv = (*result)->AsyncOpen2(converter);
|
||||||
} else {
|
} else {
|
||||||
// Stylesheet loads for extension content scripts require a sync channel,
|
// Stylesheet loads for extension content scripts require a sync channel.
|
||||||
// but fortunately do not invoke security checks.
|
|
||||||
|
|
||||||
nsCOMPtr<nsIInputStream> sourceStream;
|
nsCOMPtr<nsIInputStream> sourceStream;
|
||||||
|
if (aLoadInfo && aLoadInfo->GetEnforceSecurity()) {
|
||||||
|
rv = (*result)->Open2(getter_AddRefs(sourceStream));
|
||||||
|
} else {
|
||||||
rv = (*result)->Open(getter_AddRefs(sourceStream));
|
rv = (*result)->Open(getter_AddRefs(sourceStream));
|
||||||
|
}
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
rv = convService->Convert(sourceStream, kFromType, kToType,
|
rv = convService->Convert(sourceStream, kFromType, kToType,
|
||||||
|
Loading…
Reference in New Issue
Block a user