diff options
Diffstat (limited to '')
-rw-r--r-- | dom/console/ConsoleInstance.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/dom/console/ConsoleInstance.cpp b/dom/console/ConsoleInstance.cpp index 24477da56c..ade82be50f 100644 --- a/dom/console/ConsoleInstance.cpp +++ b/dom/console/ConsoleInstance.cpp @@ -71,7 +71,7 @@ ConsoleInstance::ConsoleInstance(JSContext* aCx, return; } - CopyUTF16toUTF8(aOptions.mMaxLogLevelPref, mMaxLogLevelPref); + mMaxLogLevelPref = aOptions.mMaxLogLevelPref; Preferences::RegisterCallback(MaxLogLevelPrefChangedCallback, mMaxLogLevelPref, this); @@ -106,9 +106,8 @@ ConsoleLogLevel PrefToValue(const nsACString& aPref, return aLevel; } - int index = FindEnumStringIndexImpl(value.get(), value.Length(), - ConsoleLogLevelValues::strings); - if (NS_WARN_IF(index < 0)) { + Maybe<ConsoleLogLevel> level = StringToEnum<ConsoleLogLevel>(value); + if (NS_WARN_IF(level.isNothing())) { nsString message; message.AssignLiteral("Invalid Console.maxLogLevelPref value: "); message.Append(NS_ConvertUTF8toUTF16(value)); @@ -118,8 +117,7 @@ ConsoleLogLevel PrefToValue(const nsACString& aPref, return aLevel; } - MOZ_ASSERT(index < (int)ConsoleLogLevelValues::Count); - return static_cast<ConsoleLogLevel>(index); + return level.value(); } void ConsoleInstance::SetLogLevel() { |