diff --git a/devtools/client/framework/test/browser_source_map-01.js b/devtools/client/framework/test/browser_source_map-01.js index c6a7436c73fb..76f316ace118 100644 --- a/devtools/client/framework/test/browser_source_map-01.js +++ b/devtools/client/framework/test/browser_source_map-01.js @@ -1,11 +1,7 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ -// Whitelisting this test. -// As part of bug 1077403, the leaking uncaught rejections should be fixed. -thisTestLeaksUncaughtRejectionsAndShouldBeFixed("[object Object]"); -thisTestLeaksUncaughtRejectionsAndShouldBeFixed( - "TypeError: this.transport is null"); +"use strict"; /** * Tests the SourceMapService updates generated sources when source maps @@ -13,15 +9,8 @@ thisTestLeaksUncaughtRejectionsAndShouldBeFixed( * when tagging an already source mapped location initially. */ -// Force the old debugger UI since it's directly used (see Bug 1301705) -Services.prefs.setBoolPref("devtools.debugger.new-debugger-frontend", false); -registerCleanupFunction(function* () { - Services.prefs.clearUserPref("devtools.debugger.new-debugger-frontend"); -}); - -const DEBUGGER_ROOT = "http://example.com/browser/devtools/client/debugger/test/mochitest/"; // Empty page -const PAGE_URL = `${DEBUGGER_ROOT}doc_empty-tab-01.html`; +const PAGE_URL = `${URL_ROOT}doc_empty-tab-01.html`; const JS_URL = `${URL_ROOT}code_binary_search.js`; const COFFEE_URL = `${URL_ROOT}code_binary_search.coffee`; @@ -30,9 +19,9 @@ add_task(function* () { const service = toolbox.sourceMapURLService; // Inject JS script - let sourceShown = waitForSourceShown(toolbox.getCurrentPanel(), "code_binary_search"); + let sourceSeen = waitForSourceLoad(toolbox, JS_URL); yield createScript(JS_URL); - yield sourceShown; + yield sourceSeen; let loc1 = { url: JS_URL, line: 6 }; let newLoc1 = yield service.originalPositionFor(loc1.url, loc1.line); @@ -64,33 +53,3 @@ function checkLoc2(oldLoc, newLoc) { is(newLoc.column, 10, "Correct column for JS:8:3 -> COFFEE"); is(newLoc.sourceUrl, COFFEE_URL, "Correct url for JS:8:3 -> COFFEE"); } - -function createScript(url) { - info(`Creating script: ${url}`); - let mm = getFrameScript(); - let command = ` - let script = document.createElement("script"); - script.setAttribute("src", "${url}"); - document.body.appendChild(script); - null; - `; - return evalInDebuggee(mm, command); -} - -function waitForSourceShown(debuggerPanel, url) { - let { panelWin } = debuggerPanel; - let deferred = defer(); - - info(`Waiting for source ${url} to be shown in the debugger...`); - panelWin.on(panelWin.EVENTS.SOURCE_SHOWN, function onSourceShown(_, source) { - - let sourceUrl = source.url || source.generatedUrl; - if (sourceUrl.includes(url)) { - panelWin.off(panelWin.EVENTS.SOURCE_SHOWN, onSourceShown); - info(`Source shown for ${url}`); - deferred.resolve(source); - } - }); - - return deferred.promise; -} diff --git a/devtools/client/framework/test/head.js b/devtools/client/framework/test/head.js index 22433b237f6a..1d49df71c6f2 100644 --- a/devtools/client/framework/test/head.js +++ b/devtools/client/framework/test/head.js @@ -146,3 +146,45 @@ function checkHostType(toolbox, hostType, previousHostType) { previousHostType, "The previous host is correct"); } } + +/** + * Create a new