browser_dbg_sources-keybindings.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
  2. /* Any copyright is dedicated to the Public Domain.
  3. * http://creativecommons.org/publicdomain/zero/1.0/ */
  4. /**
  5. * Tests related to source panel keyboard shortcut bindings
  6. */
  7. const TAB_URL = EXAMPLE_URL + "doc_function-search.html";
  8. const SCRIPT_URI = EXAMPLE_URL + "code_function-search-01.js";
  9. function test() {
  10. let gTab, gPanel, gDebugger, gSources;
  11. let options = {
  12. source: SCRIPT_URI,
  13. line: 1
  14. };
  15. initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {
  16. gTab = aTab;
  17. gPanel = aPanel;
  18. gDebugger = gPanel.panelWin;
  19. gSources = gDebugger.DebuggerView.Sources;
  20. testCopyURLShortcut()
  21. .then(() => closeDebuggerAndFinish(gPanel))
  22. .then(null, aError => {
  23. ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
  24. });
  25. });
  26. function testCopyURLShortcut() {
  27. return waitForClipboardPromise(sendCopyShortcut, SCRIPT_URI);
  28. }
  29. function sendCopyShortcut() {
  30. EventUtils.synthesizeKey("C", { accelKey: true }, gDebugger);
  31. }
  32. }