summaryrefslogtreecommitdiffstats
path: root/parser
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
commit8dd16259287f58f9273002717ec4d27e97127719 (patch)
tree3863e62a53829a84037444beab3abd4ed9dfc7d0 /parser
parentReleasing progress-linux version 126.0.1-1~progress7.99u1. (diff)
downloadfirefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz
firefox-8dd16259287f58f9273002717ec4d27e97127719.zip
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'parser')
-rw-r--r--parser/html/nsHtml5String.cpp15
-rw-r--r--parser/html/nsHtml5TreeOpExecutor.cpp7
2 files changed, 15 insertions, 7 deletions
diff --git a/parser/html/nsHtml5String.cpp b/parser/html/nsHtml5String.cpp
index 5fa9415f06..7e10080669 100644
--- a/parser/html/nsHtml5String.cpp
+++ b/parser/html/nsHtml5String.cpp
@@ -5,12 +5,11 @@
#include "nsHtml5String.h"
#include "nsCharTraits.h"
#include "nsHtml5TreeBuilder.h"
-#include "nsUTF8Utils.h"
void nsHtml5String::ToString(nsAString& aString) {
switch (GetKind()) {
case eStringBuffer:
- return AsStringBuffer()->ToString(Length(), aString);
+ return aString.Assign(AsStringBuffer(), Length());
case eAtom:
return AsAtom()->ToString(aString);
case eEmpty:
@@ -157,12 +156,14 @@ nsHtml5String nsHtml5String::FromString(const nsAString& aString) {
if (!length) {
return nsHtml5String(eEmpty);
}
- RefPtr<nsStringBuffer> buffer = nsStringBuffer::FromString(aString);
- if (buffer && (length == buffer->StorageSize() / sizeof(char16_t) - 1)) {
- return nsHtml5String(reinterpret_cast<uintptr_t>(buffer.forget().take()) |
- eStringBuffer);
+ if (nsStringBuffer* buffer = aString.GetStringBuffer()) {
+ if (length == buffer->StorageSize() / sizeof(char16_t) - 1) {
+ buffer->AddRef();
+ return nsHtml5String(reinterpret_cast<uintptr_t>(buffer) | eStringBuffer);
+ }
}
- buffer = nsStringBuffer::Alloc((length + 1) * sizeof(char16_t));
+ RefPtr<nsStringBuffer> buffer =
+ nsStringBuffer::Alloc((length + 1) * sizeof(char16_t));
if (!buffer) {
MOZ_CRASH("Out of memory.");
}
diff --git a/parser/html/nsHtml5TreeOpExecutor.cpp b/parser/html/nsHtml5TreeOpExecutor.cpp
index f2c47c42a6..f25949e6cc 100644
--- a/parser/html/nsHtml5TreeOpExecutor.cpp
+++ b/parser/html/nsHtml5TreeOpExecutor.cpp
@@ -1343,6 +1343,13 @@ void nsHtml5TreeOpExecutor::SetSpeculationBase(const nsAString& aURL) {
return;
}
+ // See
+ // https://html.spec.whatwg.org/multipage/semantics.html#set-the-frozen-base-url
+ // data: and javascript: base URLs are not allowed.
+ if (newBaseURI->SchemeIs("data") || newBaseURI->SchemeIs("javascript")) {
+ return;
+ }
+
// Check the document's CSP usually delivered via the CSP header.
if (nsCOMPtr<nsIContentSecurityPolicy> csp = mDocument->GetCsp()) {
// base-uri should not fallback to the default-src and preloads should not