FreeBSD Bugzilla – Attachment 151731 Details for
Bug 196802
www/firefox: Crash on Wikipedia when built with clang 3.5
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Patch from bug 1083461
patch-bug1083461 (text/plain), 8.51 KB, created by
Jean-Sébastien Pédron
on 2015-01-16 10:15:28 UTC
(
hide
)
Description:
Patch from bug 1083461
Filename:
MIME Type:
Creator:
Jean-Sébastien Pédron
Created:
2015-01-16 10:15:28 UTC
Size:
8.51 KB
patch
obsolete
> ># HG changeset patch ># User L. David Baron <dbaron@dbaron.org> ># Date 1413775899 14400 ># Node ID 983af7fa41f5293e39554d771e990e6aaa3ba463 ># Parent 6f5ba08ca1b9dd67f61e630241832990860ef170 >Bug 1083461 - Convert nsCSSValue{,Pair}List::operator== back to a static Equal method so that it can be validly called on null pointers. r=bzbarsky > >diff --git layout/style/StyleAnimationValue.cpp layout/style/StyleAnimationValue.cpp >--- layout/style/StyleAnimationValue.cpp >+++ layout/style/StyleAnimationValue.cpp >@@ -3846,21 +3846,23 @@ StyleAnimationValue::operator==(const St > case eUnit_CSSValueTriplet: > return *mValue.mCSSValueTriplet == *aOther.mValue.mCSSValueTriplet; > case eUnit_CSSRect: > return *mValue.mCSSRect == *aOther.mValue.mCSSRect; > case eUnit_Dasharray: > case eUnit_Filter: > case eUnit_Shadow: > case eUnit_BackgroundPosition: >- return *mValue.mCSSValueList == *aOther.mValue.mCSSValueList; >+ return nsCSSValueList::Equal(mValue.mCSSValueList, >+ aOther.mValue.mCSSValueList); > case eUnit_Transform: > return *mValue.mCSSValueSharedList == *aOther.mValue.mCSSValueSharedList; > case eUnit_CSSValuePairList: >- return *mValue.mCSSValuePairList == *aOther.mValue.mCSSValuePairList; >+ return nsCSSValuePairList::Equal(mValue.mCSSValuePairList, >+ aOther.mValue.mCSSValuePairList); > case eUnit_UnparsedString: > return (NS_strcmp(GetStringBufferValue(), > aOther.GetStringBufferValue()) == 0); > } > > NS_NOTREACHED("incomplete case"); > return false; > } >diff --git layout/style/nsCSSValue.cpp layout/style/nsCSSValue.cpp >--- layout/style/nsCSSValue.cpp >+++ layout/style/nsCSSValue.cpp >@@ -259,23 +259,24 @@ bool nsCSSValue::operator==(const nsCSSV > } > else if (eCSSUnit_Triplet == mUnit) { > return *mValue.mTriplet == *aOther.mValue.mTriplet; > } > else if (eCSSUnit_Rect == mUnit) { > return *mValue.mRect == *aOther.mValue.mRect; > } > else if (eCSSUnit_List == mUnit) { >- return *mValue.mList == *aOther.mValue.mList; >+ return nsCSSValueList::Equal(mValue.mList, aOther.mValue.mList); > } > else if (eCSSUnit_SharedList == mUnit) { > return *mValue.mSharedList == *aOther.mValue.mSharedList; > } > else if (eCSSUnit_PairList == mUnit) { >- return *mValue.mPairList == *aOther.mValue.mPairList; >+ return nsCSSValuePairList::Equal(mValue.mPairList, >+ aOther.mValue.mPairList); > } > else if (eCSSUnit_GridTemplateAreas == mUnit) { > return *mValue.mGridTemplateAreas == *aOther.mValue.mGridTemplateAreas; > } > else if (eCSSUnit_FontFamilyList == mUnit) { > return *mValue.mFontFamilyList == *aOther.mValue.mFontFamilyList; > } > else { >@@ -1870,23 +1871,25 @@ nsCSSValueList::AppendToString(nsCSSProp > if (aProperty == eCSSProperty_grid_template_columns || > aProperty == eCSSProperty_grid_template_rows) { > AppendGridTemplateToString(this, aProperty, aResult, aSerialization); > } else { > AppendValueListToString(this, aProperty, aResult, aSerialization); > } > } > >-bool >-nsCSSValueList::operator==(const nsCSSValueList& aOther) const >+/* static */ bool >+nsCSSValueList::Equal(const nsCSSValueList* aList1, >+ const nsCSSValueList* aList2) > { >- if (this == &aOther) >+ if (aList1 == aList2) { > return true; >+ } > >- const nsCSSValueList *p1 = this, *p2 = &aOther; >+ const nsCSSValueList *p1 = aList1, *p2 = aList2; > for ( ; p1 && p2; p1 = p1->mNext, p2 = p2->mNext) { > if (p1->mValue != p2->mValue) > return false; > } > return !p1 && !p2; // true if same length, false otherwise > } > > size_t >@@ -1929,18 +1932,17 @@ nsCSSValueSharedList::AppendToString(nsC > if (mHead) { > mHead->AppendToString(aProperty, aResult, aSerialization); > } > } > > bool > nsCSSValueSharedList::operator==(const nsCSSValueSharedList& aOther) const > { >- return !mHead == !aOther.mHead && >- (!mHead || *mHead == *aOther.mHead); >+ return nsCSSValueList::Equal(mHead, aOther.mHead); > } > > size_t > nsCSSValueSharedList::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const > { > size_t n = 0; > n += aMallocSizeOf(this); > n += mHead->SizeOfIncludingThis(aMallocSizeOf); >@@ -2143,23 +2145,25 @@ nsCSSValuePairList::AppendToString(nsCSS > if (nsCSSProps::PropHasFlags(aProperty, > CSS_PROPERTY_VALUE_LIST_USES_COMMAS) || > aProperty == eCSSProperty_clip_path) > aResult.Append(char16_t(',')); > aResult.Append(char16_t(' ')); > } > } > >-bool >-nsCSSValuePairList::operator==(const nsCSSValuePairList& aOther) const >+/* static */ bool >+nsCSSValuePairList::Equal(const nsCSSValuePairList* aList1, >+ const nsCSSValuePairList* aList2) > { >- if (this == &aOther) >+ if (aList1 == aList2) { > return true; >+ } > >- const nsCSSValuePairList *p1 = this, *p2 = &aOther; >+ const nsCSSValuePairList *p1 = aList1, *p2 = aList2; > for ( ; p1 && p2; p1 = p1->mNext, p2 = p2->mNext) { > if (p1->mXValue != p2->mXValue || > p1->mYValue != p2->mYValue) > return false; > } > return !p1 && !p2; // true if same length, false otherwise > } > >diff --git layout/style/nsCSSValue.h layout/style/nsCSSValue.h >--- layout/style/nsCSSValue.h >+++ layout/style/nsCSSValue.h >@@ -866,31 +866,36 @@ struct nsCSSValueList { > nsCSSValueList() : mNext(nullptr) { MOZ_COUNT_CTOR(nsCSSValueList); } > ~nsCSSValueList(); > > nsCSSValueList* Clone() const; // makes a deep copy. Infallible. > void CloneInto(nsCSSValueList* aList) const; // makes a deep copy into aList > void AppendToString(nsCSSProperty aProperty, nsAString& aResult, > nsCSSValue::Serialization aValueSerialization) const; > >- bool operator==(nsCSSValueList const& aOther) const; >- bool operator!=(const nsCSSValueList& aOther) const >- { return !(*this == aOther); } >+ static bool Equal(const nsCSSValueList* aList1, >+ const nsCSSValueList* aList2); > > size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; > > nsCSSValue mValue; > nsCSSValueList* mNext; > > private: > nsCSSValueList(const nsCSSValueList& aCopy) // makes a shallow copy > : mValue(aCopy.mValue), mNext(nullptr) > { > MOZ_COUNT_CTOR(nsCSSValueList); > } >+ >+ // We don't want operator== or operator!= because they wouldn't be >+ // null-safe, which is generally what we need. Use |Equal| method >+ // above instead. >+ bool operator==(nsCSSValueList const& aOther) const MOZ_DELETE; >+ bool operator!=(const nsCSSValueList& aOther) const MOZ_DELETE; > }; > > // nsCSSValueList_heap differs from nsCSSValueList only in being > // refcounted. It should not be necessary to use this class directly; > // it's an implementation detail of nsCSSValue. > struct nsCSSValueList_heap MOZ_FINAL : public nsCSSValueList { > NS_INLINE_DECL_REFCOUNTING(nsCSSValueList_heap) > >@@ -1259,32 +1264,37 @@ nsCSSValue::GetTripletValue() const > struct nsCSSValuePairList { > nsCSSValuePairList() : mNext(nullptr) { MOZ_COUNT_CTOR(nsCSSValuePairList); } > ~nsCSSValuePairList(); > > nsCSSValuePairList* Clone() const; // makes a deep copy. Infallible. > void AppendToString(nsCSSProperty aProperty, nsAString& aResult, > nsCSSValue::Serialization aValueSerialization) const; > >- bool operator==(const nsCSSValuePairList& aOther) const; >- bool operator!=(const nsCSSValuePairList& aOther) const >- { return !(*this == aOther); } >+ static bool Equal(const nsCSSValuePairList* aList1, >+ const nsCSSValuePairList* aList2); > > size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; > > nsCSSValue mXValue; > nsCSSValue mYValue; > nsCSSValuePairList* mNext; > > private: > nsCSSValuePairList(const nsCSSValuePairList& aCopy) // makes a shallow copy > : mXValue(aCopy.mXValue), mYValue(aCopy.mYValue), mNext(nullptr) > { > MOZ_COUNT_CTOR(nsCSSValuePairList); > } >+ >+ // We don't want operator== or operator!= because they wouldn't be >+ // null-safe, which is generally what we need. Use |Equal| method >+ // above instead. >+ bool operator==(const nsCSSValuePairList& aOther) const MOZ_DELETE; >+ bool operator!=(const nsCSSValuePairList& aOther) const MOZ_DELETE; > }; > > // nsCSSValuePairList_heap differs from nsCSSValuePairList only in being > // refcounted. It should not be necessary to use this class directly; > // it's an implementation detail of nsCSSValue. > struct nsCSSValuePairList_heap MOZ_FINAL : public nsCSSValuePairList { > NS_INLINE_DECL_REFCOUNTING(nsCSSValuePairList_heap) > >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
jbeich
:
maintainer-approval+
Actions:
View
Attachments on
bug 196802
: 151731