0
0
Fork 0
mirror of https://github.com/denoland/rusty_v8.git synced 2024-11-25 15:29:43 -05:00
Commit graph

543 commits

Author SHA1 Message Date
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
Bert Belder
db5bbf6e43
Move 'create_param_allocations' from OwnedIsolate to IsolateAnnex (#365) 2020-04-23 20:15:39 +02:00
Bert Belder
cc626550b1
Explicitly drop slots when disposing an isolate (#364) 2020-04-23 19:48:07 +02:00
Bert Belder
ce54d39929
Clarify the purpose of the mutex in struct IsolateAnnex (#363) 2020-04-23 19:22:05 +02:00
Bartek Iwańczuk
3aa1c961dc
upgrade: rust 1.43.0 (#362) 2020-04-23 19:21:22 +02:00
Bert Belder
0d636de447
Add safe alternative to get_data/set_data (#360) 2020-04-23 03:34:28 -04:00
Bert Belder
92389f3321
v0.4.0 2020-04-22 19:24:18 +02:00
Bert Belder
8dfbd3d34c
Upgrade crates (#358) 2020-04-22 19:22:34 +02:00
Bert Belder
05782b846f
Make Isolate take ownership of CreateParams (#357) 2020-04-20 21:18:03 +02:00
Bert Belder
fc582316db
Refactor C++ shared pointer wrappers (#355)
* Add `SharedPtr` as a nullable sibling to `SharedRef`.
* Add `Borrow`, `AsRef` and `AsMut` implementations as appropriate.
* `SharedRef<T>` now derefs to `T` rather than to `UnsafeCell<T>`.
* `array_buffer::BackingStore` now derefs to `[Cell<u8>]`.
2020-04-20 19:38:08 +02:00