https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 3dadc0c18b5224dae634f59f54f6025cc9cdc17e authored by PhistucK on 03 November 2018, 12:16:45 UTC
HTML/events/beforeunload - respect preventDefault().
Tip revision: 3dadc0c
battery-insecure-context.html
<!DOCTYPE html>
<meta charset="utf-8">
<title>Battery Test: navigator.getBattery() shall throw "SecurityError" in an insecure context</title>
<link rel="author" title="Intel" href="http://www.intel.com">
<link rel="help" href="https://www.w3.org/TR/battery-status/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
  #note {
    background-color: #fef1b5;
    border: solid 1px #cdab2d;
    padding: 5px;
    margin: 15px;
    display: block;
  }
</style>
<div id="note">
  Run test in an insecure context, e.g. http://example.com/.
</div>

<script>

promise_test(t => {
  return promise_rejects(t, 'SecurityError', navigator.getBattery());
}, "navigator.getBattery() shall throw a 'SecurityError' in an insecure context");

</script>
back to top