tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

observer-exceptions.html (2060B)


      1 <!DOCTYPE html>
      2 <meta name="viewport" content="width=device-width,initial-scale=1">
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 
      6 <script>
      7 test(function () {
      8  assert_throws_js(RangeError, function() {
      9    new IntersectionObserver(e => {}, {threshold: [1.1]})
     10  })
     11 }, "IntersectionObserver constructor with { threshold: [1.1] }");
     12 
     13 test(function () {
     14  assert_throws_js(TypeError, function() {
     15    new IntersectionObserver(e => {}, {threshold: ["foo"]})
     16  })
     17 }, 'IntersectionObserver constructor with { threshold: ["foo"] }');
     18 
     19 test(function () {
     20  assert_throws_dom("SYNTAX_ERR", function() {
     21    new IntersectionObserver(e => {}, {rootMargin: "1"})
     22  })
     23 }, 'IntersectionObserver constructor with { rootMargin: "1" }');
     24 
     25 test(function () {
     26  assert_throws_dom("SYNTAX_ERR", function() {
     27    new IntersectionObserver(e => {}, {rootMargin: "2em"})
     28  })
     29 }, 'IntersectionObserver constructor with { rootMargin: "2em" }');
     30 
     31 test(function () {
     32  assert_throws_dom("SYNTAX_ERR", function() {
     33    new IntersectionObserver(e => {}, {rootMargin: "auto"})
     34  })
     35 }, 'IntersectionObserver constructor with { rootMargin: "auto" }');
     36 
     37 test(function () {
     38  assert_throws_dom("SYNTAX_ERR", function() {
     39    new IntersectionObserver(e => {}, {rootMargin: "calc(1px + 2px)"})
     40  })
     41 }, 'IntersectionObserver constructor with { rootMargin: "calc(1px + 2px)" }');
     42 
     43 test(function () {
     44  assert_throws_dom("SYNTAX_ERR", function() {
     45    new IntersectionObserver(e => {}, {rootMargin: "1px !important"})
     46  })
     47 }, 'IntersectionObserver constructor with { rootMargin: "1px !important" }');
     48 
     49 test(function () {
     50  assert_throws_dom("SYNTAX_ERR", function() {
     51    new IntersectionObserver(e => {}, {rootMargin: "1px 1px 1px 1px 1px"})
     52  })
     53 }, 'IntersectionObserver constructor with { rootMargin: "1px 1px 1px 1px 1px" }');
     54 
     55 test(function () {
     56  assert_throws_js(TypeError, function() {
     57    let observer = new IntersectionObserver(c => {}, {});
     58    observer.observe("foo");
     59  })
     60 }, 'IntersectionObserver.observe("foo")');
     61 </script>