mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 07:15:46 +00:00
Bug 1362549 - Assert against accessing the attributes of a snapshot that doesn't have attributes saved. r=emilio
MozReview-Commit-ID: 8BsnTF6uIGM
This commit is contained in:
parent
e8eb9f05e3
commit
a8f10f24ec
@ -32,7 +32,7 @@ ServoElementSnapshot::AddAttrs(Element* aElement)
|
||||
{
|
||||
MOZ_ASSERT(aElement);
|
||||
|
||||
if (HasAny(Flags::Attributes)) {
|
||||
if (HasAttrs()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -70,9 +70,9 @@ public:
|
||||
explicit ServoElementSnapshot(const Element* aElement);
|
||||
~ServoElementSnapshot();
|
||||
|
||||
bool HasAttrs() { return HasAny(Flags::Attributes); }
|
||||
bool HasAttrs() const { return HasAny(Flags::Attributes); }
|
||||
|
||||
bool HasState() { return HasAny(Flags::State); }
|
||||
bool HasState() const { return HasAny(Flags::State); }
|
||||
|
||||
/**
|
||||
* Captures the given state (if not previously captured).
|
||||
@ -95,6 +95,7 @@ public:
|
||||
*/
|
||||
BorrowedAttrInfo GetAttrInfoAt(uint32_t aIndex) const
|
||||
{
|
||||
MOZ_ASSERT(HasAttrs());
|
||||
if (aIndex >= mAttrs.Length()) {
|
||||
return BorrowedAttrInfo(nullptr, nullptr);
|
||||
}
|
||||
@ -109,6 +110,7 @@ public:
|
||||
const nsAttrValue* GetParsedAttr(nsIAtom* aLocalName,
|
||||
int32_t aNamespaceID) const
|
||||
{
|
||||
MOZ_ASSERT(HasAttrs());
|
||||
uint32_t i, len = mAttrs.Length();
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
// This should be the common case so lets make an optimized loop
|
||||
@ -135,7 +137,7 @@ public:
|
||||
return mIsInChromeDocument;
|
||||
}
|
||||
|
||||
bool HasAny(Flags aFlags) { return bool(mContains & aFlags); }
|
||||
bool HasAny(Flags aFlags) const { return bool(mContains & aFlags); }
|
||||
|
||||
private:
|
||||
// TODO: Profile, a 1 or 2 element AutoTArray could be worth it, given we know
|
||||
|
Loading…
Reference in New Issue
Block a user