Bug 1395545 - test that an invalid source map is reported to the console; r=nchevobbe

MozReview-Commit-ID: 4a1auGMOKGT

--HG--
extra : rebase_source : 928871607eef5f77c1a0e1de7d72b82e2fb589fa
This commit is contained in:
Tom Tromey 2017-08-31 12:03:24 -06:00
parent 6af7b263fd
commit 1a90ef84f7
5 changed files with 132 additions and 0 deletions

View file

@ -175,6 +175,7 @@ devtools/client/framework/test/code_ugly*
devtools/client/inspector/markup/test/events_bundle.js
devtools/client/netmonitor/test/xhr_bundle.js
devtools/client/webconsole/new-console-output/test/mochitest/code_bundle_nosource.js
devtools/client/webconsole/new-console-output/test/mochitest/code_bundle_invalidmap.js
devtools/server/tests/unit/babel_and_browserify_script_with_source_map.js
devtools/server/tests/unit/setBreakpoint*
devtools/server/tests/unit/sourcemapped.js

View file

@ -2,6 +2,8 @@
tags = devtools
subsuite = devtools
support-files =
code_bundle_invalidmap.js
code_bundle_invalidmap.js.map
code_bundle_nosource.js
code_bundle_nosource.js.map
head.js
@ -59,6 +61,7 @@ skip-if = (os == 'linux' && bits == 32 && debug) # bug 1328915, disable linux32
[browser_webconsole_scroll.js]
[browser_webconsole_shows_reqs_in_netmonitor.js]
[browser_webconsole_sourcemap_error.js]
[browser_webconsole_sourcemap_invalid.js]
[browser_webconsole_sourcemap_nosource.js]
[browser_webconsole_stacktrace_location_debugger_link.js]
[browser_webconsole_stacktrace_location_scratchpad_link.js]

View file

@ -0,0 +1,34 @@
/* -*- 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/ */
"use strict";
// Test that an invalid source map is reported.
const JS_URL = URL_ROOT + "code_bundle_invalidmap.js";
const PAGE_URL = `data:text/html,
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>Empty test page to test source map with invalid source map</title>
</head>
<body>
<script src="${JS_URL}"></script>
</body>
</html>`;
add_task(function* () {
yield pushPref("devtools.source-map.client-service.enabled", true);
const hud = yield openNewTabAndConsole(PAGE_URL);
const node = yield waitFor(() => findMessage(hud, "Source map error"));
ok(node, "source map error is displayed in web console");
});

View file

@ -0,0 +1,93 @@
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// Original source code for the cross-domain source map test.
// The generated file was made with
// webpack --devtool nosources-source-map code_nosource.js code_bundle_nosource.js
// ... and then the bundle was edited to change the source name.
function f() {
console.log("here");
}
f();
// Avoid script GC.
window.f = f;
/***/ })
/******/ ]);
//# sourceMappingURL=code_bundle_invalidmap.js.map

View file

@ -0,0 +1 @@
!!!!!!!!!!!!!!!! not a source map !!!!!!!!!!!!!!!!