0
0
Fork 0
mirror of https://github.com/denoland/rusty_v8.git synced 2024-11-28 16:21:04 -05:00
Commit graph

481 commits

Author SHA1 Message Date
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
Bert Belder
d3a6c1403b
Fix race condition in v8::platform::Task tests (#355) 2020-04-20 19:19:00 +02:00
Bert Belder
3d0a90c1c8
Clippy (#354) 2020-04-16 15:35:27 +02:00
Bert Belder
b85346047e
Remove the 'Delete' trait, use regular 'Drop' instead (#353) 2020-04-16 05:24:07 +02:00
Bert Belder
256b6710d0
Remove transmutes from UniquePtr/UniqueRef implementation (#352) 2020-04-16 03:21:11 +02:00
Bert Belder
9ef9c5f871
Make all V8 heap object types subtypes of v8::Data (#351)
In v8.h, not all heap object classes actually derive from `v8::Data`,
but this seems to be a mistake, because this hierarchy does definitely
exists in V8's internal source code.
2020-04-15 23:56:59 +02:00
Bert Belder
16d6ca2398
Re-generate data.rs from the latest version of v8.h (#351) 2020-04-15 23:23:20 +02:00
Bert Belder
bb448d3e00
Upgrade dependencies (#350) 2020-04-15 20:57:25 +02:00
Bert Belder
79d0bca2c7
Add 'restore-keys' to Github Actions config to avoid unnecessary recompilation (#350) 2020-04-15 20:37:53 +02:00
Bert Belder
d1ac68f0c8
Always use raw pointers to send V8 handles between C++ and Rust (#349)
And other pointer usage touch-ups on the C++ side:
- const parameters are passed by & reference.
- mutable parameters are passed by * pointer.
2020-04-14 00:34:32 +02:00
Bert Belder
675d585977
Add binding for v8__internal__GetIsolateFromHeapObject() (#348) 2020-04-13 02:18:05 +02:00
Bert Belder
2b08fd1651
Format source code (#348) 2020-04-13 00:48:59 +02:00
Ryan Dahl
7b1cd84f4f
v0.3.11 2020-04-09 14:26:31 -04:00