mirror of https://github.com/lukechilds/node.git
Browse Source
If the undocumented v8BreakIterator does not have data available, monkeypatch it to throw an error instead of crashing. Fixes: https://github.com/nodejs/node/issues/3111 PR-URL: https://github.com/nodejs/node/pull/4253 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>v6.x
Steven R. Loomis
9 years ago
committed by
Evan Lucas
3 changed files with 37 additions and 0 deletions
@ -0,0 +1,15 @@ |
|||
'use strict'; |
|||
require('../common'); |
|||
const assert = require('assert'); |
|||
|
|||
if (global.Intl === undefined || Intl.v8BreakIterator === undefined) { |
|||
return console.log('1..0 # Skipped: no Intl'); |
|||
} |
|||
|
|||
try { |
|||
new Intl.v8BreakIterator(); |
|||
// May succeed if data is available - OK
|
|||
} catch (e) { |
|||
// May throw this error if ICU data is not available - OK
|
|||
assert.throws(() => new Intl.v8BreakIterator(), /ICU data/); |
|||
} |
Loading…
Reference in new issue