tor-browser

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

bug1833279-001.html (1483B)


      1 <!DOCTYPE HTML>
      2 <meta charset="utf-8">
      3 <title>Test for bug 1833279</title>
      4 <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com">
      5 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1833279">
      6 <script src="/resources/testharness.js"></script>
      7 <script src="/resources/testharnessreport.js"></script>
      8 <script>
      9  setup({ single_test: true });
     10 
     11  // The following callback-function gets called twice by our iframe inner-doc:
     12  // 1. when the iframe's document finishes printing.
     13  // 2. when the iframe's document finishes loading its own <object> child-document.
     14  // When those two steps have completed, we're past the situation that would
     15  // trigger a fatal assertion when the object document gets cycle-collected.
     16  // So at that point we remove our iframe, and (after a rAF tick) trigger a
     17  // GC and CC, and then consider the test as having passed if we're still
     18  // alive at that point.
     19  const MAX_STEPS = 2;
     20  let stepsComplete = 0;
     21 
     22  function iframeStepComplete() {
     23    stepsComplete++;
     24    if (stepsComplete < MAX_STEPS) {
     25      return;
     26    }
     27    requestAnimationFrame(()=> {
     28      myIframe.remove();
     29      requestAnimationFrame(()=> {
     30        SpecialPowers.DOMWindowUtils.garbageCollect();
     31        SpecialPowers.DOMWindowUtils.cycleCollect();
     32        assert_true(true, "successfully completed without crashing");
     33        done();
     34      });
     35    });
     36  }
     37 </script>
     38 <iframe id="myIframe" src="resources/bug1833279-iframe.html"></iframe>