Skip to content
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

inspector: fix StringUtil::CharacterCount for unicodes #56788

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

legendecas
Copy link
Member

StringUtil::CharacterCount should return the length of underlying
representation storage of a protocol string.

StringUtil::CharacterCount is only used in DictionaryValue
serialization. Only Network.Headers is an object type, represented
with DictionaryValue.

`StringUtil::CharacterCount` should return the length of underlying
representation storage of a protocol string.

`StringUtil::CharacterCount` is only used in DictionaryValue
serialization. Only `Network.Headers` is an object type, represented
with DictionaryValue.
@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Jan 27, 2025

Review requested:

  • @nodejs/gyp
  • @nodejs/inspector
  • @nodejs/cpp-reviewers

@nodejs-github-bot nodejs-github-bot added lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Jan 27, 2025
@legendecas legendecas added the inspector Issues and PRs related to the V8 inspector protocol label Jan 27, 2025
@legendecas legendecas added the request-ci Add this label to start a Jenkins CI on a PR. label Jan 27, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jan 27, 2025
@nodejs-github-bot
Copy link
Collaborator

@lemire
Copy link
Member

lemire commented Jan 27, 2025

This goes back to at least this commit by @targos

5aaa7fe

(6 years ago)

where the code was...

size_t CharacterCount(const String& s) {
  icu::UnicodeString utf16 =
      icu::UnicodeString::fromUTF8(icu::StringPiece(s.data(), s.length()));
  return utf16.countChar32();
}

@lemire
Copy link
Member

lemire commented Jan 27, 2025

So it was always wrong?

@legendecas
Copy link
Member Author

@lemire this function was never called. Only the new protocol Network.Headers uses this function, like mentioned in the OP.

Copy link

codecov bot commented Jan 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.22%. Comparing base (04f147b) to head (2908bef).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #56788   +/-   ##
=======================================
  Coverage   89.22%   89.22%           
=======================================
  Files         663      663           
  Lines      191974   191974           
  Branches    36922    36919    -3     
=======================================
+ Hits       171282   171293   +11     
+ Misses      13561    13555    -6     
+ Partials     7131     7126    -5     
Files with missing lines Coverage Δ
src/inspector/node_string.cc 60.00% <100.00%> (ø)
src/inspector/node_string.h 57.14% <ø> (ø)

... and 41 files with indirect coverage changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inspector Issues and PRs related to the V8 inspector protocol lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants