diff options
author | Moonchild <moonchild@palemoon.org> | 2020-09-17 23:48:58 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2020-09-21 11:10:23 +0000 |
commit | 3272147d97757673898da87bf02ea93438cae1a1 (patch) | |
tree | 853540025dd2241a5035b293fefc66b7b592d862 /dom | |
parent | f2866a5420b4645d888fc50b22f7cbdd8a178042 (diff) | |
download | UXP-3272147d97757673898da87bf02ea93438cae1a1.tar UXP-3272147d97757673898da87bf02ea93438cae1a1.tar.gz UXP-3272147d97757673898da87bf02ea93438cae1a1.tar.lz UXP-3272147d97757673898da87bf02ea93438cae1a1.tar.xz UXP-3272147d97757673898da87bf02ea93438cae1a1.zip |
Issue #1224 - Remove constant expressions from /dom
This excludes DOMProxy handlers in dom bindings because that's intertwined with
codegen and js that needs to be handled together.
Diffstat (limited to 'dom')
32 files changed, 53 insertions, 54 deletions
diff --git a/dom/animation/AnimationPerformanceWarning.h b/dom/animation/AnimationPerformanceWarning.h index a1ac35cba..582c48cc3 100644 --- a/dom/animation/AnimationPerformanceWarning.h +++ b/dom/animation/AnimationPerformanceWarning.h @@ -38,8 +38,6 @@ struct AnimationPerformanceWarning std::initializer_list<int32_t> aParams) : mType(aType) { - // FIXME: Once std::initializer_list::size() become a constexpr function, - // we should use static_assert here. MOZ_ASSERT(aParams.size() <= kMaxParamsForLocalization, "The length of parameters should be less than " "kMaxParamsForLocalization"); @@ -49,11 +47,11 @@ struct AnimationPerformanceWarning // Maximum number of parameters passed to // nsContentUtils::FormatLocalizedString to localize warning messages. // - // NOTE: This constexpr can't be forward declared, so if you want to use + // NOTE: This can't be forward declared, so if you want to use // this variable, please include this header file directly. // This value is the same as the limit of nsStringBundle::FormatString. // See the implementation of nsStringBundle::FormatString. - static constexpr uint8_t kMaxParamsForLocalization = 10; + static const uint8_t kMaxParamsForLocalization = 10; // Indicates why this property could not be animated on the compositor. Type mType; diff --git a/dom/base/WindowNamedPropertiesHandler.h b/dom/base/WindowNamedPropertiesHandler.h index 227d8c946..cafeadb85 100644 --- a/dom/base/WindowNamedPropertiesHandler.h +++ b/dom/base/WindowNamedPropertiesHandler.h @@ -15,7 +15,7 @@ namespace dom { class WindowNamedPropertiesHandler : public BaseDOMProxyHandler { public: - constexpr WindowNamedPropertiesHandler() + WindowNamedPropertiesHandler() : BaseDOMProxyHandler(nullptr, /* hasPrototype = */ true) { } diff --git a/dom/base/nsAttrValue.h b/dom/base/nsAttrValue.h index 23f61a614..33ee91afd 100644 --- a/dom/base/nsAttrValue.h +++ b/dom/base/nsAttrValue.h @@ -268,7 +268,7 @@ public: // EnumTable can be initialized either with an int16_t value // or a value of an enumeration type that can fit within an int16_t. - constexpr EnumTable(const char* aTag, int16_t aValue) + EnumTable(const char* aTag, int16_t aValue) : tag(aTag) , value(aValue) { @@ -276,7 +276,7 @@ public: template<typename T, typename = typename std::enable_if<std::is_enum<T>::value>::type> - constexpr EnumTable(const char* aTag, T aValue) + EnumTable(const char* aTag, T aValue) : tag(aTag) , value(static_cast<int16_t>(aValue)) { diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index d696d826b..1c098897b 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -956,7 +956,7 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(DialogValueHolder) class nsOuterWindowProxy : public js::Wrapper { public: - constexpr nsOuterWindowProxy() : js::Wrapper(0) { } + nsOuterWindowProxy() : js::Wrapper(0) { } virtual bool finalizeInBackground(const JS::Value& priv) const override { return false; @@ -1407,7 +1407,7 @@ nsOuterWindowProxy::singleton; class nsChromeOuterWindowProxy : public nsOuterWindowProxy { public: - constexpr nsChromeOuterWindowProxy() : nsOuterWindowProxy() { } + nsChromeOuterWindowProxy() : nsOuterWindowProxy() { } virtual const char *className(JSContext *cx, JS::Handle<JSObject*> wrapper) const override; diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp index 605b1917f..0411bee80 100644 --- a/dom/base/nsJSEnvironment.cpp +++ b/dom/base/nsJSEnvironment.cpp @@ -1161,7 +1161,7 @@ TimeUntilNow(TimeStamp start) struct CycleCollectorStats { - constexpr CycleCollectorStats() : + CycleCollectorStats() : mMaxGCDuration(0), mRanSyncForgetSkippable(false), mSuspected(0), mMaxSkippableDuration(0), mMaxSliceTime(0), mMaxSliceTimeSinceClear(0), mTotalSliceTime(0), mAnyLockedOut(false), mExtraForgetSkippableCalls(0), diff --git a/dom/bindings/BindingUtils.h b/dom/bindings/BindingUtils.h index 5cab835b3..12a2e370a 100644 --- a/dom/bindings/BindingUtils.h +++ b/dom/bindings/BindingUtils.h @@ -3071,21 +3071,21 @@ class GetCCParticipant { // Helper for GetCCParticipant for classes that participate in CC. template<class U> - static constexpr nsCycleCollectionParticipant* + static nsCycleCollectionParticipant* GetHelper(int, typename U::NS_CYCLE_COLLECTION_INNERCLASS* dummy=nullptr) { return T::NS_CYCLE_COLLECTION_INNERCLASS::GetParticipant(); } // Helper for GetCCParticipant for classes that don't participate in CC. template<class U> - static constexpr nsCycleCollectionParticipant* + static nsCycleCollectionParticipant* GetHelper(double) { return nullptr; } public: - static constexpr nsCycleCollectionParticipant* + static nsCycleCollectionParticipant* Get() { // Passing int() here will try to call the GetHelper that takes an int as @@ -3100,7 +3100,7 @@ template<class T> class GetCCParticipant<T, true> { public: - static constexpr nsCycleCollectionParticipant* + static nsCycleCollectionParticipant* Get() { return nullptr; @@ -3123,7 +3123,7 @@ EnumerateGlobal(JSContext* aCx, JS::Handle<JSObject*> aObj); template <class T> struct CreateGlobalOptions { - static constexpr ProtoAndIfaceCache::Kind ProtoAndIfaceCacheKind = + static const ProtoAndIfaceCache::Kind ProtoAndIfaceCacheKind = ProtoAndIfaceCache::NonWindowLike; static void TraceGlobal(JSTracer* aTrc, JSObject* aObj) { @@ -3140,7 +3140,7 @@ struct CreateGlobalOptions template <> struct CreateGlobalOptions<nsGlobalWindow> { - static constexpr ProtoAndIfaceCache::Kind ProtoAndIfaceCacheKind = + static const ProtoAndIfaceCache::Kind ProtoAndIfaceCacheKind = ProtoAndIfaceCache::WindowLike; static void TraceGlobal(JSTracer* aTrc, JSObject* aObj); static bool PostCreateGlobal(JSContext* aCx, JS::Handle<JSObject*> aGlobal); diff --git a/dom/bindings/DOMJSClass.h b/dom/bindings/DOMJSClass.h index 6e779840f..c97cf9322 100644 --- a/dom/bindings/DOMJSClass.h +++ b/dom/bindings/DOMJSClass.h @@ -210,7 +210,7 @@ struct NativePropertiesN { const int32_t iteratorAliasMethodIndex; - constexpr const NativePropertiesN<7>* Upcast() const { + const NativePropertiesN<7>* Upcast() const { return reinterpret_cast<const NativePropertiesN<7>*>(this); } diff --git a/dom/cache/DBSchema.cpp b/dom/cache/DBSchema.cpp index 176e7b9d1..37510e2e1 100644 --- a/dom/cache/DBSchema.cpp +++ b/dom/cache/DBSchema.cpp @@ -2460,7 +2460,7 @@ Validate(mozIStorageConnection* aConn) typedef nsresult (*MigrationFunc)(mozIStorageConnection*, bool&); struct Migration { - constexpr Migration(int32_t aFromVersion, MigrationFunc aFunc) + Migration(int32_t aFromVersion, MigrationFunc aFunc) : mFromVersion(aFromVersion) , mFunc(aFunc) { } diff --git a/dom/events/EventStates.h b/dom/events/EventStates.h index 2672d2897..183070755 100644 --- a/dom/events/EventStates.h +++ b/dom/events/EventStates.h @@ -27,7 +27,7 @@ public: typedef uint64_t InternalType; typedef uint8_t ServoType; - constexpr EventStates() + EventStates() : mStates(0) { } @@ -37,12 +37,12 @@ public: // In that case, we could be sure that only macros at the end were creating // EventStates instances with mStates set to something else than 0. // Unfortunately, this constructor is needed at at least two places now. - explicit constexpr EventStates(InternalType aStates) + explicit EventStates(InternalType aStates) : mStates(aStates) { } - EventStates constexpr operator|(const EventStates& aEventStates) const + EventStates operator|(const EventStates& aEventStates) const { return EventStates(mStates | aEventStates.mStates); } @@ -56,7 +56,7 @@ public: // NOTE: calling if (eventStates1 & eventStates2) will not build. // This might work correctly if operator bool() is defined // but using HasState, HasAllStates or HasAtLeastOneOfStates is recommended. - EventStates constexpr operator&(const EventStates& aEventStates) const + EventStates operator&(const EventStates& aEventStates) const { return EventStates(mStates & aEventStates.mStates); } diff --git a/dom/heapsnapshot/HeapSnapshot.cpp b/dom/heapsnapshot/HeapSnapshot.cpp index 299a96a9c..668b7f5a5 100644 --- a/dom/heapsnapshot/HeapSnapshot.cpp +++ b/dom/heapsnapshot/HeapSnapshot.cpp @@ -1455,7 +1455,7 @@ HeapSnapshot::CreateUniqueCoreDumpFile(ErrorResult& rv, class DeleteHeapSnapshotTempFileHelperChild { public: - constexpr DeleteHeapSnapshotTempFileHelperChild() { } + DeleteHeapSnapshotTempFileHelperChild() { } void operator()(PHeapSnapshotTempFileHelperChild* ptr) const { Unused << NS_WARN_IF(!HeapSnapshotTempFileHelperChild::Send__delete__(ptr)); diff --git a/dom/html/HTMLTrackElement.cpp b/dom/html/HTMLTrackElement.cpp index 758018f8d..59810a444 100644 --- a/dom/html/HTMLTrackElement.cpp +++ b/dom/html/HTMLTrackElement.cpp @@ -57,7 +57,7 @@ namespace mozilla { namespace dom { // Map html attribute string values to TextTrackKind enums. -static constexpr nsAttrValue::EnumTable kKindTable[] = { +static nsAttrValue::EnumTable kKindTable[] = { { "subtitles", static_cast<int16_t>(TextTrackKind::Subtitles) }, { "captions", static_cast<int16_t>(TextTrackKind::Captions) }, { "descriptions", static_cast<int16_t>(TextTrackKind::Descriptions) }, @@ -68,7 +68,7 @@ static constexpr nsAttrValue::EnumTable kKindTable[] = { // Invalid values are treated as "metadata" in ParseAttribute, but if no value // at all is specified, it's treated as "subtitles" in GetKind -static constexpr const nsAttrValue::EnumTable* kKindTableInvalidValueDefault = &kKindTable[4]; +static const nsAttrValue::EnumTable* kKindTableInvalidValueDefault = &kKindTable[4]; class WindowDestroyObserver final : public nsIObserver { diff --git a/dom/indexedDB/ActorsParent.cpp b/dom/indexedDB/ActorsParent.cpp index 74afef452..c7feb8d86 100644 --- a/dom/indexedDB/ActorsParent.cpp +++ b/dom/indexedDB/ActorsParent.cpp @@ -270,7 +270,7 @@ const uint32_t kDEBUGTransactionThreadSleepMS = 0; #endif template <size_t N> -constexpr size_t +size_t LiteralStringLength(const char (&aArr)[N]) { static_assert(N, "Zero-length string literal?!"); @@ -2905,11 +2905,11 @@ UpgradeKeyFunction::CopyAndUpgradeKeyBufferInternal(const uint8_t*& aSource, MOZ_ASSERT(aDestination); MOZ_ASSERT(aTagOffset <= Key::kMaxArrayCollapse); - static constexpr uint8_t kOldNumberTag = 0x1; - static constexpr uint8_t kOldDateTag = 0x2; - static constexpr uint8_t kOldStringTag = 0x3; - static constexpr uint8_t kOldArrayTag = 0x4; - static constexpr uint8_t kOldMaxType = kOldArrayTag; + static uint8_t kOldNumberTag = 0x1; + static uint8_t kOldDateTag = 0x2; + static uint8_t kOldStringTag = 0x3; + static uint8_t kOldArrayTag = 0x4; + static uint8_t kOldMaxType = kOldArrayTag; if (NS_WARN_IF(aRecursionDepth > Key::kMaxRecursionDepth)) { IDB_REPORT_INTERNAL_ERR(); diff --git a/dom/media/MediaCache.cpp b/dom/media/MediaCache.cpp index 37399f851..64523afcb 100644 --- a/dom/media/MediaCache.cpp +++ b/dom/media/MediaCache.cpp @@ -277,7 +277,7 @@ protected: }; struct BlockOwner { - constexpr BlockOwner() {} + BlockOwner() {} // The stream that owns this block, or null if the block is free. MediaCacheStream* mStream = nullptr; diff --git a/dom/media/platforms/PDMFactory.h b/dom/media/platforms/PDMFactory.h index 2b43fa1ab..a13c99ac0 100644 --- a/dom/media/platforms/PDMFactory.h +++ b/dom/media/platforms/PDMFactory.h @@ -49,10 +49,10 @@ public: void SetCDMProxy(CDMProxy* aProxy); #endif - static constexpr int kYUV400 = 0; - static constexpr int kYUV420 = 1; - static constexpr int kYUV422 = 2; - static constexpr int kYUV444 = 3; + static const int kYUV400 = 0; + static const int kYUV420 = 1; + static const int kYUV422 = 2; + static const int kYUV444 = 3; private: virtual ~PDMFactory(); diff --git a/dom/smil/SMILBoolType.h b/dom/smil/SMILBoolType.h index 608a09ccf..d0bbcf5ea 100644 --- a/dom/smil/SMILBoolType.h +++ b/dom/smil/SMILBoolType.h @@ -42,7 +42,7 @@ protected: private: // Private constructor: prevent instances beyond my singleton. - constexpr SMILBoolType() {} + SMILBoolType() {} }; } // namespace mozilla diff --git a/dom/smil/SMILEnumType.h b/dom/smil/SMILEnumType.h index b6cda3ff9..070ae60bb 100644 --- a/dom/smil/SMILEnumType.h +++ b/dom/smil/SMILEnumType.h @@ -43,7 +43,7 @@ protected: private: // Private constructor: prevent instances beyond my singleton. - constexpr SMILEnumType() {} + SMILEnumType() {} }; } // namespace mozilla diff --git a/dom/smil/SMILIntegerType.h b/dom/smil/SMILIntegerType.h index 39560cc79..bf8030b6e 100644 --- a/dom/smil/SMILIntegerType.h +++ b/dom/smil/SMILIntegerType.h @@ -38,7 +38,8 @@ public: } private: - constexpr SMILIntegerType() {} + // Private constructor: prevent instances beyond my singleton. + SMILIntegerType() {} }; } // namespace mozilla diff --git a/dom/smil/SMILStringType.h b/dom/smil/SMILStringType.h index 6f160cadb..6fb51b7d9 100644 --- a/dom/smil/SMILStringType.h +++ b/dom/smil/SMILStringType.h @@ -43,7 +43,7 @@ protected: private: // Private constructor: prevent instances beyond my singleton. - constexpr SMILStringType() {} + SMILStringType() {} }; } // namespace mozilla diff --git a/dom/smil/nsSMILCSSValueType.h b/dom/smil/nsSMILCSSValueType.h index 0c71605f0..0303e69e3 100644 --- a/dom/smil/nsSMILCSSValueType.h +++ b/dom/smil/nsSMILCSSValueType.h @@ -110,7 +110,7 @@ public: private: // Private constructor: prevent instances beyond my singleton. - constexpr nsSMILCSSValueType() {} + nsSMILCSSValueType() {} }; #endif // NS_SMILCSSVALUETYPE_H_ diff --git a/dom/smil/nsSMILFloatType.h b/dom/smil/nsSMILFloatType.h index fd57e4a77..470e935d3 100644 --- a/dom/smil/nsSMILFloatType.h +++ b/dom/smil/nsSMILFloatType.h @@ -41,7 +41,7 @@ protected: private: // Private constructor: prevent instances beyond my singleton. - constexpr nsSMILFloatType() {} + nsSMILFloatType() {} }; #endif // NS_SMILFLOATTYPE_H_ diff --git a/dom/smil/nsSMILNullType.h b/dom/smil/nsSMILNullType.h index d21610ff4..c668773ce 100644 --- a/dom/smil/nsSMILNullType.h +++ b/dom/smil/nsSMILNullType.h @@ -44,7 +44,7 @@ protected: private: // Private constructor: prevent instances beyond my singleton. - constexpr nsSMILNullType() {} + nsSMILNullType() {} }; #endif // NS_SMILNULLTYPE_H_ diff --git a/dom/svg/SVGIntegerPairSMILType.h b/dom/svg/SVGIntegerPairSMILType.h index 52af5d3dc..ae62781fd 100644 --- a/dom/svg/SVGIntegerPairSMILType.h +++ b/dom/svg/SVGIntegerPairSMILType.h @@ -45,7 +45,7 @@ protected: private: // Private constructor: prevent instances beyond my singleton. - constexpr SVGIntegerPairSMILType() {} + SVGIntegerPairSMILType() {} }; } // namespace mozilla diff --git a/dom/svg/SVGLengthListSMILType.h b/dom/svg/SVGLengthListSMILType.h index 10321b585..2fbb84488 100644 --- a/dom/svg/SVGLengthListSMILType.h +++ b/dom/svg/SVGLengthListSMILType.h @@ -93,7 +93,7 @@ protected: private: // Private constructor: prevent instances beyond my singleton. - constexpr SVGLengthListSMILType() {} + SVGLengthListSMILType() {} }; } // namespace mozilla diff --git a/dom/svg/SVGMotionSMILType.h b/dom/svg/SVGMotionSMILType.h index 7529d796d..768c90093 100644 --- a/dom/svg/SVGMotionSMILType.h +++ b/dom/svg/SVGMotionSMILType.h @@ -78,7 +78,7 @@ public: private: // Private constructor: prevent instances beyond my singleton. - constexpr SVGMotionSMILType() {} + SVGMotionSMILType() {} }; } // namespace mozilla diff --git a/dom/svg/SVGNumberListSMILType.h b/dom/svg/SVGNumberListSMILType.h index 5e8db8afe..efdabdb14 100644 --- a/dom/svg/SVGNumberListSMILType.h +++ b/dom/svg/SVGNumberListSMILType.h @@ -47,7 +47,7 @@ protected: private: // Private constructor: prevent instances beyond my singleton. - constexpr SVGNumberListSMILType() {} + SVGNumberListSMILType() {} }; } // namespace mozilla diff --git a/dom/svg/SVGNumberPairSMILType.h b/dom/svg/SVGNumberPairSMILType.h index 0f90163f5..a88a0f5ac 100644 --- a/dom/svg/SVGNumberPairSMILType.h +++ b/dom/svg/SVGNumberPairSMILType.h @@ -40,7 +40,7 @@ protected: private: // Private constructor: prevent instances beyond my singleton. - constexpr SVGNumberPairSMILType() {} + SVGNumberPairSMILType() {} }; } // namespace mozilla diff --git a/dom/svg/SVGOrientSMILType.h b/dom/svg/SVGOrientSMILType.h index 6b30cbee0..904b37680 100644 --- a/dom/svg/SVGOrientSMILType.h +++ b/dom/svg/SVGOrientSMILType.h @@ -60,7 +60,7 @@ protected: private: // Private constructor: prevent instances beyond my singleton. - constexpr SVGOrientSMILType() {} + SVGOrientSMILType() {} }; } // namespace mozilla diff --git a/dom/svg/SVGPathSegListSMILType.h b/dom/svg/SVGPathSegListSMILType.h index 6856ef275..5e4e89141 100644 --- a/dom/svg/SVGPathSegListSMILType.h +++ b/dom/svg/SVGPathSegListSMILType.h @@ -51,7 +51,7 @@ protected: private: // Private constructor: prevent instances beyond my singleton. - constexpr SVGPathSegListSMILType() {} + SVGPathSegListSMILType() {} }; } // namespace mozilla diff --git a/dom/svg/SVGPointListSMILType.h b/dom/svg/SVGPointListSMILType.h index 6f58bd42e..053959553 100644 --- a/dom/svg/SVGPointListSMILType.h +++ b/dom/svg/SVGPointListSMILType.h @@ -47,7 +47,7 @@ protected: private: // Private constructor: prevent instances beyond my singleton. - constexpr SVGPointListSMILType() {} + SVGPointListSMILType() {} }; } // namespace mozilla diff --git a/dom/svg/SVGTransformListSMILType.h b/dom/svg/SVGTransformListSMILType.h index 526f9ba50..6572815a1 100644 --- a/dom/svg/SVGTransformListSMILType.h +++ b/dom/svg/SVGTransformListSMILType.h @@ -123,7 +123,7 @@ public: private: // Private constructor: prevent instances beyond my singleton. - constexpr SVGTransformListSMILType() {} + SVGTransformListSMILType() {} }; } // end namespace mozilla diff --git a/dom/svg/SVGViewBoxSMILType.h b/dom/svg/SVGViewBoxSMILType.h index f05f3928d..54b171263 100644 --- a/dom/svg/SVGViewBoxSMILType.h +++ b/dom/svg/SVGViewBoxSMILType.h @@ -40,7 +40,7 @@ protected: private: // Private constructor: prevent instances beyond my singleton. - constexpr SVGViewBoxSMILType() {} + SVGViewBoxSMILType() {} }; } // namespace mozilla diff --git a/dom/xbl/nsXBLMaybeCompiled.h b/dom/xbl/nsXBLMaybeCompiled.h index d4b366b0e..ba66ec5d5 100644 --- a/dom/xbl/nsXBLMaybeCompiled.h +++ b/dom/xbl/nsXBLMaybeCompiled.h @@ -124,7 +124,7 @@ struct BarrierMethods<nsXBLMaybeCompiled<UncompiledT>> template <class T> struct IsHeapConstructibleType<nsXBLMaybeCompiled<T>> { // Yes, this is the exception to the rule. Sorry. - static constexpr bool value = true; + static const bool value = true; }; template <class UncompiledT> |