tor-browser

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

test_custom_element_reflector.html (1054B)


      1 <!doctype html>
      2 <title>Custom Elements don't lose their reflectors</title>
      3 <script src="/tests/SimpleTest/SimpleTest.js"></script>
      4 <!-- First tests upgrading with an existing reflector, second without -->
      5 <custom-element></custom-element>
      6 <custom-element></custom-element>
      7 <script>
      8  (function() {
      9    // Ensure we create a reflector for the first element before-hand.
     10    let firstElement = document.querySelector("custom-element");
     11  }());
     12 
     13  customElements.define("custom-element", class MyCustomElement extends HTMLElement {
     14    myFunction() {
     15      // Do nothing
     16    }
     17  });
     18 
     19  ok(!!document.querySelector("custom-element").myFunction, "Has the right prototype before GC");;
     20  ok(!!document.querySelectorAll("custom-element")[1].myFunction, "Has the right prototype before GC");;
     21 
     22  SpecialPowers.forceCC();
     23  SpecialPowers.forceGC();
     24 
     25  ok(!!document.querySelector("custom-element").myFunction, "Has the right prototype after GC");;
     26  ok(!!document.querySelectorAll("custom-element")[1].myFunction, "Has the right prototype before GC");;
     27 </script>