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: * Tests that iframes can be added as debuggees. michael@0: */ michael@0: michael@0: const TAB_URL = EXAMPLE_URL + "doc_iframes.html"; michael@0: michael@0: function test() { michael@0: let gTab, gDebuggee, gPanel, gDebugger; michael@0: let gIframe, gEditor, gSources, gFrames; 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: gIframe = gDebuggee.frames[0]; michael@0: gEditor = gDebugger.DebuggerView.editor; michael@0: gSources = gDebugger.DebuggerView.Sources; michael@0: gFrames = gDebugger.DebuggerView.StackFrames; michael@0: michael@0: waitForSourceShown(gPanel, "inline-debugger-statement.html") michael@0: .then(checkIframeSource) michael@0: .then(checkIframePause) 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: michael@0: function checkIframeSource() { michael@0: is(gDebugger.gThreadClient.paused, false, michael@0: "Should be running after starting the test."); michael@0: michael@0: ok(isCaretPos(gPanel, 1), michael@0: "The source editor caret position was incorrect."); michael@0: is(gFrames.itemCount, 0, michael@0: "Should have only no frames."); michael@0: michael@0: is(gSources.itemCount, 1, michael@0: "Found the expected number of entries in the sources widget."); michael@0: is(gEditor.getText().indexOf("debugger"), 348, michael@0: "The correct source was loaded initially."); michael@0: is(gSources.selectedValue, EXAMPLE_URL + "doc_inline-debugger-statement.html", michael@0: "The currently selected source value is incorrect (0)."); michael@0: is(gSources.selectedValue, gSources.values[0], michael@0: "The currently selected source value is incorrect (1)."); michael@0: } michael@0: michael@0: function checkIframePause() { michael@0: // Spin the event loop before causing the debuggee to pause, to allow michael@0: // this function to return first. michael@0: executeSoon(() => gIframe.runDebuggerStatement()); michael@0: michael@0: return waitForCaretAndScopes(gPanel, 16).then(() => { michael@0: is(gDebugger.gThreadClient.paused, true, michael@0: "Should be paused after an interrupt request."); michael@0: michael@0: ok(isCaretPos(gPanel, 16), michael@0: "The source editor caret position was incorrect."); michael@0: is(gFrames.itemCount, 1, michael@0: "Should have only one frame."); michael@0: }); michael@0: } michael@0: }