summaryrefslogtreecommitdiffstats
path: root/xpcom/ds
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:29 +0000
commit59203c63bb777a3bacec32fb8830fba33540e809 (patch)
tree58298e711c0ff0575818c30485b44a2f21bf28a0 /xpcom/ds
parentAdding upstream version 126.0.1. (diff)
downloadfirefox-59203c63bb777a3bacec32fb8830fba33540e809.tar.xz
firefox-59203c63bb777a3bacec32fb8830fba33540e809.zip
Adding upstream version 127.0.upstream/127.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'xpcom/ds')
-rw-r--r--xpcom/ds/StaticAtoms.py5
-rw-r--r--xpcom/ds/Tokenizer.h60
-rw-r--r--xpcom/ds/nsAtomTable.cpp6
-rw-r--r--xpcom/ds/nsTArray.h12
4 files changed, 68 insertions, 15 deletions
diff --git a/xpcom/ds/StaticAtoms.py b/xpcom/ds/StaticAtoms.py
index 5be3323986..d50d31a6a3 100644
--- a/xpcom/ds/StaticAtoms.py
+++ b/xpcom/ds/StaticAtoms.py
@@ -386,6 +386,8 @@ STATIC_ATOMS = [
Atom("docNoteref", "doc-noteref"),
Atom("docNotice", "doc-notice"),
Atom("docPagebreak", "doc-pagebreak"),
+ Atom("docPagefooter", "doc-pagefooter"),
+ Atom("docPageheader", "doc-pageheader"),
Atom("docPagelist", "doc-pagelist"),
Atom("docPart", "doc-part"),
Atom("docPreface", "doc-preface"),
@@ -448,6 +450,7 @@ STATIC_ATOMS = [
Atom("figcaption", "figcaption"),
Atom("figure", "figure"),
Atom("findbar", "findbar"),
+ Atom("firstColumn", "first-column"),
Atom("firstInput", "first-input"),
Atom("fixed", "fixed"),
Atom("flags", "flags"),
@@ -969,6 +972,7 @@ STATIC_ATOMS = [
Atom("option", "option"),
Atom("_or", "or"),
Atom("order", "order"),
+ Atom("ordinal", "ordinal"),
Atom("orient", "orient"),
Atom("orientation", "orientation"),
Atom("origin_trial", "origin-trial"),
@@ -2461,6 +2465,7 @@ STATIC_ATOMS = [
Atom("DirectoryService_OS_SystemConfigDir", "SysConfD"),
# Atom("DirectoryService_OS_HomeDirectory", "Home"), # "Home" is present above
Atom("DirectoryService_OS_DesktopDirectory", "Desk"),
+ Atom("DirectoryService_OS_DocumentsDirectory", "Docs"),
Atom("DirectoryService_InitCurrentProcess_dummy", "MozBinD"),
Atom("DirectoryService_SystemDirectory", "SysD"),
Atom("DirectoryService_UserLibDirectory", "ULibDir"),
diff --git a/xpcom/ds/Tokenizer.h b/xpcom/ds/Tokenizer.h
index 713b63f269..6a4ec89d51 100644
--- a/xpcom/ds/Tokenizer.h
+++ b/xpcom/ds/Tokenizer.h
@@ -439,6 +439,66 @@ class TTokenizer : public TokenizerBase<TChar> {
}
/**
+ * This is an hexadecimal read helper. It returns false and doesn't move the
+ * read cursor when any of the following happens:
+ * - the token at the read cursor is not 0, and it's not followed by x
+ * - the token(s) that follow don't make a valid hexadecimal number
+ * - the final number doesn't fit the T type
+ * Otherwise true is returned, aValue is filled with the integral number
+ * and the cursor is moved forward.
+ */
+ template <typename T>
+ [[nodiscard]] bool ReadHexadecimal(T* aValue, bool aPrefixed = true) {
+ MOZ_RELEASE_ASSERT(aValue);
+
+ typename base::TAString::const_char_iterator rollback = mRollback;
+ typename base::TAString::const_char_iterator cursor = base::mCursor;
+ auto revert = MakeScopeExit([&] {
+ // Move to a state as if Check() call has failed
+ mRollback = rollback;
+ base::mCursor = cursor;
+ base::mHasFailed = true;
+ });
+
+ if (aPrefixed) {
+ typename base::Token t;
+ if (!Check(base::TOKEN_INTEGER, t) && t.AsInteger() != 0) {
+ return false;
+ }
+
+ if (!CheckChar([](const TChar aChar) { return aChar == 'x'; })) {
+ return false;
+ }
+ }
+
+ TChar c = 'z';
+ mozilla::CheckedInt<T> resultingNumber = 0;
+ while (ReadChar(
+ [](const TChar aChar) {
+ return (aChar >= '0' && aChar <= '9') ||
+ (aChar >= 'A' && aChar <= 'F') ||
+ (aChar >= 'a' && aChar <= 'f');
+ },
+ &c)) {
+ resultingNumber *= 16;
+ if (c <= '9') {
+ resultingNumber += static_cast<uint64_t>(c - '0');
+ } else if (c <= 'F') {
+ resultingNumber += static_cast<uint64_t>(c - 'A') + 0xa;
+ } else {
+ resultingNumber += static_cast<uint64_t>(c - 'a') + 0xa;
+ }
+ }
+ if (c == 'z' || !resultingNumber.isValid()) {
+ return false;
+ }
+
+ *aValue = resultingNumber.value();
+ revert.release();
+ return true;
+ }
+
+ /**
* Returns the read cursor position back as it was before the last call of any
* parsing method of TTokenizer (Next, Check*, Skip*, Read*) so that the last
* operation can be repeated. Rollback cannot be used multiple times, it only
diff --git a/xpcom/ds/nsAtomTable.cpp b/xpcom/ds/nsAtomTable.cpp
index a03fdcce53..379aa647d4 100644
--- a/xpcom/ds/nsAtomTable.cpp
+++ b/xpcom/ds/nsAtomTable.cpp
@@ -82,7 +82,7 @@ nsDynamicAtom* nsDynamicAtom::Create(const nsAString& aString, uint32_t aHash) {
// We tack the chars onto the end of the nsDynamicAtom object.
const bool isAsciiLower =
::IsAsciiLowercase(aString.Data(), aString.Length());
- RefPtr<nsStringBuffer> buffer = nsStringBuffer::FromString(aString);
+ RefPtr<nsStringBuffer> buffer = aString.GetStringBuffer();
if (!buffer) {
buffer = nsStringBuffer::Create(aString.Data(), aString.Length());
if (MOZ_UNLIKELY(!buffer)) {
@@ -111,7 +111,7 @@ void nsAtom::ToString(nsAString& aString) const {
// which is what's important.
aString.AssignLiteral(AsStatic()->String(), mLength);
} else {
- AsDynamic()->StringBuffer()->ToString(mLength, aString);
+ aString.Assign(AsDynamic()->StringBuffer(), mLength);
}
}
@@ -577,7 +577,7 @@ already_AddRefed<nsAtom> nsAtomTable::Atomize(const nsACString& aUTF8String) {
nsString str;
CopyUTF8toUTF16(aUTF8String, str);
- MOZ_ASSERT(nsStringBuffer::FromString(str), "Should create a string buffer");
+ MOZ_ASSERT(str.GetStringBuffer(), "Should create a string buffer");
RefPtr<nsAtom> atom = dont_AddRef(nsDynamicAtom::Create(str, key.mHash));
he->mAtom = atom;
diff --git a/xpcom/ds/nsTArray.h b/xpcom/ds/nsTArray.h
index 56f926ccad..c088f1c4bd 100644
--- a/xpcom/ds/nsTArray.h
+++ b/xpcom/ds/nsTArray.h
@@ -369,13 +369,6 @@ struct nsTArray_SafeElementAtHelper<mozilla::OwningNonNull<E>, Derived>
: public nsTArray_SafeElementAtSmartPtrHelper<mozilla::OwningNonNull<E>,
Derived> {};
-// Servo bindings.
-extern "C" void Gecko_EnsureTArrayCapacity(void* aArray, size_t aCapacity,
- size_t aElementSize);
-extern "C" void Gecko_ClearPODTArray(void* aArray, size_t aElementSize,
- size_t aElementAlign);
-
-//
// This class serves as a base class for nsTArray. It shouldn't be used
// directly. It holds common implementation code that does not depend on the
// element type of the nsTArray.
@@ -393,11 +386,6 @@ class nsTArray_base {
template <class E, class XAlloc>
friend class nsTArray_Impl;
- friend void Gecko_EnsureTArrayCapacity(void* aArray, size_t aCapacity,
- size_t aElemSize);
- friend void Gecko_ClearPODTArray(void* aTArray, size_t aElementSize,
- size_t aElementAlign);
-
protected:
typedef nsTArrayHeader Header;