| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 28bec2d commit 0bfbb68
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -371,6 +371,9 @@ util.formatWithOptions({ colors: true }, 'See object %O', { foo: 42 }); | |||
| 371 | 371 | <!-- YAML | |
| 372 | 372 | added: v22.9.0 | |
| 373 | 373 | changes: | |
| 374 | + - version: REPLACEME | ||
| 375 | + pr-url: https://github.com/nodejs/node/pull/56551 | ||
| 376 | + description: Property `CallSite.scriptId` is exposed. | ||
| 374 | 377 | - version: v22.12.0 | |
| 375 | 378 | pr-url: https://github.com/nodejs/node/pull/55626 | |
| 376 | 379 | description: The API is renamed from `util.getCallSite` to `util.getCallSites()`. | |
@@ -385,6 +388,7 @@ changes: | |||
| 385 | 388 | * `functionName` {string} Returns the name of the function associated with this call site. | |
| 386 | 389 | * `scriptName` {string} Returns the name of the resource that contains the script for the | |
| 387 | 390 | function for this call site. | |
| 391 | + * `scriptId` {string} Returns the unique id of the script, as in Chrome DevTools protocol [`Runtime.ScriptId`][]. | ||
| 388 | 392 | * `lineNumber` {number} Returns the number, 1-based, of the line for the associate function call. | |
| 389 | 393 | * `column` {number} Returns the 1-based column offset on the line for the associated function call. | |
| 390 | 394 | ||
@@ -3602,6 +3606,7 @@ util.log('Timestamped message.'); | |||
| 3602 | 3606 | [`Object.freeze()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze | |
| 3603 | 3607 | [`Promise`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise | |
| 3604 | 3608 | [`Proxy`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy | |
| 3609 | + [`Runtime.ScriptId`]: https://chromedevtools.github.io/devtools-protocol/1-3/Runtime/#type-ScriptId | ||
| 3605 | 3610 | [`Set`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set | |
| 3606 | 3611 | [`SharedArrayBuffer`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer | |
| 3607 | 3612 | [`TypedArray`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -320,6 +320,7 @@ | |||
| 320 | 320 | V(salt_length_string, "saltLength") \ | |
| 321 | 321 | V(scheme_string, "scheme") \ | |
| 322 | 322 | V(scopeid_string, "scopeid") \ | |
| 323 | + V(script_id_string, "scriptId") \ | ||
| 323 | 324 | V(script_name_string, "scriptName") \ | |
| 324 | 325 | V(serial_number_string, "serialNumber") \ | |
| 325 | 326 | V(serial_string, "serial") \ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -275,14 +275,18 @@ static void GetCallSites(const FunctionCallbackInfo<Value>& args) { | |||
| 275 | 275 | script_name = v8::String::Empty(isolate); | |
| 276 | 276 | } | |
| 277 | 277 | ||
| 278 | + std::string script_id = std::to_string(stack_frame->GetScriptId()); | ||
| 279 | + | ||
| 278 | 280 | Local<Name> names[] = { | |
| 279 | 281 | env->function_name_string(), | |
| 282 | + env->script_id_string(), | ||
| 280 | 283 | env->script_name_string(), | |
| 281 | 284 | env->line_number_string(), | |
| 282 | 285 | env->column_string(), | |
| 283 | 286 | }; | |
| 284 | 287 | Local<Value> values[] = { | |
| 285 | 288 | function_name, | |
| 289 | + OneByteString(isolate, script_id), | ||
| 286 | 290 | script_name, | |
| 287 | 291 | Integer::NewFromUnsigned(isolate, stack_frame->GetLineNumber()), | |
| 288 | 292 | Integer::NewFromUnsigned(isolate, stack_frame->GetColumn()), | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -79,6 +79,13 @@ const assert = require('node:assert'); | |||
| 79 | 79 | ); | |
| 80 | 80 | } | |
| 81 | 81 | ||
| 82 | + // ScriptId is a string. | ||
| 83 | + { | ||
| 84 | + const callSites = getCallSites(1); | ||
| 85 | + assert.strictEqual(callSites.length, 1); | ||
| 86 | + assert.strictEqual(typeof callSites[0].scriptId, 'string'); | ||
| 87 | + } | ||
| 88 | + | ||
| 82 | 89 | // Guarantee [eval] will appear on stacktraces when using -e | |
| 83 | 90 | { | |
| 84 | 91 | const { status, stderr, stdout } = spawnSync( | |
| Back | FazBrowse Home | New Git URL |
0 commit comments