From 086c044dc34dfc0f74fbe41f4ecb402b2cd34884 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:13:33 +0200 Subject: Merging upstream version 125.0.1. Signed-off-by: Daniel Baumann --- dom/console/Console.h | 1 + dom/console/ConsoleAPIStorage.sys.mjs | 2 +- dom/console/ConsoleInstance.cpp | 10 ++++------ dom/console/ConsoleUtils.cpp | 1 + 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'dom/console') diff --git a/dom/console/Console.h b/dom/console/Console.h index 410cc8ba46..5898c6b0f5 100644 --- a/dom/console/Console.h +++ b/dom/console/Console.h @@ -9,6 +9,7 @@ #include "domstubs.h" #include "mozilla/dom/ConsoleBinding.h" +#include "mozilla/dom/ConsoleInstanceBinding.h" #include "mozilla/TimeStamp.h" #include "nsCycleCollectionParticipant.h" #include "nsTHashMap.h" diff --git a/dom/console/ConsoleAPIStorage.sys.mjs b/dom/console/ConsoleAPIStorage.sys.mjs index f920d0d5e0..2f537f21e9 100644 --- a/dom/console/ConsoleAPIStorage.sys.mjs +++ b/dom/console/ConsoleAPIStorage.sys.mjs @@ -49,7 +49,7 @@ ConsoleAPIStorageService.prototype = { "nsIObserver", ]), - observe: function CS_observe(aSubject, aTopic, aData) { + observe: function CS_observe(aSubject, aTopic) { if (aTopic == "xpcom-shutdown") { Services.obs.removeObserver(this, "xpcom-shutdown"); Services.obs.removeObserver(this, "inner-window-destroyed"); 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 level = StringToEnum(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(index); + return level.value(); } void ConsoleInstance::SetLogLevel() { diff --git a/dom/console/ConsoleUtils.cpp b/dom/console/ConsoleUtils.cpp index 9767dd30dd..585ff2ec3d 100644 --- a/dom/console/ConsoleUtils.cpp +++ b/dom/console/ConsoleUtils.cpp @@ -14,6 +14,7 @@ #include "mozilla/ClearOnShutdown.h" #include "mozilla/NullPrincipal.h" #include "mozilla/dom/ConsoleBinding.h" +#include "mozilla/dom/ConsoleInstanceBinding.h" #include "mozilla/dom/RootedDictionary.h" #include "mozilla/dom/ScriptSettings.h" #include "js/PropertyAndElement.h" // JS_DefineProperty -- cgit v1.2.3