Check for partially-working normalize support.
This commit is contained in:
parent
ef8b9c36ef
commit
bb6bc4cac3
@ -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 });
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user