/* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ /** * Make sure that the variables view correctly displays WebIDL attributes in DOM * objects. */ const TAB_URL = EXAMPLE_URL + "doc_frame-parameters.html"; let gTab, gDebuggee, gPanel, gDebugger; let gVariables; function test() { // Debug test slaves are a bit slow at this test. requestLongerTimeout(2); initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { gTab = aTab; gDebuggee = aDebuggee; gPanel = aPanel; gDebugger = gPanel.panelWin; gVariables = gDebugger.DebuggerView.Variables; waitForSourceAndCaretAndScopes(gPanel, ".html", 24) .then(expandGlobalScope) .then(performTest) .then(() => resumeDebuggerThenCloseAndFinish(gPanel)) .then(null, aError => { ok(false, "Got an error: " + aError.message + "\n" + aError.stack); }); EventUtils.sendMouseEvent({ type: "click" }, gDebuggee.document.querySelector("button"), gDebuggee); }); } function expandGlobalScope() { let deferred = promise.defer(); let globalScope = gVariables.getScopeAtIndex(1); is(globalScope.expanded, false, "The global scope should not be expanded by default."); gDebugger.once(gDebugger.EVENTS.FETCHED_VARIABLES, deferred.resolve); EventUtils.sendMouseEvent({ type: "mousedown" }, globalScope.target.querySelector(".name"), gDebugger); return deferred.promise; } function performTest() { let deferred = promise.defer(); let globalScope = gVariables.getScopeAtIndex(1); let buttonVar = globalScope.get("button"); let buttonAsProtoVar = globalScope.get("buttonAsProto"); let documentVar = globalScope.get("document"); is(buttonVar.target.querySelector(".name").getAttribute("value"), "button", "Should have the right property name for 'button'."); is(buttonVar.target.querySelector(".value").getAttribute("value"), "