summaryrefslogtreecommitdiff
path: root/deps/v8/src/inspector/v8-stack-trace-impl.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/inspector/v8-stack-trace-impl.cc')
-rw-r--r--deps/v8/src/inspector/v8-stack-trace-impl.cc23
1 files changed, 18 insertions, 5 deletions
diff --git a/deps/v8/src/inspector/v8-stack-trace-impl.cc b/deps/v8/src/inspector/v8-stack-trace-impl.cc
index 639ba46592..dc991937c0 100644
--- a/deps/v8/src/inspector/v8-stack-trace-impl.cc
+++ b/deps/v8/src/inspector/v8-stack-trace-impl.cc
@@ -10,6 +10,10 @@
#include "src/inspector/v8-debugger.h"
#include "src/inspector/v8-inspector-impl.h"
+using v8_crdtp::SpanFrom;
+using v8_crdtp::json::ConvertCBORToJSON;
+using v8_crdtp::json::ConvertJSONToCBOR;
+
namespace v8_inspector {
int V8StackTraceImpl::maxCallStackSizeToCapture = 200;
@@ -124,10 +128,19 @@ V8StackTraceId::V8StackTraceId(uintptr_t id,
bool should_pause)
: id(id), debugger_id(debugger_id), should_pause(should_pause) {}
-V8StackTraceId::V8StackTraceId(const StringView& json)
+V8StackTraceId::V8StackTraceId(StringView json)
: id(0), debugger_id(V8DebuggerId().pair()) {
- auto dict =
- protocol::DictionaryValue::cast(protocol::StringUtil::parseJSON(json));
+ if (json.length() == 0) return;
+ std::vector<uint8_t> cbor;
+ if (json.is8Bit()) {
+ ConvertJSONToCBOR(
+ v8_crdtp::span<uint8_t>(json.characters8(), json.length()), &cbor);
+ } else {
+ ConvertJSONToCBOR(
+ v8_crdtp::span<uint16_t>(json.characters16(), json.length()), &cbor);
+ }
+ auto dict = protocol::DictionaryValue::cast(
+ protocol::Value::parseBinary(cbor.data(), cbor.size()));
if (!dict) return;
String16 s;
if (!dict->getString(kId, &s)) return;
@@ -151,8 +164,8 @@ std::unique_ptr<StringBuffer> V8StackTraceId::ToString() {
dict->setString(kDebuggerId, V8DebuggerId(debugger_id).toString());
dict->setBoolean(kShouldPause, should_pause);
std::vector<uint8_t> json;
- std::vector<uint8_t> cbor = std::move(*dict).TakeSerialized();
- v8_crdtp::json::ConvertCBORToJSON(v8_crdtp::SpanFrom(cbor), &json);
+ v8_crdtp::json::ConvertCBORToJSON(v8_crdtp::SpanFrom(dict->Serialize()),
+ &json);
return StringBufferFrom(std::move(json));
}