script: Implement jsglue traps for saveJobQueue()#38232
Merged
Conversation
Signed-off-by: Delan Azabani <[email protected]> Co-authored-by: atbrakhi <[email protected]>
4255604 to
1f6c9fa
Compare
saveJobQueue()
Member
Author
|
hmm, clippy is busted in ci, but not locally? |
jdm
requested changes
Jul 24, 2025
Member
jdm
left a comment
There was a problem hiding this comment.
I'd like to see the code with my suggestions addressed. My hope is that it will raise fewer eyebrows!
Co-authored-by: atbrakhi <[email protected]> Signed-off-by: Delan Azabani <[email protected]>
cacdb8f to
c6f599b
Compare
saveJobQueue()
This was referenced Jul 28, 2025
Co-authored-by: atbrakhi <[email protected]> Signed-off-by: Delan Azabani <[email protected]>
167faca to
9f16e31
Compare
Co-authored-by: atbrakhi <[email protected]> Signed-off-by: Delan Azabani <[email protected]>
Signed-off-by: Delan Azabani <[email protected]>
Member
|
@delan Clippy warnings are preventing merging. |
Member
Author
abdelrahman1234567
pushed a commit
to abdelrahman1234567/servo
that referenced
this pull request
Jul 28, 2025
in the [SpiderMonkey Debugger API](https://firefox-source-docs.mozilla.org/js/Debugger/), hooks like [onNewGlobalObject()](https://firefox-source-docs.mozilla.org/js/Debugger/Debugger.html#onnewglobalobject-global) use an AutoDebuggerJobQueueInterruption to [switch to a new microtask queue](https://github.com/servo/mozjs/blob/b14aebff23ac4d5b0652060ef949334bda08b22f/mozjs-sys/mozjs/js/src/debugger/Debugger.cpp#L2834-L2841) and avoid clobbering the debuggee’s microtask queue. this in turn relies on JobQueue::saveJobQueue(), which is [not yet implemented in RustJobQueue](https://github.com/servo/mozjs/blob/b14aebff23ac4d5b0652060ef949334bda08b22f/mozjs-sys/src/jsglue.cpp#L83-L86). this patch bumps mozjs to servo/mozjs#595, which implements [saveJobQueue() and SavedJobQueue](https://github.com/servo/mozjs/blob/b14aebff23ac4d5b0652060ef949334bda08b22f/mozjs-sys/mozjs/js/public/Promise.h#L92-L114) for RustJobQueue by calling into Servo via two new JobQueueTraps that create and destroy extra “interrupt” queues for use by the debugger. SpiderMonkey [does not own external job queues](https://github.com/servo/mozjs/blob/b14aebff23ac4d5b0652060ef949334bda08b22f/mozjs-sys/mozjs/js/public/Promise.h#L117-L123), so the lifetime of these queues is managed in Servo, where they are stored in a Vec-based stack. stack-like behaviour is adequate for SpiderMonkey’s save and restore patterns, as far as we can tell, but we’ve added an assertion just in case. Testing: manually tested working in devtools debugger patch (servo#37667), where it will undergo automated tests Fixes: servo#38311 --------- Signed-off-by: Delan Azabani <[email protected]> Co-authored-by: atbrakhi <[email protected]>
minghuaw
pushed a commit
to minghuaw/servo
that referenced
this pull request
Aug 1, 2025
in the [SpiderMonkey Debugger API](https://firefox-source-docs.mozilla.org/js/Debugger/), hooks like [onNewGlobalObject()](https://firefox-source-docs.mozilla.org/js/Debugger/Debugger.html#onnewglobalobject-global) use an AutoDebuggerJobQueueInterruption to [switch to a new microtask queue](https://github.com/servo/mozjs/blob/b14aebff23ac4d5b0652060ef949334bda08b22f/mozjs-sys/mozjs/js/src/debugger/Debugger.cpp#L2834-L2841) and avoid clobbering the debuggee’s microtask queue. this in turn relies on JobQueue::saveJobQueue(), which is [not yet implemented in RustJobQueue](https://github.com/servo/mozjs/blob/b14aebff23ac4d5b0652060ef949334bda08b22f/mozjs-sys/src/jsglue.cpp#L83-L86). this patch bumps mozjs to servo/mozjs#595, which implements [saveJobQueue() and SavedJobQueue](https://github.com/servo/mozjs/blob/b14aebff23ac4d5b0652060ef949334bda08b22f/mozjs-sys/mozjs/js/public/Promise.h#L92-L114) for RustJobQueue by calling into Servo via two new JobQueueTraps that create and destroy extra “interrupt” queues for use by the debugger. SpiderMonkey [does not own external job queues](https://github.com/servo/mozjs/blob/b14aebff23ac4d5b0652060ef949334bda08b22f/mozjs-sys/mozjs/js/public/Promise.h#L117-L123), so the lifetime of these queues is managed in Servo, where they are stored in a Vec-based stack. stack-like behaviour is adequate for SpiderMonkey’s save and restore patterns, as far as we can tell, but we’ve added an assertion just in case. Testing: manually tested working in devtools debugger patch (servo#37667), where it will undergo automated tests Fixes: servo#38311 --------- Signed-off-by: Delan Azabani <[email protected]> Co-authored-by: atbrakhi <[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.
in the SpiderMonkey Debugger API, hooks like onNewGlobalObject() use an AutoDebuggerJobQueueInterruption to switch to a new microtask queue and avoid clobbering the debuggee’s microtask queue. this in turn relies on JobQueue::saveJobQueue(), which is not yet implemented in RustJobQueue.
this patch bumps mozjs to servo/mozjs#595, which implements saveJobQueue() and SavedJobQueue for RustJobQueue by calling into Servo via two new JobQueueTraps that create and destroy extra “interrupt” queues for use by the debugger.
SpiderMonkey does not own external job queues, so the lifetime of these queues is managed in Servo, where they are stored in a Vec-based stack. stack-like behaviour is adequate for SpiderMonkey’s save and restore patterns, as far as we can tell, but we’ve added an assertion just in case.
Testing: manually tested working in devtools debugger patch (#37667), where it will undergo automated tests
Fixes: #38311