Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: panic, unwrap to unwrap_or #739

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
13 changes: 13 additions & 0 deletions core/00_primordials.js
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,19 @@
},
);

primordials.ArrayPrototypePush = (thisArray, ...args) => {
for (let i = 0; i < args.length; i++) {
ObjectDefineProperty(thisArray, thisArray.length, {
peko-thunder marked this conversation as resolved.
Show resolved Hide resolved
Comment on lines +490 to +492
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the fix in #754, do we really want to change this?

@0f-0b @devsnek

__proto__: null,
value: args[i],
enumerable: true,
writable: true,
configurable: true,
});
}
return thisArray.length;
};

primordials.ArrayPrototypeToString = (thisArray) =>
ArrayPrototypeJoin(thisArray);

Expand Down
4 changes: 3 additions & 1 deletion core/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,9 @@ impl JsError {

// Convert them into Vec<JsStackFrame>
let mut frames: Vec<JsStackFrame> = match frames_v8 {
Some(frames_v8) => serde_v8::from_v8(scope, frames_v8.into()).unwrap(),
Some(frames_v8) => {
serde_v8::from_v8(scope, frames_v8.into()).unwrap_or(Vec::new())
}
None => vec![],
};
let mut source_line = None;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.

// This test refers to the issue.
// https://github.com/denoland/deno_core/issues/744

Object.prototype.__defineSetter__(0, function () {});

// Need to dare to make errors.
// For example, `ReferenceError: variable is not defined`.
variable;
1 change: 1 addition & 0 deletions testing/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ integration_test!(
error_rejection_catch,
error_rejection_order,
error_ext_stack,
error_internal_method_set,
error_with_stack,
error_without_stack,
main_module_handler,
Expand Down
Loading