4 https://bugzilla.mozilla.org/show_bug.cgi?id=1048659
8 <title>Test for Bug
1048659</title>
9 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
10 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css"/>
11 <script type=
"application/javascript">
12 /* global TestInterfaceJS */
13 /** Test for returning unions from JS-implemented WebIDL. **/
14 SimpleTest.waitForExplicitFinish();
15 SpecialPowers.pushPrefEnv({set: [[
"dom.expose_test_interfaces", true]]}, go);
18 var t = new TestInterfaceJS();
19 var t2 = new TestInterfaceJS();
21 is(t.pingPongUnion(t2), t2,
"ping pong union for left case should be identity");
22 is(t.pingPongUnion(
12),
12,
"ping pong union for right case should be identity");
24 is(t.pingPongUnionContainingNull(
"this is not a string"),
"this is not a string",
25 "ping pong union containing union for left case should be identity");
26 is(t.pingPongUnionContainingNull(null), null,
27 "ping pong union containing null for right case null should be identity");
28 is(t.pingPongUnionContainingNull(t2), t2,
29 "ping pong union containing null for right case should be identity");
31 is(t.pingPongNullableUnion(t2), t2,
"ping pong nullable union for left case should be identity");
32 is(t.pingPongNullableUnion(
12),
12,
"ping pong nullable union for right case should be identity");
33 is(t.pingPongNullableUnion(null), null,
"ping pong nullable union for null case should be identity");
35 var rejectedBadUnion = false;
38 result = t.returnBadUnion();
40 rejectedBadUnion = true;
42 is(result, null,
"bad union should not set a value for result");
43 ok(rejectedBadUnion,
"bad union should throw an exception");
51 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=1048659">Mozilla Bug
1048659</a>
53 <div id=
"content" style=
"display: none">