bool KeyPath::AppendStringWithValidation(const nsAString& aString) { if (!IsValidKeyPathString(aString)) { return false; } if (IsString()) { NS_ASSERTION(mStrings.Length() == 0, "Too many strings!"); mStrings.AppendElement(aString); return true; } if (IsArray()) { mStrings.AppendElement(aString); return true; } MOZ_ASSERT_UNREACHABLE("What?!"); return false; }
bool KeyPath::AppendStringWithValidation(JSContext* aCx, const nsAString& aString) { if (!IsValidKeyPathString(aCx, aString)) { return false; } if (IsString()) { NS_ASSERTION(mStrings.Length() == 0, "Too many strings!"); mStrings.AppendElement(aString); return true; } if (IsArray()) { mStrings.AppendElement(aString); return true; } NS_NOTREACHED("What?!"); return false; }