mirror of
https://github.com/denoland/deno.git
synced 2024-11-25 15:29:32 -05:00
Upgrade to rusty_v8 0.4.2 / V8 8.5.216 (#6503)
This commit is contained in:
parent
0c735ebdc7
commit
e10d74a3d3
8 changed files with 378 additions and 572 deletions
201
Cargo.lock
generated
201
Cargo.lock
generated
|
@ -27,9 +27,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "0.7.10"
|
||||
version = "0.7.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8716408b8bc624ed7f65d223ddb9ac2d044c0547b6fa4b0d554f3a9540496ada"
|
||||
checksum = "043164d8ba5c4c3035fec9bbee8647c0261d788f3474306f93bb65901cae0e86"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
@ -55,7 +55,7 @@ version = "0.11.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
|
||||
dependencies = [
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -81,7 +81,7 @@ dependencies = [
|
|||
"proc-macro2 1.0.18",
|
||||
"quote 1.0.7",
|
||||
"swc_macros_common",
|
||||
"syn 1.0.31",
|
||||
"syn 1.0.33",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -106,7 +106,7 @@ checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
|
|||
dependencies = [
|
||||
"hermit-abi",
|
||||
"libc",
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -138,9 +138,9 @@ checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7"
|
|||
|
||||
[[package]]
|
||||
name = "base64"
|
||||
version = "0.12.2"
|
||||
version = "0.12.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e223af0dc48c96d4f8342ec01a4974f139df863896b316681efd36742f22cc67"
|
||||
checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
|
@ -245,9 +245,9 @@ checksum = "5ba7d7f7b201dfcbc314b14f2176c92f8ba521dab538b40e426ffed25ed7cd80"
|
|||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.54"
|
||||
version = "1.0.55"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7bbb73db36c1246e9034e307d0fba23f9a2e251faa47ade70c1bd252220c8311"
|
||||
checksum = "b1be3409f94d7bdceeb5f5fac551039d9b3f00e25da7a74fc4d33400a0d96368"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
|
@ -255,16 +255,6 @@ version = "0.1.10"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
||||
|
||||
[[package]]
|
||||
name = "chashmap"
|
||||
version = "2.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ff41a3c2c1e39921b9003de14bf0439c7b63a9039637c291e1a64925d8ddfa45"
|
||||
dependencies = [
|
||||
"owning_ref 0.3.3",
|
||||
"parking_lot 0.4.8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "2.33.1"
|
||||
|
@ -360,7 +350,7 @@ dependencies = [
|
|||
"proc-macro2 1.0.18",
|
||||
"quote 1.0.7",
|
||||
"strsim 0.9.3",
|
||||
"syn 1.0.31",
|
||||
"syn 1.0.33",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -371,7 +361,7 @@ checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72"
|
|||
dependencies = [
|
||||
"darling_core",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.31",
|
||||
"syn 1.0.33",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -390,7 +380,7 @@ name = "deno"
|
|||
version = "1.1.1"
|
||||
dependencies = [
|
||||
"atty",
|
||||
"base64 0.12.2",
|
||||
"base64 0.12.3",
|
||||
"byteorder",
|
||||
"bytes 0.5.5",
|
||||
"clap",
|
||||
|
@ -436,7 +426,7 @@ dependencies = [
|
|||
"warp",
|
||||
"webpki",
|
||||
"webpki-roots",
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -514,7 +504,7 @@ dependencies = [
|
|||
"dlopen_derive",
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -587,7 +577,7 @@ dependencies = [
|
|||
"pmutil",
|
||||
"proc-macro2 1.0.18",
|
||||
"swc_macros_common",
|
||||
"syn 1.0.31",
|
||||
"syn 1.0.33",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -616,7 +606,7 @@ dependencies = [
|
|||
"cfg-if",
|
||||
"libc",
|
||||
"redox_syscall",
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -646,7 +636,7 @@ dependencies = [
|
|||
"pmutil",
|
||||
"proc-macro2 1.0.18",
|
||||
"swc_macros_common",
|
||||
"syn 1.0.31",
|
||||
"syn 1.0.33",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -754,7 +744,7 @@ dependencies = [
|
|||
"proc-macro-hack",
|
||||
"proc-macro2 1.0.18",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.31",
|
||||
"syn 1.0.33",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -823,7 +813,7 @@ dependencies = [
|
|||
"libc",
|
||||
"log 0.4.8",
|
||||
"rustc_version",
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -871,7 +861,7 @@ version = "0.3.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed18eb2459bf1a09ad2d6b1547840c3e5e62882fa09b9a6a20b1de8e3228848f"
|
||||
dependencies = [
|
||||
"base64 0.12.2",
|
||||
"base64 0.12.3",
|
||||
"bitflags",
|
||||
"bytes 0.5.5",
|
||||
"headers-core",
|
||||
|
@ -1104,7 +1094,7 @@ version = "0.1.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c"
|
||||
dependencies = [
|
||||
"owning_ref 0.4.1",
|
||||
"owning_ref",
|
||||
"scopeguard 0.3.3",
|
||||
]
|
||||
|
||||
|
@ -1241,7 +1231,7 @@ dependencies = [
|
|||
"log 0.4.8",
|
||||
"mio",
|
||||
"miow 0.3.5",
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1274,7 +1264,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "07b88fb9795d4d36d62a012dfbf49a8f5cf12751f36d31a9dbe66d528e58979e"
|
||||
dependencies = [
|
||||
"socket2",
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1303,7 +1293,7 @@ checksum = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7"
|
|||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1327,13 +1317,12 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "notify"
|
||||
version = "5.0.0-pre.2"
|
||||
version = "5.0.0-pre.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7b00c0b65188bffb5598c302e19b062feb94adef02c31f15622a163c95d673c3"
|
||||
checksum = "77d03607cf88b4b160ba0e9ed425fff3cee3b55ac813f0c685b3a3772da37d0e"
|
||||
dependencies = [
|
||||
"anymap",
|
||||
"bitflags",
|
||||
"chashmap",
|
||||
"crossbeam-channel",
|
||||
"filetime",
|
||||
"fsevent",
|
||||
|
@ -1343,7 +1332,7 @@ dependencies = [
|
|||
"mio",
|
||||
"mio-extras",
|
||||
"walkdir",
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1406,16 +1395,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "fb233f06c2307e1f5ce2ecad9f8121cffbbee2c95428f44ea85222e460d0d213"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"winapi 0.3.8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "owning_ref"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37"
|
||||
dependencies = [
|
||||
"stable_deref_trait",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1427,16 +1407,6 @@ dependencies = [
|
|||
"stable_deref_trait",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
version = "0.4.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "149d8f5b97f3c1133e3cfcd8886449959e856b557ff281e292b733d7c69e005e"
|
||||
dependencies = [
|
||||
"owning_ref 0.3.3",
|
||||
"parking_lot_core 0.2.14",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
version = "0.7.1"
|
||||
|
@ -1444,19 +1414,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "ab41b4aed082705d1056416ae4468b6ea99d52599ecf3169b00088d43113e337"
|
||||
dependencies = [
|
||||
"lock_api",
|
||||
"parking_lot_core 0.4.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot_core"
|
||||
version = "0.2.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4db1a8ccf734a7bce794cc19b3df06ed87ab2f3907036b693c68f56b4d4537fa"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"rand 0.4.6",
|
||||
"smallvec 0.6.13",
|
||||
"winapi 0.3.8",
|
||||
"parking_lot_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1469,7 +1427,7 @@ dependencies = [
|
|||
"rand 0.6.5",
|
||||
"rustc_version",
|
||||
"smallvec 0.6.13",
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1559,7 +1517,7 @@ checksum = "6a0ffd45cf79d88737d7cc85bfd5d2894bee1139b356e616fe85dc389c61aaf7"
|
|||
dependencies = [
|
||||
"proc-macro2 1.0.18",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.31",
|
||||
"syn 1.0.33",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1582,7 +1540,7 @@ checksum = "3894e5d549cccbe44afecf72922f277f603cd4bb0219c8342631ef18fffbe004"
|
|||
dependencies = [
|
||||
"proc-macro2 1.0.18",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.31",
|
||||
"syn 1.0.33",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1624,7 +1582,7 @@ version = "1.0.18"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa"
|
||||
dependencies = [
|
||||
"unicode-xid 0.2.0",
|
||||
"unicode-xid 0.2.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1661,19 +1619,6 @@ dependencies = [
|
|||
"proc-macro2 1.0.18",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.4.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293"
|
||||
dependencies = [
|
||||
"fuchsia-cprng",
|
||||
"libc",
|
||||
"rand_core 0.3.1",
|
||||
"rdrand",
|
||||
"winapi 0.3.8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.6.5"
|
||||
|
@ -1690,7 +1635,7 @@ dependencies = [
|
|||
"rand_os",
|
||||
"rand_pcg 0.1.2",
|
||||
"rand_xorshift",
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1786,7 +1731,7 @@ checksum = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b"
|
|||
dependencies = [
|
||||
"libc",
|
||||
"rand_core 0.4.2",
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1800,7 +1745,7 @@ dependencies = [
|
|||
"libc",
|
||||
"rand_core 0.4.2",
|
||||
"rdrand",
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1870,7 +1815,7 @@ version = "0.5.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
|
||||
dependencies = [
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1880,7 +1825,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "3b82c9238b305f26f53443e3a4bc8528d64b8d0bee408ec949eb7bf5635ec680"
|
||||
dependencies = [
|
||||
"async-compression",
|
||||
"base64 0.12.2",
|
||||
"base64 0.12.3",
|
||||
"bytes 0.5.5",
|
||||
"encoding_rs",
|
||||
"futures-core",
|
||||
|
@ -1921,7 +1866,7 @@ dependencies = [
|
|||
"spin",
|
||||
"untrusted",
|
||||
"web-sys",
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1948,9 +1893,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rusty_v8"
|
||||
version = "0.5.1"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "acb51793f34f267b197a6688c986ddcd7a60c94894d77702f1b4a3febf6e1eda"
|
||||
checksum = "da4dd2d680bf9812b3156b44f89fdd7b508c1369fbc69a14150972c6919c84d1"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cargo_gn",
|
||||
|
@ -1974,7 +1919,7 @@ dependencies = [
|
|||
"unicode-segmentation",
|
||||
"unicode-width",
|
||||
"utf8parse",
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2055,22 +2000,22 @@ checksum = "b46e1121e8180c12ff69a742aabc4f310542b6ccb69f1691689ac17fdf8618aa"
|
|||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.112"
|
||||
version = "1.0.114"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "736aac72d1eafe8e5962d1d1c3d99b0df526015ba40915cb3c49d042e92ec243"
|
||||
checksum = "5317f7588f0a5078ee60ef675ef96735a1442132dc645eb1d12c018620ed8cd3"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.112"
|
||||
version = "1.0.114"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf0343ce212ac0d3d6afd9391ac8e9c9efe06b533c8d33f660f6390cc4093f57"
|
||||
checksum = "2a0be94b04690fbaed37cddffc5c134bf537c8e3329d53e982fe04c374978f8e"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.18",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.31",
|
||||
"syn 1.0.33",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2161,7 +2106,7 @@ dependencies = [
|
|||
"cfg-if",
|
||||
"libc",
|
||||
"redox_syscall",
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2227,7 +2172,7 @@ dependencies = [
|
|||
"proc-macro2 1.0.18",
|
||||
"quote 1.0.7",
|
||||
"swc_macros_common",
|
||||
"syn 1.0.31",
|
||||
"syn 1.0.33",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2266,7 +2211,7 @@ dependencies = [
|
|||
"from_variant",
|
||||
"fxhash",
|
||||
"log 0.4.8",
|
||||
"parking_lot 0.7.1",
|
||||
"parking_lot",
|
||||
"scoped-tls 1.0.0",
|
||||
"serde",
|
||||
"sourcemap",
|
||||
|
@ -2307,7 +2252,7 @@ dependencies = [
|
|||
"swc_common",
|
||||
"swc_ecma_ast",
|
||||
"swc_ecma_parser_macros",
|
||||
"unicode-xid 0.2.0",
|
||||
"unicode-xid 0.2.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2320,7 +2265,7 @@ dependencies = [
|
|||
"proc-macro2 1.0.18",
|
||||
"quote 1.0.7",
|
||||
"swc_macros_common",
|
||||
"syn 1.0.31",
|
||||
"syn 1.0.33",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2347,7 +2292,7 @@ dependencies = [
|
|||
"proc-macro2 1.0.18",
|
||||
"quote 1.0.7",
|
||||
"swc_macros_common",
|
||||
"syn 1.0.31",
|
||||
"syn 1.0.33",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2359,7 +2304,7 @@ dependencies = [
|
|||
"pmutil",
|
||||
"proc-macro2 1.0.18",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.31",
|
||||
"syn 1.0.33",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2375,13 +2320,13 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.31"
|
||||
version = "1.0.33"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5304cfdf27365b7585c25d4af91b35016ed21ef88f17ced89c7093b43dba8b6"
|
||||
checksum = "e8d5d96e8cbb005d6959f119f773bfaebb5684296108fb32600c00cde305b2cd"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.18",
|
||||
"quote 1.0.7",
|
||||
"unicode-xid 0.2.0",
|
||||
"unicode-xid 0.2.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2405,7 +2350,7 @@ dependencies = [
|
|||
"rand 0.7.3",
|
||||
"redox_syscall",
|
||||
"remove_dir_all",
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2462,7 +2407,7 @@ checksum = "bd80fc12f73063ac132ac92aceea36734f04a1d93c1240c6944e23a3b8841793"
|
|||
dependencies = [
|
||||
"proc-macro2 1.0.18",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.31",
|
||||
"syn 1.0.33",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2481,7 +2426,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2511,7 +2456,7 @@ dependencies = [
|
|||
"signal-hook-registry",
|
||||
"slab",
|
||||
"tokio-macros",
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2533,7 +2478,7 @@ checksum = "f0c3acc6aa564495a0f2e1d59fab677cd7f81a19994cfc7f3ad0e64301560389"
|
|||
dependencies = [
|
||||
"proc-macro2 1.0.18",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.31",
|
||||
"syn 1.0.33",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2677,9 +2622,9 @@ checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
|
|||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
|
||||
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
|
||||
|
||||
[[package]]
|
||||
name = "untrusted"
|
||||
|
@ -2778,7 +2723,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d"
|
||||
dependencies = [
|
||||
"same-file",
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
|
@ -2847,7 +2792,7 @@ dependencies = [
|
|||
"log 0.4.8",
|
||||
"proc-macro2 1.0.18",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.31",
|
||||
"syn 1.0.33",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
|
@ -2881,7 +2826,7 @@ checksum = "3156052d8ec77142051a533cdd686cba889537b213f948cd1d20869926e68e92"
|
|||
dependencies = [
|
||||
"proc-macro2 1.0.18",
|
||||
"quote 1.0.7",
|
||||
"syn 1.0.31",
|
||||
"syn 1.0.33",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
@ -2923,9 +2868,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "which"
|
||||
version = "4.0.0"
|
||||
version = "4.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bd3edc3cf5458851a4d6a2329232bd5f42c7f9bbe4c4782c4ef9ce37e5d101b2"
|
||||
checksum = "b5fe1a9cb33fe7cf77d431070d0223e544b1e4e7f7764bad0a3e691a6678a131"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"thiserror",
|
||||
|
@ -2939,9 +2884,9 @@ checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
|
|||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.8"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6"
|
||||
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
||||
dependencies = [
|
||||
"winapi-i686-pc-windows-gnu",
|
||||
"winapi-x86_64-pc-windows-gnu",
|
||||
|
@ -2965,7 +2910,7 @@ version = "0.1.5"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
|
||||
dependencies = [
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2980,7 +2925,7 @@ version = "0.7.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69"
|
||||
dependencies = [
|
||||
"winapi 0.3.8",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
@ -378,8 +378,7 @@ impl DenoInspector {
|
|||
let core_state_rc = deno_core::CoreIsolate::state(isolate);
|
||||
let core_state = core_state_rc.borrow();
|
||||
|
||||
let mut hs = v8::HandleScope::new(isolate);
|
||||
let scope = hs.enter();
|
||||
let scope = &mut v8::HandleScope::new(&mut **isolate);
|
||||
|
||||
let (new_websocket_tx, new_websocket_rx) =
|
||||
mpsc::unbounded::<WebSocketProxy>();
|
||||
|
@ -402,7 +401,7 @@ impl DenoInspector {
|
|||
|
||||
let sessions = InspectorSessions::new(self_ptr, new_websocket_rx);
|
||||
let flags = InspectorFlags::new();
|
||||
let waker = InspectorWaker::new(scope.isolate().thread_safe_handle());
|
||||
let waker = InspectorWaker::new(scope.thread_safe_handle());
|
||||
|
||||
Self {
|
||||
v8_inspector_client,
|
||||
|
|
|
@ -19,7 +19,7 @@ futures = { version = "0.3.5", features = ["thread-pool", "compat"] }
|
|||
lazy_static = "1.4.0"
|
||||
libc = "0.2.71"
|
||||
log = "0.4.8"
|
||||
rusty_v8 = "0.5.1"
|
||||
rusty_v8 = "0.6.0"
|
||||
serde_json = "1.0.55"
|
||||
url = "2.1.1"
|
||||
|
||||
|
|
452
core/bindings.rs
452
core/bindings.rs
|
@ -53,7 +53,7 @@ lazy_static! {
|
|||
}
|
||||
|
||||
pub fn script_origin<'a>(
|
||||
s: &mut impl v8::ToLocal<'a>,
|
||||
s: &mut v8::HandleScope<'a>,
|
||||
resource_name: v8::Local<'a, v8::String>,
|
||||
) -> v8::ScriptOrigin<'a> {
|
||||
let resource_line_offset = v8::Integer::new(s, 0);
|
||||
|
@ -78,7 +78,7 @@ pub fn script_origin<'a>(
|
|||
}
|
||||
|
||||
pub fn module_origin<'a>(
|
||||
s: &mut impl v8::ToLocal<'a>,
|
||||
s: &mut v8::HandleScope<'a>,
|
||||
resource_name: v8::Local<'a, v8::String>,
|
||||
) -> v8::ScriptOrigin<'a> {
|
||||
let resource_line_offset = v8::Integer::new(s, 0);
|
||||
|
@ -103,127 +103,92 @@ pub fn module_origin<'a>(
|
|||
}
|
||||
|
||||
pub fn initialize_context<'s>(
|
||||
scope: &mut impl v8::ToLocal<'s>,
|
||||
scope: &mut v8::HandleScope<'s, ()>,
|
||||
) -> v8::Local<'s, v8::Context> {
|
||||
let mut hs = v8::EscapableHandleScope::new(scope);
|
||||
let scope = hs.enter();
|
||||
let scope = &mut v8::EscapableHandleScope::new(scope);
|
||||
|
||||
let context = v8::Context::new(scope);
|
||||
let global = context.global(scope);
|
||||
|
||||
let mut cs = v8::ContextScope::new(scope, context);
|
||||
let scope = cs.enter();
|
||||
let scope = &mut v8::ContextScope::new(scope, context);
|
||||
|
||||
let deno_key = v8::String::new(scope, "Deno").unwrap();
|
||||
let deno_val = v8::Object::new(scope);
|
||||
global.set(
|
||||
context,
|
||||
v8::String::new(scope, "Deno").unwrap().into(),
|
||||
deno_val.into(),
|
||||
);
|
||||
global.set(scope, deno_key.into(), deno_val.into());
|
||||
|
||||
let mut core_val = v8::Object::new(scope);
|
||||
deno_val.set(
|
||||
context,
|
||||
v8::String::new(scope, "core").unwrap().into(),
|
||||
core_val.into(),
|
||||
);
|
||||
let core_key = v8::String::new(scope, "core").unwrap();
|
||||
let core_val = v8::Object::new(scope);
|
||||
deno_val.set(scope, core_key.into(), core_val.into());
|
||||
|
||||
let mut print_tmpl = v8::FunctionTemplate::new(scope, print);
|
||||
let print_val = print_tmpl.get_function(scope, context).unwrap();
|
||||
core_val.set(
|
||||
context,
|
||||
v8::String::new(scope, "print").unwrap().into(),
|
||||
print_val.into(),
|
||||
);
|
||||
let print_key = v8::String::new(scope, "print").unwrap();
|
||||
let print_tmpl = v8::FunctionTemplate::new(scope, print);
|
||||
let print_val = print_tmpl.get_function(scope).unwrap();
|
||||
core_val.set(scope, print_key.into(), print_val.into());
|
||||
|
||||
let mut recv_tmpl = v8::FunctionTemplate::new(scope, recv);
|
||||
let recv_val = recv_tmpl.get_function(scope, context).unwrap();
|
||||
core_val.set(
|
||||
context,
|
||||
v8::String::new(scope, "recv").unwrap().into(),
|
||||
recv_val.into(),
|
||||
);
|
||||
let recv_key = v8::String::new(scope, "recv").unwrap();
|
||||
let recv_tmpl = v8::FunctionTemplate::new(scope, recv);
|
||||
let recv_val = recv_tmpl.get_function(scope).unwrap();
|
||||
core_val.set(scope, recv_key.into(), recv_val.into());
|
||||
|
||||
let mut send_tmpl = v8::FunctionTemplate::new(scope, send);
|
||||
let send_val = send_tmpl.get_function(scope, context).unwrap();
|
||||
core_val.set(
|
||||
context,
|
||||
v8::String::new(scope, "send").unwrap().into(),
|
||||
send_val.into(),
|
||||
);
|
||||
let send_key = v8::String::new(scope, "send").unwrap();
|
||||
let send_tmpl = v8::FunctionTemplate::new(scope, send);
|
||||
let send_val = send_tmpl.get_function(scope).unwrap();
|
||||
core_val.set(scope, send_key.into(), send_val.into());
|
||||
|
||||
let mut set_macrotask_callback_tmpl =
|
||||
let set_macrotask_callback_key =
|
||||
v8::String::new(scope, "setMacrotaskCallback").unwrap();
|
||||
let set_macrotask_callback_tmpl =
|
||||
v8::FunctionTemplate::new(scope, set_macrotask_callback);
|
||||
let set_macrotask_callback_val = set_macrotask_callback_tmpl
|
||||
.get_function(scope, context)
|
||||
.unwrap();
|
||||
let set_macrotask_callback_val =
|
||||
set_macrotask_callback_tmpl.get_function(scope).unwrap();
|
||||
core_val.set(
|
||||
context,
|
||||
v8::String::new(scope, "setMacrotaskCallback")
|
||||
.unwrap()
|
||||
.into(),
|
||||
scope,
|
||||
set_macrotask_callback_key.into(),
|
||||
set_macrotask_callback_val.into(),
|
||||
);
|
||||
|
||||
let mut eval_context_tmpl = v8::FunctionTemplate::new(scope, eval_context);
|
||||
let eval_context_val =
|
||||
eval_context_tmpl.get_function(scope, context).unwrap();
|
||||
core_val.set(
|
||||
context,
|
||||
v8::String::new(scope, "evalContext").unwrap().into(),
|
||||
eval_context_val.into(),
|
||||
);
|
||||
let eval_context_key = v8::String::new(scope, "evalContext").unwrap();
|
||||
let eval_context_tmpl = v8::FunctionTemplate::new(scope, eval_context);
|
||||
let eval_context_val = eval_context_tmpl.get_function(scope).unwrap();
|
||||
core_val.set(scope, eval_context_key.into(), eval_context_val.into());
|
||||
|
||||
let mut format_error_tmpl = v8::FunctionTemplate::new(scope, format_error);
|
||||
let format_error_val =
|
||||
format_error_tmpl.get_function(scope, context).unwrap();
|
||||
core_val.set(
|
||||
context,
|
||||
v8::String::new(scope, "formatError").unwrap().into(),
|
||||
format_error_val.into(),
|
||||
);
|
||||
let format_error_key = v8::String::new(scope, "formatError").unwrap();
|
||||
let format_error_tmpl = v8::FunctionTemplate::new(scope, format_error);
|
||||
let format_error_val = format_error_tmpl.get_function(scope).unwrap();
|
||||
core_val.set(scope, format_error_key.into(), format_error_val.into());
|
||||
|
||||
let mut encode_tmpl = v8::FunctionTemplate::new(scope, encode);
|
||||
let encode_val = encode_tmpl.get_function(scope, context).unwrap();
|
||||
core_val.set(
|
||||
context,
|
||||
v8::String::new(scope, "encode").unwrap().into(),
|
||||
encode_val.into(),
|
||||
);
|
||||
let encode_key = v8::String::new(scope, "encode").unwrap();
|
||||
let encode_tmpl = v8::FunctionTemplate::new(scope, encode);
|
||||
let encode_val = encode_tmpl.get_function(scope).unwrap();
|
||||
core_val.set(scope, encode_key.into(), encode_val.into());
|
||||
|
||||
let mut decode_tmpl = v8::FunctionTemplate::new(scope, decode);
|
||||
let decode_val = decode_tmpl.get_function(scope, context).unwrap();
|
||||
core_val.set(
|
||||
context,
|
||||
v8::String::new(scope, "decode").unwrap().into(),
|
||||
decode_val.into(),
|
||||
);
|
||||
let decode_key = v8::String::new(scope, "decode").unwrap();
|
||||
let decode_tmpl = v8::FunctionTemplate::new(scope, decode);
|
||||
let decode_val = decode_tmpl.get_function(scope).unwrap();
|
||||
core_val.set(scope, decode_key.into(), decode_val.into());
|
||||
|
||||
let mut get_promise_details_tmpl =
|
||||
let get_promise_details_key =
|
||||
v8::String::new(scope, "getPromiseDetails").unwrap();
|
||||
let get_promise_details_tmpl =
|
||||
v8::FunctionTemplate::new(scope, get_promise_details);
|
||||
let get_promise_details_val = get_promise_details_tmpl
|
||||
.get_function(scope, context)
|
||||
.unwrap();
|
||||
let get_promise_details_val =
|
||||
get_promise_details_tmpl.get_function(scope).unwrap();
|
||||
core_val.set(
|
||||
context,
|
||||
v8::String::new(scope, "getPromiseDetails").unwrap().into(),
|
||||
scope,
|
||||
get_promise_details_key.into(),
|
||||
get_promise_details_val.into(),
|
||||
);
|
||||
|
||||
core_val.set_accessor(
|
||||
context,
|
||||
v8::String::new(scope, "shared").unwrap().into(),
|
||||
shared_getter,
|
||||
);
|
||||
let shared_key = v8::String::new(scope, "shared").unwrap();
|
||||
core_val.set_accessor(scope, shared_key.into(), shared_getter);
|
||||
|
||||
// Direct bindings on `window`.
|
||||
let mut queue_microtask_tmpl =
|
||||
v8::FunctionTemplate::new(scope, queue_microtask);
|
||||
let queue_microtask_val =
|
||||
queue_microtask_tmpl.get_function(scope, context).unwrap();
|
||||
let queue_microtask_key = v8::String::new(scope, "queueMicrotask").unwrap();
|
||||
let queue_microtask_tmpl = v8::FunctionTemplate::new(scope, queue_microtask);
|
||||
let queue_microtask_val = queue_microtask_tmpl.get_function(scope).unwrap();
|
||||
global.set(
|
||||
context,
|
||||
v8::String::new(scope, "queueMicrotask").unwrap().into(),
|
||||
scope,
|
||||
queue_microtask_key.into(),
|
||||
queue_microtask_val.into(),
|
||||
);
|
||||
|
||||
|
@ -231,7 +196,7 @@ pub fn initialize_context<'s>(
|
|||
}
|
||||
|
||||
pub fn boxed_slice_to_uint8array<'sc>(
|
||||
scope: &mut impl v8::ToLocal<'sc>,
|
||||
scope: &mut v8::HandleScope<'sc>,
|
||||
buf: Box<[u8]>,
|
||||
) -> v8::Local<'sc, v8::Uint8Array> {
|
||||
assert!(!buf.is_empty());
|
||||
|
@ -248,9 +213,7 @@ pub extern "C" fn host_import_module_dynamically_callback(
|
|||
referrer: v8::Local<v8::ScriptOrModule>,
|
||||
specifier: v8::Local<v8::String>,
|
||||
) -> *mut v8::Promise {
|
||||
let mut cbs = v8::CallbackScope::new_escapable(context);
|
||||
let mut hs = v8::EscapableHandleScope::new(cbs.enter());
|
||||
let scope = hs.enter();
|
||||
let scope = &mut unsafe { v8::CallbackScope::new(context) };
|
||||
|
||||
// NOTE(bartlomieju): will crash for non-UTF-8 specifier
|
||||
let specifier_str = specifier
|
||||
|
@ -269,19 +232,19 @@ pub extern "C" fn host_import_module_dynamically_callback(
|
|||
let host_defined_options = referrer.get_host_defined_options();
|
||||
assert_eq!(host_defined_options.length(), 0);
|
||||
|
||||
let resolver = v8::PromiseResolver::new(scope, context).unwrap();
|
||||
let resolver = v8::PromiseResolver::new(scope).unwrap();
|
||||
let promise = resolver.get_promise(scope);
|
||||
|
||||
let mut resolver_handle = v8::Global::new();
|
||||
resolver_handle.set(scope, resolver);
|
||||
|
||||
{
|
||||
let state_rc = EsIsolate::state(scope.isolate());
|
||||
let state_rc = EsIsolate::state(scope);
|
||||
let mut state = state_rc.borrow_mut();
|
||||
state.dyn_import_cb(resolver_handle, &specifier_str, &referrer_name_str);
|
||||
}
|
||||
|
||||
&mut *scope.escape(promise)
|
||||
&*promise as *const _ as *mut _
|
||||
}
|
||||
|
||||
pub extern "C" fn host_initialize_import_meta_object_callback(
|
||||
|
@ -289,10 +252,8 @@ pub extern "C" fn host_initialize_import_meta_object_callback(
|
|||
module: v8::Local<v8::Module>,
|
||||
meta: v8::Local<v8::Object>,
|
||||
) {
|
||||
let mut cbs = v8::CallbackScope::new(context);
|
||||
let mut hs = v8::HandleScope::new(cbs.enter());
|
||||
let scope = hs.enter();
|
||||
let state_rc = EsIsolate::state(scope.isolate());
|
||||
let scope = &mut unsafe { v8::CallbackScope::new(context) };
|
||||
let state_rc = EsIsolate::state(scope);
|
||||
let state = state_rc.borrow();
|
||||
|
||||
let id = module.get_identity_hash();
|
||||
|
@ -300,30 +261,21 @@ pub extern "C" fn host_initialize_import_meta_object_callback(
|
|||
|
||||
let info = state.modules.get_info(id).expect("Module not found");
|
||||
|
||||
meta.create_data_property(
|
||||
context,
|
||||
v8::String::new(scope, "url").unwrap().into(),
|
||||
v8::String::new(scope, &info.name).unwrap().into(),
|
||||
);
|
||||
meta.create_data_property(
|
||||
context,
|
||||
v8::String::new(scope, "main").unwrap().into(),
|
||||
v8::Boolean::new(scope, info.main).into(),
|
||||
);
|
||||
let url_key = v8::String::new(scope, "url").unwrap();
|
||||
let url_val = v8::String::new(scope, &info.name).unwrap();
|
||||
meta.create_data_property(scope, url_key.into(), url_val.into());
|
||||
|
||||
let main_key = v8::String::new(scope, "main").unwrap();
|
||||
let main_val = v8::Boolean::new(scope, info.main);
|
||||
meta.create_data_property(scope, main_key.into(), main_val.into());
|
||||
}
|
||||
|
||||
pub extern "C" fn promise_reject_callback(message: v8::PromiseRejectMessage) {
|
||||
let mut cbs = v8::CallbackScope::new(&message);
|
||||
let mut hs = v8::HandleScope::new(cbs.enter());
|
||||
let scope = hs.enter();
|
||||
let scope = &mut unsafe { v8::CallbackScope::new(&message) };
|
||||
|
||||
let state_rc = CoreIsolate::state(scope.isolate());
|
||||
let state_rc = CoreIsolate::state(scope);
|
||||
let mut state = state_rc.borrow_mut();
|
||||
|
||||
let context = state.global_context.get(scope).unwrap();
|
||||
let mut cs = v8::ContextScope::new(scope, context);
|
||||
let scope = cs.enter();
|
||||
|
||||
let promise = message.get_promise();
|
||||
let promise_id = promise.get_identity_hash();
|
||||
|
||||
|
@ -374,7 +326,7 @@ pub(crate) unsafe fn get_backing_store_slice_mut(
|
|||
}
|
||||
|
||||
fn print(
|
||||
scope: v8::FunctionCallbackScope,
|
||||
scope: &mut v8::HandleScope,
|
||||
args: v8::FunctionCallbackArguments,
|
||||
_rv: v8::ReturnValue,
|
||||
) {
|
||||
|
@ -384,9 +336,6 @@ fn print(
|
|||
let obj = args.get(0);
|
||||
let is_err_arg = args.get(1);
|
||||
|
||||
let mut hs = v8::HandleScope::new(scope);
|
||||
let scope = hs.enter();
|
||||
|
||||
let mut is_err = false;
|
||||
if arg_len == 2 {
|
||||
let int_val = is_err_arg
|
||||
|
@ -394,30 +343,29 @@ fn print(
|
|||
.expect("Unable to convert to integer");
|
||||
is_err = int_val != 0;
|
||||
};
|
||||
let mut try_catch = v8::TryCatch::new(scope);
|
||||
let _tc = try_catch.enter();
|
||||
let str_ = match obj.to_string(scope) {
|
||||
let tc_scope = &mut v8::TryCatch::new(scope);
|
||||
let str_ = match obj.to_string(tc_scope) {
|
||||
Some(s) => s,
|
||||
None => v8::String::new(scope, "").unwrap(),
|
||||
None => v8::String::new(tc_scope, "").unwrap(),
|
||||
};
|
||||
if is_err {
|
||||
eprint!("{}", str_.to_rust_string_lossy(scope));
|
||||
eprint!("{}", str_.to_rust_string_lossy(tc_scope));
|
||||
} else {
|
||||
print!("{}", str_.to_rust_string_lossy(scope));
|
||||
print!("{}", str_.to_rust_string_lossy(tc_scope));
|
||||
}
|
||||
}
|
||||
|
||||
fn recv(
|
||||
scope: v8::FunctionCallbackScope,
|
||||
scope: &mut v8::HandleScope,
|
||||
args: v8::FunctionCallbackArguments,
|
||||
_rv: v8::ReturnValue,
|
||||
) {
|
||||
let state_rc = CoreIsolate::state(scope.isolate());
|
||||
let state_rc = CoreIsolate::state(scope);
|
||||
let mut state = state_rc.borrow_mut();
|
||||
|
||||
if !state.js_recv_cb.is_empty() {
|
||||
let msg = v8::String::new(scope, "Deno.core.recv already called.").unwrap();
|
||||
scope.isolate().throw_exception(msg.into());
|
||||
scope.throw_exception(msg.into());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -426,7 +374,7 @@ fn recv(
|
|||
}
|
||||
|
||||
fn send(
|
||||
scope: v8::FunctionCallbackScope,
|
||||
scope: &mut v8::HandleScope,
|
||||
args: v8::FunctionCallbackArguments,
|
||||
mut rv: v8::ReturnValue,
|
||||
) {
|
||||
|
@ -435,7 +383,7 @@ fn send(
|
|||
Err(err) => {
|
||||
let msg = format!("invalid op id: {}", err);
|
||||
let msg = v8::String::new(scope, &msg).unwrap();
|
||||
scope.isolate().throw_exception(msg.into());
|
||||
scope.throw_exception(msg.into());
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
@ -453,7 +401,7 @@ fn send(
|
|||
Err(_) => &[],
|
||||
};
|
||||
|
||||
let state_rc = CoreIsolate::state(scope.isolate());
|
||||
let state_rc = CoreIsolate::state(scope);
|
||||
let mut state = state_rc.borrow_mut();
|
||||
assert!(!state.global_context.is_empty());
|
||||
|
||||
|
@ -493,7 +441,7 @@ fn send(
|
|||
let maybe_response = match buf_iter_result {
|
||||
Ok(bufs) => state.dispatch_op(scope, op_id, control, bufs),
|
||||
Err(exc) => {
|
||||
scope.isolate().throw_exception(exc);
|
||||
scope.throw_exception(exc);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
@ -511,18 +459,18 @@ fn send(
|
|||
}
|
||||
|
||||
fn set_macrotask_callback(
|
||||
scope: v8::FunctionCallbackScope,
|
||||
scope: &mut v8::HandleScope,
|
||||
args: v8::FunctionCallbackArguments,
|
||||
_rv: v8::ReturnValue,
|
||||
) {
|
||||
let state_rc = CoreIsolate::state(scope.isolate());
|
||||
let state_rc = CoreIsolate::state(scope);
|
||||
let mut state = state_rc.borrow_mut();
|
||||
|
||||
if !state.js_macrotask_cb.is_empty() {
|
||||
let msg =
|
||||
v8::String::new(scope, "Deno.core.setMacrotaskCallback already called.")
|
||||
.unwrap();
|
||||
scope.isolate().throw_exception(msg.into());
|
||||
scope.throw_exception(msg.into());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -532,23 +480,16 @@ fn set_macrotask_callback(
|
|||
}
|
||||
|
||||
fn eval_context(
|
||||
scope: v8::FunctionCallbackScope,
|
||||
scope: &mut v8::HandleScope,
|
||||
args: v8::FunctionCallbackArguments,
|
||||
mut rv: v8::ReturnValue,
|
||||
) {
|
||||
let state_rc = CoreIsolate::state(scope.isolate());
|
||||
let context = {
|
||||
let state = state_rc.borrow();
|
||||
assert!(!state.global_context.is_empty());
|
||||
state.global_context.get(scope).unwrap()
|
||||
};
|
||||
|
||||
let source = match v8::Local::<v8::String>::try_from(args.get(0)) {
|
||||
Ok(s) => s,
|
||||
Err(_) => {
|
||||
let msg = v8::String::new(scope, "Invalid argument").unwrap();
|
||||
let exception = v8::Exception::type_error(scope, msg);
|
||||
scope.isolate().throw_exception(exception);
|
||||
scope.throw_exception(exception);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
@ -566,116 +507,108 @@ fn eval_context(
|
|||
isCompileError: boolean,
|
||||
}
|
||||
*/
|
||||
let mut try_catch = v8::TryCatch::new(scope);
|
||||
let tc = try_catch.enter();
|
||||
let tc_scope = &mut v8::TryCatch::new(scope);
|
||||
let name =
|
||||
v8::String::new(scope, url.as_ref().map_or("<unknown>", Url::as_str))
|
||||
v8::String::new(tc_scope, url.as_ref().map_or("<unknown>", Url::as_str))
|
||||
.unwrap();
|
||||
let origin = script_origin(scope, name);
|
||||
let maybe_script = v8::Script::compile(scope, context, source, Some(&origin));
|
||||
let origin = script_origin(tc_scope, name);
|
||||
let maybe_script = v8::Script::compile(tc_scope, source, Some(&origin));
|
||||
|
||||
if maybe_script.is_none() {
|
||||
assert!(tc.has_caught());
|
||||
let exception = tc.exception(scope).unwrap();
|
||||
assert!(tc_scope.has_caught());
|
||||
let exception = tc_scope.exception().unwrap();
|
||||
|
||||
output.set(
|
||||
context,
|
||||
v8::Integer::new(scope, 0).into(),
|
||||
v8::null(scope).into(),
|
||||
);
|
||||
let js_zero = v8::Integer::new(tc_scope, 0);
|
||||
let js_null = v8::null(tc_scope);
|
||||
output.set(tc_scope, js_zero.into(), js_null.into());
|
||||
|
||||
let errinfo_obj = v8::Object::new(scope);
|
||||
let errinfo_obj = v8::Object::new(tc_scope);
|
||||
|
||||
let is_compile_error_key =
|
||||
v8::String::new(tc_scope, "isCompileError").unwrap();
|
||||
let is_compile_error_val = v8::Boolean::new(tc_scope, true);
|
||||
errinfo_obj.set(
|
||||
context,
|
||||
v8::String::new(scope, "isCompileError").unwrap().into(),
|
||||
v8::Boolean::new(scope, true).into(),
|
||||
tc_scope,
|
||||
is_compile_error_key.into(),
|
||||
is_compile_error_val.into(),
|
||||
);
|
||||
|
||||
let is_native_error_key =
|
||||
v8::String::new(tc_scope, "isNativeError").unwrap();
|
||||
let is_native_error_val =
|
||||
v8::Boolean::new(tc_scope, exception.is_native_error());
|
||||
errinfo_obj.set(
|
||||
context,
|
||||
v8::String::new(scope, "isNativeError").unwrap().into(),
|
||||
v8::Boolean::new(scope, exception.is_native_error()).into(),
|
||||
tc_scope,
|
||||
is_native_error_key.into(),
|
||||
is_native_error_val.into(),
|
||||
);
|
||||
|
||||
errinfo_obj.set(
|
||||
context,
|
||||
v8::String::new(scope, "thrown").unwrap().into(),
|
||||
exception,
|
||||
);
|
||||
let thrown_key = v8::String::new(tc_scope, "thrown").unwrap();
|
||||
errinfo_obj.set(tc_scope, thrown_key.into(), exception);
|
||||
|
||||
output.set(
|
||||
context,
|
||||
v8::Integer::new(scope, 1).into(),
|
||||
errinfo_obj.into(),
|
||||
);
|
||||
let js_one = v8::Integer::new(tc_scope, 1);
|
||||
output.set(tc_scope, js_one.into(), errinfo_obj.into());
|
||||
|
||||
rv.set(output.into());
|
||||
return;
|
||||
}
|
||||
|
||||
let result = maybe_script.unwrap().run(scope, context);
|
||||
let result = maybe_script.unwrap().run(tc_scope);
|
||||
|
||||
if result.is_none() {
|
||||
assert!(tc.has_caught());
|
||||
let exception = tc.exception(scope).unwrap();
|
||||
assert!(tc_scope.has_caught());
|
||||
let exception = tc_scope.exception().unwrap();
|
||||
|
||||
output.set(
|
||||
context,
|
||||
v8::Integer::new(scope, 0).into(),
|
||||
v8::null(scope).into(),
|
||||
);
|
||||
let js_zero = v8::Integer::new(tc_scope, 0);
|
||||
let js_null = v8::null(tc_scope);
|
||||
output.set(tc_scope, js_zero.into(), js_null.into());
|
||||
|
||||
let errinfo_obj = v8::Object::new(scope);
|
||||
let errinfo_obj = v8::Object::new(tc_scope);
|
||||
|
||||
let is_compile_error_key =
|
||||
v8::String::new(tc_scope, "isCompileError").unwrap();
|
||||
let is_compile_error_val = v8::Boolean::new(tc_scope, false);
|
||||
errinfo_obj.set(
|
||||
context,
|
||||
v8::String::new(scope, "isCompileError").unwrap().into(),
|
||||
v8::Boolean::new(scope, false).into(),
|
||||
tc_scope,
|
||||
is_compile_error_key.into(),
|
||||
is_compile_error_val.into(),
|
||||
);
|
||||
|
||||
let is_native_error = if exception.is_native_error() {
|
||||
v8::Boolean::new(scope, true)
|
||||
} else {
|
||||
v8::Boolean::new(scope, false)
|
||||
};
|
||||
|
||||
let is_native_error_key =
|
||||
v8::String::new(tc_scope, "isNativeError").unwrap();
|
||||
let is_native_error_val =
|
||||
v8::Boolean::new(tc_scope, exception.is_native_error());
|
||||
errinfo_obj.set(
|
||||
context,
|
||||
v8::String::new(scope, "isNativeError").unwrap().into(),
|
||||
is_native_error.into(),
|
||||
tc_scope,
|
||||
is_native_error_key.into(),
|
||||
is_native_error_val.into(),
|
||||
);
|
||||
|
||||
errinfo_obj.set(
|
||||
context,
|
||||
v8::String::new(scope, "thrown").unwrap().into(),
|
||||
exception,
|
||||
);
|
||||
let thrown_key = v8::String::new(tc_scope, "thrown").unwrap();
|
||||
errinfo_obj.set(tc_scope, thrown_key.into(), exception);
|
||||
|
||||
output.set(
|
||||
context,
|
||||
v8::Integer::new(scope, 1).into(),
|
||||
errinfo_obj.into(),
|
||||
);
|
||||
let js_one = v8::Integer::new(tc_scope, 1);
|
||||
output.set(tc_scope, js_one.into(), errinfo_obj.into());
|
||||
|
||||
rv.set(output.into());
|
||||
return;
|
||||
}
|
||||
|
||||
output.set(context, v8::Integer::new(scope, 0).into(), result.unwrap());
|
||||
output.set(
|
||||
context,
|
||||
v8::Integer::new(scope, 1).into(),
|
||||
v8::null(scope).into(),
|
||||
);
|
||||
let js_zero = v8::Integer::new(tc_scope, 0);
|
||||
let js_one = v8::Integer::new(tc_scope, 1);
|
||||
let js_null = v8::null(tc_scope);
|
||||
output.set(tc_scope, js_zero.into(), result.unwrap());
|
||||
output.set(tc_scope, js_one.into(), js_null.into());
|
||||
rv.set(output.into());
|
||||
}
|
||||
|
||||
fn format_error(
|
||||
scope: v8::FunctionCallbackScope,
|
||||
scope: &mut v8::HandleScope,
|
||||
args: v8::FunctionCallbackArguments,
|
||||
mut rv: v8::ReturnValue,
|
||||
) {
|
||||
let e = JSError::from_v8_exception(scope, args.get(0));
|
||||
let state_rc = CoreIsolate::state(scope.isolate());
|
||||
let state_rc = CoreIsolate::state(scope);
|
||||
let state = state_rc.borrow();
|
||||
let e = (state.js_error_create_fn)(e);
|
||||
let e = e.to_string();
|
||||
|
@ -684,7 +617,7 @@ fn format_error(
|
|||
}
|
||||
|
||||
fn encode(
|
||||
scope: v8::FunctionCallbackScope,
|
||||
scope: &mut v8::HandleScope,
|
||||
args: v8::FunctionCallbackArguments,
|
||||
mut rv: v8::ReturnValue,
|
||||
) {
|
||||
|
@ -693,7 +626,7 @@ fn encode(
|
|||
Err(_) => {
|
||||
let msg = v8::String::new(scope, "Invalid argument").unwrap();
|
||||
let exception = v8::Exception::type_error(scope, msg);
|
||||
scope.isolate().throw_exception(exception);
|
||||
scope.throw_exception(exception);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
@ -717,7 +650,7 @@ fn encode(
|
|||
}
|
||||
|
||||
fn decode(
|
||||
scope: v8::FunctionCallbackScope,
|
||||
scope: &mut v8::HandleScope,
|
||||
args: v8::FunctionCallbackArguments,
|
||||
mut rv: v8::ReturnValue,
|
||||
) {
|
||||
|
@ -726,7 +659,7 @@ fn decode(
|
|||
Err(_) => {
|
||||
let msg = v8::String::new(scope, "Invalid argument").unwrap();
|
||||
let exception = v8::Exception::type_error(scope, msg);
|
||||
scope.isolate().throw_exception(exception);
|
||||
scope.throw_exception(exception);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
@ -746,27 +679,27 @@ fn decode(
|
|||
}
|
||||
|
||||
fn queue_microtask(
|
||||
scope: v8::FunctionCallbackScope,
|
||||
scope: &mut v8::HandleScope,
|
||||
args: v8::FunctionCallbackArguments,
|
||||
_rv: v8::ReturnValue,
|
||||
) {
|
||||
match v8::Local::<v8::Function>::try_from(args.get(0)) {
|
||||
Ok(f) => scope.isolate().enqueue_microtask(f),
|
||||
Ok(f) => scope.enqueue_microtask(f),
|
||||
Err(_) => {
|
||||
let msg = v8::String::new(scope, "Invalid argument").unwrap();
|
||||
let exception = v8::Exception::type_error(scope, msg);
|
||||
scope.isolate().throw_exception(exception);
|
||||
scope.throw_exception(exception);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
fn shared_getter(
|
||||
scope: v8::PropertyCallbackScope,
|
||||
scope: &mut v8::HandleScope,
|
||||
_name: v8::Local<v8::Name>,
|
||||
_args: v8::PropertyCallbackArguments,
|
||||
mut rv: v8::ReturnValue,
|
||||
) {
|
||||
let state_rc = CoreIsolate::state(scope.isolate());
|
||||
let state_rc = CoreIsolate::state(scope);
|
||||
let mut state = state_rc.borrow_mut();
|
||||
|
||||
// Lazily initialize the persistent external ArrayBuffer.
|
||||
|
@ -787,11 +720,9 @@ pub fn module_resolve_callback<'s>(
|
|||
specifier: v8::Local<'s, v8::String>,
|
||||
referrer: v8::Local<'s, v8::Module>,
|
||||
) -> Option<v8::Local<'s, v8::Module>> {
|
||||
let mut scope = v8::CallbackScope::new_escapable(context);
|
||||
let mut scope = v8::EscapableHandleScope::new(scope.enter());
|
||||
let scope = scope.enter();
|
||||
let scope = &mut unsafe { v8::CallbackScope::new(context) };
|
||||
|
||||
let state_rc = EsIsolate::state(scope.isolate());
|
||||
let state_rc = EsIsolate::state(scope);
|
||||
let mut state = state_rc.borrow_mut();
|
||||
|
||||
let referrer_id = referrer.get_identity_hash();
|
||||
|
@ -819,13 +750,11 @@ pub fn module_resolve_callback<'s>(
|
|||
req_str, referrer_name
|
||||
);
|
||||
let msg = v8::String::new(scope, &msg).unwrap();
|
||||
scope.isolate().throw_exception(msg.into());
|
||||
scope.throw_exception(msg.into());
|
||||
break;
|
||||
}
|
||||
|
||||
return maybe_info
|
||||
.and_then(|i| i.handle.get(scope))
|
||||
.map(|m| scope.escape(m));
|
||||
return maybe_info.and_then(|i| i.handle.get(scope));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -833,26 +762,21 @@ pub fn module_resolve_callback<'s>(
|
|||
}
|
||||
|
||||
// Returns promise details or throw TypeError, if argument passed isn't a Promise.
|
||||
// Promise details is a two elements array.
|
||||
// Promise details is a js_two elements array.
|
||||
// promise_details = [State, Result]
|
||||
// State = enum { Pending = 0, Fulfilled = 1, Rejected = 2}
|
||||
// Result = PromiseResult<T> | PromiseError
|
||||
fn get_promise_details(
|
||||
scope: v8::FunctionCallbackScope,
|
||||
scope: &mut v8::HandleScope,
|
||||
args: v8::FunctionCallbackArguments,
|
||||
mut rv: v8::ReturnValue,
|
||||
) {
|
||||
let state_rc = CoreIsolate::state(scope.isolate());
|
||||
let state = state_rc.borrow();
|
||||
assert!(!state.global_context.is_empty());
|
||||
let context = state.global_context.get(scope).unwrap();
|
||||
|
||||
let promise = match v8::Local::<v8::Promise>::try_from(args.get(0)) {
|
||||
Ok(val) => val,
|
||||
Err(_) => {
|
||||
let msg = v8::String::new(scope, "Invalid argument").unwrap();
|
||||
let exception = v8::Exception::type_error(scope, msg);
|
||||
scope.isolate().throw_exception(exception);
|
||||
scope.throw_exception(exception);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
@ -861,37 +785,25 @@ fn get_promise_details(
|
|||
|
||||
match promise.state() {
|
||||
v8::PromiseState::Pending => {
|
||||
promise_details.set(
|
||||
context,
|
||||
v8::Integer::new(scope, 0).into(),
|
||||
v8::Integer::new(scope, 0).into(),
|
||||
);
|
||||
let js_zero = v8::Integer::new(scope, 0);
|
||||
promise_details.set(scope, js_zero.into(), js_zero.into());
|
||||
rv.set(promise_details.into());
|
||||
}
|
||||
v8::PromiseState::Fulfilled => {
|
||||
promise_details.set(
|
||||
context,
|
||||
v8::Integer::new(scope, 0).into(),
|
||||
v8::Integer::new(scope, 1).into(),
|
||||
);
|
||||
promise_details.set(
|
||||
context,
|
||||
v8::Integer::new(scope, 1).into(),
|
||||
promise.result(scope),
|
||||
);
|
||||
let js_zero = v8::Integer::new(scope, 0);
|
||||
let js_one = v8::Integer::new(scope, 1);
|
||||
let promise_result = promise.result(scope);
|
||||
promise_details.set(scope, js_zero.into(), js_one.into());
|
||||
promise_details.set(scope, js_one.into(), promise_result);
|
||||
rv.set(promise_details.into());
|
||||
}
|
||||
v8::PromiseState::Rejected => {
|
||||
promise_details.set(
|
||||
context,
|
||||
v8::Integer::new(scope, 0).into(),
|
||||
v8::Integer::new(scope, 2).into(),
|
||||
);
|
||||
promise_details.set(
|
||||
context,
|
||||
v8::Integer::new(scope, 1).into(),
|
||||
promise.result(scope),
|
||||
);
|
||||
let js_zero = v8::Integer::new(scope, 0);
|
||||
let js_one = v8::Integer::new(scope, 1);
|
||||
let js_two = v8::Integer::new(scope, 2);
|
||||
let promise_result = promise.result(scope);
|
||||
promise_details.set(scope, js_zero.into(), js_two.into());
|
||||
promise_details.set(scope, js_one.into(), promise_result);
|
||||
rv.set(promise_details.into());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,14 +109,6 @@ pub struct CoreIsolateState {
|
|||
waker: AtomicWaker,
|
||||
}
|
||||
|
||||
// TODO(ry) The trait v8::InIsolate is superfluous. HandleScope::new should just
|
||||
// take &mut v8::Isolate.
|
||||
impl v8::InIsolate for CoreIsolate {
|
||||
fn isolate(&mut self) -> &mut v8::Isolate {
|
||||
self.v8_isolate.as_mut().unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
impl Deref for CoreIsolate {
|
||||
type Target = v8::Isolate;
|
||||
fn deref(&self) -> &v8::Isolate {
|
||||
|
@ -193,14 +185,12 @@ impl CoreIsolate {
|
|||
v8::SnapshotCreator::new(Some(&bindings::EXTERNAL_REFERENCES));
|
||||
let isolate = unsafe { creator.get_owned_isolate() };
|
||||
let mut isolate = CoreIsolate::setup_isolate(isolate);
|
||||
|
||||
let mut hs = v8::HandleScope::new(&mut isolate);
|
||||
let scope = hs.enter();
|
||||
|
||||
let context = bindings::initialize_context(scope);
|
||||
global_context.set(scope, context);
|
||||
creator.set_default_context(context);
|
||||
|
||||
{
|
||||
let scope = &mut v8::HandleScope::new(&mut isolate);
|
||||
let context = bindings::initialize_context(scope);
|
||||
global_context.set(scope, context);
|
||||
creator.set_default_context(context);
|
||||
}
|
||||
(isolate, Some(creator))
|
||||
} else {
|
||||
let mut params = v8::Isolate::create_params()
|
||||
|
@ -218,19 +208,17 @@ impl CoreIsolate {
|
|||
|
||||
let isolate = v8::Isolate::new(params);
|
||||
let mut isolate = CoreIsolate::setup_isolate(isolate);
|
||||
|
||||
let mut hs = v8::HandleScope::new(&mut isolate);
|
||||
let scope = hs.enter();
|
||||
|
||||
let context = if snapshot_loaded {
|
||||
v8::Context::new(scope)
|
||||
} else {
|
||||
// If no snapshot is provided, we initialize the context with empty
|
||||
// main source code and source maps.
|
||||
bindings::initialize_context(scope)
|
||||
};
|
||||
global_context.set(scope, context);
|
||||
|
||||
{
|
||||
let scope = &mut v8::HandleScope::new(&mut isolate);
|
||||
let context = if snapshot_loaded {
|
||||
v8::Context::new(scope)
|
||||
} else {
|
||||
// If no snapshot is provided, we initialize the context with empty
|
||||
// main source code and source maps.
|
||||
bindings::initialize_context(scope)
|
||||
};
|
||||
global_context.set(scope, context);
|
||||
}
|
||||
(isolate, None)
|
||||
};
|
||||
|
||||
|
@ -297,11 +285,9 @@ impl CoreIsolate {
|
|||
let state_rc = Self::state(self);
|
||||
let state = state_rc.borrow();
|
||||
|
||||
let mut hs = v8::HandleScope::new(self.v8_isolate.as_mut().unwrap());
|
||||
let scope = hs.enter();
|
||||
let scope = &mut v8::HandleScope::new(self.v8_isolate.as_mut().unwrap());
|
||||
let context = state.global_context.get(scope).unwrap();
|
||||
let mut cs = v8::ContextScope::new(scope, context);
|
||||
let scope = cs.enter();
|
||||
let scope = &mut v8::ContextScope::new(scope, context);
|
||||
|
||||
drop(state);
|
||||
|
||||
|
@ -309,24 +295,22 @@ impl CoreIsolate {
|
|||
let name = v8::String::new(scope, js_filename).unwrap();
|
||||
let origin = bindings::script_origin(scope, name);
|
||||
|
||||
let mut try_catch = v8::TryCatch::new(scope);
|
||||
let tc = try_catch.enter();
|
||||
let tc_scope = &mut v8::TryCatch::new(scope);
|
||||
|
||||
let mut script =
|
||||
match v8::Script::compile(scope, context, source, Some(&origin)) {
|
||||
Some(script) => script,
|
||||
None => {
|
||||
let exception = tc.exception(scope).unwrap();
|
||||
return exception_to_err_result(scope, exception);
|
||||
}
|
||||
};
|
||||
let script = match v8::Script::compile(tc_scope, source, Some(&origin)) {
|
||||
Some(script) => script,
|
||||
None => {
|
||||
let exception = tc_scope.exception().unwrap();
|
||||
return exception_to_err_result(tc_scope, exception);
|
||||
}
|
||||
};
|
||||
|
||||
match script.run(scope, context) {
|
||||
match script.run(tc_scope) {
|
||||
Some(_) => Ok(()),
|
||||
None => {
|
||||
assert!(tc.has_caught());
|
||||
let exception = tc.exception(scope).unwrap();
|
||||
exception_to_err_result(scope, exception)
|
||||
assert!(tc_scope.has_caught());
|
||||
let exception = tc_scope.exception().unwrap();
|
||||
exception_to_err_result(tc_scope, exception)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -346,8 +330,7 @@ impl CoreIsolate {
|
|||
// TODO(piscisaureus): The rusty_v8 type system should enforce this.
|
||||
{
|
||||
let v8_isolate = self.v8_isolate.as_mut().unwrap();
|
||||
let mut hs = v8::HandleScope::new(v8_isolate);
|
||||
let scope = hs.enter();
|
||||
let scope = &mut v8::HandleScope::new(v8_isolate);
|
||||
state.borrow_mut().global_context.reset(scope);
|
||||
}
|
||||
|
||||
|
@ -388,14 +371,12 @@ impl Future for CoreIsolate {
|
|||
state.waker.register(cx.waker());
|
||||
}
|
||||
|
||||
let mut hs = v8::HandleScope::new(core_isolate);
|
||||
let scope = hs.enter();
|
||||
let scope = &mut v8::HandleScope::new(&mut **core_isolate);
|
||||
let context = {
|
||||
let state = state_rc.borrow();
|
||||
state.global_context.get(scope).unwrap()
|
||||
};
|
||||
let mut cs = v8::ContextScope::new(scope, context);
|
||||
let scope = cs.enter();
|
||||
let scope = &mut v8::ContextScope::new(scope, context);
|
||||
|
||||
check_promise_exceptions(scope)?;
|
||||
|
||||
|
@ -502,7 +483,7 @@ impl CoreIsolateState {
|
|||
|
||||
pub fn dispatch_op<'s>(
|
||||
&mut self,
|
||||
scope: &mut impl v8::ToLocal<'s>,
|
||||
scope: &mut v8::HandleScope<'s>,
|
||||
op_id: OpId,
|
||||
control_buf: &[u8],
|
||||
zero_copy_bufs: &mut [ZeroCopyBuf],
|
||||
|
@ -513,7 +494,7 @@ impl CoreIsolateState {
|
|||
let message =
|
||||
v8::String::new(scope, &format!("Unknown op id: {}", op_id)).unwrap();
|
||||
let exception = v8::Exception::type_error(scope, message);
|
||||
scope.isolate().throw_exception(exception);
|
||||
scope.throw_exception(exception);
|
||||
return None;
|
||||
};
|
||||
|
||||
|
@ -542,13 +523,13 @@ impl CoreIsolateState {
|
|||
}
|
||||
|
||||
fn async_op_response<'s>(
|
||||
scope: &mut impl v8::ToLocal<'s>,
|
||||
scope: &mut v8::HandleScope<'s>,
|
||||
maybe_buf: Option<(OpId, Box<[u8]>)>,
|
||||
) -> Result<(), ErrBox> {
|
||||
let context = scope.get_current_context().unwrap();
|
||||
let context = scope.get_current_context();
|
||||
let global: v8::Local<v8::Value> = context.global(scope).into();
|
||||
|
||||
let state_rc = CoreIsolate::state(scope.isolate());
|
||||
let state_rc = CoreIsolate::state(scope);
|
||||
let state = state_rc.borrow_mut();
|
||||
|
||||
let js_recv_cb = state
|
||||
|
@ -557,35 +538,31 @@ fn async_op_response<'s>(
|
|||
.expect("Deno.core.recv has not been called.");
|
||||
drop(state);
|
||||
|
||||
// TODO(piscisaureus): properly integrate TryCatch in the scope chain.
|
||||
let mut try_catch = v8::TryCatch::new(scope);
|
||||
let tc = try_catch.enter();
|
||||
let tc_scope = &mut v8::TryCatch::new(scope);
|
||||
|
||||
match maybe_buf {
|
||||
Some((op_id, buf)) => {
|
||||
let op_id: v8::Local<v8::Value> =
|
||||
v8::Integer::new(scope, op_id as i32).into();
|
||||
v8::Integer::new(tc_scope, op_id as i32).into();
|
||||
let ui8: v8::Local<v8::Value> =
|
||||
bindings::boxed_slice_to_uint8array(scope, buf).into();
|
||||
js_recv_cb.call(scope, context, global, &[op_id, ui8])
|
||||
bindings::boxed_slice_to_uint8array(tc_scope, buf).into();
|
||||
js_recv_cb.call(tc_scope, global, &[op_id, ui8])
|
||||
}
|
||||
None => js_recv_cb.call(scope, context, global, &[]),
|
||||
None => js_recv_cb.call(tc_scope, global, &[]),
|
||||
};
|
||||
|
||||
match tc.exception(scope) {
|
||||
match tc_scope.exception() {
|
||||
None => Ok(()),
|
||||
Some(exception) => exception_to_err_result(scope, exception),
|
||||
Some(exception) => exception_to_err_result(tc_scope, exception),
|
||||
}
|
||||
}
|
||||
|
||||
fn drain_macrotasks<'s>(
|
||||
scope: &mut impl v8::ToLocal<'s>,
|
||||
) -> Result<(), ErrBox> {
|
||||
let context = scope.get_current_context().unwrap();
|
||||
fn drain_macrotasks<'s>(scope: &mut v8::HandleScope<'s>) -> Result<(), ErrBox> {
|
||||
let context = scope.get_current_context();
|
||||
let global: v8::Local<v8::Value> = context.global(scope).into();
|
||||
|
||||
let js_macrotask_cb = {
|
||||
let state_rc = CoreIsolate::state(scope.isolate());
|
||||
let state_rc = CoreIsolate::state(scope);
|
||||
let state = state_rc.borrow_mut();
|
||||
state.js_macrotask_cb.get(scope)
|
||||
};
|
||||
|
@ -598,13 +575,12 @@ fn drain_macrotasks<'s>(
|
|||
// such that ready microtasks would be automatically run before
|
||||
// next macrotask is processed.
|
||||
loop {
|
||||
let mut try_catch = v8::TryCatch::new(scope);
|
||||
let tc = try_catch.enter();
|
||||
let tc_scope = &mut v8::TryCatch::new(scope);
|
||||
|
||||
let is_done = js_macrotask_cb.call(scope, context, global, &[]);
|
||||
let is_done = js_macrotask_cb.call(tc_scope, global, &[]);
|
||||
|
||||
if let Some(exception) = tc.exception(scope) {
|
||||
return exception_to_err_result(scope, exception);
|
||||
if let Some(exception) = tc_scope.exception() {
|
||||
return exception_to_err_result(tc_scope, exception);
|
||||
}
|
||||
|
||||
let is_done = is_done.unwrap();
|
||||
|
@ -617,15 +593,13 @@ fn drain_macrotasks<'s>(
|
|||
}
|
||||
|
||||
pub(crate) fn exception_to_err_result<'s, T>(
|
||||
scope: &mut impl v8::ToLocal<'s>,
|
||||
scope: &mut v8::HandleScope<'s>,
|
||||
exception: v8::Local<v8::Value>,
|
||||
) -> Result<T, ErrBox> {
|
||||
// TODO(piscisaureus): in rusty_v8, `is_execution_terminating()` should
|
||||
// also be implemented on `struct Isolate`.
|
||||
let is_terminating_exception = scope
|
||||
.isolate()
|
||||
.thread_safe_handle()
|
||||
.is_execution_terminating();
|
||||
let is_terminating_exception =
|
||||
scope.thread_safe_handle().is_execution_terminating();
|
||||
let mut exception = exception;
|
||||
|
||||
if is_terminating_exception {
|
||||
|
@ -633,10 +607,7 @@ pub(crate) fn exception_to_err_result<'s, T>(
|
|||
// exception can be created..
|
||||
// TODO(piscisaureus): in rusty_v8, `cancel_terminate_execution()` should
|
||||
// also be implemented on `struct Isolate`.
|
||||
scope
|
||||
.isolate()
|
||||
.thread_safe_handle()
|
||||
.cancel_terminate_execution();
|
||||
scope.thread_safe_handle().cancel_terminate_execution();
|
||||
|
||||
// Maybe make a new exception object.
|
||||
if exception.is_null_or_undefined() {
|
||||
|
@ -647,7 +618,7 @@ pub(crate) fn exception_to_err_result<'s, T>(
|
|||
|
||||
let js_error = JSError::from_v8_exception(scope, exception);
|
||||
|
||||
let state_rc = CoreIsolate::state(scope.isolate());
|
||||
let state_rc = CoreIsolate::state(scope);
|
||||
let state = state_rc.borrow();
|
||||
let js_error = (state.js_error_create_fn)(js_error);
|
||||
|
||||
|
@ -655,16 +626,16 @@ pub(crate) fn exception_to_err_result<'s, T>(
|
|||
// Re-enable exception termination.
|
||||
// TODO(piscisaureus): in rusty_v8, `terminate_execution()` should also
|
||||
// be implemented on `struct Isolate`.
|
||||
scope.isolate().thread_safe_handle().terminate_execution();
|
||||
scope.thread_safe_handle().terminate_execution();
|
||||
}
|
||||
|
||||
Err(js_error)
|
||||
}
|
||||
|
||||
fn check_promise_exceptions<'s>(
|
||||
scope: &mut impl v8::ToLocal<'s>,
|
||||
scope: &mut v8::HandleScope<'s>,
|
||||
) -> Result<(), ErrBox> {
|
||||
let state_rc = CoreIsolate::state(scope.isolate());
|
||||
let state_rc = CoreIsolate::state(scope);
|
||||
let mut state = state_rc.borrow_mut();
|
||||
|
||||
if let Some(&key) = state.pending_promise_exceptions.keys().next() {
|
||||
|
|
|
@ -106,13 +106,12 @@ pub struct JSStackFrame {
|
|||
}
|
||||
|
||||
fn get_property<'a>(
|
||||
scope: &mut impl v8::ToLocal<'a>,
|
||||
context: v8::Local<v8::Context>,
|
||||
scope: &mut v8::HandleScope<'a>,
|
||||
object: v8::Local<v8::Object>,
|
||||
key: &str,
|
||||
) -> Option<v8::Local<'a, v8::Value>> {
|
||||
let key = v8::String::new(scope, key).unwrap();
|
||||
object.get(scope, context, key.into())
|
||||
object.get(scope, key.into())
|
||||
}
|
||||
|
||||
impl JSError {
|
||||
|
@ -121,14 +120,12 @@ impl JSError {
|
|||
}
|
||||
|
||||
pub fn from_v8_exception(
|
||||
scope: &mut impl v8::InIsolate,
|
||||
scope: &mut v8::HandleScope,
|
||||
exception: v8::Local<v8::Value>,
|
||||
) -> Self {
|
||||
// Create a new HandleScope because we're creating a lot of new local
|
||||
// handles below.
|
||||
let mut hs = v8::HandleScope::new(scope);
|
||||
let scope = hs.enter();
|
||||
let context = { scope.get_current_context().unwrap() };
|
||||
let scope = &mut v8::HandleScope::new(scope);
|
||||
|
||||
let msg = v8::Exception::create_message(scope, exception);
|
||||
|
||||
|
@ -138,11 +135,11 @@ impl JSError {
|
|||
exception.clone().try_into().unwrap();
|
||||
|
||||
// Get the message by formatting error.name and error.message.
|
||||
let name = get_property(scope, context, exception, "name")
|
||||
let name = get_property(scope, exception, "name")
|
||||
.and_then(|m| m.to_string(scope))
|
||||
.map(|s| s.to_rust_string_lossy(scope))
|
||||
.unwrap_or_else(|| "undefined".to_string());
|
||||
let message_prop = get_property(scope, context, exception, "message")
|
||||
let message_prop = get_property(scope, exception, "message")
|
||||
.and_then(|m| m.to_string(scope))
|
||||
.map(|s| s.to_rust_string_lossy(scope))
|
||||
.unwrap_or_else(|| "undefined".to_string());
|
||||
|
@ -150,17 +147,16 @@ impl JSError {
|
|||
|
||||
// Access error.stack to ensure that prepareStackTrace() has been called.
|
||||
// This should populate error.__callSiteEvals and error.__formattedFrames.
|
||||
let _ = get_property(scope, context, exception, "stack");
|
||||
let _ = get_property(scope, exception, "stack");
|
||||
|
||||
// Read an array of structured frames from error.__callSiteEvals.
|
||||
let frames_v8 =
|
||||
get_property(scope, context, exception, "__callSiteEvals");
|
||||
let frames_v8 = get_property(scope, exception, "__callSiteEvals");
|
||||
let frames_v8: Option<v8::Local<v8::Array>> =
|
||||
frames_v8.and_then(|a| a.try_into().ok());
|
||||
|
||||
// Read an array of pre-formatted frames from error.__formattedFrames.
|
||||
let formatted_frames_v8 =
|
||||
get_property(scope, context, exception, "__formattedFrames");
|
||||
get_property(scope, exception, "__formattedFrames");
|
||||
let formatted_frames_v8: Option<v8::Local<v8::Array>> =
|
||||
formatted_frames_v8.and_then(|a| a.try_into().ok());
|
||||
|
||||
|
@ -171,92 +167,89 @@ impl JSError {
|
|||
(frames_v8, formatted_frames_v8)
|
||||
{
|
||||
for i in 0..frames_v8.length() {
|
||||
let call_site: v8::Local<v8::Object> = frames_v8
|
||||
.get_index(scope, context, i)
|
||||
.unwrap()
|
||||
.try_into()
|
||||
.unwrap();
|
||||
let call_site: v8::Local<v8::Object> =
|
||||
frames_v8.get_index(scope, i).unwrap().try_into().unwrap();
|
||||
let type_name: Option<v8::Local<v8::String>> =
|
||||
get_property(scope, context, call_site, "typeName")
|
||||
get_property(scope, call_site, "typeName")
|
||||
.unwrap()
|
||||
.try_into()
|
||||
.ok();
|
||||
let type_name = type_name.map(|s| s.to_rust_string_lossy(scope));
|
||||
let function_name: Option<v8::Local<v8::String>> =
|
||||
get_property(scope, context, call_site, "functionName")
|
||||
get_property(scope, call_site, "functionName")
|
||||
.unwrap()
|
||||
.try_into()
|
||||
.ok();
|
||||
let function_name =
|
||||
function_name.map(|s| s.to_rust_string_lossy(scope));
|
||||
let method_name: Option<v8::Local<v8::String>> =
|
||||
get_property(scope, context, call_site, "methodName")
|
||||
get_property(scope, call_site, "methodName")
|
||||
.unwrap()
|
||||
.try_into()
|
||||
.ok();
|
||||
let method_name = method_name.map(|s| s.to_rust_string_lossy(scope));
|
||||
let file_name: Option<v8::Local<v8::String>> =
|
||||
get_property(scope, context, call_site, "fileName")
|
||||
get_property(scope, call_site, "fileName")
|
||||
.unwrap()
|
||||
.try_into()
|
||||
.ok();
|
||||
let file_name = file_name.map(|s| s.to_rust_string_lossy(scope));
|
||||
let line_number: Option<v8::Local<v8::Integer>> =
|
||||
get_property(scope, context, call_site, "lineNumber")
|
||||
get_property(scope, call_site, "lineNumber")
|
||||
.unwrap()
|
||||
.try_into()
|
||||
.ok();
|
||||
let line_number = line_number.map(|n| n.value());
|
||||
let column_number: Option<v8::Local<v8::Integer>> =
|
||||
get_property(scope, context, call_site, "columnNumber")
|
||||
get_property(scope, call_site, "columnNumber")
|
||||
.unwrap()
|
||||
.try_into()
|
||||
.ok();
|
||||
let column_number = column_number.map(|n| n.value());
|
||||
let eval_origin: Option<v8::Local<v8::String>> =
|
||||
get_property(scope, context, call_site, "evalOrigin")
|
||||
get_property(scope, call_site, "evalOrigin")
|
||||
.unwrap()
|
||||
.try_into()
|
||||
.ok();
|
||||
let eval_origin = eval_origin.map(|s| s.to_rust_string_lossy(scope));
|
||||
let is_top_level: Option<v8::Local<v8::Boolean>> =
|
||||
get_property(scope, context, call_site, "isTopLevel")
|
||||
get_property(scope, call_site, "isTopLevel")
|
||||
.unwrap()
|
||||
.try_into()
|
||||
.ok();
|
||||
let is_top_level = is_top_level.map(|b| b.is_true());
|
||||
let is_eval: v8::Local<v8::Boolean> =
|
||||
get_property(scope, context, call_site, "isEval")
|
||||
get_property(scope, call_site, "isEval")
|
||||
.unwrap()
|
||||
.try_into()
|
||||
.unwrap();
|
||||
let is_eval = is_eval.is_true();
|
||||
let is_native: v8::Local<v8::Boolean> =
|
||||
get_property(scope, context, call_site, "isNative")
|
||||
get_property(scope, call_site, "isNative")
|
||||
.unwrap()
|
||||
.try_into()
|
||||
.unwrap();
|
||||
let is_native = is_native.is_true();
|
||||
let is_constructor: v8::Local<v8::Boolean> =
|
||||
get_property(scope, context, call_site, "isConstructor")
|
||||
get_property(scope, call_site, "isConstructor")
|
||||
.unwrap()
|
||||
.try_into()
|
||||
.unwrap();
|
||||
let is_constructor = is_constructor.is_true();
|
||||
let is_async: v8::Local<v8::Boolean> =
|
||||
get_property(scope, context, call_site, "isAsync")
|
||||
get_property(scope, call_site, "isAsync")
|
||||
.unwrap()
|
||||
.try_into()
|
||||
.unwrap();
|
||||
let is_async = is_async.is_true();
|
||||
let is_promise_all: v8::Local<v8::Boolean> =
|
||||
get_property(scope, context, call_site, "isPromiseAll")
|
||||
get_property(scope, call_site, "isPromiseAll")
|
||||
.unwrap()
|
||||
.try_into()
|
||||
.unwrap();
|
||||
let is_promise_all = is_promise_all.is_true();
|
||||
let promise_index: Option<v8::Local<v8::Integer>> =
|
||||
get_property(scope, context, call_site, "columnNumber")
|
||||
get_property(scope, call_site, "columnNumber")
|
||||
.unwrap()
|
||||
.try_into()
|
||||
.ok();
|
||||
|
@ -278,7 +271,7 @@ impl JSError {
|
|||
promise_index,
|
||||
});
|
||||
let formatted_frame: v8::Local<v8::String> = formatted_frames_v8
|
||||
.get_index(scope, context, i)
|
||||
.get_index(scope, i)
|
||||
.unwrap()
|
||||
.try_into()
|
||||
.unwrap();
|
||||
|
@ -301,9 +294,9 @@ impl JSError {
|
|||
.and_then(|v| v8::Local::<v8::String>::try_from(v).ok())
|
||||
.map(|v| v.to_rust_string_lossy(scope)),
|
||||
source_line: msg
|
||||
.get_source_line(scope, context)
|
||||
.get_source_line(scope)
|
||||
.map(|v| v.to_rust_string_lossy(scope)),
|
||||
line_number: msg.get_line_number(context).and_then(|v| v.try_into().ok()),
|
||||
line_number: msg.get_line_number(scope).and_then(|v| v.try_into().ok()),
|
||||
start_column: msg.get_start_column().try_into().ok(),
|
||||
end_column: msg.get_end_column().try_into().ok(),
|
||||
frames,
|
||||
|
@ -365,7 +358,7 @@ impl fmt::Display for JSError {
|
|||
}
|
||||
|
||||
pub(crate) fn attach_handle_to_error(
|
||||
scope: &mut impl v8::InIsolate,
|
||||
scope: &mut v8::Isolate,
|
||||
err: ErrBox,
|
||||
handle: v8::Local<v8::Value>,
|
||||
) -> ErrBox {
|
||||
|
@ -381,7 +374,7 @@ pub struct ErrWithV8Handle {
|
|||
|
||||
impl ErrWithV8Handle {
|
||||
pub fn new(
|
||||
scope: &mut impl v8::InIsolate,
|
||||
scope: &mut v8::Isolate,
|
||||
err: ErrBox,
|
||||
handle: v8::Local<v8::Value>,
|
||||
) -> Self {
|
||||
|
|
|
@ -111,14 +111,11 @@ impl EsIsolate {
|
|||
source: &str,
|
||||
) -> Result<ModuleId, ErrBox> {
|
||||
let state_rc = Self::state(self);
|
||||
|
||||
let core_state_rc = CoreIsolate::state(self);
|
||||
let core_state = core_state_rc.borrow();
|
||||
let mut hs = v8::HandleScope::new(&mut self.0);
|
||||
let scope = hs.enter();
|
||||
let scope = &mut v8::HandleScope::new(&mut *self.0);
|
||||
let context = core_state.global_context.get(scope).unwrap();
|
||||
let mut cs = v8::ContextScope::new(scope, context);
|
||||
let scope = cs.enter();
|
||||
let scope = &mut v8::ContextScope::new(scope, context);
|
||||
|
||||
let name_str = v8::String::new(scope, name).unwrap();
|
||||
let source_str = v8::String::new(scope, source).unwrap();
|
||||
|
@ -126,15 +123,14 @@ impl EsIsolate {
|
|||
let origin = bindings::module_origin(scope, name_str);
|
||||
let source = v8::script_compiler::Source::new(source_str, &origin);
|
||||
|
||||
let mut try_catch = v8::TryCatch::new(scope);
|
||||
let tc = try_catch.enter();
|
||||
let tc_scope = &mut v8::TryCatch::new(scope);
|
||||
|
||||
let maybe_module = v8::script_compiler::compile_module(scope, source);
|
||||
let maybe_module = v8::script_compiler::compile_module(tc_scope, source);
|
||||
|
||||
if tc.has_caught() {
|
||||
if tc_scope.has_caught() {
|
||||
assert!(maybe_module.is_none());
|
||||
let e = tc.exception(scope).unwrap();
|
||||
return exception_to_err_result(scope, e);
|
||||
let e = tc_scope.exception().unwrap();
|
||||
return exception_to_err_result(tc_scope, e);
|
||||
}
|
||||
|
||||
let module = maybe_module.unwrap();
|
||||
|
@ -143,7 +139,7 @@ impl EsIsolate {
|
|||
let mut import_specifiers: Vec<ModuleSpecifier> = vec![];
|
||||
for i in 0..module.get_module_requests_length() {
|
||||
let import_specifier =
|
||||
module.get_module_request(i).to_rust_string_lossy(scope);
|
||||
module.get_module_request(i).to_rust_string_lossy(tc_scope);
|
||||
let state = state_rc.borrow();
|
||||
let module_specifier =
|
||||
state.loader.resolve(&import_specifier, name, false)?;
|
||||
|
@ -151,7 +147,7 @@ impl EsIsolate {
|
|||
}
|
||||
|
||||
let mut handle = v8::Global::<v8::Module>::new();
|
||||
handle.set(scope, module);
|
||||
handle.set(tc_scope, module);
|
||||
|
||||
{
|
||||
let mut state = state_rc.borrow_mut();
|
||||
|
@ -173,34 +169,30 @@ impl EsIsolate {
|
|||
|
||||
let core_state_rc = CoreIsolate::state(self);
|
||||
let core_state = core_state_rc.borrow();
|
||||
let mut hs = v8::HandleScope::new(&mut self.0);
|
||||
let scope = hs.enter();
|
||||
let scope = &mut v8::HandleScope::new(&mut *self.0);
|
||||
let context = core_state.global_context.get(scope).unwrap();
|
||||
let mut cs = v8::ContextScope::new(scope, context);
|
||||
let scope = cs.enter();
|
||||
|
||||
let mut try_catch = v8::TryCatch::new(scope);
|
||||
let tc = try_catch.enter();
|
||||
let scope = &mut v8::ContextScope::new(scope, context);
|
||||
let tc_scope = &mut v8::TryCatch::new(scope);
|
||||
|
||||
let module_info = match state.modules.get_info(id) {
|
||||
Some(info) => info,
|
||||
None if id == 0 => return Ok(()),
|
||||
_ => panic!("module id {} not found in module table", id),
|
||||
};
|
||||
let mut module = module_info.handle.get(scope).unwrap();
|
||||
let module = module_info.handle.get(tc_scope).unwrap();
|
||||
drop(state);
|
||||
|
||||
if module.get_status() == v8::ModuleStatus::Errored {
|
||||
exception_to_err_result(scope, module.get_exception())?
|
||||
exception_to_err_result(tc_scope, module.get_exception())?
|
||||
}
|
||||
|
||||
let result =
|
||||
module.instantiate_module(context, bindings::module_resolve_callback);
|
||||
module.instantiate_module(tc_scope, bindings::module_resolve_callback);
|
||||
match result {
|
||||
Some(_) => Ok(()),
|
||||
None => {
|
||||
let exception = tc.exception(scope).unwrap();
|
||||
exception_to_err_result(scope, exception)
|
||||
let exception = tc_scope.exception().unwrap();
|
||||
exception_to_err_result(tc_scope, exception)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -217,14 +209,12 @@ impl EsIsolate {
|
|||
|
||||
let core_state_rc = CoreIsolate::state(self);
|
||||
|
||||
let mut hs = v8::HandleScope::new(&mut self.0);
|
||||
let scope = hs.enter();
|
||||
let scope = &mut v8::HandleScope::new(&mut *self.0);
|
||||
let context = {
|
||||
let core_state = core_state_rc.borrow();
|
||||
core_state.global_context.get(scope).unwrap()
|
||||
};
|
||||
let mut cs = v8::ContextScope::new(scope, context);
|
||||
let scope = cs.enter();
|
||||
let scope = &mut v8::ContextScope::new(scope, context);
|
||||
|
||||
let info = state.modules.get_info(id).expect("ModuleInfo not found");
|
||||
let module = info.handle.get(scope).expect("Empty module handle");
|
||||
|
@ -247,7 +237,7 @@ impl EsIsolate {
|
|||
// For more details see:
|
||||
// https://github.com/denoland/deno/issues/4908
|
||||
// https://v8.dev/features/top-level-await#module-execution-order
|
||||
let maybe_value = module.evaluate(scope, context);
|
||||
let maybe_value = module.evaluate(scope);
|
||||
|
||||
// Update status after evaluating.
|
||||
status = module.get_status();
|
||||
|
@ -293,11 +283,9 @@ impl EsIsolate {
|
|||
let core_state_rc = CoreIsolate::state(self);
|
||||
let core_state = core_state_rc.borrow();
|
||||
|
||||
let mut hs = v8::HandleScope::new(&mut self.0);
|
||||
let scope = hs.enter();
|
||||
let scope = &mut v8::HandleScope::new(&mut *self.0);
|
||||
let context = core_state.global_context.get(scope).unwrap();
|
||||
let mut cs = v8::ContextScope::new(scope, context);
|
||||
let scope = cs.enter();
|
||||
let scope = &mut v8::ContextScope::new(scope, context);
|
||||
|
||||
drop(core_state);
|
||||
|
||||
|
@ -319,8 +307,8 @@ impl EsIsolate {
|
|||
v8::Exception::type_error(scope, message)
|
||||
});
|
||||
|
||||
resolver.reject(context, exception).unwrap();
|
||||
scope.isolate().run_microtasks();
|
||||
resolver.reject(scope, exception).unwrap();
|
||||
scope.run_microtasks();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -335,14 +323,12 @@ impl EsIsolate {
|
|||
|
||||
debug!("dyn_import_done {} {:?}", id, mod_id);
|
||||
assert!(mod_id != 0);
|
||||
let mut hs = v8::HandleScope::new(&mut self.0);
|
||||
let scope = hs.enter();
|
||||
let scope = &mut v8::HandleScope::new(&mut *self.0);
|
||||
let context = {
|
||||
let core_state = core_state_rc.borrow();
|
||||
core_state.global_context.get(scope).unwrap()
|
||||
};
|
||||
let mut cs = v8::ContextScope::new(scope, context);
|
||||
let scope = cs.enter();
|
||||
let scope = &mut v8::ContextScope::new(scope, context);
|
||||
|
||||
let mut resolver_handle = {
|
||||
let mut state = state_rc.borrow_mut();
|
||||
|
@ -366,8 +352,8 @@ impl EsIsolate {
|
|||
assert_eq!(module.get_status(), v8::ModuleStatus::Evaluated);
|
||||
|
||||
let module_namespace = module.get_module_namespace();
|
||||
resolver.resolve(context, module_namespace).unwrap();
|
||||
scope.isolate().run_microtasks();
|
||||
resolver.resolve(scope, module_namespace).unwrap();
|
||||
scope.run_microtasks();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ unsafe impl Send for ZeroCopyBuf {}
|
|||
|
||||
impl ZeroCopyBuf {
|
||||
pub fn new<'s>(
|
||||
scope: &mut impl v8::ToLocal<'s>,
|
||||
scope: &mut v8::HandleScope<'s>,
|
||||
view: v8::Local<v8::ArrayBufferView>,
|
||||
) -> Self {
|
||||
let backing_store = view.buffer(scope).unwrap().get_backing_store();
|
||||
|
|
Loading…
Reference in a new issue