nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: denoland/deno_core
Pull request #284 (2023-10-26 10:49:12)

Use extra bindings object for V8 builtins


Patch:
diff --git a/core/runtime/bindings.rs b/core/runtime/bindings.rs
index 32179f4..1762954 100644
--- a/core/runtime/bindings.rs
+++ b/core/runtime/bindings.rs
@@ -130,10 +130,11 @@ pub(crate) fn initialize_context<'s>(
   codegen.push_str(include_str!("bindings.js"));
   _ = writeln!(
     codegen,
-    "Deno.__op__ = function(opFns, callConsole, console) {{"
+    "Deno.__op__ = function(opFns, callConsole, console, isOneByte, fromUtf8, toUtf8) {{"
   );
   if init_mode == InitMode::New {
     _ = writeln!(codegen, "Deno.__op__console(callConsole, console);");
+    _ = writeln!(codegen, "Deno.core = {{ ops: {{}}, asyncOps: {{}}, isOneByte, fromUtf8, toUtf8 }};");
   }
   for op_ctx in op_ctxs {
     if op_ctx.decl.enabled {
@@ -179,17 +180,26 @@ pub(crate) fn initialize_context<'s>(
 
     // Bind v8 console object to Deno.core.console
     let extra_binding_obj = context.get_extras_binding_object(scope);
-    let console_obj: v8::Local<v8::Object> = get(
-      scope,
-      extra_binding_obj,
-      b"console",
-      "ExtrasBindingObject.console",
-    );
+    let console_obj: v8::Local<v8::Object> =
+      get(scope, extra_binding_obj, b"console", "%console");
+    let is_one_byte_fn: v8::Local<v8::Object> =
+      get(scope, extra_binding_obj, b"isOneByte", "%isOneByte");
+    let from_utf8_fn: v8::Local<v8::Object> =
+      get(scope, extra_binding_obj, b"fromUtf8", "%fromUtf8");
+    let to_utf8_fn: v8::Local<v8::Object> =
+      get(scope, extra_binding_obj, b"toUtf8", "%toUtf8");
 
     op_fn.call(
       scope,
       recv.into(),
-      &[op_fns.into(), call_console_fn.into(), console_obj.into()],
+      &[
+        op_fns.into(),
+        call_console_fn.into(),
+        console_obj.into(),
+        is_one_byte_fn.into(),
+        from_utf8_fn.into(),
+        to_utf8_fn.into(),
+      ],
     );
   }
 


Test patch:
diff --git a/core/runtime/tests/misc.rs b/core/runtime/tests/misc.rs
index cc2acf5..b6bafbe 100644
--- a/core/runtime/tests/misc.rs
+++ b/core/runtime/tests/misc.rs
@@ -1037,3 +1037,22 @@ export const TEST = "foo";
     ..Default::default()
   });
 }
+
+#[test]
+fn test_v8_deno_builtins() {
+  let mut runtime = JsRuntime::new(RuntimeOptions::default());
+  let all_true: v8::Global<v8::Value> = runtime
+    .execute_script_static(
+      "v8_builtins.js",
+      r#"
+    (function () {
+      const str = "Hello World";
+      return Deno.core.isOneByte(str)
+    })()
+  "#,
+    )
+    .unwrap();
+  let mut scope = runtime.handle_scope();
+  let all_true = v8::Local::<v8::Value>::new(&mut scope, &all_true);
+  assert!(all_true.is_true());
+}
Repository: denoland/deno_core
Pull request #293 (2023-11-01 13:41:57)

Revert "Use extra bindings object for V8 builtins (#284)"
This reverts commit 35f029ce96cc4b70b91f5f05894b588d2a3fe878.


