https://github.com/web-platform-tests/wpt
Raw File
Tip revision: c050814c692c5e59194d4bf5b5d20f1bbf92397f authored by Simon Pieters on 19 December 2016, 13:33:32 UTC
Test that the snapshotting happens at document creation time
Tip revision: c050814
Worker_ErrorEvent_error.htm
<!doctype html>
<meta charset=utf-8>
<title></title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script>
var t1 = async_test("Error handler outside the worker should not see the error value");
var t2 = async_test("Error handlers inside a worker should see the error value");

test(function() {
  var worker = new Worker("support/ErrorEvent-error.js");
  worker.onerror = t1.step_func_done(function(e) {
    assert_true(/hello/.test(e.message));
    assert_equals(e.error, null);
  });

  var messages = 0;
  worker.onmessage = t2.step_func(function(e) {
    ++messages;
    var data = e.data;
    assert_true(data.source == "onerror" ||
                data.source == "event listener");
    assert_equals(data.value, "hello");
    if (messages == 2) {
      t2.done();
    }
  });
});
</script>
back to top