Check for partially-working normalize support.

This commit is contained in:
Richard Moore 2018-11-27 15:59:14 -05:00
parent ef8b9c36ef
commit bb6bc4cac3
No known key found for this signature in database
GPG Key ID: 525F70A6FCABC295

@ -125,10 +125,19 @@ export function setCensorship(censorship: boolean, permanent?: boolean): void {
export function checkNormalize(): void {
try {
// Make sure all forms of normalization are supported
["NFD", "NFC", "NFKD", "NFKC"].forEach((form) => {
try {
"test".normalize(form);
} catch(error) {
throw new Error('missing ' + form);
}
});
if (String.fromCharCode(0xe9).normalize('NFD') !== String.fromCharCode(0x65, 0x0301)) {
throw new Error('broken')
throw new Error('broken implementation')
}
} catch (error) {
throwError('platform missing String.prototype.normalize', UNSUPPORTED_OPERATION, { operation: 'String.prototype.normalize' });
throwError('platform missing String.prototype.normalize', UNSUPPORTED_OPERATION, { operation: 'String.prototype.normalize', form: error.message });
}
}