Skip to content

Commit e6b8355

Browse files
author
Eugene Ostroukhov
committed
Inspector snapshot
Blink Commit: 62cd277117e6f8ec53e31b1be58290a6f7ab42ef
1 parent fa977c8 commit e6b8355

7 files changed

Lines changed: 31 additions & 24 deletions

File tree

third_party/v8_inspector/platform/v8_inspector/InjectedScriptSource.js

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function push(array, var_args)
6060
*/
6161
function toString(obj)
6262
{
63-
// We don't use String(obj) because String16 could be overridden.
63+
// We don't use String(obj) because String could be overridden.
6464
// Also the ("" + obj) expression may throw.
6565
try {
6666
return "" + obj;
@@ -171,7 +171,8 @@ function doesAttributeHaveObservableSideEffectOnGet(object, attribute)
171171
{
172172
for (var interfaceName in domAttributesWithObservableSideEffectOnGet) {
173173
var interfaceFunction = inspectedGlobalObject[interfaceName];
174-
var isInstance = typeof interfaceFunction === "function" && object instanceof interfaceFunction;
174+
// instanceof call looks safe after typeof check.
175+
var isInstance = typeof interfaceFunction === "function" && /* suppressBlacklist */ object instanceof interfaceFunction;
175176
if (isInstance)
176177
return attribute in domAttributesWithObservableSideEffectOnGet[interfaceName];
177178
}
@@ -198,18 +199,17 @@ InjectedScript.primitiveTypes = {
198199
}
199200

200201
/**
201-
* @type {!Map<string, string>}
202+
* @type {!Object<string, string>}
202203
* @const
203204
*/
204-
InjectedScript.closureTypes = new Map([
205-
["local", "Local"],
206-
["closure", "Closure"],
207-
["catch", "Catch"],
208-
["block", "Block"],
209-
["script", "Script"],
210-
["with", "With Block"],
211-
["global", "Global"]
212-
]);
205+
InjectedScript.closureTypes = { __proto__: null };
206+
InjectedScript.closureTypes["local"] = "Local";
207+
InjectedScript.closureTypes["closure"] = "Closure";
208+
InjectedScript.closureTypes["catch"] = "Catch";
209+
InjectedScript.closureTypes["block"] = "Block";
210+
InjectedScript.closureTypes["script"] = "Script";
211+
InjectedScript.closureTypes["with"] = "With Block";
212+
InjectedScript.closureTypes["global"] = "Global";
213213

214214
InjectedScript.prototype = {
215215
/**
@@ -637,7 +637,8 @@ InjectedScript.prototype = {
637637

638638
if (isSymbol(obj)) {
639639
try {
640-
return obj.toString() || "Symbol";
640+
// It isn't safe, because Symbol.prototype.toString can be overriden.
641+
return /* suppressBlacklist */ obj.toString() || "Symbol";
641642
} catch (e) {
642643
return "Symbol";
643644
}
@@ -668,7 +669,7 @@ InjectedScript.prototype = {
668669
return "Scopes[" + obj.length + "]";
669670

670671
if (subtype === "internal#scope")
671-
return (InjectedScript.closureTypes.get(obj.type) || "Unknown") + (obj.name ? " (" + obj.name + ")" : "");
672+
return (InjectedScript.closureTypes[obj.type] || "Unknown") + (obj.name ? " (" + obj.name + ")" : "");
672673

673674
return className;
674675
},
@@ -793,7 +794,8 @@ InjectedScript.RemoteObject.prototype = {
793794
*/
794795
function logError(error)
795796
{
796-
Promise.resolve().then(inspectedGlobalObject.console.error.bind(inspectedGlobalObject.console, "Custom Formatter Failed: " + error.message));
797+
// We use user code to generate custom output for object, we can use user code for reporting error too.
798+
Promise.resolve().then(/* suppressBlacklist */ inspectedGlobalObject.console.error.bind(inspectedGlobalObject.console, "Custom Formatter Failed: " + error.message));
797799
}
798800

799801
/**

third_party/v8_inspector/platform/v8_inspector/V8Compat.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ class V8_EXPORT MicrotasksScope {
2222
};
2323

2424
} // namespace v8
25-
25+
#define V8_FUNCTION_NEW_REMOVE_PROTOTYPE(context, callback, data, length) \
26+
v8::Function::New((context), (callback), (data), (length))
27+
#else
28+
#define V8_FUNCTION_NEW_REMOVE_PROTOTYPE(context, callback, data, length) \
29+
v8::Function::New((context), (callback), (data), (length), v8::ConstructorBehavior::kThrow)
2630
#endif // V8_MAJOR_VERSION < 5 || (V8_MAJOR_VERSION == 5 && V8_MINOR_VERSION < 1)
2731

2832
#endif // V8Compat_h

third_party/v8_inspector/platform/v8_inspector/V8Console.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,13 +271,13 @@ void createBoundFunctionProperty(v8::Local<v8::Context> context, v8::Local<v8::O
271271
{
272272
v8::Local<v8::String> funcName = toV8StringInternalized(context->GetIsolate(), name);
273273
v8::Local<v8::Function> func;
274-
if (!v8::Function::New(context, callback, console, 0, v8::ConstructorBehavior::kThrow).ToLocal(&func))
274+
if (!V8_FUNCTION_NEW_REMOVE_PROTOTYPE(context, callback, console, 0).ToLocal(&func))
275275
return;
276276
func->SetName(funcName);
277277
if (description) {
278278
v8::Local<v8::String> returnValue = toV8String(context->GetIsolate(), description);
279279
v8::Local<v8::Function> toStringFunction;
280-
if (v8::Function::New(context, returnDataCallback, returnValue, 0, v8::ConstructorBehavior::kThrow).ToLocal(&toStringFunction))
280+
if (V8_FUNCTION_NEW_REMOVE_PROTOTYPE(context, returnDataCallback, returnValue, 0).ToLocal(&toStringFunction))
281281
func->Set(toV8StringInternalized(context->GetIsolate(), "toString"), toStringFunction);
282282
}
283283
if (!console->Set(context, funcName, func).FromMaybe(false))
@@ -690,7 +690,7 @@ v8::Local<v8::Object> V8Console::createConsole(InspectedContext* inspectedContex
690690
DCHECK(success);
691691

692692
if (hasMemoryAttribute)
693-
console->SetAccessorProperty(toV8StringInternalized(isolate, "memory"), v8::Function::New(context, V8Console::memoryGetterCallback, console, 0, v8::ConstructorBehavior::kThrow).ToLocalChecked(), v8::Function::New(context, V8Console::memorySetterCallback, v8::Local<v8::Value>(), 0, v8::ConstructorBehavior::kThrow).ToLocalChecked(), static_cast<v8::PropertyAttribute>(v8::None), v8::DEFAULT);
693+
console->SetAccessorProperty(toV8StringInternalized(isolate, "memory"), V8_FUNCTION_NEW_REMOVE_PROTOTYPE(context, V8Console::memoryGetterCallback, console, 0).ToLocalChecked(), V8_FUNCTION_NEW_REMOVE_PROTOTYPE(context, V8Console::memorySetterCallback, v8::Local<v8::Value>(), 0).ToLocalChecked(), static_cast<v8::PropertyAttribute>(v8::None), v8::DEFAULT);
694694

695695
console->SetPrivate(context, inspectedContextPrivateKey(isolate), v8::External::New(isolate, inspectedContext));
696696
return console;

third_party/v8_inspector/platform/v8_inspector/V8Debugger.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ void V8Debugger::breakProgram()
250250

251251
v8::HandleScope scope(m_isolate);
252252
v8::Local<v8::Function> breakFunction;
253-
if (!v8::Function::New(m_isolate->GetCurrentContext(), &V8Debugger::breakProgramCallback, v8::External::New(m_isolate, this), 0, v8::ConstructorBehavior::kThrow).ToLocal(&breakFunction))
253+
if (!V8_FUNCTION_NEW_REMOVE_PROTOTYPE(m_isolate->GetCurrentContext(), &V8Debugger::breakProgramCallback, v8::External::New(m_isolate, this), 0).ToLocal(&breakFunction))
254254
return;
255255
v8::Debug::Call(debuggerContext(), breakFunction).ToLocalChecked();
256256
}

third_party/v8_inspector/platform/v8_inspector/V8InjectedScriptHost.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ void setFunctionProperty(v8::Local<v8::Context> context, v8::Local<v8::Object> o
2121
{
2222
v8::Local<v8::String> funcName = toV8StringInternalized(context->GetIsolate(), name);
2323
v8::Local<v8::Function> func;
24-
if (!v8::Function::New(context, callback, external, 0, v8::ConstructorBehavior::kThrow).ToLocal(&func))
24+
if (!V8_FUNCTION_NEW_REMOVE_PROTOTYPE(context, callback, external, 0).ToLocal(&func))
2525
return;
2626
func->SetName(funcName);
2727
if (!obj->Set(context, funcName, func).FromMaybe(false))

third_party/v8_inspector/platform/v8_inspector/V8RuntimeAgentImpl.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "platform/v8_inspector/InjectedScript.h"
3636
#include "platform/v8_inspector/InspectedContext.h"
3737
#include "platform/v8_inspector/RemoteObjectId.h"
38+
#include "platform/v8_inspector/V8Compat.h"
3839
#include "platform/v8_inspector/V8ConsoleMessage.h"
3940
#include "platform/v8_inspector/V8Debugger.h"
4041
#include "platform/v8_inspector/V8DebuggerAgentImpl.h"
@@ -81,12 +82,12 @@ class ProtocolPromiseHandler {
8182
ProtocolPromiseHandler<Callback>* handler = new ProtocolPromiseHandler(inspector, contextGroupId, executionContextId, objectGroup, returnByValue, generatePreview, std::move(callback));
8283
v8::Local<v8::Value> wrapper = handler->m_wrapper.Get(inspector->isolate());
8384

84-
v8::Local<v8::Function> thenCallbackFunction = v8::Function::New(context, thenCallback, wrapper, 0, v8::ConstructorBehavior::kThrow).ToLocalChecked();
85+
v8::Local<v8::Function> thenCallbackFunction = V8_FUNCTION_NEW_REMOVE_PROTOTYPE(context, thenCallback, wrapper, 0).ToLocalChecked();
8586
if (promise->Then(context, thenCallbackFunction).IsEmpty()) {
8687
rawCallback->sendFailure("Internal error");
8788
return;
8889
}
89-
v8::Local<v8::Function> catchCallbackFunction = v8::Function::New(context, catchCallback, wrapper, 0, v8::ConstructorBehavior::kThrow).ToLocalChecked();
90+
v8::Local<v8::Function> catchCallbackFunction = V8_FUNCTION_NEW_REMOVE_PROTOTYPE(context, catchCallback, wrapper, 0).ToLocalChecked();
9091
if (promise->Catch(context, catchCallbackFunction).IsEmpty()) {
9192
rawCallback->sendFailure("Internal error");
9293
return;

third_party/v8_inspector/platform/v8_inspector/public/InspectorVersion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
// found in the LICENSE file.
44

55
// This file is automatically generated. Do not modify.
6-
#define V8_INSPECTOR_REVISION "62f9bf90d67be3a8b3c89e15a21504b767c3357d"
6+
#define V8_INSPECTOR_REVISION "62cd277117e6f8ec53e31b1be58290a6f7ab42ef"

0 commit comments

Comments
 (0)