Skip to content

Commit b77f822

Browse files
magomezpgorszkowski-igalia
authored andcommitted
[JSC] Add option to disable console logging
1 parent ee25625 commit b77f822

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

Source/JavaScriptCore/runtime/ConsoleObject.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
#include "ConsoleClient.h"
3030
#include "JSCInlines.h"
31+
#include "Options.h"
3132
#include "ScriptArguments.h"
3233
#include "ScriptCallStackFactory.h"
3334

@@ -133,6 +134,9 @@ static EncodedJSValue consoleLogWithLevel(JSGlobalObject* globalObject, CallFram
133134
if (!client)
134135
return JSValue::encode(jsUndefined());
135136

137+
if (Options::disableConsoleLog())
138+
return JSValue::encode(jsUndefined());
139+
136140
client->logWithLevel(globalObject, Inspector::createScriptArguments(globalObject, callFrame, 0), level);
137141
return JSValue::encode(jsUndefined());
138142
}

Source/JavaScriptCore/runtime/OptionsList.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ bool hasCapacityToUseLargeGigacage();
605605
v(Bool, useWebAssemblyRelaxedSIMD, false, Normal, "Allow the relaxed simd instructions and types from the wasm relaxed simd spec.") \
606606
v(Bool, useWebAssemblyTailCalls, false, Normal, "Allow the new instructions from the wasm tail calls spec.") \
607607
v(Bool, useWebAssemblyExtendedConstantExpressions, true, Normal, "Allow the use of global, element, and data init expressions from the extended constant expressions proposal.") \
608-
608+
v(Bool, disableConsoleLog, false, Normal, "Disable printing of JS console logs.") \
609609

610610

611611
enum OptionEquivalence {

0 commit comments

Comments
 (0)