4 https://bugzilla.mozilla.org/show_bug.cgi?id=1465602
8 <title>Test for Bug
1465602</title>
9 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
10 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css"/>
13 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=1465602">Mozilla Bug
1465602</a>
15 <div id=
"content" style=
"display: none">
20 <script type=
"application/javascript">
21 /* global TestFunctions */
22 /** Test for Bug
1465602 **/
24 SimpleTest.waitForExplicitFinish();
25 SpecialPowers.pushPrefEnv({set: [[
"dom.expose_test_interfaces", true]]}, go);
28 var ourObj = new TestFunctions();
29 is(ourObj.one,
1,
"Basic sanity check for our 'one'");
30 is(ourObj.two, undefined,
"Basic sanity check for our 'two'");
32 var otherObj = new frames[
0].TestFunctions();
33 is(otherObj.one,
1,
"Basic sanity check for subframe 'one'");
34 is(otherObj.two,
2,
"Basic sanity check for subframe 'two'");
36 var ourToJSON = ourObj.toJSON();
37 is(ourToJSON.one,
1,
"We should have correct value for 'one'");
38 is(ourToJSON.two, undefined,
"We should have correct value for 'two'");
39 ok(!Object.hasOwnProperty(ourToJSON,
"two"),
40 "We should not have a property named 'two'");
42 var otherToJSON = otherObj.toJSON();
43 is(otherToJSON.one,
1,
"Subframe should have correct value for 'one'");
44 is(otherToJSON.two,
2,
"Subframe should have correct value for 'two'");
46 var mixedToJSON = ourObj.toJSON.call(otherObj);
47 is(mixedToJSON.one,
1,
"First test should have correct value for 'one'");
48 is(mixedToJSON.two,
2,
"First test should have correct value for 'two'");
50 mixedToJSON = otherObj.toJSON.call(ourObj);
51 is(mixedToJSON.one,
1,
"Second test should have correct value for 'one'");
52 is(mixedToJSON.two, undefined,
53 "Second test should have correct value for 'two'");