CARVIEW |
Select Language
HTTP/2 200
date: Tue, 22 Jul 2025 02:17:20 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
x-repository-download: git clone https://github.com/chakra-core/ChakraCore.git
etag: W/"b10efa9deea8f9ddd1d8f6a61e0feca2"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: no-referrer-when-downgrade
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=%2FjdB9XLKRvdAsRocdy%2BC%2Be86W%2Fzc344ZLe4RDhjL2LANpMdXQu%2Bxd%2FlkACVbp%2FW36V2Dm7U9grcvzbh8WVAqsARULAmOp12AcegBYN7Ka6hNccvvM69kw2THdknF%2Bf1%2FxoEgnNHK9pLeqbKoD2MXu1ka%2FjshDKk%2BgMEZc9mxRzlGST02BPixz7XbPxAaaJyS6hXsKxzGwx9owD18FK4nW3ruJFwvhqrPLlyqulMjfut9kjEC1oLWwF9DJKuPe8s%2BQcX%2Fjir15VI0zP8FegBqcg%3D%3D--L8sT5wjlH5dnJaPB--%2Bt06L%2BRsoriMTi25LVZPHA%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.81777481.1753150639; Path=/; Domain=github.com; Expires=Wed, 22 Jul 2026 02:17:19 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Wed, 22 Jul 2026 02:17:19 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: 92D2:3CADF0:71D68:AAE08:687EF4AF
Jsrt: Modify signature of JsCopyString · chakra-core/ChakraCore@356656c · GitHub
Copy file name to clipboardExpand all lines: bin/ch/ChakraRtInterface.cpp
Copy file name to clipboardExpand all lines: test/native-tests/test-c98/sample.cpp
Copy file name to clipboardExpand all lines: test/native-tests/test-char/sample.cpp
Copy file name to clipboardExpand all lines: test/native-tests/test-char16/sample.cpp
Copy file name to clipboardExpand all lines: test/native-tests/test-python/helloWorld.py
Copy file name to clipboardExpand all lines: test/native-tests/test-shared-basic/sample.cpp
Skip to content
Navigation Menu
{{ message }}
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit 356656c
committed
Jsrt: Modify signature of JsCopyString
Modified signature of `JsCopyString` to also return actual count of UTF8 bytes present in jsString.
With this information, host can simply allocate a buffer assuming all characters are ascii and
based on `writtenLength` and `actualLength` values returned by the API, it can decide if the assumption was correct
i.e. `writtenLength == actualLength` or it should take slow path to call `JsCopyString` again by passing bigger buffer
equal to size of`actualLength`.
Today, if host wants to copy UTF8 representation of javascript string into a buffer, here is how it is done:
```c++
size_t length = 0;
JsCopyString(jsString, nullptr, 0, &length);
char* buffer = malloc(length);
size_t written = 0;
JsCopyString(jsString, buffer, length, &written);
assert(written == length);
```
can be changed to
```c++
size_t actualLength = 0;
size_t writtenLength = 0;
size_t strLength = 0;
JsStringToPointer(strRef, nullptr, &strLength);
char* buffer = malloc(strLength + 1);
JsCopyString(jsString, buffer, strLength, &writtenLength, &actualLength);
// slow path if jsString contains non-ascii characters
if(written != actualLength) {
free(buffer);
buffer = malloc(actualLength + 1);
JsCopyString(jsString, buffer, actualLength, &writtenLength, &actualLength);
}
```1 parent 1ffb64c commit 356656cCopy full SHA for 356656c
File tree
Expand file treeCollapse file tree
11 files changed
+71
-32
lines changedFilter options
- bin/ch
- lib/Jsrt
- test/native-tests
- test-c98
- test-char16
- test-char
- test-python
- test-shared-basic
- test-static-native
Expand file treeCollapse file tree
11 files changed
+71
-32
lines changedbin/ch/ChakraRtInterface.cpp
Copy file name to clipboardExpand all lines: bin/ch/ChakraRtInterface.cpp+1Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
144 | 144 |
| |
145 | 145 |
| |
146 | 146 |
| |
| 147 | + | |
147 | 148 |
| |
148 | 149 |
| |
149 | 150 |
| |
|
+5-2Lines changed: 5 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
77 | 77 |
| |
78 | 78 |
| |
79 | 79 |
| |
80 |
| - | |
| 80 | + | |
| 81 | + | |
81 | 82 |
| |
82 | 83 |
| |
83 | 84 |
| |
| |||
172 | 173 |
| |
173 | 174 |
| |
174 | 175 |
| |
| 176 | + | |
175 | 177 |
| |
176 | 178 |
| |
177 | 179 |
| |
| |||
396 | 398 |
| |
397 | 399 |
| |
398 | 400 |
| |
399 |
| - | |
| 401 | + | |
| 402 | + | |
400 | 403 |
| |
401 | 404 |
| |
402 | 405 |
| |
|
+27-6Lines changed: 27 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
206 | 206 |
| |
207 | 207 |
| |
208 | 208 |
| |
| 209 | + | |
| 210 | + | |
| 211 | + | |
209 | 212 |
| |
210 | 213 |
| |
211 |
| - | |
212 |
| - | |
| 214 | + | |
213 | 215 |
| |
214 | 216 |
| |
215 |
| - | |
216 |
| - | |
217 |
| - | |
218 |
| - | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
219 | 236 |
| |
220 | 237 |
| |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
221 | 242 |
| |
222 | 243 |
| |
223 | 244 |
| |
|
+14-3Lines changed: 14 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
286 | 286 |
| |
287 | 287 |
| |
288 | 288 |
| |
289 |
| - | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
290 | 293 |
| |
291 | 294 |
| |
292 | 295 |
| |
293 | 296 |
| |
294 | 297 |
| |
295 |
| - | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
296 | 306 |
| |
297 | 307 |
| |
298 | 308 |
| |
| |||
301 | 311 |
| |
302 | 312 |
| |
303 | 313 |
| |
304 |
| - | |
| 314 | + | |
| 315 | + | |
305 | 316 |
| |
306 | 317 |
| |
307 | 318 |
| |
|
+12-9Lines changed: 12 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4252 | 4252 |
| |
4253 | 4253 |
| |
4254 | 4254 |
| |
4255 |
| - | |
| 4255 | + | |
| 4256 | + | |
4256 | 4257 |
| |
4257 | 4258 |
| |
4258 | 4259 |
| |
| |||
4266 | 4267 |
| |
4267 | 4268 |
| |
4268 | 4269 |
| |
4269 |
| - | |
| 4270 | + | |
4270 | 4271 |
| |
4271 |
| - | |
4272 |
| - | |
4273 |
| - | |
4274 |
| - | |
| 4272 | + | |
4275 | 4273 |
| |
4276 |
| - | |
| 4274 | + | |
| 4275 | + | |
4277 | 4276 |
| |
4278 | 4277 |
| |
4279 | 4278 |
| |
| |||
4284 | 4283 |
| |
4285 | 4284 |
| |
4286 | 4285 |
| |
4287 |
| - | |
| 4286 | + | |
4288 | 4287 |
| |
4289 |
| - | |
| 4288 | + | |
4290 | 4289 |
| |
4291 | 4290 |
| |
| 4291 | + | |
| 4292 | + | |
| 4293 | + | |
| 4294 | + | |
4292 | 4295 |
| |
4293 | 4296 |
| |
4294 | 4297 |
| |
|
test/native-tests/test-c98/sample.cpp
Copy file name to clipboardExpand all lines: test/native-tests/test-c98/sample.cpp+2-2Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
63 | 63 |
| |
64 | 64 |
| |
65 | 65 |
| |
66 |
| - | |
| 66 | + | |
67 | 67 |
| |
68 |
| - | |
| 68 | + | |
69 | 69 |
| |
70 | 70 |
| |
71 | 71 |
| |
|
test/native-tests/test-char/sample.cpp
Copy file name to clipboardExpand all lines: test/native-tests/test-char/sample.cpp+2-2Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
73 | 73 |
| |
74 | 74 |
| |
75 | 75 |
| |
76 |
| - | |
| 76 | + | |
77 | 77 |
| |
78 |
| - | |
| 78 | + | |
79 | 79 |
| |
80 | 80 |
| |
81 | 81 |
| |
|
test/native-tests/test-char16/sample.cpp
Copy file name to clipboardExpand all lines: test/native-tests/test-char16/sample.cpp+2-2Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
69 | 69 |
| |
70 | 70 |
| |
71 | 71 |
| |
72 |
| - | |
| 72 | + | |
73 | 73 |
| |
74 |
| - | |
| 74 | + | |
75 | 75 |
| |
76 | 76 |
| |
77 | 77 |
| |
|
test/native-tests/test-python/helloWorld.py
Copy file name to clipboardExpand all lines: test/native-tests/test-python/helloWorld.py+2-2Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
56 | 56 |
| |
57 | 57 |
| |
58 | 58 |
| |
59 |
| - | |
| 59 | + | |
60 | 60 |
| |
61 | 61 |
| |
62 | 62 |
| |
63 | 63 |
| |
64 |
| - | |
| 64 | + | |
65 | 65 |
| |
66 | 66 |
| |
67 | 67 |
| |
|
test/native-tests/test-shared-basic/sample.cpp
Copy file name to clipboardExpand all lines: test/native-tests/test-shared-basic/sample.cpp+2-2Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
57 | 57 |
| |
58 | 58 |
| |
59 | 59 |
| |
60 |
| - | |
| 60 | + | |
61 | 61 |
| |
62 |
| - | |
| 62 | + | |
63 | 63 |
| |
64 | 64 |
| |
65 | 65 |
| |
|
You can’t perform that action at this time.
0 commit comments