browser/devtools/debugger/test/browser_dbg_variables-view-data.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:ca06544bacf4
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3
4 /**
5 * Make sure that the variables view correctly populates itself
6 * when given some raw data.
7 */
8
9 let gTab, gDebuggee, gPanel, gDebugger;
10 let gVariablesView, gScope, gVariable;
11
12 function test() {
13 initDebugger("about:blank").then(([aTab, aDebuggee, aPanel]) => {
14 gTab = aTab;
15 gDebuggee = aDebuggee;
16 gPanel = aPanel;
17 gDebugger = gPanel.panelWin;
18 gVariablesView = gDebugger.DebuggerView.Variables;
19
20 performTest();
21 });
22 }
23
24 function performTest() {
25 let arr = [
26 42,
27 true,
28 "nasu",
29 undefined,
30 null,
31 [0, 1, 2],
32 { prop1: 9, prop2: 8 }
33 ];
34
35 let obj = {
36 p0: 42,
37 p1: true,
38 p2: "nasu",
39 p3: undefined,
40 p4: null,
41 p5: [3, 4, 5],
42 p6: { prop1: 7, prop2: 6 },
43 get p7() { return arr; },
44 set p8(value) { arr[0] = value }
45 };
46
47 let test = {
48 someProp0: 42,
49 someProp1: true,
50 someProp2: "nasu",
51 someProp3: undefined,
52 someProp4: null,
53 someProp5: arr,
54 someProp6: obj,
55 get someProp7() { return arr; },
56 set someProp7(value) { arr[0] = value }
57 };
58
59 gVariablesView.eval = function() {};
60 gVariablesView.switch = function() {};
61 gVariablesView.delete = function() {};
62 gVariablesView.new = function() {};
63 gVariablesView.rawObject = test;
64
65 testHierarchy();
66 testHeader();
67 testFirstLevelContents();
68 testSecondLevelContents();
69 testThirdLevelContents();
70 testOriginalRawDataIntegrity(arr, obj);
71
72 let fooScope = gVariablesView.addScope("foo");
73 let anonymousVar = fooScope.addItem();
74
75 let anonymousScope = gVariablesView.addScope();
76 let barVar = anonymousScope.addItem("bar");
77 let bazProperty = barVar.addItem("baz");
78
79 testAnonymousHeaders(fooScope, anonymousVar, anonymousScope, barVar, bazProperty);
80 testPropertyInheritance(fooScope, anonymousVar, anonymousScope, barVar, bazProperty);
81
82 testClearHierarchy();
83 closeDebuggerAndFinish(gPanel);
84 }
85
86 function testHierarchy() {
87 is(gVariablesView._currHierarchy.size, 13,
88 "There should be 1 scope, 1 var, 1 proto, 8 props, 1 getter and 1 setter.");
89
90 gScope = gVariablesView._currHierarchy.get("");
91 gVariable = gVariablesView._currHierarchy.get("[\"\"]");
92
93 is(gVariablesView._store.length, 1,
94 "There should be only one scope in the view.");
95 is(gScope._store.size, 1,
96 "There should be only one variable in the scope.");
97 is(gVariable._store.size, 9,
98 "There should be 1 __proto__ and 8 properties in the variable.");
99 }
100
101 function testHeader() {
102 is(gScope.header, false,
103 "The scope title header should be hidden.");
104 is(gVariable.header, false,
105 "The variable title header should be hidden.");
106
107 gScope.showHeader();
108 gVariable.showHeader();
109
110 is(gScope.header, false,
111 "The scope title header should still not be visible.");
112 is(gVariable.header, false,
113 "The variable title header should still not be visible.");
114
115 gScope.hideHeader();
116 gVariable.hideHeader();
117
118 is(gScope.header, false,
119 "The scope title header should now still be hidden.");
120 is(gVariable.header, false,
121 "The variable title header should now still be hidden.");
122 }
123
124 function testFirstLevelContents() {
125 let someProp0 = gVariable.get("someProp0");
126 let someProp1 = gVariable.get("someProp1");
127 let someProp2 = gVariable.get("someProp2");
128 let someProp3 = gVariable.get("someProp3");
129 let someProp4 = gVariable.get("someProp4");
130 let someProp5 = gVariable.get("someProp5");
131 let someProp6 = gVariable.get("someProp6");
132 let someProp7 = gVariable.get("someProp7");
133 let __proto__ = gVariable.get("__proto__");
134
135 is(someProp0.visible, true, "The first property visible state is correct.");
136 is(someProp1.visible, true, "The second property visible state is correct.");
137 is(someProp2.visible, true, "The third property visible state is correct.");
138 is(someProp3.visible, true, "The fourth property visible state is correct.");
139 is(someProp4.visible, true, "The fifth property visible state is correct.");
140 is(someProp5.visible, true, "The sixth property visible state is correct.");
141 is(someProp6.visible, true, "The seventh property visible state is correct.");
142 is(someProp7.visible, true, "The eight property visible state is correct.");
143 is(__proto__.visible, true, "The __proto__ property visible state is correct.");
144
145 is(someProp0.expanded, false, "The first property expanded state is correct.");
146 is(someProp1.expanded, false, "The second property expanded state is correct.");
147 is(someProp2.expanded, false, "The third property expanded state is correct.");
148 is(someProp3.expanded, false, "The fourth property expanded state is correct.");
149 is(someProp4.expanded, false, "The fifth property expanded state is correct.");
150 is(someProp5.expanded, false, "The sixth property expanded state is correct.");
151 is(someProp6.expanded, false, "The seventh property expanded state is correct.");
152 is(someProp7.expanded, true, "The eight property expanded state is correct.");
153 is(__proto__.expanded, false, "The __proto__ property expanded state is correct.");
154
155 is(someProp0.header, true, "The first property header state is correct.");
156 is(someProp1.header, true, "The second property header state is correct.");
157 is(someProp2.header, true, "The third property header state is correct.");
158 is(someProp3.header, true, "The fourth property header state is correct.");
159 is(someProp4.header, true, "The fifth property header state is correct.");
160 is(someProp5.header, true, "The sixth property header state is correct.");
161 is(someProp6.header, true, "The seventh property header state is correct.");
162 is(someProp7.header, true, "The eight property header state is correct.");
163 is(__proto__.header, true, "The __proto__ property header state is correct.");
164
165 is(someProp0.twisty, false, "The first property twisty state is correct.");
166 is(someProp1.twisty, false, "The second property twisty state is correct.");
167 is(someProp2.twisty, false, "The third property twisty state is correct.");
168 is(someProp3.twisty, false, "The fourth property twisty state is correct.");
169 is(someProp4.twisty, false, "The fifth property twisty state is correct.");
170 is(someProp5.twisty, true, "The sixth property twisty state is correct.");
171 is(someProp6.twisty, true, "The seventh property twisty state is correct.");
172 is(someProp7.twisty, true, "The eight property twisty state is correct.");
173 is(__proto__.twisty, true, "The __proto__ property twisty state is correct.");
174
175 is(someProp0.name, "someProp0", "The first property name is correct.");
176 is(someProp1.name, "someProp1", "The second property name is correct.");
177 is(someProp2.name, "someProp2", "The third property name is correct.");
178 is(someProp3.name, "someProp3", "The fourth property name is correct.");
179 is(someProp4.name, "someProp4", "The fifth property name is correct.");
180 is(someProp5.name, "someProp5", "The sixth property name is correct.");
181 is(someProp6.name, "someProp6", "The seventh property name is correct.");
182 is(someProp7.name, "someProp7", "The eight property name is correct.");
183 is(__proto__.name, "__proto__", "The __proto__ property name is correct.");
184
185 is(someProp0.value, 42, "The first property value is correct.");
186 is(someProp1.value, true, "The second property value is correct.");
187 is(someProp2.value, "nasu", "The third property value is correct.");
188 is(someProp3.value.type, "undefined", "The fourth property value is correct.");
189 is(someProp4.value.type, "null", "The fifth property value is correct.");
190 is(someProp5.value.type, "object", "The sixth property value type is correct.");
191 is(someProp5.value.class, "Array", "The sixth property value class is correct.");
192 is(someProp6.value.type, "object", "The seventh property value type is correct.");
193 is(someProp6.value.class, "Object", "The seventh property value class is correct.");
194 is(someProp7.value, null, "The eight property value is correct.");
195 isnot(someProp7.getter, null, "The eight property getter is correct.");
196 isnot(someProp7.setter, null, "The eight property setter is correct.");
197 is(someProp7.getter.type, "object", "The eight property getter type is correct.");
198 is(someProp7.getter.class, "Function", "The eight property getter class is correct.");
199 is(someProp7.setter.type, "object", "The eight property setter type is correct.");
200 is(someProp7.setter.class, "Function", "The eight property setter class is correct.");
201 is(__proto__.value.type, "object", "The __proto__ property value type is correct.");
202 is(__proto__.value.class, "Object", "The __proto__ property value class is correct.");
203
204 someProp0.expand();
205 someProp1.expand();
206 someProp2.expand();
207 someProp3.expand();
208 someProp4.expand();
209 someProp7.expand();
210
211 ok(!someProp0.get("__proto__"), "Number primitives should not have a prototype");
212 ok(!someProp1.get("__proto__"), "Boolean primitives should not have a prototype");
213 ok(!someProp2.get("__proto__"), "String literals should not have a prototype");
214 ok(!someProp3.get("__proto__"), "Undefined values should not have a prototype");
215 ok(!someProp4.get("__proto__"), "Null values should not have a prototype");
216 ok(!someProp7.get("__proto__"), "Getter properties should not have a prototype");
217 }
218
219 function testSecondLevelContents() {
220 let someProp5 = gVariable.get("someProp5");
221 let someProp6 = gVariable.get("someProp6");
222
223 is(someProp5._store.size, 0, "No properties should be in someProp5 before expanding");
224 someProp5.expand();
225 is(someProp5._store.size, 9, "Some properties should be in someProp5 before expanding");
226
227 let arrayItem0 = someProp5.get("0");
228 let arrayItem1 = someProp5.get("1");
229 let arrayItem2 = someProp5.get("2");
230 let arrayItem3 = someProp5.get("3");
231 let arrayItem4 = someProp5.get("4");
232 let arrayItem5 = someProp5.get("5");
233 let arrayItem6 = someProp5.get("6");
234 let __proto__ = someProp5.get("__proto__");
235
236 is(arrayItem0.visible, true, "The first array item visible state is correct.");
237 is(arrayItem1.visible, true, "The second array item visible state is correct.");
238 is(arrayItem2.visible, true, "The third array item visible state is correct.");
239 is(arrayItem3.visible, true, "The fourth array item visible state is correct.");
240 is(arrayItem4.visible, true, "The fifth array item visible state is correct.");
241 is(arrayItem5.visible, true, "The sixth array item visible state is correct.");
242 is(arrayItem6.visible, true, "The seventh array item visible state is correct.");
243 is(__proto__.visible, true, "The __proto__ property visible state is correct.");
244
245 is(arrayItem0.expanded, false, "The first array item expanded state is correct.");
246 is(arrayItem1.expanded, false, "The second array item expanded state is correct.");
247 is(arrayItem2.expanded, false, "The third array item expanded state is correct.");
248 is(arrayItem3.expanded, false, "The fourth array item expanded state is correct.");
249 is(arrayItem4.expanded, false, "The fifth array item expanded state is correct.");
250 is(arrayItem5.expanded, false, "The sixth array item expanded state is correct.");
251 is(arrayItem6.expanded, false, "The seventh array item expanded state is correct.");
252 is(__proto__.expanded, false, "The __proto__ property expanded state is correct.");
253
254 is(arrayItem0.header, true, "The first array item header state is correct.");
255 is(arrayItem1.header, true, "The second array item header state is correct.");
256 is(arrayItem2.header, true, "The third array item header state is correct.");
257 is(arrayItem3.header, true, "The fourth array item header state is correct.");
258 is(arrayItem4.header, true, "The fifth array item header state is correct.");
259 is(arrayItem5.header, true, "The sixth array item header state is correct.");
260 is(arrayItem6.header, true, "The seventh array item header state is correct.");
261 is(__proto__.header, true, "The __proto__ property header state is correct.");
262
263 is(arrayItem0.twisty, false, "The first array item twisty state is correct.");
264 is(arrayItem1.twisty, false, "The second array item twisty state is correct.");
265 is(arrayItem2.twisty, false, "The third array item twisty state is correct.");
266 is(arrayItem3.twisty, false, "The fourth array item twisty state is correct.");
267 is(arrayItem4.twisty, false, "The fifth array item twisty state is correct.");
268 is(arrayItem5.twisty, true, "The sixth array item twisty state is correct.");
269 is(arrayItem6.twisty, true, "The seventh array item twisty state is correct.");
270 is(__proto__.twisty, true, "The __proto__ property twisty state is correct.");
271
272 is(arrayItem0.name, "0", "The first array item name is correct.");
273 is(arrayItem1.name, "1", "The second array item name is correct.");
274 is(arrayItem2.name, "2", "The third array item name is correct.");
275 is(arrayItem3.name, "3", "The fourth array item name is correct.");
276 is(arrayItem4.name, "4", "The fifth array item name is correct.");
277 is(arrayItem5.name, "5", "The sixth array item name is correct.");
278 is(arrayItem6.name, "6", "The seventh array item name is correct.");
279 is(__proto__.name, "__proto__", "The __proto__ property name is correct.");
280
281 is(arrayItem0.value, 42, "The first array item value is correct.");
282 is(arrayItem1.value, true, "The second array item value is correct.");
283 is(arrayItem2.value, "nasu", "The third array item value is correct.");
284 is(arrayItem3.value.type, "undefined", "The fourth array item value is correct.");
285 is(arrayItem4.value.type, "null", "The fifth array item value is correct.");
286 is(arrayItem5.value.type, "object", "The sixth array item value type is correct.");
287 is(arrayItem5.value.class, "Array", "The sixth array item value class is correct.");
288 is(arrayItem6.value.type, "object", "The seventh array item value type is correct.");
289 is(arrayItem6.value.class, "Object", "The seventh array item value class is correct.");
290 is(__proto__.value.type, "object", "The __proto__ property value type is correct.");
291 is(__proto__.value.class, "Array", "The __proto__ property value class is correct.");
292
293 is(someProp6._store.size, 0, "No properties should be in someProp6 before expanding");
294 someProp6.expand();
295 is(someProp6._store.size, 10, "Some properties should be in someProp6 before expanding");
296
297 let objectItem0 = someProp6.get("p0");
298 let objectItem1 = someProp6.get("p1");
299 let objectItem2 = someProp6.get("p2");
300 let objectItem3 = someProp6.get("p3");
301 let objectItem4 = someProp6.get("p4");
302 let objectItem5 = someProp6.get("p5");
303 let objectItem6 = someProp6.get("p6");
304 let objectItem7 = someProp6.get("p7");
305 let objectItem8 = someProp6.get("p8");
306 let __proto__ = someProp6.get("__proto__");
307
308 is(objectItem0.visible, true, "The first object item visible state is correct.");
309 is(objectItem1.visible, true, "The second object item visible state is correct.");
310 is(objectItem2.visible, true, "The third object item visible state is correct.");
311 is(objectItem3.visible, true, "The fourth object item visible state is correct.");
312 is(objectItem4.visible, true, "The fifth object item visible state is correct.");
313 is(objectItem5.visible, true, "The sixth object item visible state is correct.");
314 is(objectItem6.visible, true, "The seventh object item visible state is correct.");
315 is(objectItem7.visible, true, "The eight object item visible state is correct.");
316 is(objectItem8.visible, true, "The ninth object item visible state is correct.");
317 is(__proto__.visible, true, "The __proto__ property visible state is correct.");
318
319 is(objectItem0.expanded, false, "The first object item expanded state is correct.");
320 is(objectItem1.expanded, false, "The second object item expanded state is correct.");
321 is(objectItem2.expanded, false, "The third object item expanded state is correct.");
322 is(objectItem3.expanded, false, "The fourth object item expanded state is correct.");
323 is(objectItem4.expanded, false, "The fifth object item expanded state is correct.");
324 is(objectItem5.expanded, false, "The sixth object item expanded state is correct.");
325 is(objectItem6.expanded, false, "The seventh object item expanded state is correct.");
326 is(objectItem7.expanded, true, "The eight object item expanded state is correct.");
327 is(objectItem8.expanded, true, "The ninth object item expanded state is correct.");
328 is(__proto__.expanded, false, "The __proto__ property expanded state is correct.");
329
330 is(objectItem0.header, true, "The first object item header state is correct.");
331 is(objectItem1.header, true, "The second object item header state is correct.");
332 is(objectItem2.header, true, "The third object item header state is correct.");
333 is(objectItem3.header, true, "The fourth object item header state is correct.");
334 is(objectItem4.header, true, "The fifth object item header state is correct.");
335 is(objectItem5.header, true, "The sixth object item header state is correct.");
336 is(objectItem6.header, true, "The seventh object item header state is correct.");
337 is(objectItem7.header, true, "The eight object item header state is correct.");
338 is(objectItem8.header, true, "The ninth object item header state is correct.");
339 is(__proto__.header, true, "The __proto__ property header state is correct.");
340
341 is(objectItem0.twisty, false, "The first object item twisty state is correct.");
342 is(objectItem1.twisty, false, "The second object item twisty state is correct.");
343 is(objectItem2.twisty, false, "The third object item twisty state is correct.");
344 is(objectItem3.twisty, false, "The fourth object item twisty state is correct.");
345 is(objectItem4.twisty, false, "The fifth object item twisty state is correct.");
346 is(objectItem5.twisty, true, "The sixth object item twisty state is correct.");
347 is(objectItem6.twisty, true, "The seventh object item twisty state is correct.");
348 is(objectItem7.twisty, true, "The eight object item twisty state is correct.");
349 is(objectItem8.twisty, true, "The ninth object item twisty state is correct.");
350 is(__proto__.twisty, true, "The __proto__ property twisty state is correct.");
351
352 is(objectItem0.name, "p0", "The first object item name is correct.");
353 is(objectItem1.name, "p1", "The second object item name is correct.");
354 is(objectItem2.name, "p2", "The third object item name is correct.");
355 is(objectItem3.name, "p3", "The fourth object item name is correct.");
356 is(objectItem4.name, "p4", "The fifth object item name is correct.");
357 is(objectItem5.name, "p5", "The sixth object item name is correct.");
358 is(objectItem6.name, "p6", "The seventh object item name is correct.");
359 is(objectItem7.name, "p7", "The eight seventh object item name is correct.");
360 is(objectItem8.name, "p8", "The ninth seventh object item name is correct.");
361 is(__proto__.name, "__proto__", "The __proto__ property name is correct.");
362
363 is(objectItem0.value, 42, "The first object item value is correct.");
364 is(objectItem1.value, true, "The second object item value is correct.");
365 is(objectItem2.value, "nasu", "The third object item value is correct.");
366 is(objectItem3.value.type, "undefined", "The fourth object item value is correct.");
367 is(objectItem4.value.type, "null", "The fifth object item value is correct.");
368 is(objectItem5.value.type, "object", "The sixth object item value type is correct.");
369 is(objectItem5.value.class, "Array", "The sixth object item value class is correct.");
370 is(objectItem6.value.type, "object", "The seventh object item value type is correct.");
371 is(objectItem6.value.class, "Object", "The seventh object item value class is correct.");
372 is(objectItem7.value, null, "The eight object item value is correct.");
373 isnot(objectItem7.getter, null, "The eight object item getter is correct.");
374 isnot(objectItem7.setter, null, "The eight object item setter is correct.");
375 is(objectItem7.setter.type, "undefined", "The eight object item setter type is correct.");
376 is(objectItem7.getter.type, "object", "The eight object item getter type is correct.");
377 is(objectItem7.getter.class, "Function", "The eight object item getter class is correct.");
378 is(objectItem8.value, null, "The ninth object item value is correct.");
379 isnot(objectItem8.getter, null, "The ninth object item getter is correct.");
380 isnot(objectItem8.setter, null, "The ninth object item setter is correct.");
381 is(objectItem8.getter.type, "undefined", "The eight object item getter type is correct.");
382 is(objectItem8.setter.type, "object", "The ninth object item setter type is correct.");
383 is(objectItem8.setter.class, "Function", "The ninth object item setter class is correct.");
384 is(__proto__.value.type, "object", "The __proto__ property value type is correct.");
385 is(__proto__.value.class, "Object", "The __proto__ property value class is correct.");
386 }
387
388 function testThirdLevelContents() {
389 (function() {
390 let someProp5 = gVariable.get("someProp5");
391 let arrayItem5 = someProp5.get("5");
392 let arrayItem6 = someProp5.get("6");
393
394 is(arrayItem5._store.size, 0, "No properties should be in arrayItem5 before expanding");
395 arrayItem5.expand();
396 is(arrayItem5._store.size, 5, "Some properties should be in arrayItem5 before expanding");
397
398 is(arrayItem6._store.size, 0, "No properties should be in arrayItem6 before expanding");
399 arrayItem6.expand();
400 is(arrayItem6._store.size, 3, "Some properties should be in arrayItem6 before expanding");
401
402 let arraySubItem0 = arrayItem5.get("0");
403 let arraySubItem1 = arrayItem5.get("1");
404 let arraySubItem2 = arrayItem5.get("2");
405 let objectSubItem0 = arrayItem6.get("prop1");
406 let objectSubItem1 = arrayItem6.get("prop2");
407
408 is(arraySubItem0.value, 0, "The first array sub-item value is correct.");
409 is(arraySubItem1.value, 1, "The second array sub-item value is correct.");
410 is(arraySubItem2.value, 2, "The third array sub-item value is correct.");
411
412 is(objectSubItem0.value, 9, "The first object sub-item value is correct.");
413 is(objectSubItem1.value, 8, "The second object sub-item value is correct.");
414
415 let array__proto__ = arrayItem5.get("__proto__");
416 let object__proto__ = arrayItem6.get("__proto__");
417
418 ok(array__proto__, "The array should have a __proto__ property.");
419 ok(object__proto__, "The object should have a __proto__ property.");
420 })();
421
422 (function() {
423 let someProp6 = gVariable.get("someProp6");
424 let objectItem5 = someProp6.get("p5");
425 let objectItem6 = someProp6.get("p6");
426
427 is(objectItem5._store.size, 0, "No properties should be in objectItem5 before expanding");
428 objectItem5.expand();
429 is(objectItem5._store.size, 5, "Some properties should be in objectItem5 before expanding");
430
431 is(objectItem6._store.size, 0, "No properties should be in objectItem6 before expanding");
432 objectItem6.expand();
433 is(objectItem6._store.size, 3, "Some properties should be in objectItem6 before expanding");
434
435 let arraySubItem0 = objectItem5.get("0");
436 let arraySubItem1 = objectItem5.get("1");
437 let arraySubItem2 = objectItem5.get("2");
438 let objectSubItem0 = objectItem6.get("prop1");
439 let objectSubItem1 = objectItem6.get("prop2");
440
441 is(arraySubItem0.value, 3, "The first array sub-item value is correct.");
442 is(arraySubItem1.value, 4, "The second array sub-item value is correct.");
443 is(arraySubItem2.value, 5, "The third array sub-item value is correct.");
444
445 is(objectSubItem0.value, 7, "The first object sub-item value is correct.");
446 is(objectSubItem1.value, 6, "The second object sub-item value is correct.");
447
448 let array__proto__ = objectItem5.get("__proto__");
449 let object__proto__ = objectItem6.get("__proto__");
450
451 ok(array__proto__, "The array should have a __proto__ property.");
452 ok(object__proto__, "The object should have a __proto__ property.");
453 })();
454 }
455
456 function testOriginalRawDataIntegrity(arr, obj) {
457 is(arr[0], 42, "The first array item should not have changed.");
458 is(arr[1], true, "The second array item should not have changed.");
459 is(arr[2], "nasu", "The third array item should not have changed.");
460 is(arr[3], undefined, "The fourth array item should not have changed.");
461 is(arr[4], null, "The fifth array item should not have changed.");
462 ok(arr[5] instanceof Array, "The sixth array item should be an Array.");
463 is(arr[5][0], 0, "The sixth array item should not have changed.");
464 is(arr[5][1], 1, "The sixth array item should not have changed.");
465 is(arr[5][2], 2, "The sixth array item should not have changed.");
466 ok(arr[6] instanceof Object, "The seventh array item should be an Object.");
467 is(arr[6].prop1, 9, "The seventh array item should not have changed.");
468 is(arr[6].prop2, 8, "The seventh array item should not have changed.");
469
470 is(obj.p0, 42, "The first object property should not have changed.");
471 is(obj.p1, true, "The first object property should not have changed.");
472 is(obj.p2, "nasu", "The first object property should not have changed.");
473 is(obj.p3, undefined, "The first object property should not have changed.");
474 is(obj.p4, null, "The first object property should not have changed.");
475 ok(obj.p5 instanceof Array, "The sixth object property should be an Array.");
476 is(obj.p5[0], 3, "The sixth object property should not have changed.");
477 is(obj.p5[1], 4, "The sixth object property should not have changed.");
478 is(obj.p5[2], 5, "The sixth object property should not have changed.");
479 ok(obj.p6 instanceof Object, "The seventh object property should be an Object.");
480 is(obj.p6.prop1, 7, "The seventh object property should not have changed.");
481 is(obj.p6.prop2, 6, "The seventh object property should not have changed.");
482 }
483
484 function testAnonymousHeaders(fooScope, anonymousVar, anonymousScope, barVar, bazProperty) {
485 is(fooScope.header, true,
486 "A named scope should have a header visible.");
487 is(fooScope.target.hasAttribute("untitled"), false,
488 "The non-header attribute should not be applied to scopes with headers.");
489
490 is(anonymousScope.header, false,
491 "An anonymous scope should have a header visible.");
492 is(anonymousScope.target.hasAttribute("untitled"), true,
493 "The non-header attribute should not be applied to scopes without headers.");
494
495 is(barVar.header, true,
496 "A named variable should have a header visible.");
497 is(barVar.target.hasAttribute("untitled"), false,
498 "The non-header attribute should not be applied to variables with headers.");
499
500 is(anonymousVar.header, false,
501 "An anonymous variable should have a header visible.");
502 is(anonymousVar.target.hasAttribute("untitled"), true,
503 "The non-header attribute should not be applied to variables without headers.");
504 }
505
506 function testPropertyInheritance(fooScope, anonymousVar, anonymousScope, barVar, bazProperty) {
507 is(fooScope.preventDisableOnChange, gVariablesView.preventDisableOnChange,
508 "The preventDisableOnChange property should persist from the view to all scopes.");
509 is(fooScope.preventDescriptorModifiers, gVariablesView.preventDescriptorModifiers,
510 "The preventDescriptorModifiers property should persist from the view to all scopes.");
511 is(fooScope.editableNameTooltip, gVariablesView.editableNameTooltip,
512 "The editableNameTooltip property should persist from the view to all scopes.");
513 is(fooScope.editableValueTooltip, gVariablesView.editableValueTooltip,
514 "The editableValueTooltip property should persist from the view to all scopes.");
515 is(fooScope.editButtonTooltip, gVariablesView.editButtonTooltip,
516 "The editButtonTooltip property should persist from the view to all scopes.");
517 is(fooScope.deleteButtonTooltip, gVariablesView.deleteButtonTooltip,
518 "The deleteButtonTooltip property should persist from the view to all scopes.");
519 is(fooScope.contextMenuId, gVariablesView.contextMenuId,
520 "The contextMenuId property should persist from the view to all scopes.");
521 is(fooScope.separatorStr, gVariablesView.separatorStr,
522 "The separatorStr property should persist from the view to all scopes.");
523 is(fooScope.eval, gVariablesView.eval,
524 "The eval property should persist from the view to all scopes.");
525 is(fooScope.switch, gVariablesView.switch,
526 "The switch property should persist from the view to all scopes.");
527 is(fooScope.delete, gVariablesView.delete,
528 "The delete property should persist from the view to all scopes.");
529 is(fooScope.new, gVariablesView.new,
530 "The new property should persist from the view to all scopes.");
531 isnot(fooScope.eval, fooScope.switch,
532 "The eval and switch functions got mixed up in the scope.");
533 isnot(fooScope.switch, fooScope.delete,
534 "The eval and switch functions got mixed up in the scope.");
535
536 is(barVar.preventDisableOnChange, gVariablesView.preventDisableOnChange,
537 "The preventDisableOnChange property should persist from the view to all variables.");
538 is(barVar.preventDescriptorModifiers, gVariablesView.preventDescriptorModifiers,
539 "The preventDescriptorModifiers property should persist from the view to all variables.");
540 is(barVar.editableNameTooltip, gVariablesView.editableNameTooltip,
541 "The editableNameTooltip property should persist from the view to all variables.");
542 is(barVar.editableValueTooltip, gVariablesView.editableValueTooltip,
543 "The editableValueTooltip property should persist from the view to all variables.");
544 is(barVar.editButtonTooltip, gVariablesView.editButtonTooltip,
545 "The editButtonTooltip property should persist from the view to all variables.");
546 is(barVar.deleteButtonTooltip, gVariablesView.deleteButtonTooltip,
547 "The deleteButtonTooltip property should persist from the view to all variables.");
548 is(barVar.contextMenuId, gVariablesView.contextMenuId,
549 "The contextMenuId property should persist from the view to all variables.");
550 is(barVar.separatorStr, gVariablesView.separatorStr,
551 "The separatorStr property should persist from the view to all variables.");
552 is(barVar.eval, gVariablesView.eval,
553 "The eval property should persist from the view to all variables.");
554 is(barVar.switch, gVariablesView.switch,
555 "The switch property should persist from the view to all variables.");
556 is(barVar.delete, gVariablesView.delete,
557 "The delete property should persist from the view to all variables.");
558 is(barVar.new, gVariablesView.new,
559 "The new property should persist from the view to all variables.");
560 isnot(barVar.eval, barVar.switch,
561 "The eval and switch functions got mixed up in the variable.");
562 isnot(barVar.switch, barVar.delete,
563 "The eval and switch functions got mixed up in the variable.");
564
565 is(bazProperty.preventDisableOnChange, gVariablesView.preventDisableOnChange,
566 "The preventDisableOnChange property should persist from the view to all properties.");
567 is(bazProperty.preventDescriptorModifiers, gVariablesView.preventDescriptorModifiers,
568 "The preventDescriptorModifiers property should persist from the view to all properties.");
569 is(bazProperty.editableNameTooltip, gVariablesView.editableNameTooltip,
570 "The editableNameTooltip property should persist from the view to all properties.");
571 is(bazProperty.editableValueTooltip, gVariablesView.editableValueTooltip,
572 "The editableValueTooltip property should persist from the view to all properties.");
573 is(bazProperty.editButtonTooltip, gVariablesView.editButtonTooltip,
574 "The editButtonTooltip property should persist from the view to all properties.");
575 is(bazProperty.deleteButtonTooltip, gVariablesView.deleteButtonTooltip,
576 "The deleteButtonTooltip property should persist from the view to all properties.");
577 is(bazProperty.contextMenuId, gVariablesView.contextMenuId,
578 "The contextMenuId property should persist from the view to all properties.");
579 is(bazProperty.separatorStr, gVariablesView.separatorStr,
580 "The separatorStr property should persist from the view to all properties.");
581 is(bazProperty.eval, gVariablesView.eval,
582 "The eval property should persist from the view to all properties.");
583 is(bazProperty.switch, gVariablesView.switch,
584 "The switch property should persist from the view to all properties.");
585 is(bazProperty.delete, gVariablesView.delete,
586 "The delete property should persist from the view to all properties.");
587 is(bazProperty.new, gVariablesView.new,
588 "The new property should persist from the view to all properties.");
589 isnot(bazProperty.eval, bazProperty.switch,
590 "The eval and switch functions got mixed up in the property.");
591 isnot(bazProperty.switch, bazProperty.delete,
592 "The eval and switch functions got mixed up in the property.");
593 }
594
595 function testClearHierarchy() {
596 gVariablesView.clearHierarchy();
597 ok(!gVariablesView._prevHierarchy.size,
598 "The previous hierarchy should have been cleared.");
599 ok(!gVariablesView._currHierarchy.size,
600 "The current hierarchy should have been cleared.");
601 }
602
603 registerCleanupFunction(function() {
604 gTab = null;
605 gDebuggee = null;
606 gPanel = null;
607 gDebugger = null;
608 gVariablesView = null;
609 gScope = null;
610 gVariable = null;
611 });

mercurial