0
0
Fork 0
mirror of https://github.com/denoland/rusty_v8.git synced 2024-11-30 16:41:03 -05:00
Commit graph

552 commits

Author SHA1 Message Date
Bert Belder
acf6bfe0e4
Add the 'HandleScope::with_context()' scope constructor (#410) 2020-07-01 10:44:23 +02:00
Bert Belder
c13625148f
Refactor handle types 'Local' and 'Global' (#410)
* Merged all handle type implementations into one file ('handle.h').
* Made it so that `Global` handles cannot be empty.
* Renamed the `AsHandle` trait to `Handle`, and made it more generally
  useful.
* Simplified how `PartialEq` is implemented for V8 heap objects and/or
  the `Local`/`Global` handles that reference them.
2020-07-01 10:44:23 +02:00
Bert Belder
850af2e857
Remove 'FinalizationGroup' bindings (#410)
V8 no longer supports or even defines this type.
2020-07-01 10:44:23 +02:00
Bert Belder
17a40b3914
v0.6.0 2020-06-26 18:07:27 +02:00
Bert Belder
c1104f335e
Upgrade V8 to 8.5.216 (#409) 2020-06-26 17:32:44 +02:00
Bert Belder
8635fb2a60
Upgrade crates (#409) 2020-06-26 17:29:10 +02:00
Bert Belder
4e64cefc9c
Remove unnecessary 'DerefMut' impl from 'Local<T>' (#406)
Local handles never need to be mutable. This patch also rounds up the
last few places where we were still asking the user to pass an `&mut T`
to an API method.
2020-06-26 15:05:39 +02:00
Bert Belder
b1a4dfea8b
Remove 'context' param from (almost) all public methods (#406) 2020-06-26 03:00:06 +02:00
Bert Belder
de2cca4c7f
Integrate 'TryCatch' in the scope system (#406) 2020-06-26 01:50:32 +02:00
Bert Belder
3b6ed67f5e
Rewrite the scope system from scratch (#406) 2020-06-26 01:42:00 +02:00
Bert Belder
8a4dc30445
Rename to_local() to cast_local(), use a closure (#406)
This makes it possible to add a run-time check that verifies that the
specified closure is actually the one that contains the local handle.
2020-06-19 20:18:07 +02:00
Bert Belder
dfd5069ef6
Upgrade crates (#408) 2020-06-19 20:13:37 +02:00
Bert Belder
dba9cb5ec3
ci: upgrade to Rust 1.44.1 (#408) 2020-06-19 20:12:24 +02:00
Bert Belder
6db41791ca
Remove unused 'v8::Locker' constructor/destructor bindings (#407) 2020-06-17 06:15:09 +02:00
Bert Belder
106a8085e2
Remove an unnecessary try_into() call (#407) 2020-06-17 06:15:08 +02:00
Bert Belder
54f6bfe8c1
Reflow comments and strings that exceed the 80-char column limit (#407) 2020-06-17 06:15:08 +02:00
Bert Belder
acdcede4d6
ci: upgrade to Rust 1.44.0 (#402) 2020-06-05 04:36:50 +02:00
Bert Belder
72042f2401
ci: use upstream actions/cache@v2 (#402)
Upstream finally tagged v2.0.0 so there's no reason to use our own fork
any longer.
2020-06-05 04:36:39 +02:00
Bert Belder
35e7e73ff4
Add (failing) test: escaping twice from EscapableHandleScope should panic (#401) 2020-06-05 03:57:31 +02:00
Ryan Dahl
5bb08e89b1 v0.5.1 2020-06-04 10:29:48 -04:00
Ryan Dahl
d8be935b19 upgrade crates 2020-06-04 10:29:48 -04:00
Ryan Dahl
3676a938b5
upgrade: V8 8.5.104 (#398) 2020-06-03 18:49:52 -04:00
Ryan Dahl
775f848a8f
v0.5.0 2020-06-01 17:34:32 -04:00
Ryan Dahl
5c5ff3a521
Add module_snapshot test (#396) 2020-06-01 17:32:20 -04:00
Bert Belder
74d806cbe3
Make error constructors in Exception less repetitive (#394) 2020-06-01 08:57:45 +02:00
Bert Belder
e4c260b8d2
Fix typo in signature of trait method 'Shared::from_unique_ptr()' (#393) 2020-06-01 08:44:10 +02:00
Bert Belder
771acbab02
Reflow comment and fix a typo in it (#391)
Closes: #374
2020-05-31 23:05:23 +02:00
Max Bruce
1937d30eba
Add bindings for 'Object::get_(own)_property_names()' (#337)
Co-authored-by: Bert Belder <bertbelder@gmail.com>
2020-05-31 23:04:01 +02:00
George Hahn
d87341a7ce
Fallback to curl if download_file.py fails (#373) 2020-05-31 14:36:56 -04:00
Bert Belder
a9ea69b5d5
Add more comments explaining why Local::from_raw() is appropriate (#389) 2020-05-31 19:39:08 +02:00
utam0k
25276c8249
Improve error message when build.rs fails because OUT_DIR is not set (#387) 2020-05-31 19:25:25 +02:00
Bert Belder
405a874c36
Fix remaining Local::from_raw() misuse, and correct some lifetimes (#388) 2020-05-31 19:00:04 +02:00
Bert Belder
c114c46e15
Fix incorrect function signatures in module.rs (#388)
* `usize` and `int` are not equivalent or interchangeable at any level.
* Removed an unnecessary mutable borrow.
2020-05-31 19:00:01 +02:00
Bert Belder
af9ac3c4b9
Uncomment broken test, use #[ignore] instead (#388) 2020-05-31 18:59:51 +02:00
Bert Belder
cfbfb9524f
Add test that triggers an unsolved HandleScope bug (#385) 2020-05-31 13:42:13 +02:00
Bert Belder
8213c0e428
Remove incorrect uses of Local::from_raw() (#385) 2020-05-31 13:41:42 +02:00
Bert Belder
9540732a6a
Relax some Function/PropertyCallbackArguments lifetime constraints (#385) 2020-05-31 13:41:10 +02:00
Ryan Dahl
defb39b101
Make get_data and set_data private (#384) 2020-05-29 18:42:54 -04:00
Bert Belder
56c3d9f9c0
Use correct lifetime for TryCatch::exception()/message() return value (#380)
According to v8.h, "the returned handle is valid until this TryCatch
block has been destroyed". This is incorrect, as can be demonstrated
with the test below. In practice the return value lives no longer and
no shorter than the active HandleScope at the time these methods are
called. An issue has been opened about this in the V8 bug tracker:
https://bugs.chromium.org/p/v8/issues/detail?id=10537.

```rust
fn try_catch_bad_lifetimes() {
  let _setup_guard = setup();
  let mut isolate = v8::Isolate::new(Default::default());
  let mut hs = v8::HandleScope::new(&mut isolate);
  let scope = hs.enter();
  let context = v8::Context::new(scope);
  let mut cs = v8::ContextScope::new(scope, context);
  let scope = cs.enter();
  let caught_msg_2 = {
    let mut try_catch = v8::TryCatch::new(scope);
    let try_catch = try_catch.enter();
    let caught_msg_1 = {
      let mut hs = v8::HandleScope::new(scope);
      let scope = hs.enter();

      // Throw exception #1.
      let msg_1 = v8::String::new(scope, "BOOM!").unwrap();
      let exc_1 = v8::Exception::type_error(scope, msg_1);
      scope.isolate().throw_exception(exc_1);
      // Catch exception #1.
      let caught_msg_1 = try_catch.message().unwrap();
      let caught_str_1 =
        caught_msg_1.get(scope).to_rust_string_lossy(scope);
      assert!(caught_str_1.contains("BOOM"));
      // Move `caught_msg_1` out of the HandleScope it was created in.
      // The borrow checker allows this because `caught_msg_1`'s
      // lifetime is contrained to not outlive the TryCatch, but it is
      // allowed to outlive the HandleScope that was active when the
      // exception was caught.
      caught_msg_1
    };
    // Next line crashes.
    let caught_str_1 =
      caught_msg_1.get(scope).to_rust_string_lossy(scope);
    assert!(caught_str_1.contains("BOOM"));

    // Throws exception #2.
    let msg_2 = v8::String::new(scope, "DANG!").unwrap();
    let exc_2 = v8::Exception::type_error(scope, msg_2);
    scope.isolate().throw_exception(exc_2);
    // Catch exception #2.
    let caught_msg_2 = try_catch.message().unwrap();
    let caught_str_2 =
      caught_msg_2.get(scope).to_rust_string_lossy(scope);
    assert!(caught_str_2.contains("DANG"));
    // Move `caught_msg_2` out of the extent of the TryCatch, but still
    // within the extent of its HandleScope. This is unnecessarily
    // rejected at compile time.
    caught_msg_2
  };
  let caught_str_2 =
    caught_msg_2.get(scope).to_rust_string_lossy(scope);
  assert!(caught_str_2.contains("DANG"));
}
```
2020-05-24 21:37:22 +02:00
Jen
3fb278e7e8
Fix typos in README.md (#375) 2020-05-20 22:56:41 +02:00
Bert Belder
327639f6cb
Disable 'fail-fast' for master and tag builds on CI (#372) 2020-05-11 23:26:15 +02:00
Bert Belder
62d50b5a0b
Add prettier configuration (#372) 2020-05-11 23:24:56 +02:00
Bert Belder
36bec8cd2b
v0.4.2 2020-05-06 19:37:36 +02:00
Bert Belder
6638b05096
Fix: SnapshotCreator's internal Isolate does not get initialized (#371) 2020-05-06 19:26:23 +02:00
Bert Belder
f242d17732
v0.4.1 2020-05-06 17:48:07 +02:00
Bert Belder
0d1cea92cb
Upgrade crates (#369) 2020-05-06 07:45:05 +02:00
Bert Belder
12f444841b
Update V8 version in readme (#369) 2020-05-06 07:45:05 +02:00
Bert Belder
9ad0d35718
Upgrade V8 to 8.4.300 (#368) 2020-05-06 03:48:19 +02:00
Bert Belder
041bcd1797
Use a Github Actions cache version that works (#368) 2020-05-06 03:48:19 +02:00
Ryan Dahl
11340c9ca3
There should be a single entry point for creating IsolateHandle (#361) 2020-04-23 16:46:53 -04:00