https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 9b373c2bb3fc0aa2681e0b167a99546b42a67591 authored by Anne van Kesteren on 31 May 2016, 13:13:51 UTC
test about URLs
Tip revision: 9b373c2
usb-allowed-by-feature-policy-attribute.https.sub.html
<!DOCTYPE html>
<body>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script>
'use strict';

async_test(t => {
  let frame = document.createElement('iframe');
  frame.src = 'https://{{domains[www]}}:{{ports[https][0]}}/webusb/resources/check-availability.html';
  frame.allow = 'usb';

  window.addEventListener('message', t.step_func(evt => {
    if (evt.source == frame.contentWindow) {
      assert_equals(evt.data, '#OK');
      document.body.removeChild(frame);
      t.done();
    }
  }));

  document.body.appendChild(frame);
}, 'Feature policy "usb" can be enabled in cross-origin iframes using "allowed" attribute.');
</script>
</body>
back to top