/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
staticbool LoadLocalizedStrings(nsTArray<nsString>& aStrings) { // All enumes in ResolveError.
ResolveError errors[] = {ResolveError::Failure,
ResolveError::FailureMayBeBare,
ResolveError::BlockedByNullEntry,
ResolveError::BlockedByAfterPrefix,
ResolveError::BlockedByBacktrackingPrefix,
ResolveError::InvalidBareSpecifier};
static_assert(
std::size(errors) == static_cast<size_t>(ResolveError::Length), "The array 'errors' has missing entries in the enum class ResolveError.");
for (auto i : errors) {
nsAutoString message;
nsresult rv = nsContentUtils::GetLocalizedString(
nsContentUtils::eDOM_PROPERTIES, ResolveErrorInfo::GetString(i),
message); if (NS_WARN_IF(NS_FAILED(rv))) { if (NS_WARN_IF(!aStrings.AppendElement(EmptyString(), fallible))) { returnfalse;
}
} else { if (NS_WARN_IF(!aStrings.AppendElement(message, fallible))) { returnfalse;
}
}
}
returntrue;
}
already_AddRefed<Promise> Worklet::AddModule(JSContext* aCx, const nsAString& aModuleURL, const WorkletOptions& aOptions,
CallerType aCallerType,
ErrorResult& aRv) {
MOZ_ASSERT(NS_IsMainThread()); if (mLocalizedStrings.IsEmpty()) { bool result = LoadLocalizedStrings(mLocalizedStrings); if (!result) { return nullptr;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.