Bug 1348874 - If origin is an opaque origin, reject promise with a TypeError, r=janv

This commit is contained in:
Shawn Huang 2017-04-17 15:07:15 +08:00
Родитель 1bffdaa737
Коммит d1021ec94a
1 изменённых файлов: 7 добавлений и 0 удалений

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

@ -287,6 +287,13 @@ ExecuteOpOnMainOrWorkerThread(nsIGlobalObject* aGlobal,
nsCOMPtr<nsIPrincipal> principal = doc->NodePrincipal(); nsCOMPtr<nsIPrincipal> principal = doc->NodePrincipal();
MOZ_ASSERT(principal); MOZ_ASSERT(principal);
// Storage Standard 7. API
// If origin is an opaque origin, then reject promise with a TypeError.
if (principal->GetIsNullPrincipal()) {
promise->MaybeReject(NS_ERROR_DOM_TYPE_ERR);
return promise.forget();
}
switch (aType) { switch (aType) {
case RequestResolver::Type::Persisted: { case RequestResolver::Type::Persisted: {
RefPtr<RequestResolver> resolver = RefPtr<RequestResolver> resolver =