From 6bd8a09aee8fd2dc1a58cfd632ee1ef8ac42b57c Mon Sep 17 00:00:00 2001 From: Alexandre Poirot Date: Mon, 11 Jan 2021 13:11:50 +0000 Subject: [PATCH] Bug 1685090 - [devtools] Print exceptions when importing functions thrown in browser toolbox tests. r=jdescottes Without this, we were silently ignoring many errors when evaluating a piece of JS. Imported function may still work, but were missing global variables. Very misleading! Differential Revision: https://phabricator.services.mozilla.com/D100927 --- .../browser-toolbox/test/helpers-browser-toolbox.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/devtools/client/framework/browser-toolbox/test/helpers-browser-toolbox.js b/devtools/client/framework/browser-toolbox/test/helpers-browser-toolbox.js index 01ae24ef05bb..da2364dec6d5 100644 --- a/devtools/client/framework/browser-toolbox/test/helpers-browser-toolbox.js +++ b/devtools/client/framework/browser-toolbox/test/helpers-browser-toolbox.js @@ -155,7 +155,14 @@ async function initBrowserToolboxTask({ } async function importScript(script) { - await consoleFront.evaluateJSAsync(script); + const response = await consoleFront.evaluateJSAsync(script); + if (response.hasException) { + ok( + false, + "ToolboxTask.spawn exception while importing script: " + + response.exceptionMessage + ); + } } async function destroy() {