Bug 1507260 - Pretty Print fails with sourceMap error when Source Maps is off. r=lsmyth

Tags:

Bug #: 1507260

Differential Revision: https://phabricator.services.mozilla.com/D11928
This commit is contained in:
Jason Laster 2018-11-14 15:09:32 -05:00
parent 5d354ce421
commit d7eb5542a4
6 changed files with 26 additions and 7 deletions

View File

@ -25,6 +25,8 @@ import {
getPendingBreakpointsForSource
} from "../../selectors";
import { prefs } from "../../utils/prefs";
import type { Source, SourceId } from "../../types";
import type { Action, ThunkArgs } from "../types";
@ -46,7 +48,7 @@ function createOriginalSource(
function loadSourceMaps(sources) {
return async function({ dispatch, sourceMaps }: ThunkArgs) {
if (!sourceMaps) {
if (!prefs.clientSourceMapsEnabled) {
return;
}

View File

@ -61,8 +61,7 @@ export function shouldPrettyPrint(source: Source) {
isPretty(source) ||
!isJavaScript(source) ||
isOriginal(source) ||
source.sourceMapURL ||
!prefs.clientSourceMapsEnabled
(prefs.clientSourceMapsEnabled && source.sourceMapURL)
) {
return false;
}

View File

@ -730,6 +730,7 @@ skip-if = os == "win" # Bug 1393121
skip-if = os == "win"
[browser_dbg-search-project.js]
[browser_dbg-sourcemaps.js]
[browser_dbg-sourcemaps-disabled.js]
[browser_dbg-sourcemaps-reload.js]
skip-if = os == "win" || (verify) # Bug 1434792
[browser_dbg-sourcemaps-reloading.js]

View File

@ -0,0 +1,19 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Tests loading and pretty printing bundles with sourcemaps disabled
requestLongerTimeout(2);
add_task(async function() {
await pushPref("devtools.source-map.client-service.enabled", false);
const dbg = await initDebugger("doc-sourcemaps.html");
await waitForSources(dbg, "bundle.js");
const bundleSrc = findSource(dbg, "bundle.js");
info('Pretty print the bundle');
await selectSource(dbg, bundleSrc);
clickElement(dbg, "prettyPrintButton");
await waitForSelectedSource(dbg, "bundle.js:formatted");
ok(true, 'everything finished');
});

View File

@ -690,9 +690,6 @@ Toolbox.prototype = {
* the source map worker.
*/
get sourceMapService() {
if (!Services.prefs.getBoolPref("devtools.source-map.client-service.enabled")) {
return null;
}
return this._createSourceMapService();
},

View File

@ -314,7 +314,8 @@ StyleEditorUI.prototype = {
const toolbox = gDevTools.getToolbox(this._target);
const sourceMapService = toolbox.sourceMapService;
if (!sourceMapService) {
if (!sourceMapService || !Services.prefs.getBoolPref(PREF_ORIG_SOURCES)) {
return editor;
}