File tree Expand file tree Collapse file tree 3 files changed +37
-0
lines changed Expand file tree Collapse file tree 3 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -773,7 +773,12 @@ class V8EXPORT StackTrace {
773
773
kIsEval = 1 << 4 ,
774
774
kIsConstructor = 1 << 5 ,
775
775
kScriptNameOrSourceURL = 1 << 6 ,
776
+ #ifdef QT_BUILD_SCRIPT_LIB
777
+ kScriptId = 1 << 7 ,
778
+ kOverview = kLineNumber | kColumnOffset | kScriptName | kFunctionName | kScriptId ,
779
+ #else
776
780
kOverview = kLineNumber | kColumnOffset | kScriptName | kFunctionName ,
781
+ #endif
777
782
kDetailed = kOverview | kIsEval | kIsConstructor | kScriptNameOrSourceURL
778
783
};
779
784
@@ -833,6 +838,14 @@ class V8EXPORT StackFrame {
833
838
*/
834
839
Local<String> GetScriptName () const ;
835
840
841
+ #ifdef QT_BUILD_SCRIPT_LIB
842
+ /* *
843
+ * Returns the id of the resource that contains the script for the
844
+ * function for this StackFrame.
845
+ */
846
+ Local<Value> GetScriptId () const ;
847
+ #endif
848
+
836
849
/* *
837
850
* Returns the name of the resource that contains the script for the
838
851
* function for this StackFrame or sourceURL value if the script name
Original file line number Diff line number Diff line change @@ -1942,6 +1942,20 @@ Local<String> StackFrame::GetScriptName() const {
1942
1942
return scope.Close (Local<String>::Cast (Utils::ToLocal (name)));
1943
1943
}
1944
1944
1945
+ #ifdef QT_BUILD_SCRIPT_LIB
1946
+ Local<Value> StackFrame::GetScriptId () const {
1947
+ i::Isolate* isolate = i::Isolate::Current ();
1948
+ if (IsDeadCheck (isolate, " v8::StackFrame::GetScriptId()" )) return Local<Value>();
1949
+ ENTER_V8 (isolate);
1950
+ HandleScope scope;
1951
+ i::Handle<i::JSObject> self = Utils::OpenHandle (this );
1952
+ i::Handle<i::Object> id = GetProperty (self, " scriptId" );
1953
+ if (!id->IsNumber ()) {
1954
+ return Local<Value>();
1955
+ }
1956
+ return scope.Close (Utils::ToLocal (id));
1957
+ }
1958
+ #endif
1945
1959
1946
1960
Local<String> StackFrame::GetScriptNameOrSourceURL () const {
1947
1961
i::Isolate* isolate = Utils::OpenHandle (this )->GetIsolate ();
Original file line number Diff line number Diff line change @@ -197,6 +197,9 @@ Handle<JSArray> Isolate::CaptureCurrentStackTrace(
197
197
Handle<String> column_key = factory ()->LookupAsciiSymbol (" column" );
198
198
Handle<String> line_key = factory ()->LookupAsciiSymbol (" lineNumber" );
199
199
Handle<String> script_key = factory ()->LookupAsciiSymbol (" scriptName" );
200
+ #ifdef QT_BUILD_SCRIPT_LIB
201
+ Handle<String> script_id_key = factory ()->LookupAsciiSymbol (" scriptId" );
202
+ #endif
200
203
Handle<String> name_or_source_url_key =
201
204
factory ()->LookupAsciiSymbol (" nameOrSourceURL" );
202
205
Handle<String> script_name_or_source_url_key =
@@ -249,6 +252,13 @@ Handle<JSArray> Isolate::CaptureCurrentStackTrace(
249
252
SetLocalPropertyNoThrow (stackFrame, script_key, script_name);
250
253
}
251
254
255
+ #ifdef QT_BUILD_SCRIPT_LIB
256
+ if (options & StackTrace::kScriptId ) {
257
+ Handle<Object> script_id (script->id ());
258
+ SetLocalPropertyNoThrow (stackFrame, script_id_key, script_id);
259
+ }
260
+ #endif
261
+
252
262
if (options & StackTrace::kScriptNameOrSourceURL ) {
253
263
Handle<Object> script_name (script->name (), this );
254
264
Handle<JSValue> script_wrapper = GetScriptWrapper (script);
You can’t perform that action at this time.
0 commit comments