Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3 "use strict";
5 let someObject = {
6 a: 1,
7 func: function()
8 {
9 this.b = 2;
10 }
11 };
13 let anotherObject = {
14 _finalize: function()
15 {
16 someObject.c = 3;
17 }
18 };
20 function test() {
21 ok(TiltUtils, "The TiltUtils object doesn't exist.");
23 TiltUtils.bindObjectFunc(someObject, "", anotherObject);
24 someObject.func();
26 is(someObject.a, 1,
27 "The bindObjectFunc() messed the non-function members of the object.");
28 isnot(someObject.b, 2,
29 "The bindObjectFunc() didn't ignore the old scope correctly.");
30 is(anotherObject.b, 2,
31 "The bindObjectFunc() didn't set the new scope correctly.");
34 TiltUtils.destroyObject(anotherObject);
35 is(someObject.c, 3,
36 "The finalize function wasn't called when an object was destroyed.");
39 TiltUtils.destroyObject(someObject);
40 is(typeof someObject.a, "undefined",
41 "Not all members of the destroyed object were deleted.");
42 is(typeof someObject.func, "undefined",
43 "Not all function members of the destroyed object were deleted.");
44 }