зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1380156
- Loading temporary unpacked extension breaks extension page's CSS in OOP Extensions. r=jimm
MozReview-Commit-ID: 3SskOcpAI5Z --HG-- extra : rebase_source : 2ca3e48c66b3e2765a2a41882ddb4b01a83dd3fe
This commit is contained in:
Родитель
4d97701185
Коммит
d8e4797b60
|
@ -603,24 +603,38 @@ ExtensionProtocolHandler::NewStream(nsIURI* aChildURI, bool* aTerminateSender)
|
|||
return Err(NS_ERROR_FILE_NOT_DIRECTORY);
|
||||
}
|
||||
|
||||
/*
|
||||
* Now get a channel for the resolved child URI and make sure the
|
||||
* channel is a file channel.
|
||||
*/
|
||||
// Make sure the child URI resolves to a file URI then get a file
|
||||
// channel for the request. The resultant channel should be a
|
||||
// file channel because we only request remote streams for unpacked
|
||||
// extension resource loads where the URI resolves to a file.
|
||||
nsAutoCString resolvedSpec;
|
||||
NS_TRY(ResolveURI(aChildURI, resolvedSpec));
|
||||
|
||||
nsAutoCString resolvedScheme;
|
||||
NS_TRY(net_ExtractURLScheme(resolvedSpec, resolvedScheme));
|
||||
if (!resolvedScheme.EqualsLiteral("file")) {
|
||||
return Err(NS_ERROR_UNEXPECTED);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIIOService> ioService = do_GetIOService(&rv);
|
||||
NS_TRY(rv);
|
||||
|
||||
nsCOMPtr<nsIURI> resolvedURI;
|
||||
NS_TRY(ioService->NewURI(resolvedSpec,
|
||||
nullptr,
|
||||
nullptr,
|
||||
getter_AddRefs(resolvedURI)));
|
||||
|
||||
// We use the system principal to get a file channel for the request,
|
||||
// but only after we've checked (above) that the child URI is of
|
||||
// moz-extension scheme and that the URI host maps to a directory.
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
NS_TRY(NS_NewChannel(getter_AddRefs(channel),
|
||||
aChildURI,
|
||||
resolvedURI,
|
||||
nsContentUtils::GetSystemPrincipal(),
|
||||
nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
|
||||
nsIContentPolicy::TYPE_OTHER));
|
||||
|
||||
// Channel should be a file channel. It should never be a JAR
|
||||
// channel because we only request remote streams for unpacked
|
||||
// extension resource loads where the URI resolves to a file.
|
||||
nsCOMPtr<nsIFileChannel> fileChannel = do_QueryInterface(channel, &rv);
|
||||
NS_TRY(rv);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче