0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/fixtures/url-tests-additional.js
Timothy Gu b610a4db1c url: enforce valid UTF-8 in WHATWG parser
This commit implements the Web IDL USVString conversion, which mandates
all unpaired Unicode surrogates be turned into U+FFFD REPLACEMENT
CHARACTER. It also disallows Symbols to be used as USVString per spec.

Certain functions call into C++ methods in the binding that use the
Utf8Value class to access string arguments. Utf8Value already does the
normalization using V8's String::Write, so in those cases, instead of
doing the full USVString normalization, only a symbol check is done
(`'' + val`, which uses ES's ToString, versus `String()` which has
special provisions for symbols).

PR-URL: https://github.com/nodejs/node/pull/11436
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-02-28 18:39:20 -08:00

37 lines
859 B
JavaScript

'use strict';
// This file contains test cases not part of the WPT
module.exports = [
{
// surrogate pair
'url': 'https://github.com/nodejs/\uD83D\uDE00node',
'protocol': 'https:',
'pathname': '/nodejs/%F0%9F%98%80node'
},
{
// unpaired low surrogate
'url': 'https://github.com/nodejs/\uD83D',
'protocol': 'https:',
'pathname': '/nodejs/%EF%BF%BD'
},
{
// unpaired low surrogate
'url': 'https://github.com/nodejs/\uD83Dnode',
'protocol': 'https:',
'pathname': '/nodejs/%EF%BF%BDnode'
},
{
// unmatched high surrogate
'url': 'https://github.com/nodejs/\uDE00',
'protocol': 'https:',
'pathname': '/nodejs/%EF%BF%BD'
},
{
// unmatched high surrogate
'url': 'https://github.com/nodejs/\uDE00node',
'protocol': 'https:',
'pathname': '/nodejs/%EF%BF%BDnode'
}
];