Revision 149c83d77d05dafea4a5a4dadf6670bfadc8e360 authored by moz-wptsync-bot on 16 March 2018, 13:38:52 UTC, committed by moz-wptsync-bot on 16 March 2018, 13:38:52 UTC
bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1445883
gecko-commit: 0f81334efa0a008db8931a41eef2d26a77d0e800
gecko-integration-branch: mozilla-inbound
gecko-reviewers: smaug
1 parent 1cbb928
Raw File
webxr_availability.http.sub.html
<!DOCTYPE html>
<body>
  <script src=/resources/testharness.js></script>
  <script src=/resources/testharnessreport.js></script>
  <script src=/webxr/resources/webxr_util.js></script>
  <script>
    'use strict';

    var same_origin_src = '/webxr/resources/';
    var cross_origin_https_src = 'https://{{domains[www]}}:{{ports[https][0]}}' +
      same_origin_src;

    test(t => {
      forEachWebxrObject((obj, name) => {
        assert_equals(obj, undefined, name + ' was defined in insecure context.');
      });
    }, 'Test webxr not available in insecure context');

    async_test(t => {
      let frame = document.createElement('iframe');
      frame.src = cross_origin_https_src + 'webxr_check.html';

      window.addEventListener('message', t.step_func(function handler(evt) {
          if (evt.source === frame.contentWindow) {
            document.body.removeChild(frame);
            window.removeEventListener('message', handler);

            assert_equals(evt.data.definedObjects.length, 0,
              "Some objects were defined in insecure context: " +
              evt.data.definedObjects.toString());
            t.done();
          }
      }));

      document.body.appendChild(frame);
    }, 'Test webxr not available in secure context in insecure context');

  </script>
</body>
back to top