Remove wrong handling of *const Handle in wrappers#680
Merged
jdm merged 2 commits intoservo:mainfrom Dec 16, 2025
Merged
Conversation
Signed-off-by: sagudev <[email protected]>
Member
Author
|
Although reading https://stackoverflow.com/questions/41815619/are-raw-pointers-to-temporaries-ok-in-rust rust should keep temp variables alive long enough and I cannot reproduce crash with minimal repro: https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=a68e1910a8f1645e072ff2008eb9f07d so something fishy is going on here. |
Signed-off-by: sagudev <[email protected]>
Member
Author
|
What I think is happens here that we get temporary & that is then deref into ptr and this does not trigger error, but using |
jdm
approved these changes
Dec 16, 2025
This was referenced Dec 23, 2025
github-merge-queue bot
pushed a commit
to servo/servo
that referenced
this pull request
Dec 25, 2025
This is companion PR to servo/mozjs#680 but it was originally written as part of #40716. Testing: Covered by `/webidl/ecmascript-binding/global-object-implicit-this-value-cross-realm.html` Signed-off-by: sagudev <[email protected]>
This file contains hidden or 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
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.
Handling of
*const Handlewas wrong inwrap!macro. It generated code like this:but this is wrong as we get ptr to invalid place (args are temporary values) cause crashing. I am not sure why rust was not complaining, but I suspect it has something to do with the fact that we change ref to ptrs. The solution is to do this:
but this is hard to do in macro, so I simply removed handling of this case and wrote a manual wrapper. Servo currently uses nonwrapped function call as wrapped would cause crashes.