browser/devtools/tilt/test/browser_tilt_utils06.js

branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
equal deleted inserted replaced
-1:000000000000 0:3852ddae1b7f
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3 "use strict";
4
5 let someObject = {
6 a: 1,
7 func: function()
8 {
9 this.b = 2;
10 }
11 };
12
13 let anotherObject = {
14 _finalize: function()
15 {
16 someObject.c = 3;
17 }
18 };
19
20 function test() {
21 ok(TiltUtils, "The TiltUtils object doesn't exist.");
22
23 TiltUtils.bindObjectFunc(someObject, "", anotherObject);
24 someObject.func();
25
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.");
32
33
34 TiltUtils.destroyObject(anotherObject);
35 is(someObject.c, 3,
36 "The finalize function wasn't called when an object was destroyed.");
37
38
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 }

mercurial