summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/keyboard-map/navigator-keyboard-map-allowed-from-cross-origin-iframe.https.html
blob: 04a8c85fd970bcdade2c8d38fd56287d3936f7be (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
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/cors/support.js?pipe=sub"></script>
<body>
<script>
'use strict';

promise_test(() => {
  let iframe = document.createElement('iframe');
  iframe.src = CROSSDOMAIN  + 'resources/iframe-keyboard-map-allow-helper.html';
  iframe.allow = "keyboard-map";
  iframe.onload = () => {
    iframe.contentWindow.postMessage('Ready', '*');
  }

  document.body.appendChild(iframe);

  return new Promise((resolve,reject) => {
    window.onmessage = message => {
      if (message.data == 'Success') {
        resolve();
      } else if (message.data == 'Failure') {
        reject();
      }
    }
  });
}, '[Keyboard Map] getLayoutMap() allowed from within cross-origin iframe');

</script>