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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user