browser_callwatcher-02.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* Any copyright is dedicated to the Public Domain.
  2. http://creativecommons.org/publicdomain/zero/1.0/ */
  3. /**
  4. * Bug 1112378
  5. * Tests to ensure that errors called on wrapped functions via call-watcher
  6. * correctly looks like the error comes from the content, not from within the devtools.
  7. */
  8. const BUG_1112378_URL = EXAMPLE_URL + "doc_bug_1112378.html";
  9. add_task(function* () {
  10. let { target, panel } = yield initWebAudioEditor(BUG_1112378_URL);
  11. let { panelWin } = panel;
  12. let { gFront, $, $$, EVENTS, gAudioNodes } = panelWin;
  13. loadFrameScripts();
  14. let rendered = waitForGraphRendered(panelWin, 2, 0);
  15. reload(target);
  16. yield rendered;
  17. let error = yield evalInDebuggee("throwError()");
  18. is(error.lineNumber, 21, "error has correct lineNumber");
  19. is(error.columnNumber, 11, "error has correct columnNumber");
  20. is(error.name, "TypeError", "error has correct name");
  21. is(error.message, "Argument 1 is not valid for any of the 2-argument overloads of AudioNode.connect.", "error has correct message");
  22. is(error.stringified, "TypeError: Argument 1 is not valid for any of the 2-argument overloads of AudioNode.connect.", "error is stringified correctly");
  23. is(error.instanceof, true, "error is correctly an instanceof TypeError");
  24. is(error.fileName, "http://example.com/browser/devtools/client/webaudioeditor/test/doc_bug_1112378.html", "error has correct fileName");
  25. error = yield evalInDebuggee("throwDOMException()");
  26. is(error.lineNumber, 37, "exception has correct lineNumber");
  27. is(error.columnNumber, 0, "exception has correct columnNumber");
  28. is(error.code, 9, "exception has correct code");
  29. is(error.result, 2152923145, "exception has correct result");
  30. is(error.name, "NotSupportedError", "exception has correct name");
  31. is(error.message, "Operation is not supported", "exception has correct message");
  32. is(error.stringified, "NotSupportedError: Operation is not supported", "exception is stringified correctly");
  33. is(error.instanceof, true, "exception is correctly an instance of DOMException");
  34. is(error.filename, "http://example.com/browser/devtools/client/webaudioeditor/test/doc_bug_1112378.html", "exception has correct filename");
  35. yield teardown(target);
  36. });