1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390
|
/* vim:set ts=2 sw=2 sts=2 et: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Make sure that the property view correctly re-expands nodes after pauses.
*/
const TAB_URL = EXAMPLE_URL + "browser_dbg_with-frame.html";
var gPane = null;
var gTab = null;
var gDebugger = null;
var gDebuggee = null;
requestLongerTimeout(2);
function test()
{
debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
gTab = aTab;
gPane = aPane;
gDebugger = gPane.panelWin;
gDebuggee = aDebuggee;
addBreakpoint();
});
}
function addBreakpoint()
{
gDebugger.DebuggerController.Breakpoints.addBreakpoint({
url: gDebugger.DebuggerView.Sources.selectedValue,
line: 16
}, function() {
// Wait for the resume...
gDebugger.gClient.addOneTimeListener("resumed", function() {
gDebugger.DebuggerController.StackFrames.autoScopeExpand = true;
gDebugger.DebuggerView.Variables.nonEnumVisible = false;
gDebugger.DebuggerView.Variables.commitHierarchyIgnoredItems = Object.create(null);
testVariablesExpand();
});
});
}
function testVariablesExpand()
{
let count = 0;
gDebugger.addEventListener("Debugger:FetchedVariables", function test() {
// We expect 4 Debugger:FetchedVariables events, one from the global object
// scope, two from the |with| scopes and the regular one.
if (++count < 4) {
info("Number of received Debugger:FetchedVariables events: " + count);
return;
}
gDebugger.removeEventListener("Debugger:FetchedVariables", test, false);
Services.tm.currentThread.dispatch({ run: function() {
var frames = gDebugger.DebuggerView.StackFrames._container._list,
scopes = gDebugger.DebuggerView.Variables._list,
innerScope = scopes.querySelectorAll(".scope")[0],
mathScope = scopes.querySelectorAll(".scope")[1],
testScope = scopes.querySelectorAll(".scope")[2],
loadScope = scopes.querySelectorAll(".scope")[3],
globalScope = scopes.querySelectorAll(".scope")[4];
let innerScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
innerScope.querySelector(".name").getAttribute("value"));
let mathScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
mathScope.querySelector(".name").getAttribute("value"));
let testScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
testScope.querySelector(".name").getAttribute("value"));
let loadScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
loadScope.querySelector(".name").getAttribute("value"));
let globalScopeItem = gDebugger.DebuggerView.Variables._currHierarchy.get(
globalScope.querySelector(".name").getAttribute("value"));
is(innerScope.querySelector(".arrow").hasAttribute("open"), true,
"The innerScope arrow should initially be expanded");
is(mathScope.querySelector(".arrow").hasAttribute("open"), true,
"The mathScope arrow should initially be expanded");
is(testScope.querySelector(".arrow").hasAttribute("open"), true,
"The testScope arrow should initially be expanded");
is(loadScope.querySelector(".arrow").hasAttribute("open"), true,
"The loadScope arrow should initially be expanded");
is(globalScope.querySelector(".arrow").hasAttribute("open"), true,
"The globalScope arrow should initially be expanded");
is(innerScope.querySelector(".details").hasAttribute("open"), true,
"The innerScope enumerables should initially be expanded");
is(mathScope.querySelector(".details").hasAttribute("open"), true,
"The mathScope enumerables should initially be expanded");
is(testScope.querySelector(".details").hasAttribute("open"), true,
"The testScope enumerables should initially be expanded");
is(loadScope.querySelector(".details").hasAttribute("open"), true,
"The loadScope enumerables should initially be expanded");
is(globalScope.querySelector(".details").hasAttribute("open"), true,
"The globalScope enumerables should initially be expanded");
is(innerScopeItem.expanded, true,
"The innerScope expanded getter should return true");
is(mathScopeItem.expanded, true,
"The mathScope expanded getter should return true");
is(testScopeItem.expanded, true,
"The testScope expanded getter should return true");
is(loadScopeItem.expanded, true,
"The loadScope expanded getter should return true");
is(globalScopeItem.expanded, true,
"The globalScope expanded getter should return true");
mathScopeItem.collapse();
testScopeItem.collapse();
loadScopeItem.collapse();
globalScopeItem.collapse();
is(innerScope.querySelector(".arrow").hasAttribute("open"), true,
"The innerScope arrow should initially be expanded");
is(mathScope.querySelector(".arrow").hasAttribute("open"), false,
"The mathScope arrow should initially not be expanded");
is(testScope.querySelector(".arrow").hasAttribute("open"), false,
"The testScope arrow should initially not be expanded");
is(loadScope.querySelector(".arrow").hasAttribute("open"), false,
"The loadScope arrow should initially not be expanded");
is(globalScope.querySelector(".arrow").hasAttribute("open"), false,
"The globalScope arrow should initially not be expanded");
is(innerScope.querySelector(".details").hasAttribute("open"), true,
"The innerScope enumerables should initially be expanded");
is(mathScope.querySelector(".details").hasAttribute("open"), false,
"The mathScope enumerables should initially not be expanded");
is(testScope.querySelector(".details").hasAttribute("open"), false,
"The testScope enumerables should initially not be expanded");
is(loadScope.querySelector(".details").hasAttribute("open"), false,
"The loadScope enumerables should initially not be expanded");
is(globalScope.querySelector(".details").hasAttribute("open"), false,
"The globalScope enumerables should initially not be expanded");
is(innerScopeItem.expanded, true,
"The innerScope expanded getter should return true");
is(mathScopeItem.expanded, false,
"The mathScope expanded getter should return false");
is(testScopeItem.expanded, false,
"The testScope expanded getter should return false");
is(loadScopeItem.expanded, false,
"The loadScope expanded getter should return false");
is(globalScopeItem.expanded, false,
"The globalScope expanded getter should return false");
EventUtils.sendMouseEvent({ type: "mousedown" }, mathScope.querySelector(".arrow"), gDebugger);
EventUtils.sendMouseEvent({ type: "mousedown" }, testScope.querySelector(".arrow"), gDebugger);
EventUtils.sendMouseEvent({ type: "mousedown" }, loadScope.querySelector(".arrow"), gDebugger);
EventUtils.sendMouseEvent({ type: "mousedown" }, globalScope.querySelector(".arrow"), gDebugger);
is(innerScope.querySelector(".arrow").hasAttribute("open"), true,
"The innerScope arrow should now be expanded");
is(mathScope.querySelector(".arrow").hasAttribute("open"), true,
"The mathScope arrow should now be expanded");
is(testScope.querySelector(".arrow").hasAttribute("open"), true,
"The testScope arrow should now be expanded");
is(loadScope.querySelector(".arrow").hasAttribute("open"), true,
"The loadScope arrow should now be expanded");
is(globalScope.querySelector(".arrow").hasAttribute("open"), true,
"The globalScope arrow should now be expanded");
is(innerScope.querySelector(".details").hasAttribute("open"), true,
"The innerScope enumerables should now be expanded");
is(mathScope.querySelector(".details").hasAttribute("open"), true,
"The mathScope enumerables should now be expanded");
is(testScope.querySelector(".details").hasAttribute("open"), true,
"The testScope enumerables should now be expanded");
is(loadScope.querySelector(".details").hasAttribute("open"), true,
"The loadScope enumerables should now be expanded");
is(globalScope.querySelector(".details").hasAttribute("open"), true,
"The globalScope enumerables should now be expanded");
is(innerScopeItem.expanded, true,
"The innerScope expanded getter should return true");
is(mathScopeItem.expanded, true,
"The mathScope expanded getter should return true");
is(testScopeItem.expanded, true,
"The testScope expanded getter should return true");
is(loadScopeItem.expanded, true,
"The loadScope expanded getter should return true");
is(globalScopeItem.expanded, true,
"The globalScope expanded getter should return true");
let thisItem = innerScopeItem.get("this");
is(thisItem.expanded, false,
"The local scope 'this' should not be expanded yet");
gDebugger.addEventListener("Debugger:FetchedProperties", function test2() {
gDebugger.removeEventListener("Debugger:FetchedProperties", test2, false);
Services.tm.currentThread.dispatch({ run: function() {
let windowItem = thisItem.get("window");
is(windowItem.expanded, false,
"The local scope 'this.window' should not be expanded yet");
gDebugger.addEventListener("Debugger:FetchedProperties", function test3() {
gDebugger.removeEventListener("Debugger:FetchedProperties", test3, false);
Services.tm.currentThread.dispatch({ run: function() {
let documentItem = windowItem.get("document");
is(documentItem.expanded, false,
"The local scope 'this.window.document' should not be expanded yet");
gDebugger.addEventListener("Debugger:FetchedProperties", function test4() {
gDebugger.removeEventListener("Debugger:FetchedProperties", test4, false);
Services.tm.currentThread.dispatch({ run: function() {
let locationItem = documentItem.get("location");
is(locationItem.expanded, false,
"The local scope 'this.window.document.location' should not be expanded yet");
gDebugger.addEventListener("Debugger:FetchedProperties", function test5() {
gDebugger.removeEventListener("Debugger:FetchedProperties", test5, false);
Services.tm.currentThread.dispatch({ run: function() {
is(thisItem.target.querySelector(".arrow").hasAttribute("open"), true,
"The thisItem arrow should still be expanded (1)");
is(windowItem.target.querySelector(".arrow").hasAttribute("open"), true,
"The windowItem arrow should still be expanded (1)");
is(documentItem.target.querySelector(".arrow").hasAttribute("open"), true,
"The documentItem arrow should still be expanded (1)");
is(locationItem.target.querySelector(".arrow").hasAttribute("open"), true,
"The locationItem arrow should still be expanded (1)");
is(thisItem.target.querySelector(".details").hasAttribute("open"), true,
"The thisItem enumerables should still be expanded (1)");
is(windowItem.target.querySelector(".details").hasAttribute("open"), true,
"The windowItem enumerables should still be expanded (1)");
is(documentItem.target.querySelector(".details").hasAttribute("open"), true,
"The documentItem enumerables should still be expanded (1)");
is(locationItem.target.querySelector(".details").hasAttribute("open"), true,
"The locationItem enumerables should still be expanded (1)");
is(thisItem.expanded, true,
"The local scope 'this' should still be expanded (1)");
is(windowItem.expanded, true,
"The local scope 'this.window' should still be expanded (1)");
is(documentItem.expanded, true,
"The local scope 'this.window.document' should still be expanded (1)");
is(locationItem.expanded, true,
"The local scope 'this.window.document.location' should still be expanded (1)");
let count = 0;
gDebugger.addEventListener("Debugger:FetchedProperties", function test6() {
// We expect 4 Debugger:FetchedProperties events, one from the this
// reference, one for window, one for document and one for location.
if (++count < 4) {
info("Number of received Debugger:FetchedProperties events: " + count);
return;
}
gDebugger.removeEventListener("Debugger:FetchedProperties", test6, false);
Services.tm.currentThread.dispatch({ run: function() {
is(innerScope.querySelector(".arrow").hasAttribute("open"), true,
"The innerScope arrow should still be expanded");
is(mathScope.querySelector(".arrow").hasAttribute("open"), true,
"The mathScope arrow should still be expanded");
is(testScope.querySelector(".arrow").hasAttribute("open"), true,
"The testScope arrow should still be expanded");
is(loadScope.querySelector(".arrow").hasAttribute("open"), true,
"The loadScope arrow should still be expanded");
is(globalScope.querySelector(".arrow").hasAttribute("open"), true,
"The globalScope arrow should still be expanded");
is(innerScope.querySelector(".details").hasAttribute("open"), true,
"The innerScope enumerables should still be expanded");
is(mathScope.querySelector(".details").hasAttribute("open"), true,
"The mathScope enumerables should still be expanded");
is(testScope.querySelector(".details").hasAttribute("open"), true,
"The testScope enumerables should still be expanded");
is(loadScope.querySelector(".details").hasAttribute("open"), true,
"The loadScope enumerables should still be expanded");
is(globalScope.querySelector(".details").hasAttribute("open"), true,
"The globalScope enumerables should still be expanded");
is(innerScopeItem.expanded, true,
"The innerScope expanded getter should return true");
is(mathScopeItem.expanded, true,
"The mathScope expanded getter should return true");
is(testScopeItem.expanded, true,
"The testScope expanded getter should return true");
is(loadScopeItem.expanded, true,
"The loadScope expanded getter should return true");
is(globalScopeItem.expanded, true,
"The globalScope expanded getter should return true");
is(thisItem.target.querySelector(".arrow").hasAttribute("open"), true,
"The thisItem arrow should still be expanded (2)");
is(windowItem.target.querySelector(".arrow").hasAttribute("open"), true,
"The windowItem arrow should still be expanded (2)");
is(documentItem.target.querySelector(".arrow").hasAttribute("open"), true,
"The documentItem arrow should still be expanded (2)");
is(locationItem.target.querySelector(".arrow").hasAttribute("open"), true,
"The locationItem arrow should still be expanded (2)");
is(thisItem.target.querySelector(".details").hasAttribute("open"), true,
"The thisItem enumerables should still be expanded (2)");
is(windowItem.target.querySelector(".details").hasAttribute("open"), true,
"The windowItem enumerables should still be expanded (2)");
is(documentItem.target.querySelector(".details").hasAttribute("open"), true,
"The documentItem enumerables should still be expanded (2)");
is(locationItem.target.querySelector(".details").hasAttribute("open"), true,
"The locationItem enumerables should still be expanded (2)");
is(thisItem.expanded, true,
"The local scope 'this' should still be expanded (2)");
is(windowItem.expanded, true,
"The local scope 'this.window' should still be expanded (2)");
is(documentItem.expanded, true,
"The local scope 'this.window.document' should still be expanded (2)");
is(locationItem.expanded, true,
"The local scope 'this.window.document.location' should still be expanded (2)");
executeSoon(function() {
closeDebuggerAndFinish();
});
}}, 0);
}, false);
executeSoon(function() {
EventUtils.sendMouseEvent({ type: "mousedown" },
gDebugger.document.querySelector("#step-in"),
gDebugger);
});
}}, 0);
}, false);
executeSoon(function() {
EventUtils.sendMouseEvent({ type: "mousedown" },
locationItem.target.querySelector(".arrow"),
gDebugger);
is(locationItem.expanded, true,
"The local scope 'this.window.document.location' should be expanded now");
});
}}, 0);
}, false);
executeSoon(function() {
EventUtils.sendMouseEvent({ type: "mousedown" },
documentItem.target.querySelector(".arrow"),
gDebugger);
is(documentItem.expanded, true,
"The local scope 'this.window.document' should be expanded now");
});
}}, 0);
}, false);
executeSoon(function() {
EventUtils.sendMouseEvent({ type: "mousedown" },
windowItem.target.querySelector(".arrow"),
gDebugger);
is(windowItem.expanded, true,
"The local scope 'this.window' should be expanded now");
});
}}, 0);
}, false);
executeSoon(function() {
EventUtils.sendMouseEvent({ type: "mousedown" },
thisItem.target.querySelector(".arrow"),
gDebugger);
is(thisItem.expanded, true,
"The local scope 'this' should be expanded now");
});
}}, 0);
}, false);
EventUtils.sendMouseEvent({ type: "click" },
gDebuggee.document.querySelector("button"),
gDebuggee.window);
}
registerCleanupFunction(function() {
removeTab(gTab);
gPane = null;
gTab = null;
gDebugger = null;
gDebuggee = null;
});
|