dom/tests/mochitest/whatwg/postMessage_structured_clone_helper.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 function getTestContent()
michael@0 2 {
michael@0 3 yield "hello";
michael@0 4 yield 2+3;
michael@0 5 yield 12;
michael@0 6 yield null;
michael@0 7 yield "complex" + "string";
michael@0 8 yield new Object();
michael@0 9 yield new Date(1306113544);
michael@0 10 yield [1, 2, 3, 4, 5];
michael@0 11 let obj = new Object();
michael@0 12 obj.foo = 3;
michael@0 13 obj.bar = "hi";
michael@0 14 obj.baz = new Date(1306113544);
michael@0 15 obj.boo = obj;
michael@0 16 yield obj;
michael@0 17
michael@0 18 let recursiveobj = new Object();
michael@0 19 recursiveobj.a = recursiveobj;
michael@0 20 recursiveobj.foo = new Object();
michael@0 21 recursiveobj.foo.bar = "bar";
michael@0 22 recursiveobj.foo.backref = recursiveobj;
michael@0 23 recursiveobj.foo.baz = 84;
michael@0 24 recursiveobj.foo.backref2 = recursiveobj;
michael@0 25 recursiveobj.bar = new Object();
michael@0 26 recursiveobj.bar.foo = "foo";
michael@0 27 recursiveobj.bar.backref = recursiveobj;
michael@0 28 recursiveobj.bar.baz = new Date(1306113544);
michael@0 29 recursiveobj.bar.backref2 = recursiveobj;
michael@0 30 recursiveobj.expando = recursiveobj;
michael@0 31 yield recursiveobj;
michael@0 32
michael@0 33 let obj = new Object();
michael@0 34 obj.expando1 = 1;
michael@0 35 obj.foo = new Object();
michael@0 36 obj.foo.bar = 2;
michael@0 37 obj.bar = new Object();
michael@0 38 obj.bar.foo = obj.foo;
michael@0 39 obj.expando = new Object();
michael@0 40 obj.expando.expando = new Object();
michael@0 41 obj.expando.expando.obj = obj;
michael@0 42 obj.expando2 = 4;
michael@0 43 obj.baz = obj.expando.expando;
michael@0 44 obj.blah = obj.bar;
michael@0 45 obj.foo.baz = obj.blah;
michael@0 46 obj.foo.blah = obj.blah;
michael@0 47 yield obj;
michael@0 48
michael@0 49 let diamond = new Object();
michael@0 50 let obj = new Object();
michael@0 51 obj.foo = "foo";
michael@0 52 obj.bar = 92;
michael@0 53 obj.backref = diamond;
michael@0 54 diamond.ref1 = obj;
michael@0 55 diamond.ref2 = obj;
michael@0 56 yield diamond;
michael@0 57
michael@0 58 let doubleref = new Object();
michael@0 59 let obj = new Object();
michael@0 60 doubleref.ref1 = obj;
michael@0 61 doubleref.ref2 = obj;
michael@0 62 yield doubleref;
michael@0 63 }

mercurial