r, true);

    triggerMQLEvent(mql);
    await waitForChangesReported();
    assert_equals(calls, 1, "triggerMQLEvent");

    mql.dispatchEvent(new Event("change"));
    assert_equals(calls, 2, "dispatchEvent");
}, "removeEventListener (capture) doesn't remove listener added with addListener");

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

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

    mql.addEventListener("change", listener);
