| Index: third_party/WebKit/Source/platform/v8_inspector/V8InjectedScriptHost.cpp
|
| diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8InjectedScriptHost.cpp b/third_party/WebKit/Source/platform/v8_inspector/V8InjectedScriptHost.cpp
|
| index c3085751f74df174c46e15009c96675d950d037b..8fbc917af47c7967c7db8d115b2d71e06496322b 100644
|
| --- a/third_party/WebKit/Source/platform/v8_inspector/V8InjectedScriptHost.cpp
|
| +++ b/third_party/WebKit/Source/platform/v8_inspector/V8InjectedScriptHost.cpp
|
| @@ -145,9 +145,60 @@ void V8InjectedScriptHost::getInternalPropertiesCallback(const v8::FunctionCallb
|
| {
|
| if (info.Length() < 1)
|
| return;
|
| - v8::Local<v8::Array> properties;
|
| - if (unwrapInspector(info)->debugger()->internalProperties(info.GetIsolate()->GetCurrentContext(), info[0]).ToLocal(&properties))
|
| + HashSet<String16> allowedProperties;
|
| + if (info[0]->IsBooleanObject() || info[0]->IsNumberObject() ||
|
| + info[0]->IsStringObject() || info[0]->IsSymbolObject()) {
|
| + allowedProperties.add(String16("[[PrimitiveValue]]"));
|
| + } else if (info[0]->IsPromise()) {
|
| + allowedProperties.add(String16("[[PromiseStatus]]"));
|
| + allowedProperties.add(String16("[[PromiseValue]]"));
|
| + } else if (info[0]->IsGeneratorObject()) {
|
| + allowedProperties.add(String16("[[GeneratorStatus]]"));
|
| + } else if (info[0]->IsMapIterator() || info[0]->IsSetIterator()) {
|
| + allowedProperties.add(String16("[[IteratorHasMore]]"));
|
| + allowedProperties.add(String16("[[IteratorIndex]]"));
|
| + allowedProperties.add(String16("[[IteratorKind]]"));
|
| + allowedProperties.add(String16("[[Entries]]"));
|
| + } else if (info[0]->IsMap() || info[0]->IsWeakMap() || info[0]->IsSet() || info[0]->IsWeakSet()) {
|
| + allowedProperties.add(String16("[[Entries]]"));
|
| + }
|
| + if (!allowedProperties.size()) return;
|
| +
|
| + v8::Isolate* isolate = info.GetIsolate();
|
| + v8::Local<v8::Array> allProperties;
|
| + if (!unwrapInspector(info)->debugger()->internalProperties(isolate->GetCurrentContext(), info[0]).ToLocal(&allProperties) || !allProperties->IsArray() || allProperties->Length() % 2 != 0)
|
| + return;
|
| +
|
| + {
|
| + v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
| + v8::TryCatch tryCatch(isolate);
|
| + v8::Isolate::DisallowJavascriptExecutionScope throwJs(isolate, v8::Isolate::DisallowJavascriptExecutionScope::THROW_ON_FAILURE);
|
| +
|
| + v8::Local<v8::Array> properties = v8::Array::New(isolate);
|
| + if (tryCatch.HasCaught()) return;
|
| +
|
| + uint32_t outputIndex = 0;
|
| + for (uint32_t i = 0; i < allProperties->Length(); i += 2) {
|
| + v8::Local<v8::Value> key;
|
| + if (!allProperties->Get(context, i).ToLocal(&key)) continue;
|
| + if (tryCatch.HasCaught()) {
|
| + tryCatch.Reset();
|
| + continue;
|
| + }
|
| + String16 keyString = toProtocolStringWithTypeCheck(key);
|
| + if (keyString.isEmpty() || allowedProperties.find(keyString) == allowedProperties.end())
|
| + continue;
|
| + v8::Local<v8::Value> value;
|
| + if (!allProperties->Get(context, i + 1).ToLocal(&value)) continue;
|
| + if (tryCatch.HasCaught()) {
|
| + tryCatch.Reset();
|
| + continue;
|
| + }
|
| + createDataProperty(context, properties, outputIndex++, key);
|
| + createDataProperty(context, properties, outputIndex++, value);
|
| + }
|
| info.GetReturnValue().Set(properties);
|
| + }
|
| }
|
|
|
| void V8InjectedScriptHost::objectHasOwnPropertyCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
|
|
|