-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix building without ICU #14489
Fix building without ICU #14489
Conversation
Argh... we seriously need to get building without ICU enabled by default as part of the normal CI run. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Only lightly reviewed, mostly rubber-stamp.
@jasnell That's nodejs/build#419.
@jasnell I assume your comment was a LGTM? |
626437c
to
67493e8
Compare
I modified this PR to offer a |
doc/api/util.md
Outdated
|
||
* `encoding` {string} Identifies the `encoding` that this `TextDecoder` instance | ||
supports. Defaults to `'utf-8'`. | ||
* `options` {Object} | ||
* `fatal` {boolean} `true` if decoding failures are fatal. Defaults to | ||
`false`. | ||
`false`. This options is only supported when ICU is enabled (see |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/options/option
@@ -14,16 +14,23 @@ const ctrlU = { ctrl: true, name: 'u' }; | |||
prompt: '' | |||
}); | |||
|
|||
for (const [cursor, string] of [ | |||
const tests = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change does not look related?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is necessary to fix building (and testing) on ICU, since the JS implementation can only distinguish between wide/narrow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code change looks good, tho I'd prefer a bit less code duplication on the two TextDecoder variants.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
I've hit that "ICU missing" wall several times... good riddance.
|
||
{ | ||
const fn = TextEncoder.prototype[inspect]; | ||
fn.call(new TextEncoder(), Infinity, {}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't you want to assert anything about the output string? Or at least wrap in assert.doesNotThrow
just to be explicit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrapped in doesNotThrow
. We don't really care about the inspection results as long as it works 😉
|
||
[{}, [], true, 1, '', new TextDecoder()].forEach((i) => { | ||
assert.throws(() => fn.call(i, Infinity, {}), | ||
common.expectsError({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add the Type
of the expected Error
.
|
||
{ | ||
const fn = TextDecoder.prototype[inspect]; | ||
fn.call(new TextDecoder(), Infinity, {}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comments as in test-whatwg-encoding-textencoder.js#L24 & L28
code: 'ERR_ENCODING_INVALID_ENCODED_DATA', | ||
type: TypeError, | ||
message: | ||
/^The encoded data was not valid for encoding utf-8$/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could use a simple string, should be semantically the same as an anchored RegExp
.
lib/internal/errors.js
Outdated
@@ -118,6 +118,7 @@ E('ERR_HTTP_HEADERS_SENT', | |||
E('ERR_HTTP_INVALID_STATUS_CODE', 'Invalid status code: %s'); | |||
E('ERR_HTTP_TRAILER_INVALID', | |||
'Trailers are invalid with this transfer encoding'); | |||
E('ERR_ICU_NOT_SUPPORTED', '%s is not supported on Node.js built without ICU'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a test asserting the expected message, to test/parallel/test-internal-errors.js
, as per the new tweaks in https://github.com/nodejs/node/blob/master/doc/guides/using-internal-errors.md#testing-new-errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the reminder, I realized that I also forgot to add the new error code to the docs...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, the test file only contains more complicated error code processing, like ERR_INVALID_ARG_TYPE
. I'll still add the missing docs though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reasoning was "test the message once then assume it's ok everywhere else" but, this will probably get reworked anyway after we finish migrating all the Error, so this is non-blocking.
67493e8
to
fde1f4b
Compare
d2b9f5d
to
ad06098
Compare
@jasnell Changed so that there's less duplication. Tried to kick off a CI w/o ICU: |
Also split up the tests.
ad06098
to
e07d268
Compare
After the V8 6.0 update, the V8 Pushed one more fix to address this situation. New no ICU CI: https://ci.nodejs.org/job/node-test-commit/11505/ |
Landed in 34d1b11...17547c4. |
PR-URL: #14489 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
Also split up the tests. PR-URL: #14489 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
PR-URL: #14489 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
PR-URL: #14489 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
PR-URL: #14489 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
This doesn’t land cleanly on 8.x; if you can, please follow the guide and raise a backport PR. |
Note that the resulting package does not work yet due to nodejs/node#14489 not being in 8.3.0.
Also split up the tests. PR-URL: nodejs#14489 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
Is this needed on v6.x? |
ping. this would need to be manually backported |
Corresponding documentation changes for encoding will be folded into #14486.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
encoding, test