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