browser/devtools/tilt/test/browser_tilt_utils06.js

Wed, 31 Dec 2014 06:55:46 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:46 +0100
changeset 1
ca08bd8f51b2
permissions
-rw-r--r--

Added tag TORBROWSER_REPLICA for changeset 6474c204b198

     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 }

mercurial