Commit 205df901 authored by Benjamin Franzke's avatar Benjamin Franzke
Browse files

[BUGFIX] Fix requirejs-loader config and error handling

Adapt the fetch-configuration URL query string, to account for the
backend url change in #93048, in order to use a questionmark
to concatenate the query string instead of an ampersand.
But allow for both, base URLs with and without question mark,
as frontend context via eID would still require an ampersand
for concatenation.

Also fix a error callback name clash and properly propagate
fetchConfiguration errors through the requirejs error handling,
for requirejs errbacks to be invoked.

Resolves: #93227
Related: #93048
Releases: master, 10.4
Change-Id: If843db529e19e6af2681871a2d6307d67acbea56
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/67346

Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Richard Haeser's avatarRichard Haeser <richard@richardhaeser.com>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Tested-by: Benjamin Franzke's avatarBenjamin Franzke <bfr@qbus.de>
Reviewed-by: Richard Haeser's avatarRichard Haeser <richard@richardhaeser.com>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: Benjamin Franzke's avatarBenjamin Franzke <bfr@qbus.de>
parent f4fac8d0
......@@ -57,13 +57,13 @@
if (this.status === 200) {
success(JSON.parse(xhr.responseText));
} else {
error(this.status, xhr.statusText);
error(this.status, new Error(xhr.statusText));
}
} catch (error) {
error(this.status, error);
} catch (err) {
error(this.status, err);
}
};
xhr.open('GET', config.typo3BaseUrl + '&name=' + encodeURIComponent(name));
xhr.open('GET', config.typo3BaseUrl + (config.typo3BaseUrl.indexOf('?') === -1 ? '?' : '&' ) + 'name=' + encodeURIComponent(name));
xhr.send();
};
......@@ -128,7 +128,13 @@
// result cannot be returned since nested in two asynchronous calls
originalLoad.call(req, context, name, url);
},
function() {}
function(status, err) {
var error = new Error('requirejs fetchConfiguration for ' + name + ' failed [' + status + ']');
error.contextName = context.contextName;
error.requireModules = [name];
error.originalError = err;
context.onError(error);
}
);
};
})(requirejs);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment