mirror of
https://github.com/servo/servo.git
synced 2025-07-13 02:13:40 +01:00
26 lines
1.1 KiB
HTML
26 lines
1.1 KiB
HTML
<!DOCTYPE html>
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<script src="/resources/testdriver.js"></script>
|
|
<script src="/resources/testdriver-vendor.js"></script>
|
|
<script>
|
|
import { getOppositeOrientation } from "/screen-orientation/resources/orientation-utils.js";
|
|
promise_test(async t => {
|
|
await test_driver.bless("request full screen", () => {
|
|
return document.documentElement.requestFullscreen();
|
|
});
|
|
const newOrientation = getOppositeOrientation();
|
|
// This will reject, because the event will call lock() again.
|
|
const pMustReject = screen.orientation.lock(newOrientation);
|
|
// This one resolves, because we are re-locking.
|
|
const pMustResolve = new Promise(r => {
|
|
screen.orientation.onchange = () => {
|
|
r(orientation.lock("any"));
|
|
};
|
|
});
|
|
await promise_rejects(t, new TypeError(), pMustReject);
|
|
await pMustResolve;
|
|
screen.orientation.unlock();
|
|
return document.exitFullscreen();
|
|
}, "Re-locking orientation during event dispatch must reject existing orientationPendingPromise");
|
|
</script>
|