<!DOCTYPE html>
<html><head>
  <title> scheduler: slow loading external script added with DOM (appendChild)</title>
  <script src="/resources/testharness.js"></script>
  <script src="/resources/testharnessreport.js"></script>
  <script src="testlib/testlib.js"></script>
</head>
<body>

  <div id="log">FAILED (This TC requires JavaScript enabled)</div>
  <div></div>
  <script>
  var t = async_test()
  log('inline script #1');
  testlib.addScript('', { src:'scripts/include-1.js?pipe=trickle(d1)&'+Math.random() }, document.getElementsByTagName('head')[0], false );
  log('end script #1');
  </script>
  <script src="scripts/include-2.js"></script>
  <script>
  log( 'inline script #2' );

  function test() {
    assert_array_equals(eventOrder, ['inline script #1', 'end script #1', 'external script #2', 'inline script #2', 'external script #1']);
    t.done();
  }
  onload = t.step_func(function() {
    setTimeout(t.step_func(test), 12);
  });
  </script>

</body></html>
