Bug 1406820 part 2. Fix some missing member initialization in dom/bindings code. r=qdot

This commit is contained in:
Jonathan Watt 2017-09-22 11:35:07 +01:00
parent 24b417787f
commit 84328b84e7
2 changed files with 8 additions and 6 deletions

View File

@ -345,18 +345,19 @@ template<>
class Optional<nsAString>
{
public:
Optional() : mPassed(false) {}
Optional()
: mStr(nullptr)
{}
bool WasPassed() const
{
return mPassed;
return !!mStr;
}
void operator=(const nsAString* str)
{
MOZ_ASSERT(str);
mStr = str;
mPassed = true;
}
// If this code ever goes away, remove the comment pointing to it in the
@ -365,7 +366,6 @@ public:
{
MOZ_ASSERT(str);
mStr = reinterpret_cast<const nsString*>(str);
mPassed = true;
}
const nsAString& Value() const
@ -379,7 +379,6 @@ private:
Optional(const Optional& other) = delete;
const Optional &operator=(const Optional &other) = delete;
bool mPassed;
const nsAString* mStr;
};
@ -388,8 +387,9 @@ class NonNull
{
public:
NonNull()
: ptr(nullptr)
#ifdef DEBUG
: inited(false)
, inited(false)
#endif
{}

View File

@ -19,6 +19,8 @@ namespace binding_detail {
// for small strings and a nsStringBuffer for longer strings.
struct FakeString {
FakeString() :
mData(nsString::char_traits::sEmptyBuffer),
mLength(0),
mDataFlags(nsString::DataFlags::TERMINATED),
mClassFlags(nsString::ClassFlags(0))
{