rame.contentWindow.matchMedia(media);
    const calls = [];

    mql2.addListener(() => {
        calls.push("mql2");
    });

    mql1.addListener(() => {
        calls.push("mql1");
    });

    iframe.width = "200"; // 100x100 => 200x100
    await waitForChangesReported();

    assert_array_equals(calls, ["mql1", "mql2"]);
}, "listeners are called in order their MQLs were created");

promise_test(async t => {
    const iframe = await createIFrame(t, 200);
    const media = `(max-height: 150px)`;

    con