mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
dom: Avoid panic when SpiderMonkey enqueues dummy promise jobs.
This commit is contained in:
parent
a34d1573b6
commit
2e4cee9971
3 changed files with 25 additions and 1 deletions
|
@ -206,7 +206,12 @@ unsafe extern "C" fn enqueue_promise_job(
|
|||
let mut result = false;
|
||||
wrap_panic(&mut || {
|
||||
let microtask_queue = &*(extra as *const MicrotaskQueue);
|
||||
let global = GlobalScope::from_object(incumbent_global.get());
|
||||
let global = if !incumbent_global.is_null() {
|
||||
GlobalScope::from_object(incumbent_global.get())
|
||||
} else {
|
||||
let realm = AlreadyInRealm::assert_for_cx(cx);
|
||||
GlobalScope::from_context(*cx, InRealm::in_realm(&realm))
|
||||
};
|
||||
let pipeline = global.pipeline_id();
|
||||
let interaction = if promise.get().is_null() {
|
||||
PromiseUserInputEventHandlingState::DontCare
|
||||
|
|
|
@ -14215,6 +14215,13 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"promise-no-incumbent.html": [
|
||||
"a5458d096b5da8d6619ef5c553f232261887f45a",
|
||||
[
|
||||
null,
|
||||
{}
|
||||
]
|
||||
],
|
||||
"promise.html": [
|
||||
"5925047287175f291c07ee88075359ed92a86e6a",
|
||||
[
|
||||
|
|
12
tests/wpt/mozilla/tests/mozilla/promise-no-incumbent.html
Normal file
12
tests/wpt/mozilla/tests/mozilla/promise-no-incumbent.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
<html>
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
promise_test(function(t) {
|
||||
let p = new Promise((r) => t.step_timeout(r, 0));
|
||||
p.then = function() {};
|
||||
let p2 = new Promise((r) => t.step_timeout(r, 10));
|
||||
return Promise.race([p, p2]);
|
||||
}, 'No panic when SM puts a dummy promise with no incumbent in the queue');
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue