Bug 1348442: Part 4 - Remove support for synchronously loading localized extension CSS. r=jdm

After switching to loading content stylesheets asynchronously, there are no
longer any consumers that require a synchronous channel to load localized CSS,
so these workarounds are no longer necessary.

MozReview-Commit-ID: AwLSmYf9qL3

--HG--
extra : rebase_source : d5f34c37e91478bb656014d53011ba2f504fe0e8
This commit is contained in:
Kris Maglione 2017-03-17 16:46:59 -07:00
Родитель 5b30f059fb
Коммит 3107e48e00
1 изменённых файлов: 16 добавлений и 34 удалений

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

@ -138,44 +138,26 @@ ExtensionProtocolHandler::SubstituteChannel(nsIURI* aURI,
const char* kToType = "text/css";
nsCOMPtr<nsIInputStream> inputStream;
if (aLoadInfo &&
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;
rv = NS_NewPipe(getter_AddRefs(inputStream), getter_AddRefs(outputStream),
0, UINT32_MAX, true, false);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIOutputStream> outputStream;
rv = NS_NewPipe(getter_AddRefs(inputStream), getter_AddRefs(outputStream),
0, UINT32_MAX, true, false);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIStreamListener> listener;
nsCOMPtr<nsIRequestObserver> observer = new PipeCloser(outputStream);
rv = NS_NewSimpleStreamListener(getter_AddRefs(listener), outputStream, observer);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIStreamListener> listener;
nsCOMPtr<nsIRequestObserver> observer = new PipeCloser(outputStream);
rv = NS_NewSimpleStreamListener(getter_AddRefs(listener), outputStream, observer);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIStreamListener> converter;
rv = convService->AsyncConvertData(kFromType, kToType, listener,
aURI, getter_AddRefs(converter));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIStreamListener> converter;
rv = convService->AsyncConvertData(kFromType, kToType, listener,
aURI, getter_AddRefs(converter));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsILoadInfo> loadInfo =
static_cast<LoadInfo*>(aLoadInfo)->CloneForNewRequest();
(*result)->SetLoadInfo(loadInfo);
nsCOMPtr<nsILoadInfo> loadInfo =
static_cast<LoadInfo*>(aLoadInfo)->CloneForNewRequest();
(*result)->SetLoadInfo(loadInfo);
rv = (*result)->AsyncOpen2(converter);
} else {
// Stylesheet loads for extension content scripts require a sync channel.
nsCOMPtr<nsIInputStream> sourceStream;
if (aLoadInfo && aLoadInfo->GetEnforceSecurity()) {
rv = (*result)->Open2(getter_AddRefs(sourceStream));
} else {
rv = (*result)->Open(getter_AddRefs(sourceStream));
}
NS_ENSURE_SUCCESS(rv, rv);
rv = convService->Convert(sourceStream, kFromType, kToType,
aURI, getter_AddRefs(inputStream));
}
rv = (*result)->AsyncOpen2(converter);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIChannel> channel;