mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-02 13:58:40 +09:00
[Network, DOM] Align our implementation with the current CORS/Fetch spec.
This commit is contained in:
parent
bf19c2087b
commit
37f0199c79
9 changed files with 366 additions and 31 deletions
|
|
@ -3071,9 +3071,8 @@ XMLHttpRequestMainThread::SetRequestHeader(const nsACString& aName,
|
|||
}
|
||||
|
||||
// Step 3
|
||||
nsAutoCString value(aValue);
|
||||
static const char kHTTPWhitespace[] = "\n\t\r ";
|
||||
value.Trim(kHTTPWhitespace);
|
||||
nsAutoCString value;
|
||||
NS_TrimHTTPWhitespace(aValue, value);
|
||||
|
||||
// Step 4
|
||||
if (!NS_IsValidHTTPToken(aName) || !NS_IsReasonableHTTPHeaderValue(value)) {
|
||||
|
|
@ -3082,7 +3081,7 @@ XMLHttpRequestMainThread::SetRequestHeader(const nsACString& aName,
|
|||
|
||||
// Step 5
|
||||
bool isPrivilegedCaller = IsSystemXHR();
|
||||
bool isForbiddenHeader = nsContentUtils::IsForbiddenRequestHeader(aName);
|
||||
bool isForbiddenHeader = nsContentUtils::IsForbiddenRequestHeader(aName, aValue);
|
||||
if (!isPrivilegedCaller && isForbiddenHeader) {
|
||||
NS_ConvertUTF8toUTF16 name(aName);
|
||||
const char16_t* params[] = { name.get() };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue