content/base/test/test_bug737087.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/base/test/test_bug737087.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,37 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<!--
     1.6 +https://bugzilla.mozilla.org/show_bug.cgi?id=737087
     1.7 +-->
     1.8 +<title>Test for Bug 737087</title>
     1.9 +<script src="/tests/SimpleTest/SimpleTest.js"></script>
    1.10 +<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
    1.11 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=737087">Mozilla Bug 737087</a>
    1.12 +<script>
    1.13 +
    1.14 +/** Test for Bug 737087 **/
    1.15 +SimpleTest.waitForExplicitFinish();
    1.16 +
    1.17 +var bubbled = false;
    1.18 +var capturedEvent = null;
    1.19 +var inlineFiredEvent = null;
    1.20 +
    1.21 +addEventListener("error", function() { bubbled = true });
    1.22 +addEventListener("error", function(e) {
    1.23 +  capturedEvent = e;
    1.24 +  is(typeof e, "object", "Error event must be object");
    1.25 +  is(Object.getPrototypeOf(e), Event.prototype, "Error event must be Event");
    1.26 +  is(e.bubbles, false, "e.bubbles must be false");
    1.27 +  is(e.cancelable, false, "e.cancelable must be false");
    1.28 +}, true);
    1.29 +
    1.30 +addLoadEvent(function() {
    1.31 +  is(bubbled, false, "Error event must not bubble");
    1.32 +  isnot(capturedEvent, null, "Error event must be captured");
    1.33 +  isnot(inlineFiredEvent, null, "Inline error handler must fire");
    1.34 +  is(capturedEvent, inlineFiredEvent,
    1.35 +     "Same event must be handled by both handlers");
    1.36 +  SimpleTest.finish();
    1.37 +});
    1.38 +</script>
    1.39 +<script src=nonexistent
    1.40 +  onerror="inlineFiredEvent = event"></script>

mercurial