test_sourcemaps-04.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* Any copyright is dedicated to the Public Domain.
  2. http://creativecommons.org/publicdomain/zero/1.0/ */
  3. /**
  4. * Check that absolute source map urls work.
  5. */
  6. var gDebuggee;
  7. var gClient;
  8. var gThreadClient;
  9. function run_test()
  10. {
  11. initTestDebuggerServer();
  12. gDebuggee = addTestGlobal("test-source-map");
  13. gClient = new DebuggerClient(DebuggerServer.connectPipe());
  14. gClient.connect().then(function () {
  15. attachTestTabAndResume(gClient, "test-source-map", function (aResponse, aTabClient, aThreadClient) {
  16. gThreadClient = aThreadClient;
  17. test_absolute_source_map();
  18. });
  19. });
  20. do_test_pending();
  21. }
  22. function test_absolute_source_map()
  23. {
  24. gThreadClient.addOneTimeListener("newSource", function _onNewSource(aEvent, aPacket) {
  25. do_check_eq(aEvent, "newSource");
  26. do_check_eq(aPacket.type, "newSource");
  27. do_check_true(!!aPacket.source);
  28. do_check_true(aPacket.source.url.indexOf("sourcemapped.coffee") !== -1,
  29. "The new source should be a coffee file.");
  30. do_check_eq(aPacket.source.url.indexOf("sourcemapped.js"), -1,
  31. "The new source should not be a js file.");
  32. finishClient(gClient);
  33. });
  34. code = readFile("sourcemapped.js")
  35. + "\n//# sourceMappingURL=" + getFileUrl("source-map-data/sourcemapped.map");
  36. Components.utils.evalInSandbox(code, gDebuggee, "1.8",
  37. getFileUrl("sourcemapped.js"), 1);
  38. }