Patch:
diff --git a/core/runtime/bindings.rs b/core/runtime/bindings.rs
index 451496e..32179f4 100644
--- a/core/runtime/bindings.rs
+++ b/core/runtime/bindings.rs
@@ -130,13 +130,10 @@ pub(crate) fn initialize_context<'s>(
   codegen.push_str(include_str!("bindings.js"));
   _ = writeln!(
     codegen,
-    // "Deno.__op__ = function(opFns, callConsole, console, isOneByte, fromUtf8, toUtf8) {{"
     "Deno.__op__ = function(opFns, callConsole, console) {{"
   );
   if init_mode == InitMode::New {
     _ = writeln!(codegen, "Deno.__op__console(callConsole, console);");
-    // _ = writeln!(codegen, "Deno.core = {{ ops: {{}}, asyncOps: {{}}, isOneByte, fromUtf8, toUtf8 }};");
-    _ = writeln!(codegen, "Deno.core = {{ ops: {{}}, asyncOps: {{}} }};");
   }
   for op_ctx in op_ctxs {
     if op_ctx.decl.enabled {
@@ -182,28 +179,17 @@ pub(crate) fn initialize_context<'s>(
 
     // Bind v8 console object to Deno.core.console
     let extra_binding_obj = context.get_extras_binding_object(scope);
-    let console_obj: v8::Local<v8::Object> =
-      get(scope, extra_binding_obj, b"console", "%console");
-    // Disabled because temporarily reverted.
-    // let is_one_byte_fn: v8::Local<v8::Object> =
-    //   get(scope, extra_binding_obj, b"isOneByte", "%isOneByte");
-    // let from_utf8_fn: v8::Local<v8::Object> =
-    //   get(scope, extra_binding_obj, b"fromUtf8", "%fromUtf8");
-    // let to_utf8_fn: v8::Local<v8::Object> =
-    //   get(scope, extra_binding_obj, b"toUtf8", "%toUtf8");
+    let console_obj: v8::Local<v8::Object> = get(
+      scope,
+      extra_binding_obj,
+      b"console",
+      "ExtrasBindingObject.console",
+    );
 
     op_fn.call(
       scope,
       recv.into(),
-      &[
-        op_fns.into(),
-        call_console_fn.into(),
-        console_obj.into(),
-        // Disabled because temporarily reverted.
-        // is_one_byte_fn.into(),
-        // from_utf8_fn.into(),
-        // to_utf8_fn.into(),
-      ],
+      &[op_fns.into(), call_console_fn.into(), console_obj.into()],
     );
   }
 


Test patch:
diff --git a/core/runtime/tests/misc.rs b/core/runtime/tests/misc.rs
index 00a19b1..89879a0 100644
--- a/core/runtime/tests/misc.rs
+++ b/core/runtime/tests/misc.rs
@@ -1034,23 +1034,3 @@ export const TEST = "foo";
     ..Default::default()
   });
 }
-
-// Disabled because temporarily reverted.
-// #[test]
-// fn test_v8_deno_builtins() {
-//   let mut runtime = JsRuntime::new(RuntimeOptions::default());
-//   let all_true: v8::Global<v8::Value> = runtime
-//     .execute_script_static(
-//       "v8_builtins.js",
-//       r#"
-//     (function () {
-//       const str = "Hello World";
-//       return Deno.core.isOneByte(str)
-//     })()
-//   "#,
-//     )
-//     .unwrap();
-//   let mut scope = runtime.handle_scope();
-//   let all_true = v8::Local::<v8::Value>::new(&mut scope, &all_true);
-//   assert!(all_true.is_true());
-// }
Repository: denoland/deno_core
Pull request #298 (2023-11-02 21:38:01)

feat: enable Array.fromAsync
Closes https://github.com/denoland/deno_core/issues/297


Patch:
diff --git a/core/runtime/jsruntime.rs b/core/runtime/jsruntime.rs
index 1a440c8..fcab70d 100644
--- a/core/runtime/jsruntime.rs
+++ b/core/runtime/jsruntime.rs
@@ -342,6 +342,7 @@ fn v8_init(
     " --no-validate-asm",
     " --turbo_fast_api_calls",
     " --harmony-change-array-by-copy",
+    " --harmony-array-from_async",
   );
   let predictable_flags = "--predictable --random-seed=42";
   let expose_natives_flags = "--expose_gc --allow_natives_syntax";


Test patch:
diff --git a/core/runtime/tests/misc.rs b/core/runtime/tests/misc.rs
index 89879a0..f9e7eb2 100644
--- a/core/runtime/tests/misc.rs
+++ b/core/runtime/tests/misc.rs
@@ -908,6 +908,23 @@ fn test_array_by_copy() {
     .is_ok());
 }
 
