diff options
author | Moonchild <moonchild@palemoon.org> | 2020-09-17 23:48:58 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2020-09-17 23:48:58 +0000 |
commit | 6be15b96ae4a9f0a73aaea794602201ddf0c4242 (patch) | |
tree | a0bfe1e4c95ea2f6a1c0e551b346a5d178ba7dc0 | |
parent | a0cdf328774e553eec1df9276604362d7a3679cd (diff) | |
download | uxp-6be15b96ae4a9f0a73aaea794602201ddf0c4242.tar.gz |
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.
34 files changed, 54 insertions, 57 deletions
diff --git a/dom/animation/AnimationPerformanceWarning.h b/dom/animation/AnimationPerformanceWarning.h index a1ac35cba0..582c48cc3f 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 227d8c946d..cafeadb85e 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 23f61a614a..33ee91afd5 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 acd596a442..642681d910 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 605b1917fd..0411bee80a 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 356d3aa000..e97f29359b 100644 --- a/dom/bindings/BindingUtils.h +++ b/dom/bindings/BindingUtils.h @@ -3073,21 +3073,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 @@ -3102,7 +3102,7 @@ template<class T> class GetCCParticipant<T, true> { public: - static constexpr nsCycleCollectionParticipant* + static nsCycleCollectionParticipant* Get() { return nullptr; @@ -3125,7 +3125,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) { @@ -3142,7 +3142,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 6e779840fe..c97cf93221 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/bindings/ErrorResult.h b/dom/bindings/ErrorResult.h index da7ec30e71..15cf2aa036 100644 --- a/dom/bindings/ErrorResult.h +++ b/dom/bindings/ErrorResult.h @@ -56,7 +56,7 @@ enum ErrNum { // Debug-only compile-time table of the number of arguments of each error, for use in static_assert. #if defined(DEBUG) && (defined(__clang__) || defined(__GNUC__)) -uint16_t constexpr ErrorFormatNumArgs[] = { +uint16_t ErrorFormatNumArgs[] = { #define MSG_DEF(_name, _argc, _exn, _str) \ _argc, #include "mozilla/dom/Errors.msg" diff --git a/dom/cache/DBSchema.cpp b/dom/cache/DBSchema.cpp index 176e7b9d1d..37510e2e15 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 3397110bae..f23ae98731 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 299a96a9cc..668b7f5a5d 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/HTMLInputElement.cpp b/dom/html/HTMLInputElement.cpp index f2c14ff2dc..a1ffbb15df 100644 --- a/dom/html/HTMLInputElement.cpp +++ b/dom/html/HTMLInputElement.cpp @@ -5858,8 +5858,6 @@ HTMLInputElement::ParseAttribute(int32_t aNamespaceID, const nsAString& aValue, nsAttrValue& aResult) { - // We can't make these static_asserts because kInputDefaultType and - // kInputTypeTable aren't constexpr. MOZ_ASSERT(kInputDefaultType->value == NS_FORM_INPUT_TEXT, "Someone forgot to update kInputDefaultType when adding a new " "input type."); diff --git a/dom/html/HTMLTrackElement.cpp b/dom/html/HTMLTrackElement.cpp index 758018f8d2..59810a4447 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 74afef4523..c7feb8d867 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 37399f8511..64523afcba 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 2b43fa1ab8..a13c99ac03 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 608a09ccf5..d0bbcf5ea2 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 b6cda3ff9c..070ae60bb6 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 39560cc796..bf8030b6eb 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 6f160cadbb..6fb51b7d9d 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 0c71605f05..0303e69e37 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 fd57e4a770..470e935d37 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 d21610ff41..c668773ce5 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 52af5d3dc6..ae62781fdb 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 10321b585b..2fbb844887 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 7529d796d7..768c90093f 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 5e8db8afeb..efdabdb149 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 0f90163f58..a88a0f5acd 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 6b30cbee0f..904b376807 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 6856ef2759..5e4e89141e 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 6f58bd42e5..053959553a 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 526f9ba50c..6572815a15 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 f05f3928d2..54b171263b 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 d4b366b0ee..ba66ec5d51 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> |