1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-11 01:58:05 -05:00
denoland-deno/ext/web
Kenta Moriuchi ab60d9e6a3
fix: strict type check for cross realms (#21669)
Deno v1.39 introduces `vm.runInNewContext`. This may cause problems when
using `Object.prototype.isPrototypeOf` to check built-in types.

```js
import vm from "node:vm";

const err = new Error();
const crossErr = vm.runInNewContext(`new Error()`);

console.assert( !(crossErr instanceof Error) );
console.assert( Object.getPrototypeOf(err) !== Object.getPrototypeOf(crossErr) );
```

This PR changes to check using internal slots solves them.

---

current: 

```
> import vm from "node:vm";
undefined
> vm.runInNewContext(`new Error("message")`)
Error {}
> vm.runInNewContext(`new Date("2018-12-10T02:26:59.002Z")`)
Date {}
```

this PR:

```
> import vm from "node:vm";
undefined
> vm.runInNewContext(`new Error("message")`)
Error: message
    at <anonymous>:1:1
> vm.runInNewContext(`new Date("2018-12-10T02:26:59.002Z")`)
2018-12-10T02:26:59.002Z
```

---------

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-01-04 20:34:55 +01:00
..
benches chore: update copyright to 2024 (#21753) 2024-01-04 20:34:51 +01:00
00_infra.js chore: update copyright to 2024 (#21753) 2024-01-04 20:34:51 +01:00
01_dom_exception.js fix: strict type check for cross realms (#21669) 2024-01-04 20:34:55 +01:00
01_mimesniff.js chore: update copyright to 2024 (#21753) 2024-01-04 20:34:51 +01:00
02_event.js fix: strict type check for cross realms (#21669) 2024-01-04 20:34:55 +01:00
02_structured_clone.js fix: strict type check for cross realms (#21669) 2024-01-04 20:34:55 +01:00
02_timers.js chore: update copyright to 2024 (#21753) 2024-01-04 20:34:51 +01:00
03_abort_signal.js chore: update copyright to 2024 (#21753) 2024-01-04 20:34:51 +01:00
04_global_interfaces.js chore: update copyright to 2024 (#21753) 2024-01-04 20:34:51 +01:00
05_base64.js fix: strict type check for cross realms (#21669) 2024-01-04 20:34:55 +01:00
06_streams.js fix: strict type check for cross realms (#21669) 2024-01-04 20:34:55 +01:00
06_streams_types.d.ts chore: update copyright to 2024 (#21753) 2024-01-04 20:34:51 +01:00
08_text_encoding.js fix: strict type check for cross realms (#21669) 2024-01-04 20:34:55 +01:00
09_file.js fix: strict type check for cross realms (#21669) 2024-01-04 20:34:55 +01:00
10_filereader.js fix: strict type check for cross realms (#21669) 2024-01-04 20:34:55 +01:00
12_location.js fix: strict type check for cross realms (#21669) 2024-01-04 20:34:55 +01:00
13_message_port.js fix: strict type check for cross realms (#21669) 2024-01-04 20:34:55 +01:00
14_compression.js chore: update copyright to 2024 (#21753) 2024-01-04 20:34:51 +01:00
15_performance.js fix: strict type check for cross realms (#21669) 2024-01-04 20:34:55 +01:00
16_image_data.js fix: strict type check for cross realms (#21669) 2024-01-04 20:34:55 +01:00
blob.rs chore: update copyright to 2024 (#21753) 2024-01-04 20:34:51 +01:00
Cargo.toml chore: update copyright to 2024 (#21753) 2024-01-04 20:34:51 +01:00
compression.rs chore: update copyright to 2024 (#21753) 2024-01-04 20:34:51 +01:00
hr_timer_lock.rs chore: update copyright to 2024 (#21753) 2024-01-04 20:34:51 +01:00
internal.d.ts fix: strict type check for cross realms (#21669) 2024-01-04 20:34:55 +01:00
lib.deno_web.d.ts chore: update copyright to 2024 (#21753) 2024-01-04 20:34:51 +01:00
lib.rs chore: update copyright to 2024 (#21753) 2024-01-04 20:34:51 +01:00
message_port.rs chore: update copyright to 2024 (#21753) 2024-01-04 20:34:51 +01:00
README.md Rename extensions/ directory to ext/ (#11643) 2021-08-11 12:27:05 +02:00
stream_resource.rs chore: update copyright to 2024 (#21753) 2024-01-04 20:34:51 +01:00
timers.rs chore: update copyright to 2024 (#21753) 2024-01-04 20:34:51 +01:00

deno web

Op crate that implements Event, TextEncoder, TextDecoder and File API (https://w3c.github.io/FileAPI).

Testing for text encoding is done via WPT in cli/.