Skip to content

Commit 00d0464

Browse files
committed
test: cover invalid inspector network initiator stack
1 parent b6da56b commit 00d0464

2 files changed

Lines changed: 13 additions & 22 deletions

File tree

test/cctest/inspector/test_node_protocol.cc

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,12 @@
22
#include "gtest/gtest.h"
33
#include "inspector/node_json.h"
44
#include "node/inspector/protocol/Protocol.h"
5-
#include "node/inspector/protocol/Runtime.h"
65

76
namespace node {
87
namespace inspector {
98
namespace protocol {
109
namespace {
1110

12-
class MalformedSerializedValue : public Value {
13-
public:
14-
MalformedSerializedValue() : Value(TypeObject) {}
15-
16-
void AppendSerialized(std::vector<uint8_t>* out) const override {
17-
out->push_back(0xff);
18-
}
19-
};
20-
2111
TEST(InspectorProtocol, Utf8StringSerDes) {
2212
constexpr const char* kKey = "unicode_key";
2313
constexpr const char* kValue = "CJK 汉字 🍱 🧑‍🧑‍🧒‍🧒";
@@ -37,18 +27,6 @@ TEST(InspectorProtocol, Utf8StringSerDes) {
3727
CHECK_EQ(parsed_value, std::string(kValue));
3828
}
3929

40-
TEST(InspectorProtocol, StackTraceImportRejectsMalformedBinary) {
41-
MalformedSerializedValue value;
42-
ErrorSupport errors;
43-
44-
auto stack = ValueConversions<
45-
v8_inspector::protocol::Runtime::API::StackTrace>::fromValue(&value,
46-
&errors);
47-
48-
EXPECT_EQ(stack, nullptr);
49-
EXPECT_FALSE(errors.Errors().empty());
50-
}
51-
5230
} // namespace
5331
} // namespace protocol
5432
} // namespace inspector

test/parallel/test-inspector-emit-protocol-event-errors.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,19 @@ const NETWORK_ERROR_CASES = [
171171
networkRequest({ request: omit(networkRequest().request, 'headers') }),
172172
'Missing request.headers in event',
173173
],
174+
[
175+
'requestWillBeSent',
176+
networkRequest({
177+
initiator: {
178+
type: 'script',
179+
stack: {
180+
callFrames: [],
181+
unsupportedValue: 1n,
182+
},
183+
},
184+
}),
185+
'Invalid initiator.stack in event',
186+
],
174187

175188
[
176189
'responseReceived',

0 commit comments

Comments
 (0)