Bug 1940098 - Use UTF8Strings where applicable, r=emilio DONTBUILD

Differential Revision: https://phabricator.services.mozilla.com/D233393
This commit is contained in:
Jason Kratzer
2025-01-07 19:54:49 +00:00
parent b69f98f530
commit 7e256ce8bb
3 changed files with 8 additions and 10 deletions

View File

@@ -10,15 +10,13 @@
namespace mozilla::dom {
/* static */
void Nyx::Log(const GlobalObject&, const nsAString& aMsg) {
NS_ConvertUTF16toUTF8 cStr(aMsg);
MOZ_FUZZING_NYX_PRINTF("%s\n", cStr.get());
void Nyx::Log(const GlobalObject&, const nsACString& aMsg) {
MOZ_FUZZING_NYX_PRINTF("%s\n", PromiseFlatCString(aMsg).get());
}
/* static */
bool Nyx::IsEnabled(const GlobalObject&, const nsAString& aFuzzerName) {
return fuzzing::Nyx::instance().is_enabled(
NS_ConvertUTF16toUTF8(aFuzzerName).get());
bool Nyx::IsEnabled(const GlobalObject&, const nsACString& aFuzzerName) {
return fuzzing::Nyx::instance().is_enabled(PromiseFlatCString(aFuzzerName).get());
}
/* static */

View File

@@ -15,9 +15,9 @@ class GlobalObject;
class Nyx final {
public:
static void Log(const GlobalObject&, const nsAString& aMsg);
static void Log(const GlobalObject&, const nsACString& aMsg);
static bool IsEnabled(const GlobalObject&, const nsAString& aFuzzerName);
static bool IsEnabled(const GlobalObject&, const nsACString& aFuzzerName);
static bool IsReplay(const GlobalObject&);

View File

@@ -18,12 +18,12 @@ namespace Nyx {
/**
* Use nyx_put for logging during Nyx fuzzing.
*/
undefined log(UTF8String aMsg);
undefined log(DOMString aMsg);
/**
* Determine if Nyx is enabled for the specified fuzzer.
*/
boolean isEnabled(DOMString aFuzzerName);
boolean isEnabled(UTF8String aFuzzerName);
/**