1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/debugger/test/browser_dbg_variables-view-frame-parameters-02.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,550 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +/** 1.8 + * Make sure that the variables view displays the right variables and 1.9 + * properties when debugger is paused. 1.10 + */ 1.11 + 1.12 +const TAB_URL = EXAMPLE_URL + "doc_frame-parameters.html"; 1.13 + 1.14 +let gTab, gDebuggee, gPanel, gDebugger; 1.15 +let gVariables; 1.16 + 1.17 +function test() { 1.18 + // Debug test slaves are a bit slow at this test. 1.19 + requestLongerTimeout(2); 1.20 + 1.21 + initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { 1.22 + gTab = aTab; 1.23 + gDebuggee = aDebuggee; 1.24 + gPanel = aPanel; 1.25 + gDebugger = gPanel.panelWin; 1.26 + gVariables = gDebugger.DebuggerView.Variables; 1.27 + 1.28 + waitForSourceAndCaretAndScopes(gPanel, ".html", 24) 1.29 + .then(testScopeVariables) 1.30 + .then(testArgumentsProperties) 1.31 + .then(testSimpleObject) 1.32 + .then(testComplexObject) 1.33 + .then(testArgumentObject) 1.34 + .then(testInnerArgumentObject) 1.35 + .then(testGetterSetterObject) 1.36 + .then(() => resumeDebuggerThenCloseAndFinish(gPanel)) 1.37 + .then(null, aError => { 1.38 + ok(false, "Got an error: " + aError.message + "\n" + aError.stack); 1.39 + }); 1.40 + 1.41 + EventUtils.sendMouseEvent({ type: "click" }, 1.42 + gDebuggee.document.querySelector("button"), 1.43 + gDebuggee); 1.44 + }); 1.45 +} 1.46 + 1.47 +function testScopeVariables() { 1.48 + let localScope = gVariables.getScopeAtIndex(0); 1.49 + is(localScope.expanded, true, 1.50 + "The local scope should be expanded by default."); 1.51 + 1.52 + let localEnums = localScope.target.querySelector(".variables-view-element-details.enum").childNodes; 1.53 + let localNonEnums = localScope.target.querySelector(".variables-view-element-details.nonenum").childNodes; 1.54 + 1.55 + is(localEnums.length, 12, 1.56 + "The local scope should contain all the created enumerable elements."); 1.57 + is(localNonEnums.length, 0, 1.58 + "The local scope should contain all the created non-enumerable elements."); 1.59 + 1.60 + is(localEnums[0].querySelector(".name").getAttribute("value"), "this", 1.61 + "Should have the right property name for 'this'."); 1.62 + is(localEnums[0].querySelector(".value").getAttribute("value"), 1.63 + "Window \u2192 doc_frame-parameters.html", 1.64 + "Should have the right property value for 'this'."); 1.65 + ok(localEnums[0].querySelector(".value").className.contains("token-other"), 1.66 + "Should have the right token class for 'this'."); 1.67 + 1.68 + is(localEnums[1].querySelector(".name").getAttribute("value"), "aArg", 1.69 + "Should have the right property name for 'aArg'."); 1.70 + is(localEnums[1].querySelector(".value").getAttribute("value"), "Object", 1.71 + "Should have the right property value for 'aArg'."); 1.72 + ok(localEnums[1].querySelector(".value").className.contains("token-other"), 1.73 + "Should have the right token class for 'aArg'."); 1.74 + 1.75 + is(localEnums[2].querySelector(".name").getAttribute("value"), "bArg", 1.76 + "Should have the right property name for 'bArg'."); 1.77 + is(localEnums[2].querySelector(".value").getAttribute("value"), "\"beta\"", 1.78 + "Should have the right property value for 'bArg'."); 1.79 + ok(localEnums[2].querySelector(".value").className.contains("token-string"), 1.80 + "Should have the right token class for 'bArg'."); 1.81 + 1.82 + is(localEnums[3].querySelector(".name").getAttribute("value"), "cArg", 1.83 + "Should have the right property name for 'cArg'."); 1.84 + is(localEnums[3].querySelector(".value").getAttribute("value"), "3", 1.85 + "Should have the right property value for 'cArg'."); 1.86 + ok(localEnums[3].querySelector(".value").className.contains("token-number"), 1.87 + "Should have the right token class for 'cArg'."); 1.88 + 1.89 + is(localEnums[4].querySelector(".name").getAttribute("value"), "dArg", 1.90 + "Should have the right property name for 'dArg'."); 1.91 + is(localEnums[4].querySelector(".value").getAttribute("value"), "false", 1.92 + "Should have the right property value for 'dArg'."); 1.93 + ok(localEnums[4].querySelector(".value").className.contains("token-boolean"), 1.94 + "Should have the right token class for 'dArg'."); 1.95 + 1.96 + is(localEnums[5].querySelector(".name").getAttribute("value"), "eArg", 1.97 + "Should have the right property name for 'eArg'."); 1.98 + is(localEnums[5].querySelector(".value").getAttribute("value"), "null", 1.99 + "Should have the right property value for 'eArg'."); 1.100 + ok(localEnums[5].querySelector(".value").className.contains("token-null"), 1.101 + "Should have the right token class for 'eArg'."); 1.102 + 1.103 + is(localEnums[6].querySelector(".name").getAttribute("value"), "fArg", 1.104 + "Should have the right property name for 'fArg'."); 1.105 + is(localEnums[6].querySelector(".value").getAttribute("value"), "undefined", 1.106 + "Should have the right property value for 'fArg'."); 1.107 + ok(localEnums[6].querySelector(".value").className.contains("token-undefined"), 1.108 + "Should have the right token class for 'fArg'."); 1.109 + 1.110 + is(localEnums[7].querySelector(".name").getAttribute("value"), "a", 1.111 + "Should have the right property name for 'a'."); 1.112 + is(localEnums[7].querySelector(".value").getAttribute("value"), "1", 1.113 + "Should have the right property value for 'a'."); 1.114 + ok(localEnums[7].querySelector(".value").className.contains("token-number"), 1.115 + "Should have the right token class for 'a'."); 1.116 + 1.117 + is(localEnums[8].querySelector(".name").getAttribute("value"), "arguments", 1.118 + "Should have the right property name for 'arguments'."); 1.119 + is(localEnums[8].querySelector(".value").getAttribute("value"), "Arguments", 1.120 + "Should have the right property value for 'arguments'."); 1.121 + ok(localEnums[8].querySelector(".value").className.contains("token-other"), 1.122 + "Should have the right token class for 'arguments'."); 1.123 + 1.124 + is(localEnums[9].querySelector(".name").getAttribute("value"), "b", 1.125 + "Should have the right property name for 'b'."); 1.126 + is(localEnums[9].querySelector(".value").getAttribute("value"), "Object", 1.127 + "Should have the right property value for 'b'."); 1.128 + ok(localEnums[9].querySelector(".value").className.contains("token-other"), 1.129 + "Should have the right token class for 'b'."); 1.130 + 1.131 + is(localEnums[10].querySelector(".name").getAttribute("value"), "c", 1.132 + "Should have the right property name for 'c'."); 1.133 + is(localEnums[10].querySelector(".value").getAttribute("value"), "Object", 1.134 + "Should have the right property value for 'c'."); 1.135 + ok(localEnums[10].querySelector(".value").className.contains("token-other"), 1.136 + "Should have the right token class for 'c'."); 1.137 + 1.138 + is(localEnums[11].querySelector(".name").getAttribute("value"), "myVar", 1.139 + "Should have the right property name for 'myVar'."); 1.140 + is(localEnums[11].querySelector(".value").getAttribute("value"), "Object", 1.141 + "Should have the right property value for 'myVar'."); 1.142 + ok(localEnums[11].querySelector(".value").className.contains("token-other"), 1.143 + "Should have the right token class for 'myVar'."); 1.144 +} 1.145 + 1.146 +function testArgumentsProperties() { 1.147 + let deferred = promise.defer(); 1.148 + 1.149 + let argsVar = gVariables.getScopeAtIndex(0).get("arguments"); 1.150 + is(argsVar.expanded, false, 1.151 + "The 'arguments' variable should not be expanded by default."); 1.152 + 1.153 + let argsEnums = argsVar.target.querySelector(".variables-view-element-details.enum").childNodes; 1.154 + let argsNonEnums = argsVar.target.querySelector(".variables-view-element-details.nonenum").childNodes; 1.155 + 1.156 + gDebugger.once(gDebugger.EVENTS.FETCHED_PROPERTIES, () => { 1.157 + is(argsEnums.length, 5, 1.158 + "The 'arguments' variable should contain all the created enumerable elements."); 1.159 + is(argsNonEnums.length, 3, 1.160 + "The 'arguments' variable should contain all the created non-enumerable elements."); 1.161 + 1.162 + is(argsEnums[0].querySelector(".name").getAttribute("value"), "0", 1.163 + "Should have the right property name for '0'."); 1.164 + is(argsEnums[0].querySelector(".value").getAttribute("value"), "Object", 1.165 + "Should have the right property value for '0'."); 1.166 + ok(argsEnums[0].querySelector(".value").className.contains("token-other"), 1.167 + "Should have the right token class for '0'."); 1.168 + 1.169 + is(argsEnums[1].querySelector(".name").getAttribute("value"), "1", 1.170 + "Should have the right property name for '1'."); 1.171 + is(argsEnums[1].querySelector(".value").getAttribute("value"), "\"beta\"", 1.172 + "Should have the right property value for '1'."); 1.173 + ok(argsEnums[1].querySelector(".value").className.contains("token-string"), 1.174 + "Should have the right token class for '1'."); 1.175 + 1.176 + is(argsEnums[2].querySelector(".name").getAttribute("value"), "2", 1.177 + "Should have the right property name for '2'."); 1.178 + is(argsEnums[2].querySelector(".value").getAttribute("value"), "3", 1.179 + "Should have the right property name for '2'."); 1.180 + ok(argsEnums[2].querySelector(".value").className.contains("token-number"), 1.181 + "Should have the right token class for '2'."); 1.182 + 1.183 + is(argsEnums[3].querySelector(".name").getAttribute("value"), "3", 1.184 + "Should have the right property name for '3'."); 1.185 + is(argsEnums[3].querySelector(".value").getAttribute("value"), "false", 1.186 + "Should have the right property value for '3'."); 1.187 + ok(argsEnums[3].querySelector(".value").className.contains("token-boolean"), 1.188 + "Should have the right token class for '3'."); 1.189 + 1.190 + is(argsEnums[4].querySelector(".name").getAttribute("value"), "4", 1.191 + "Should have the right property name for '4'."); 1.192 + is(argsEnums[4].querySelector(".value").getAttribute("value"), "null", 1.193 + "Should have the right property name for '4'."); 1.194 + ok(argsEnums[4].querySelector(".value").className.contains("token-null"), 1.195 + "Should have the right token class for '4'."); 1.196 + 1.197 + is(argsNonEnums[0].querySelector(".name").getAttribute("value"), "callee", 1.198 + "Should have the right property name for 'callee'."); 1.199 + is(argsNonEnums[0].querySelector(".value").getAttribute("value"), 1.200 + "test(aArg,bArg,cArg,dArg,eArg,fArg)", 1.201 + "Should have the right property name for 'callee'."); 1.202 + ok(argsNonEnums[0].querySelector(".value").className.contains("token-other"), 1.203 + "Should have the right token class for 'callee'."); 1.204 + 1.205 + is(argsNonEnums[1].querySelector(".name").getAttribute("value"), "length", 1.206 + "Should have the right property name for 'length'."); 1.207 + is(argsNonEnums[1].querySelector(".value").getAttribute("value"), "5", 1.208 + "Should have the right property value for 'length'."); 1.209 + ok(argsNonEnums[1].querySelector(".value").className.contains("token-number"), 1.210 + "Should have the right token class for 'length'."); 1.211 + 1.212 + is(argsNonEnums[2].querySelector(".name").getAttribute("value"), "__proto__", 1.213 + "Should have the right property name for '__proto__'."); 1.214 + is(argsNonEnums[2].querySelector(".value").getAttribute("value"), "Object", 1.215 + "Should have the right property value for '__proto__'."); 1.216 + ok(argsNonEnums[2].querySelector(".value").className.contains("token-other"), 1.217 + "Should have the right token class for '__proto__'."); 1.218 + 1.219 + deferred.resolve(); 1.220 + }); 1.221 + 1.222 + argsVar.expand(); 1.223 + return deferred.promise; 1.224 +} 1.225 + 1.226 +function testSimpleObject() { 1.227 + let deferred = promise.defer(); 1.228 + 1.229 + let bVar = gVariables.getScopeAtIndex(0).get("b"); 1.230 + is(bVar.expanded, false, 1.231 + "The 'b' variable should not be expanded by default."); 1.232 + 1.233 + let bEnums = bVar.target.querySelector(".variables-view-element-details.enum").childNodes; 1.234 + let bNonEnums = bVar.target.querySelector(".variables-view-element-details.nonenum").childNodes; 1.235 + 1.236 + gDebugger.once(gDebugger.EVENTS.FETCHED_PROPERTIES, () => { 1.237 + is(bEnums.length, 1, 1.238 + "The 'b' variable should contain all the created enumerable elements."); 1.239 + is(bNonEnums.length, 1, 1.240 + "The 'b' variable should contain all the created non-enumerable elements."); 1.241 + 1.242 + is(bEnums[0].querySelector(".name").getAttribute("value"), "a", 1.243 + "Should have the right property name for 'a'."); 1.244 + is(bEnums[0].querySelector(".value").getAttribute("value"), "1", 1.245 + "Should have the right property value for 'a'."); 1.246 + ok(bEnums[0].querySelector(".value").className.contains("token-number"), 1.247 + "Should have the right token class for 'a'."); 1.248 + 1.249 + is(bNonEnums[0].querySelector(".name").getAttribute("value"), "__proto__", 1.250 + "Should have the right property name for '__proto__'."); 1.251 + is(bNonEnums[0].querySelector(".value").getAttribute("value"), "Object", 1.252 + "Should have the right property value for '__proto__'."); 1.253 + ok(bNonEnums[0].querySelector(".value").className.contains("token-other"), 1.254 + "Should have the right token class for '__proto__'."); 1.255 + 1.256 + deferred.resolve(); 1.257 + }); 1.258 + 1.259 + bVar.expand(); 1.260 + return deferred.promise; 1.261 +} 1.262 + 1.263 +function testComplexObject() { 1.264 + let deferred = promise.defer(); 1.265 + 1.266 + let cVar = gVariables.getScopeAtIndex(0).get("c"); 1.267 + is(cVar.expanded, false, 1.268 + "The 'c' variable should not be expanded by default."); 1.269 + 1.270 + let cEnums = cVar.target.querySelector(".variables-view-element-details.enum").childNodes; 1.271 + let cNonEnums = cVar.target.querySelector(".variables-view-element-details.nonenum").childNodes; 1.272 + 1.273 + gDebugger.once(gDebugger.EVENTS.FETCHED_PROPERTIES, () => { 1.274 + is(cEnums.length, 6, 1.275 + "The 'c' variable should contain all the created enumerable elements."); 1.276 + is(cNonEnums.length, 1, 1.277 + "The 'c' variable should contain all the created non-enumerable elements."); 1.278 + 1.279 + is(cEnums[0].querySelector(".name").getAttribute("value"), "a", 1.280 + "Should have the right property name for 'a'."); 1.281 + is(cEnums[0].querySelector(".value").getAttribute("value"), "1", 1.282 + "Should have the right property value for 'a'."); 1.283 + ok(cEnums[0].querySelector(".value").className.contains("token-number"), 1.284 + "Should have the right token class for 'a'."); 1.285 + 1.286 + is(cEnums[1].querySelector(".name").getAttribute("value"), "b", 1.287 + "Should have the right property name for 'b'."); 1.288 + is(cEnums[1].querySelector(".value").getAttribute("value"), "\"beta\"", 1.289 + "Should have the right property value for 'b'."); 1.290 + ok(cEnums[1].querySelector(".value").className.contains("token-string"), 1.291 + "Should have the right token class for 'b'."); 1.292 + 1.293 + is(cEnums[2].querySelector(".name").getAttribute("value"), "c", 1.294 + "Should have the right property name for 'c'."); 1.295 + is(cEnums[2].querySelector(".value").getAttribute("value"), "3", 1.296 + "Should have the right property value for 'c'."); 1.297 + ok(cEnums[2].querySelector(".value").className.contains("token-number"), 1.298 + "Should have the right token class for 'c'."); 1.299 + 1.300 + is(cEnums[3].querySelector(".name").getAttribute("value"), "d", 1.301 + "Should have the right property name for 'd'."); 1.302 + is(cEnums[3].querySelector(".value").getAttribute("value"), "false", 1.303 + "Should have the right property value for 'd'."); 1.304 + ok(cEnums[3].querySelector(".value").className.contains("token-boolean"), 1.305 + "Should have the right token class for 'd'."); 1.306 + 1.307 + is(cEnums[4].querySelector(".name").getAttribute("value"), "e", 1.308 + "Should have the right property name for 'e'."); 1.309 + is(cEnums[4].querySelector(".value").getAttribute("value"), "null", 1.310 + "Should have the right property value for 'e'."); 1.311 + ok(cEnums[4].querySelector(".value").className.contains("token-null"), 1.312 + "Should have the right token class for 'e'."); 1.313 + 1.314 + is(cEnums[5].querySelector(".name").getAttribute("value"), "f", 1.315 + "Should have the right property name for 'f'."); 1.316 + is(cEnums[5].querySelector(".value").getAttribute("value"), "undefined", 1.317 + "Should have the right property value for 'f'."); 1.318 + ok(cEnums[5].querySelector(".value").className.contains("token-undefined"), 1.319 + "Should have the right token class for 'f'."); 1.320 + 1.321 + is(cNonEnums[0].querySelector(".name").getAttribute("value"), "__proto__", 1.322 + "Should have the right property name for '__proto__'."); 1.323 + is(cNonEnums[0].querySelector(".value").getAttribute("value"), "Object", 1.324 + "Should have the right property value for '__proto__'."); 1.325 + ok(cNonEnums[0].querySelector(".value").className.contains("token-other"), 1.326 + "Should have the right token class for '__proto__'."); 1.327 + 1.328 + deferred.resolve(); 1.329 + }); 1.330 + 1.331 + cVar.expand(); 1.332 + return deferred.promise; 1.333 +} 1.334 + 1.335 +function testArgumentObject() { 1.336 + let deferred = promise.defer(); 1.337 + 1.338 + let argVar = gVariables.getScopeAtIndex(0).get("aArg"); 1.339 + is(argVar.expanded, false, 1.340 + "The 'aArg' variable should not be expanded by default."); 1.341 + 1.342 + let argEnums = argVar.target.querySelector(".variables-view-element-details.enum").childNodes; 1.343 + let argNonEnums = argVar.target.querySelector(".variables-view-element-details.nonenum").childNodes; 1.344 + 1.345 + gDebugger.once(gDebugger.EVENTS.FETCHED_PROPERTIES, () => { 1.346 + is(argEnums.length, 6, 1.347 + "The 'aArg' variable should contain all the created enumerable elements."); 1.348 + is(argNonEnums.length, 1, 1.349 + "The 'aArg' variable should contain all the created non-enumerable elements."); 1.350 + 1.351 + is(argEnums[0].querySelector(".name").getAttribute("value"), "a", 1.352 + "Should have the right property name for 'a'."); 1.353 + is(argEnums[0].querySelector(".value").getAttribute("value"), "1", 1.354 + "Should have the right property value for 'a'."); 1.355 + ok(argEnums[0].querySelector(".value").className.contains("token-number"), 1.356 + "Should have the right token class for 'a'."); 1.357 + 1.358 + is(argEnums[1].querySelector(".name").getAttribute("value"), "b", 1.359 + "Should have the right property name for 'b'."); 1.360 + is(argEnums[1].querySelector(".value").getAttribute("value"), "\"beta\"", 1.361 + "Should have the right property value for 'b'."); 1.362 + ok(argEnums[1].querySelector(".value").className.contains("token-string"), 1.363 + "Should have the right token class for 'b'."); 1.364 + 1.365 + is(argEnums[2].querySelector(".name").getAttribute("value"), "c", 1.366 + "Should have the right property name for 'c'."); 1.367 + is(argEnums[2].querySelector(".value").getAttribute("value"), "3", 1.368 + "Should have the right property value for 'c'."); 1.369 + ok(argEnums[2].querySelector(".value").className.contains("token-number"), 1.370 + "Should have the right token class for 'c'."); 1.371 + 1.372 + is(argEnums[3].querySelector(".name").getAttribute("value"), "d", 1.373 + "Should have the right property name for 'd'."); 1.374 + is(argEnums[3].querySelector(".value").getAttribute("value"), "false", 1.375 + "Should have the right property value for 'd'."); 1.376 + ok(argEnums[3].querySelector(".value").className.contains("token-boolean"), 1.377 + "Should have the right token class for 'd'."); 1.378 + 1.379 + is(argEnums[4].querySelector(".name").getAttribute("value"), "e", 1.380 + "Should have the right property name for 'e'."); 1.381 + is(argEnums[4].querySelector(".value").getAttribute("value"), "null", 1.382 + "Should have the right property value for 'e'."); 1.383 + ok(argEnums[4].querySelector(".value").className.contains("token-null"), 1.384 + "Should have the right token class for 'e'."); 1.385 + 1.386 + is(argEnums[5].querySelector(".name").getAttribute("value"), "f", 1.387 + "Should have the right property name for 'f'."); 1.388 + is(argEnums[5].querySelector(".value").getAttribute("value"), "undefined", 1.389 + "Should have the right property value for 'f'."); 1.390 + ok(argEnums[5].querySelector(".value").className.contains("token-undefined"), 1.391 + "Should have the right token class for 'f'."); 1.392 + 1.393 + is(argNonEnums[0].querySelector(".name").getAttribute("value"), "__proto__", 1.394 + "Should have the right property name for '__proto__'."); 1.395 + is(argNonEnums[0].querySelector(".value").getAttribute("value"), "Object", 1.396 + "Should have the right property value for '__proto__'."); 1.397 + ok(argNonEnums[0].querySelector(".value").className.contains("token-other"), 1.398 + "Should have the right token class for '__proto__'."); 1.399 + 1.400 + deferred.resolve(); 1.401 + }); 1.402 + 1.403 + argVar.expand(); 1.404 + return deferred.promise; 1.405 +} 1.406 + 1.407 +function testInnerArgumentObject() { 1.408 + let deferred = promise.defer(); 1.409 + 1.410 + let argProp = gVariables.getScopeAtIndex(0).get("arguments").get("0"); 1.411 + is(argProp.expanded, false, 1.412 + "The 'arguments[0]' property should not be expanded by default."); 1.413 + 1.414 + let argEnums = argProp.target.querySelector(".variables-view-element-details.enum").childNodes; 1.415 + let argNonEnums = argProp.target.querySelector(".variables-view-element-details.nonenum").childNodes; 1.416 + 1.417 + gDebugger.once(gDebugger.EVENTS.FETCHED_PROPERTIES, () => { 1.418 + is(argEnums.length, 6, 1.419 + "The 'arguments[0]' property should contain all the created enumerable elements."); 1.420 + is(argNonEnums.length, 1, 1.421 + "The 'arguments[0]' property should contain all the created non-enumerable elements."); 1.422 + 1.423 + is(argEnums[0].querySelector(".name").getAttribute("value"), "a", 1.424 + "Should have the right property name for 'a'."); 1.425 + is(argEnums[0].querySelector(".value").getAttribute("value"), "1", 1.426 + "Should have the right property value for 'a'."); 1.427 + ok(argEnums[0].querySelector(".value").className.contains("token-number"), 1.428 + "Should have the right token class for 'a'."); 1.429 + 1.430 + is(argEnums[1].querySelector(".name").getAttribute("value"), "b", 1.431 + "Should have the right property name for 'b'."); 1.432 + is(argEnums[1].querySelector(".value").getAttribute("value"), "\"beta\"", 1.433 + "Should have the right property value for 'b'."); 1.434 + ok(argEnums[1].querySelector(".value").className.contains("token-string"), 1.435 + "Should have the right token class for 'b'."); 1.436 + 1.437 + is(argEnums[2].querySelector(".name").getAttribute("value"), "c", 1.438 + "Should have the right property name for 'c'."); 1.439 + is(argEnums[2].querySelector(".value").getAttribute("value"), "3", 1.440 + "Should have the right property value for 'c'."); 1.441 + ok(argEnums[2].querySelector(".value").className.contains("token-number"), 1.442 + "Should have the right token class for 'c'."); 1.443 + 1.444 + is(argEnums[3].querySelector(".name").getAttribute("value"), "d", 1.445 + "Should have the right property name for 'd'."); 1.446 + is(argEnums[3].querySelector(".value").getAttribute("value"), "false", 1.447 + "Should have the right property value for 'd'."); 1.448 + ok(argEnums[3].querySelector(".value").className.contains("token-boolean"), 1.449 + "Should have the right token class for 'd'."); 1.450 + 1.451 + is(argEnums[4].querySelector(".name").getAttribute("value"), "e", 1.452 + "Should have the right property name for 'e'."); 1.453 + is(argEnums[4].querySelector(".value").getAttribute("value"), "null", 1.454 + "Should have the right property value for 'e'."); 1.455 + ok(argEnums[4].querySelector(".value").className.contains("token-null"), 1.456 + "Should have the right token class for 'e'."); 1.457 + 1.458 + is(argEnums[5].querySelector(".name").getAttribute("value"), "f", 1.459 + "Should have the right property name for 'f'."); 1.460 + is(argEnums[5].querySelector(".value").getAttribute("value"), "undefined", 1.461 + "Should have the right property value for 'f'."); 1.462 + ok(argEnums[5].querySelector(".value").className.contains("token-undefined"), 1.463 + "Should have the right token class for 'f'."); 1.464 + 1.465 + is(argNonEnums[0].querySelector(".name").getAttribute("value"), "__proto__", 1.466 + "Should have the right property name for '__proto__'."); 1.467 + is(argNonEnums[0].querySelector(".value").getAttribute("value"), "Object", 1.468 + "Should have the right property value for '__proto__'."); 1.469 + ok(argNonEnums[0].querySelector(".value").className.contains("token-other"), 1.470 + "Should have the right token class for '__proto__'."); 1.471 + 1.472 + deferred.resolve(); 1.473 + }); 1.474 + 1.475 + argProp.expand(); 1.476 + return deferred.promise; 1.477 +} 1.478 + 1.479 +function testGetterSetterObject() { 1.480 + let deferred = promise.defer(); 1.481 + 1.482 + let myVar = gVariables.getScopeAtIndex(0).get("myVar"); 1.483 + is(myVar.expanded, false, 1.484 + "The myVar variable should not be expanded by default."); 1.485 + 1.486 + let myVarEnums = myVar.target.querySelector(".variables-view-element-details.enum").childNodes; 1.487 + let myVarNonEnums = myVar.target.querySelector(".variables-view-element-details.nonenum").childNodes; 1.488 + 1.489 + gDebugger.once(gDebugger.EVENTS.FETCHED_PROPERTIES, () => { 1.490 + is(myVarEnums.length, 2, 1.491 + "The myVar should contain all the created enumerable elements."); 1.492 + is(myVarNonEnums.length, 1, 1.493 + "The myVar should contain all the created non-enumerable elements."); 1.494 + 1.495 + is(myVarEnums[0].querySelector(".name").getAttribute("value"), "_prop", 1.496 + "Should have the right property name for '_prop'."); 1.497 + is(myVarEnums[0].querySelector(".value").getAttribute("value"), "42", 1.498 + "Should have the right property value for '_prop'."); 1.499 + ok(myVarEnums[0].querySelector(".value").className.contains("token-number"), 1.500 + "Should have the right token class for '_prop'."); 1.501 + 1.502 + is(myVarEnums[1].querySelector(".name").getAttribute("value"), "prop", 1.503 + "Should have the right property name for 'prop'."); 1.504 + is(myVarEnums[1].querySelector(".value").getAttribute("value"), "", 1.505 + "Should have the right property value for 'prop'."); 1.506 + ok(!myVarEnums[1].querySelector(".value").className.contains("token"), 1.507 + "Should have no token class for 'prop'."); 1.508 + 1.509 + is(myVarNonEnums[0].querySelector(".name").getAttribute("value"), "__proto__", 1.510 + "Should have the right property name for '__proto__'."); 1.511 + is(myVarNonEnums[0].querySelector(".value").getAttribute("value"), "Object", 1.512 + "Should have the right property value for '__proto__'."); 1.513 + ok(myVarNonEnums[0].querySelector(".value").className.contains("token-other"), 1.514 + "Should have the right token class for '__proto__'."); 1.515 + 1.516 + let propEnums = myVarEnums[1].querySelector(".variables-view-element-details.enum").childNodes; 1.517 + let propNonEnums = myVarEnums[1].querySelector(".variables-view-element-details.nonenum").childNodes; 1.518 + 1.519 + is(propEnums.length, 0, 1.520 + "The propEnums should contain all the created enumerable elements."); 1.521 + is(propNonEnums.length, 2, 1.522 + "The propEnums should contain all the created non-enumerable elements."); 1.523 + 1.524 + is(propNonEnums[0].querySelector(".name").getAttribute("value"), "get", 1.525 + "Should have the right property name for 'get'."); 1.526 + is(propNonEnums[0].querySelector(".value").getAttribute("value"), 1.527 + "test/myVar.prop()", 1.528 + "Should have the right property value for 'get'."); 1.529 + ok(propNonEnums[0].querySelector(".value").className.contains("token-other"), 1.530 + "Should have the right token class for 'get'."); 1.531 + 1.532 + is(propNonEnums[1].querySelector(".name").getAttribute("value"), "set", 1.533 + "Should have the right property name for 'set'."); 1.534 + is(propNonEnums[1].querySelector(".value").getAttribute("value"), 1.535 + "test/myVar.prop(val)", 1.536 + "Should have the right property value for 'set'."); 1.537 + ok(propNonEnums[1].querySelector(".value").className.contains("token-other"), 1.538 + "Should have the right token class for 'set'."); 1.539 + 1.540 + deferred.resolve(); 1.541 + }); 1.542 + 1.543 + myVar.expand(); 1.544 + return deferred.promise; 1.545 +} 1.546 + 1.547 +registerCleanupFunction(function() { 1.548 + gTab = null; 1.549 + gDebuggee = null; 1.550 + gPanel = null; 1.551 + gDebugger = null; 1.552 + gVariables = null; 1.553 +});