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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/bindings/core/v8/V8DOMWrapper.cpp ('k') | Source/core/inspector/InjectedScriptHost.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007-2011 Google Inc. All rights reserved. 2 * Copyright (C) 2007-2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 result = constructorName; 132 result = constructorName;
133 } 133 }
134 } 134 }
135 if (toCoreStringWithUndefinedOrNullCheck(result) == "Object" && object-> IsFunction()) 135 if (toCoreStringWithUndefinedOrNullCheck(result) == "Object" && object-> IsFunction())
136 result = v8AtomicString(info.GetIsolate(), "Function"); 136 result = v8AtomicString(info.GetIsolate(), "Function");
137 } 137 }
138 138
139 v8SetReturnValue(info, result); 139 v8SetReturnValue(info, result);
140 } 140 }
141 141
142 void V8InjectedScriptHost::isDOMWrapperMethodCustom(const v8::FunctionCallbackIn fo<v8::Value>& info)
143 {
144 if (info.Length() < 1)
145 return;
146
147 v8SetReturnValue(info, V8DOMWrapper::isWrapper(info.GetIsolate(), info[0]));
148 }
149
142 void V8InjectedScriptHost::isHTMLAllCollectionMethodCustom(const v8::FunctionCal lbackInfo<v8::Value>& info) 150 void V8InjectedScriptHost::isHTMLAllCollectionMethodCustom(const v8::FunctionCal lbackInfo<v8::Value>& info)
143 { 151 {
144 if (info.Length() < 1) 152 if (info.Length() < 1)
145 return; 153 return;
146 154
147 if (!info[0]->IsObject()) {
148 v8SetReturnValue(info, false);
149 return;
150 }
151
152 v8SetReturnValue(info, V8HTMLAllCollection::hasInstance(info[0], info.GetIso late()));
153 }
154
155 void V8InjectedScriptHost::isPopularDOMObjectMethodCustom(const v8::FunctionCall backInfo<v8::Value>& info)
156 {
157 // FIXME: Stop using this function (whilelisting) once we come up with a way
158 // to distinguish DOM wrappers from other obejcts.
159
160 if (info.Length() < 1)
161 return;
162
163 if (!info[0]->IsObject()) { 155 if (!info[0]->IsObject()) {
164 v8SetReturnValue(info, false); 156 v8SetReturnValue(info, false);
165 return; 157 return;
166 } 158 }
167 159
168 v8::Local<v8::Value> object = info[0]; 160 v8SetReturnValue(info, V8HTMLAllCollection::hasInstance(info[0], info.GetIso late()));
169 v8::Isolate* isolate = info.GetIsolate();
170 bool isPopularDOMObject = false;
171 static bool (*hasInstances[])(v8::Local<v8::Value>, v8::Isolate*) = {
172 V8Blob::hasInstance,
173 V8DOMError::hasInstance,
174 V8DOMException::hasInstance,
175 V8Element::hasInstance,
176 V8Event::hasInstance,
177 V8EventTarget::hasInstance,
178 V8Location::hasInstance,
179 V8Navigator::hasInstance,
180 };
181 for (size_t i = 0; i < sizeof hasInstances / sizeof *hasInstances; ++i) {
182 if (hasInstances[i](object, isolate)) {
183 isPopularDOMObject = true;
184 break;
185 }
186 }
187
188 v8SetReturnValue(info, isPopularDOMObject);
189 } 161 }
190 162
191 void V8InjectedScriptHost::isTypedArrayMethodCustom(const v8::FunctionCallbackIn fo<v8::Value>& info) 163 void V8InjectedScriptHost::isTypedArrayMethodCustom(const v8::FunctionCallbackIn fo<v8::Value>& info)
192 { 164 {
193 if (info.Length() < 1) 165 if (info.Length() < 1)
194 return; 166 return;
195 v8SetReturnValue(info, info[0]->IsTypedArray()); 167 v8SetReturnValue(info, info[0]->IsTypedArray());
196 } 168 }
197 169
198 void V8InjectedScriptHost::subtypeMethodCustom(const v8::FunctionCallbackInfo<v8 ::Value>& info) 170 void V8InjectedScriptHost::subtypeMethodCustom(const v8::FunctionCallbackInfo<v8 ::Value>& info)
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 InjectedScriptNative* injectedScriptNative = InjectedScriptNative::fromInjec tedScriptHost(info.Holder()); 586 InjectedScriptNative* injectedScriptNative = InjectedScriptNative::fromInjec tedScriptHost(info.Holder());
615 if (!injectedScriptNative) 587 if (!injectedScriptNative)
616 return; 588 return;
617 int id = info[0]->ToInt32(info.GetIsolate())->Value(); 589 int id = info[0]->ToInt32(info.GetIsolate())->Value();
618 String groupName = injectedScriptNative->groupName(id); 590 String groupName = injectedScriptNative->groupName(id);
619 if (!groupName.isEmpty()) 591 if (!groupName.isEmpty())
620 info.GetReturnValue().Set(v8String(info.GetIsolate(), groupName)); 592 info.GetReturnValue().Set(v8String(info.GetIsolate(), groupName));
621 } 593 }
622 594
623 } // namespace blink 595 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/V8DOMWrapper.cpp ('k') | Source/core/inspector/InjectedScriptHost.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698