/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ /* vim: set ft=javascript ts=2 et sw=2 tw=80: */ /* 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"; var gTab, gPanel, gDebugger; var gVariables; function test() { // Debug test slaves are a bit slow at this test. requestLongerTimeout(2); let options = { source: TAB_URL, line: 1 }; initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gVariables = gDebugger.DebuggerView.Variables; waitForCaretAndScopes(gPanel, 24) .then(expandGlobalScope) .then(performTest) .then(() => resumeDebuggerThenCloseAndFinish(gPanel)) .then(null, aError => { ok(false, "Got an error: " + aError.message + "\n" + aError.stack); }); generateMouseClickInTab(gTab, "content.document.querySelector('button')"); }); } function expandGlobalScope() { let deferred = promise.defer(); let globalScope = gVariables.getScopeAtIndex(2); 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(2); 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"), "