Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(258)

Unified Diff: Source/bindings/core/v8/custom/V8InjectedScriptHostCustom.cpp

Issue 978233002: bindings,devtools: Shows DOM attributes' values in DevTools. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Addressed review comments. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/bindings/core/v8/custom/V8InjectedScriptHostCustom.cpp
diff --git a/Source/bindings/core/v8/custom/V8InjectedScriptHostCustom.cpp b/Source/bindings/core/v8/custom/V8InjectedScriptHostCustom.cpp
index 17e238d1d7cc8cdee7ef7b121163b136ca644f3c..471b44867b5847a0a9b709f8767a7447fdcbc93f 100644
--- a/Source/bindings/core/v8/custom/V8InjectedScriptHostCustom.cpp
+++ b/Source/bindings/core/v8/custom/V8InjectedScriptHostCustom.cpp
@@ -139,24 +139,16 @@ void V8InjectedScriptHost::internalConstructorNameMethodCustom(const v8::Functio
v8SetReturnValue(info, result);
}
-void V8InjectedScriptHost::isHTMLAllCollectionMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
+void V8InjectedScriptHost::isDOMWrapperMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
{
if (info.Length() < 1)
return;
- if (!info[0]->IsObject()) {
- v8SetReturnValue(info, false);
- return;
- }
-
- v8SetReturnValue(info, V8HTMLAllCollection::hasInstance(info[0], info.GetIsolate()));
+ v8SetReturnValue(info, V8DOMWrapper::isWrapper(info.GetIsolate(), info[0]));
}
-void V8InjectedScriptHost::isPopularDOMObjectMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
+void V8InjectedScriptHost::isHTMLAllCollectionMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
{
- // FIXME: Stop using this function (whilelisting) once we come up with a way
- // to distinguish DOM wrappers from other obejcts.
-
if (info.Length() < 1)
return;
@@ -165,27 +157,7 @@ void V8InjectedScriptHost::isPopularDOMObjectMethodCustom(const v8::FunctionCall
return;
}
- v8::Local<v8::Value> object = info[0];
- v8::Isolate* isolate = info.GetIsolate();
- bool isPopularDOMObject = false;
- static bool (*hasInstances[])(v8::Local<v8::Value>, v8::Isolate*) = {
- V8Blob::hasInstance,
- V8DOMError::hasInstance,
- V8DOMException::hasInstance,
- V8Element::hasInstance,
- V8Event::hasInstance,
- V8EventTarget::hasInstance,
- V8Location::hasInstance,
- V8Navigator::hasInstance,
- };
- for (size_t i = 0; i < sizeof hasInstances / sizeof *hasInstances; ++i) {
- if (hasInstances[i](object, isolate)) {
- isPopularDOMObject = true;
- break;
- }
- }
-
- v8SetReturnValue(info, isPopularDOMObject);
+ v8SetReturnValue(info, V8HTMLAllCollection::hasInstance(info[0], info.GetIsolate()));
}
void V8InjectedScriptHost::isTypedArrayMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
@@ -580,6 +552,30 @@ void V8InjectedScriptHost::setNonEnumPropertyMethodCustom(const v8::FunctionCall
object->ForceSet(info[1], info[2], v8::DontEnum);
}
+void V8InjectedScriptHost::getDOMAttributesWithObservableSideEffectOnGetMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ // Returns DOM attributes which have observable side effect on getter,
+ // in the form of
+ // {interfaceName1: {attributeName1: true,
+ // attributeName2: true,
+ // ...},
+ // interfaceName2: {...},
+ // ...}
+ // These attributes should not be evaluated in the Inspector.
+
+ typedef Vector<std::pair<String, bool>> AttributeSet;
pfeldman 2015/03/09 11:41:41 I don't see why this is being created here, it is
Yuki 2015/03/09 12:48:13 I misunderstood that you disliked to have this cod
+ AttributeSet requestAttributes;
+ requestAttributes.append(std::make_pair("body", true));
+ AttributeSet responseAttributes;
+ responseAttributes.append(std::make_pair("body", true));
+
+ Vector<std::pair<String, AttributeSet>> attributesWithSideEffect;
+ attributesWithSideEffect.append(std::make_pair("Request", requestAttributes));
+ attributesWithSideEffect.append(std::make_pair("Response", responseAttributes));
+
+ v8SetReturnValue(info, toV8(attributesWithSideEffect, info.Holder(), info.GetIsolate()));
+}
+
void V8InjectedScriptHost::bindMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
{
if (info.Length() < 2 || !info[1]->IsString())

Powered by Google App Engine
This is Rietveld 408576698