|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, you can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 var EXPORTED_SYMBOLS = ['getLength', ];//'compare']; |
|
6 |
|
7 var getLength = function (obj) { |
|
8 var len = 0; |
|
9 for (i in obj) { |
|
10 len++; |
|
11 } |
|
12 |
|
13 return len; |
|
14 } |
|
15 |
|
16 // var logging = {}; Components.utils.import('resource://mozmill/stdlib/logging.js', logging); |
|
17 |
|
18 // var objectsLogger = logging.getLogger('objectsLogger'); |
|
19 |
|
20 // var compare = function (obj1, obj2, depth, recursion) { |
|
21 // if (depth == undefined) { |
|
22 // var depth = 4; |
|
23 // } |
|
24 // if (recursion == undefined) { |
|
25 // var recursion = 0; |
|
26 // } |
|
27 // |
|
28 // if (recursion > depth) { |
|
29 // return true; |
|
30 // } |
|
31 // |
|
32 // if (typeof(obj1) != typeof(obj2)) { |
|
33 // return false; |
|
34 // } |
|
35 // |
|
36 // if (typeof(obj1) == "object" && typeof(obj2) == "object") { |
|
37 // if ([x for (x in obj1)].length != [x for (x in obj2)].length) { |
|
38 // return false; |
|
39 // } |
|
40 // for (i in obj1) { |
|
41 // recursion++; |
|
42 // var result = compare(obj1[i], obj2[i], depth, recursion); |
|
43 // objectsLogger.info(i+' in recursion '+result); |
|
44 // if (result == false) { |
|
45 // return false; |
|
46 // } |
|
47 // } |
|
48 // } else { |
|
49 // if (obj1 != obj2) { |
|
50 // return false; |
|
51 // } |
|
52 // } |
|
53 // return true; |
|
54 // } |