vedEvent;
    mql.addListener(event => {
        receivedEvent = event;
    });

    const dispatchedEvent = new Event("change");
    mql.dispatchEvent(dispatchedEvent);

    assert_equals(receivedEvent, dispatchedEvent);
}, "dispatchEvent triggers listener added with addListener");

promise_test(async t => {
    const mql = await createMQL(t);

    let calls = 0;
    const listener = {
        handleEvent() {
            calls++;
        },
    };

    mql.addListener(listener);
    mql.addEventListener("c