+#[test]
+fn test_array_from_async() {
+  // Verify that "Array.fromAsync" proposal is enabled (https://github.com/tc39/proposal-array-from-async)
+  let mut runtime = JsRuntime::new(Default::default());
+  assert!(runtime
+    .execute_script_static(
+      "test_array_from_async.js",
+      "(async () => {
+        const b = await Array.fromAsync(new Map([[1, 2], [3, 4]]));
+        if (b[0][0] !== 1 || b[0][1] !== 2 || b[1][0] !== 3 || b[1][1] !== 4) {
+          throw new Error('failed');
+        }
+      })();",
+    )
+    .is_ok());
+}
+
 // Make sure that stalled top-level awaits (that is, top-level awaits that
 // aren't tied to the progress of some op) are correctly reported, even in a
 // realm other than the main one.
Repository: denoland/deno_core
Pull request #304 (2023-11-04 01:45:16)

feat: enable Iterator helpers proposal


Patch:
diff --git a/core/runtime/jsruntime.rs b/core/runtime/jsruntime.rs
index 686cc66..afec657 100644
--- a/core/runtime/jsruntime.rs
+++ b/core/runtime/jsruntime.rs
@@ -355,6 +355,7 @@ fn v8_init(
     " --turbo_fast_api_calls",
     " --harmony-change-array-by-copy",
     " --harmony-array-from_async",
+    " --harmony-iterator-helpers",
   );
   let predictable_flags = "--predictable --random-seed=42";
   let expose_natives_flags = "--expose_gc --allow_natives_syntax";


Test patch:
diff --git a/core/runtime/tests/misc.rs b/core/runtime/tests/misc.rs
index f9e7eb2..1f323cb 100644
--- a/core/runtime/tests/misc.rs
+++ b/core/runtime/tests/misc.rs
@@ -925,6 +925,30 @@ fn test_array_from_async() {
     .is_ok());
 }
 
+#[test]
+fn test_iterator_helpers() {
+  // Verify that "Iterator helpers" proposal is enabled (https://github.com/tc39/proposal-iterator-helpers)
+  let mut runtime = JsRuntime::new(Default::default());
+  assert!(runtime
+    .execute_script_static(
+      "test_iterator_helpers.js",
+      "function* naturals() {
+        let i = 0;
+        while (true) {
+          yield i;
+          i += 1;
+        }
+      }
+      
+      const a = naturals().take(5).toArray();
+      if (a[0] !== 0 || a[1] !== 1 || a[2] !== 2 || a[3] !== 3 || a[4] !== 4) {
+        throw new Error('failed');
+      }
+      ",
+    )
+    .is_ok());
+}
+
 // Make sure that stalled top-level awaits (that is, top-level awaits that
 // aren't tied to the progress of some op) are correctly reported, even in a
 // realm other than the main one.
Repository: denoland/deno_core
Pull request #307 (2023-11-06 22:28:00)

feat(core): invert register_ops
`register_ops: false` is a dangerous default and probably a footgun, so let's invert this and call it `skip_op_registration`.


