[#26488] Refactored RTCDataChannel for safer dropping and added Promise comment (#37332)

Fixes (partially) #26488 and apply the
https://github.com/servo/servo/pull/37324#discussion_r2133989190
comment.

Testing: No tests added
Fixes: Partially #26488

---------

Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
This commit is contained in:
Domenico Rizzo 2025-06-13 14:20:45 +02:00 committed by GitHub
parent f451dccd0b
commit b8738074d1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 62 additions and 25 deletions

View file

@ -73,6 +73,9 @@ impl PromiseHelper for Rc<Promise> {
}
}
// Promise objects are stored inside Rc values, so Drop is run when the last Rc is dropped,
// rather than when SpiderMonkey runs a GC. This makes it safe to interact with the JS engine unlike
// Drop implementations for other DOM types.
impl Drop for Promise {
#[allow(unsafe_code)]
fn drop(&mut self) {