summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/screen-orientation/resources/sandboxed-iframe-locking.html
blob: 436c67f5b53b1f88ef1537072be3b0011724d7b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<!DOCTYPE html>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script>
test_driver.set_test_context(parent);

// At first, run simple unlock test without lock.
screen.orientation?.unlock();

test_driver.bless("request full screen", async () => {
  const data = {};
  try {
    await document.documentElement.requestFullscreen();
    await screen.orientation.lock("portrait")
    data.result = "locked";
    data.orientation = screen.orientation.type;
  } catch (error) {
    data.result = "errored";
    data.name = error.name;
  }

  screen.orientation.unlock();
  try {
    await document.exitFullscreen();
  } catch (error) {
    data.result = "errored";
    data.name = error.name;
  }

  parent.window.postMessage(data, "*");
});
</script>