-
-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for JS getters and setters #358
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sharktheone
force-pushed
the
js-getter-setter
branch
from
February 5, 2024 21:25
0be56ad
to
4def121
Compare
Sharktheone
commented
Feb 6, 2024
src/web_executor/js/v8.rs
Outdated
Comment on lines
110
to
127
#[test] | ||
fn v8_bindings_test() { | ||
// let platform = v8::new_default_platform(0, false).make_shared(); | ||
// v8::V8::initialize_platform(platform); | ||
// v8::V8::initialize(); | ||
// The engine is already initialized in the previous test | ||
|
||
let isolate = &mut v8::Isolate::new(Default::default()); | ||
let hs = &mut v8::HandleScope::new(isolate); | ||
let c = v8::Context::new(hs); | ||
let s = &mut v8::ContextScope::new(hs, c); | ||
|
||
let code = v8::String::new(s, "console.log(\"Hello World!\"); 1234").unwrap(); | ||
|
||
let value = v8::Script::compile(s, code, None).unwrap().run(s).unwrap(); | ||
|
||
println!("{}", value.to_rust_string_lossy(s)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, interesting, looks like this Test causes some errors.
I guess, that's because V8 crashes somehow while initializing and it still holds the "init-lock", I probably should limit this.
Sharktheone
force-pushed
the
js-getter-setter
branch
2 times, most recently
from
February 6, 2024 08:21
136f8a7
to
f44565d
Compare
fix tests fix fmt
Sharktheone
force-pushed
the
js-getter-setter
branch
from
February 6, 2024 08:24
f44565d
to
90455d9
Compare
jaytaph
approved these changes
Feb 10, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds support for Javascript's getters and setters. This is needed to pass structs with fields to JS, see
test.rs
Next Steps