Bug 1119044 - Fetch API WebIDL Fixes. r=bkelly,baku

Add various [SameObject]/[NewObject] annotations.
Adds RequestCache enum.
Ensures that cors-with-forced-preflight is translated to cors in getter.
Reject cors-with-forced-preflight as a valid mode value in Request constructor.
This commit is contained in:
Nikhil Marathe
2015-01-07 16:24:40 -08:00
parent dcd66299af
commit 576ee86fbb
7 changed files with 70 additions and 8 deletions

View File

@@ -128,6 +128,16 @@ Request::Constructor(const GlobalObject& aGlobal,
fallbackCredentials = RequestCredentials::Omit;
}
// CORS-with-forced-preflight is not publicly exposed and should not be
// considered a valid value.
if (aInit.mMode.WasPassed() &&
aInit.mMode.Value() == RequestMode::Cors_with_forced_preflight) {
NS_NAMED_LITERAL_STRING(sourceDescription, "'mode' member of RequestInit");
NS_NAMED_LITERAL_STRING(value, "cors-with-forced-preflight");
NS_NAMED_LITERAL_STRING(type, "RequestMode");
aRv.ThrowTypeError(MSG_INVALID_ENUM_VALUE, &sourceDescription, &value, &type);
return nullptr;
}
RequestMode mode = aInit.mMode.WasPassed() ? aInit.mMode.Value() : fallbackMode;
RequestCredentials credentials =
aInit.mCredentials.WasPassed() ? aInit.mCredentials.Value()