Skip to content

Commit

Permalink
Enabling Error.stackTraceLimit in MLE mode.
Browse files Browse the repository at this point in the history
(cherry picked from commit f0f3dc6)
  • Loading branch information
iamstolis authored and woess committed Aug 3, 2024
1 parent fa68370 commit 5041fbf
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ protected final int doInt(
@Cached IsNumberNode isNumber,
@Cached JSToIntegerAsLongNode toInteger) {
JSContext context = getJSContext();
if (context.isOptionV8CompatibilityMode()) {
if (context.isOptionV8CompatibilityMode() || context.getLanguageOptions().isMLEMode()) {
JSFunctionObject errorConstructor = getRealm().getErrorConstructor(JSErrorType.Error);
if (JSProperty.isData(getStackTraceLimit.getPropertyFlagsOrDefault(errorConstructor, JSError.STACK_TRACE_LIMIT_PROPERTY_NAME, JSProperty.ACCESSOR))) {
Object value = getStackTraceLimit.getOrDefault(errorConstructor, JSError.STACK_TRACE_LIMIT_PROPERTY_NAME, Undefined.instance);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public static JSException create(JSErrorType type, String message, Throwable cau

public static int getStackTraceLimit(JSRealm realm) {
JSContextOptions contextOptions = realm.getContextOptions();
if (contextOptions.isV8CompatibilityMode()) {
if (contextOptions.isV8CompatibilityMode() || contextOptions.isMLEMode()) {
JSFunctionObject errorConstructor = realm.getErrorConstructor(JSErrorType.Error);
DynamicObjectLibrary lib = DynamicObjectLibrary.getUncached();
if (JSProperty.isData(lib.getPropertyFlagsOrDefault(errorConstructor, JSError.STACK_TRACE_LIMIT_PROPERTY_NAME, JSProperty.ACCESSOR))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2253,7 +2253,7 @@ private void addGlobalGlobal() {
}

private void addErrorStackTraceLimit() {
if (getContextOptions().isV8CompatibilityMode()) {
if (getContextOptions().isV8CompatibilityMode() || getContextOptions().isMLEMode()) {
JSObject errorConstructor = getErrorConstructor(JSErrorType.Error);
JSObjectUtil.putDataProperty(errorConstructor, JSError.STACK_TRACE_LIMIT_PROPERTY_NAME, getContextOptions().getStackTraceLimit(), JSAttributes.getDefault());
}
Expand Down

0 comments on commit 5041fbf

Please sign in to comment.