Patch:
diff --git a/core/runtime/bindings.rs b/core/runtime/bindings.rs
index 2a71efe..92835bb 100644
--- a/core/runtime/bindings.rs
+++ b/core/runtime/bindings.rs
@@ -128,7 +128,7 @@ pub(crate) fn initialize_context<'s>(
   if matches!(
     init_mode,
     InitMode::FromSnapshot {
-      register_ops: false
+      skip_op_registration: true
     }
   ) {
     return context;
diff --git a/core/runtime/jsruntime.rs b/core/runtime/jsruntime.rs
index afec657..f1b2357 100644
--- a/core/runtime/jsruntime.rs
+++ b/core/runtime/jsruntime.rs
@@ -185,8 +185,8 @@ pub(crate) enum InitMode {
   New,
   /// We are using a snapshot, thus certain initialization steps are skipped.
   FromSnapshot {
-    // Do we need to register new ops.
-    register_ops: bool,
+    // Can we skip the work of op registration?
+    skip_op_registration: bool,
   },
 }
 
@@ -195,7 +195,7 @@ impl InitMode {
     match options.startup_snapshot {
       None => Self::New,
       Some(_) => Self::FromSnapshot {
-        register_ops: options.register_ops,
+        skip_op_registration: options.skip_op_registration,
       },
     }
   }
@@ -412,7 +412,9 @@ pub struct RuntimeOptions {
 
   /// V8 snapshot that should be loaded on startup.
   pub startup_snapshot: Option<Snapshot>,
-  pub register_ops: bool,
+
+  /// Should op registration be skipped?
+  pub skip_op_registration: bool,
 
   /// Isolate creation parameters.
   pub create_params: Option<v8::CreateParams>,
diff --git a/core/runtime/snapshot_util.rs b/core/runtime/snapshot_util.rs
index 6bbc57a..c0df226 100644
--- a/core/runtime/snapshot_util.rs
+++ b/core/runtime/snapshot_util.rs
@@ -18,7 +18,7 @@ pub struct CreateSnapshotOptions {
   pub cargo_manifest_dir: &'static str,
   pub snapshot_path: PathBuf,
   pub startup_snapshot: Option<Snapshot>,
-  pub register_ops: bool,
+  pub skip_op_registration: bool,
   pub extensions: Vec<Extension>,
   pub compression_cb: Option<Box<CompressionCb>>,
   pub with_runtime_cb: Option<Box<WithRuntimeCb>>,
@@ -39,7 +39,7 @@ pub fn create_snapshot(
   let mut js_runtime = JsRuntimeForSnapshot::new(RuntimeOptions {
     startup_snapshot: create_snapshot_options.startup_snapshot,
     extensions: create_snapshot_options.extensions,
-    register_ops: create_snapshot_options.register_ops,
+    skip_op_registration: create_snapshot_options.skip_op_registration,
     ..Default::default()
   });
   println!(


Test patch:
diff --git a/core/runtime/tests/jsrealm.rs b/core/runtime/tests/jsrealm.rs
index 10e2f6e..886a50f 100644
--- a/core/runtime/tests/jsrealm.rs
+++ b/core/runtime/tests/jsrealm.rs
@@ -220,7 +220,7 @@ fn js_realm_init_snapshot() {
   let mut runtime = JsRuntime::new(RuntimeOptions {
     startup_snapshot: Some(Snapshot::Boxed(snapshot)),
     extensions: vec![test_ext::init_ops()],
-    register_ops: true,
+    skip_op_registration: false,
     ..Default::default()
   });
   let realm = runtime.create_realm(Default::default()).unwrap();
Repository: denoland/deno_core
Pull request #540 (2024-02-02 00:04:29)

 refactor(core): registerErrorClass for BadResource and Interrupted 


Patch:
diff --git a/core/01_core.js b/core/01_core.js
index 285b3bb..01c83f9 100644
--- a/core/01_core.js
+++ b/core/01_core.js
@@ -27,6 +27,7 @@
     getPromise,
     hasPromise,
     promiseIdSymbol,
+    registerErrorClass,
   } = window.Deno.core;
 
   let unhandledPromiseRejectionHandler = () => false;
@@ -204,6 +205,9 @@
   }
   const InterruptedPrototype = Interrupted.prototype;
 
+  registerErrorClass("BadResource", BadResource);
+  registerErrorClass("Interrupted", Interrupted);
+
   const promiseHooks = [
     [], // init
     [], // before


Test patch:
diff --git a/testing/checkin/runtime/__init.js b/testing/checkin/runtime/__init.js
index 5be1d98..bd7bd0e 100644
--- a/testing/checkin/runtime/__init.js
+++ b/testing/checkin/runtime/__init.js
@@ -49,6 +49,3 @@ Reflect.defineProperty(globalThis, "onrejectionhandled", {
 });
 Deno.unrefTimer = timers.unrefTimer;
 Deno.refTimer = timers.refTimer;
-
-// TODO(mmastrac): arguably this could be registered in 00_infra.js since it's a deno_core error
-Deno.core.registerErrorClass("BadResource", Deno.core.BadResource);
Repository: denoland/deno_core
Pull request #587 (2024-02-20 22:44:01)

chore: update rusty_v8 to 0.84.0
V8 is now at version 12.3.


Patch:
diff --git a/Cargo.lock b/Cargo.lock
index c435e58..10c8d06 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2242,9 +2242,9 @@ checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a"
 
 [[package]]
 name = "v8"
-version = "0.83.2"
+version = "0.84.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9f6c8a960dd2eb74b22eda64f7e9f3d1688f82b80202828dc0425ebdeda826ef"
+checksum = "a9205df12ea9e4e9e966c44a408b1b905ce8784ff70ef27c4ed1e73daec51b97"
 dependencies = [
  "bitflags 2.4.2",
  "fslock",
diff --git a/Cargo.toml b/Cargo.toml
index b71764a..7a5df50 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -22,7 +22,7 @@ deno_core = { version = "0.263.0", path = "./core" }
 deno_ops = { version = "0.139.0", path = "./ops" }
 serde_v8 = { version = "0.172.0", path = "./serde_v8" }
 
-v8 = { version = "0.83.2", default-features = false }
+v8 = { version = "0.84.0", default-features = false }
 deno_ast = { version = "=0.32.0", features = ["transpiling"] }
 deno_unsync = "0.3.2"
 deno_core_icudata = "0.0.73"
diff --git a/core/modules/map.rs b/core/modules/map.rs
index 469be4f..4c91f19 100644
--- a/core/modules/map.rs
+++ b/core/modules/map.rs
@@ -544,7 +544,7 @@ impl ModuleMap {
         .get_specifier()
         .to_rust_string_lossy(tc_scope);
 
-      let import_attributes = module_request.get_import_assertions();
+      let import_attributes = module_request.get_import_attributes();
 
       let attributes = parse_import_attributes(
         tc_scope,


Test patch:
diff --git a/testing/unit/tc39_test.ts b/testing/unit/tc39_test.ts
index d930b27..d41d0e9 100644
--- a/testing/unit/tc39_test.ts
+++ b/testing/unit/tc39_test.ts
@@ -1,5 +1,5 @@
 // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
-import { fail, test } from "checkin:testing";
+import { assert, assertEquals, fail, test } from "checkin:testing";
 
 // Verify that "array by copy" proposal is enabled (https://github.com/tc39/proposal-change-array-by-copy)
 test(function testArrayByCopy() {
@@ -38,3 +38,27 @@ test(function testIteratorHelpers() {
     fail("failed");
   }
 });
+
+// Verify that "Set Methods" proposal is enabled (https://github.com/tc39/proposal-set-methods)
+test(function testSetMethods() {
+  {
+    const odds = new Set([1, 3, 5, 7, 9]);
+    const squares = new Set([1, 4, 9]);
+    const intersection = odds.intersection(squares);
+    assertEquals(intersection.size, 2);
+    assert(intersection.has(1));
+    assert(intersection.has(9));
+  }
+  {
+    const evens = new Set([2, 4, 6, 8]);
+    const squares = new Set([1, 4, 9]);
+    const union = evens.union(squares);
+    assertEquals(union.size, 6);
+    assert(union.has(2));
+    assert(union.has(4));
+    assert(union.has(6));
+    assert(union.has(8));
+    assert(union.has(1));
+    assert(union.has(9));
+  }
+});
Repository: denoland/deno_core
Pull request #597 (2024-02-23 19:48:49)

fix(core): drain microtask queue after timer


Patch:
diff --git a/core/01_core.js b/core/01_core.js
index 67ddbb4..0ca898d 100644
--- a/core/01_core.js
+++ b/core/01_core.js
@@ -179,6 +179,7 @@
       for (let i = 0; i < timers.length; i += 2) {
         timerDepth = timers[i];
         timers[i + 1]();
+        op_run_microtasks();
       }
       timerDepth = 0;
     }


Test patch:
diff --git a/testing/checkin/runtime/timers.ts b/testing/checkin/runtime/timers.ts
index 3c423d3..506d0c9 100644
--- a/testing/checkin/runtime/timers.ts
+++ b/testing/checkin/runtime/timers.ts
@@ -3,7 +3,7 @@
 /**
  * Call a callback function after a delay.
  */
-export function setTimeout(callback, delay) {
+export function setTimeout(callback, delay = 0) {
   return Deno.core.queueTimer(
     Deno.core.getTimerDepth() + 1,
     false,
@@ -15,7 +15,7 @@ export function setTimeout(callback, delay) {
 /**
  * Call a callback function after a delay.
  */
-export function setInterval(callback, delay) {
+export function setInterval(callback, delay = 0) {
   return Deno.core.queueTimer(
     Deno.core.getTimerDepth() + 1,
     true,
diff --git a/testing/unit/timer_test.ts b/testing/unit/timer_test.ts
index 5eb353e..ddcfd68 100644
--- a/testing/unit/timer_test.ts
+++ b/testing/unit/timer_test.ts
@@ -62,3 +62,27 @@ test(async function testTimerDepth() {
   }, 1);
   await promise;
 });
+
+// The timers must drain the microtask queue before attempting to run the
+// next timer.
+test(async function testMicrotaskOrdering() {
+  const { promise, resolve } = Promise.withResolvers();
+  let s = "";
+  let i = 0;
+  setTimeout(() => {
+    Promise.resolve().then(() => {
+      s += "promise\n";
+    });
+    if (++i == 2) {
+      resolve(0);
+    }
+  });
+  setTimeout(() => {
+    s += "no promise\n";
+    if (++i == 2) {
+      resolve(0);
+    }
+  });
+  await promise;
+  assertEquals(s, "promise\nno promise\n");
+});
Repository: denoland/deno_core
Pull request #861 (2024-08-05 12:14:46)

fix: getFileName can return null
Refs: https://github.com/denoland/deno/issues/24869


Patch:
diff --git a/core/error.rs b/core/error.rs
index 0c9a127..fecfc11 100644
--- a/core/error.rs
+++ b/core/error.rs
@@ -1099,8 +1099,10 @@ pub mod callsite_fns {
     };
     // call getFileName
     let orig_ret =
-      call_method::<v8::String>(scope, orig, super::GET_FILE_NAME, &[]);
-    if let Some(ret_val) = orig_ret {
+      call_method::<v8::Value>(scope, orig, super::GET_FILE_NAME, &[]);
+    if let Some(ret_val) =
+      orig_ret.and_then(|v| v.try_cast::<v8::String>().ok())
+    {
       // strip off `file://`
       let string = ret_val.to_rust_string_lossy(scope);
       if let Some(file_name) = maybe_to_path_str(&string) {


Test patch:
diff --git a/testing/integration/error_get_file_name/error_get_file_name.out b/testing/integration/error_get_file_name/error_get_file_name.out
new file mode 100644
index 0000000..5082dbe
--- /dev/null
+++ b/testing/integration/error_get_file_name/error_get_file_name.out
@@ -0,0 +1,5 @@
+[
+  "test:///integration/error_get_file_name/error_get_file_name.ts",
+  null,
+  "test:///integration/error_get_file_name/error_get_file_name.ts"
+]
diff --git a/testing/integration/error_get_file_name/error_get_file_name.ts b/testing/integration/error_get_file_name/error_get_file_name.ts
new file mode 100644
index 0000000..8314bd2
--- /dev/null
+++ b/testing/integration/error_get_file_name/error_get_file_name.ts
@@ -0,0 +1,12 @@
+// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
+
+// deno-lint-ignore no-explicit-any
+(Error as any).prepareStackTrace = (_err: unknown, frames: any[]) => {
+  return frames.map((frame) => frame.getFileName());
+};
+
+new Promise((_, reject) => {
+  reject(new Error("fail").stack);
+}).catch((err) => {
+  console.log(err);
+});
diff --git a/testing/lib.rs b/testing/lib.rs
index 00494ac..de1669f 100644
--- a/testing/lib.rs
+++ b/testing/lib.rs
@@ -66,6 +66,7 @@ integration_test!(
   error_prepare_stack_trace,
   error_with_stack,
   error_without_stack,
+  error_get_file_name,
   main_module_handler,
   module_types,
   pending_unref_op_tla,
Repository: denoland/deno_core
Pull request #864 (2024-08-05 18:04:59)

fix: getFileName can be null in .toString()
Basically copy the fix from https://github.com/denoland/deno_core/pull/861


Patch:
diff --git a/core/error.rs b/core/error.rs
index fecfc11..ea3efe3 100644
--- a/core/error.rs
+++ b/core/error.rs
@@ -1141,8 +1141,10 @@ pub mod callsite_fns {
     };
     let orig_to_string = serde_v8::to_utf8(orig_to_string_v8, scope);
     // `this[kOriginalCallsite].getFileName()`
+    let orig_ret_file_name =
+      call_method::<v8::Value>(scope, orig, GET_FILE_NAME, &[]);
     let Some(orig_file_name) =
-      call_method::<v8::String>(scope, orig, GET_FILE_NAME, &[])
+      orig_ret_file_name.and_then(|v| v.try_cast::<v8::String>().ok())
     else {
       return;
     };


Test patch:
diff --git a/testing/integration/error_get_file_name_to_string/error_get_file_name_to_string.out b/testing/integration/error_get_file_name_to_string/error_get_file_name_to_string.out
new file mode 100644
index 0000000..ba287b6
--- /dev/null
+++ b/testing/integration/error_get_file_name_to_string/error_get_file_name_to_string.out
@@ -0,0 +1,5 @@
+[
+  "test:///integration/error_get_file_name_to_string/error_get_file_name_to_string.ts:7:10",
+  null,
+  "test:///integration/error_get_file_name_to_string/error_get_file_name_to_string.ts:6:1"
+]
diff --git a/testing/integration/error_get_file_name_to_string/error_get_file_name_to_string.ts b/testing/integration/error_get_file_name_to_string/error_get_file_name_to_string.ts
new file mode 100644
index 0000000..627efbb
--- /dev/null
+++ b/testing/integration/error_get_file_name_to_string/error_get_file_name_to_string.ts
@@ -0,0 +1,12 @@
+// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
+
+// deno-lint-ignore no-explicit-any
+(Error as any).prepareStackTrace = (_err: unknown, frames: any[]) => {
+  return frames.map((frame) => frame.toString());
+};
+
+new Promise((_, reject) => {
+  reject(new Error("fail").stack);
+}).catch((err) => {
+  console.log(err);
+});
diff --git a/testing/lib.rs b/testing/lib.rs
index de1669f..2c34099 100644
--- a/testing/lib.rs
+++ b/testing/lib.rs
@@ -67,6 +67,7 @@ integration_test!(
   error_with_stack,
   error_without_stack,
   error_get_file_name,
+  error_get_file_name_to_string,
   main_module_handler,
   module_types,
   pending_unref_op_tla,
Repository: denoland/deno_core
Pull request #1022 (2025-01-03 03:25:12)

Fix accessors fast call error


Patch:
diff --git a/ops/op2/mod.rs b/ops/op2/mod.rs
index bead5c8..11750a9 100644
--- a/ops/op2/mod.rs
+++ b/ops/op2/mod.rs
@@ -254,7 +254,7 @@ pub(crate) fn generate_op2(
         }
       }
       None => {
-        if config.fast || config.getter || config.setter {
+        if config.fast {
           return Err(Op2Error::ShouldNotBeFast("fast"));
         }
         if config.nofast {


Test patch:
diff --git a/testing/checkin/runner/ops.rs b/testing/checkin/runner/ops.rs
index 8fd9c4e..6c4d521 100644
--- a/testing/checkin/runner/ops.rs
+++ b/testing/checkin/runner/ops.rs
@@ -101,6 +101,12 @@ impl TestObjectWrap {
     tokio::time::sleep(std::time::Duration::from_millis(ms as u64)).await;
     Ok(())
   }
+
+  #[getter]
+  #[string]
+  fn with_slow_getter(&self) -> String {
+    String::from("getter")
+  }
 }
 
 pub struct DOMPoint {