Bug 1503169 - Only swallow head.js loadSubScript exceptions in browser-test.js;r=markh

The existing regexp used to swallow head.js load failures was a bit too
generic and would catch any loadSubScript failure that may happen in head.js.

The original intent was only to tolerate missing head.js files so we should be able
to be more selective when detecting the exception

Differential Revision: https://phabricator.services.mozilla.com/D10191

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Julian Descottes 2018-10-31 03:11:28 +00:00
Родитель f07194fbdf
Коммит 229e102468
1 изменённых файлов: 8 добавлений и 4 удалений

Просмотреть файл

@ -1047,10 +1047,14 @@ Tester.prototype = {
try {
this._scriptLoader.loadSubScript(headPath, scope);
} catch (ex) {
// Ignore if no head.js exists, but report all other errors. Note this
// will also ignore an existing head.js attempting to import a missing
// module - see bug 755558 for why this strategy is preferred anyway.
if (!/^Error opening input stream/.test(ex.toString())) {
// Bug 755558 - Ignore loadSubScript errors due to a missing head.js.
const isImportError = /^Error opening input stream/.test(ex.toString());
// Bug 1503169 - head.js may call loadSubScript, and generate similar errors.
// Only swallow errors that are strictly related to loading head.js.
const containsHeadPath = ex.toString().includes(headPath);
if (!isImportError || !containsHeadPath) {
this.currentTest.addResult(new testResult({
name: "head.js import threw an exception",
ex,