Exemple #1
0
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;
}
Exemple #2
0
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;
}