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

Side by Side Diff: Source/bindings/core/v8/custom/V8InjectedScriptHostCustom.cpp

Issue 464793002: DevTools: Simplify isArrayLike() in injected script and extend InjectedScriptHost.type() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: test fix Created 6 years, 4 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
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 19 matching lines...) Expand all
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "bindings/core/v8/V8InjectedScriptHost.h" 32 #include "bindings/core/v8/V8InjectedScriptHost.h"
33 33
34 #include "bindings/core/v8/BindingSecurity.h" 34 #include "bindings/core/v8/BindingSecurity.h"
35 #include "bindings/core/v8/ExceptionState.h" 35 #include "bindings/core/v8/ExceptionState.h"
36 #include "bindings/core/v8/ScriptDebugServer.h" 36 #include "bindings/core/v8/ScriptDebugServer.h"
37 #include "bindings/core/v8/ScriptValue.h" 37 #include "bindings/core/v8/ScriptValue.h"
38 #include "bindings/core/v8/V8AbstractEventListener.h" 38 #include "bindings/core/v8/V8AbstractEventListener.h"
39 #include "bindings/core/v8/V8Binding.h" 39 #include "bindings/core/v8/V8Binding.h"
40 #include "bindings/core/v8/V8DOMTokenList.h"
40 #include "bindings/core/v8/V8EventTarget.h" 41 #include "bindings/core/v8/V8EventTarget.h"
41 #include "bindings/core/v8/V8HTMLAllCollection.h" 42 #include "bindings/core/v8/V8HTMLAllCollection.h"
42 #include "bindings/core/v8/V8HTMLCollection.h" 43 #include "bindings/core/v8/V8HTMLCollection.h"
43 #include "bindings/core/v8/V8Node.h" 44 #include "bindings/core/v8/V8Node.h"
44 #include "bindings/core/v8/V8NodeList.h" 45 #include "bindings/core/v8/V8NodeList.h"
45 #include "bindings/core/v8/V8ScriptRunner.h" 46 #include "bindings/core/v8/V8ScriptRunner.h"
46 #include "bindings/core/v8/V8Storage.h" 47 #include "bindings/core/v8/V8Storage.h"
47 #include "bindings/core/v8/custom/V8Float32ArrayCustom.h" 48 #include "bindings/core/v8/custom/V8Float32ArrayCustom.h"
48 #include "bindings/core/v8/custom/V8Float64ArrayCustom.h" 49 #include "bindings/core/v8/custom/V8Float64ArrayCustom.h"
49 #include "bindings/core/v8/custom/V8Int16ArrayCustom.h" 50 #include "bindings/core/v8/custom/V8Int16ArrayCustom.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 { 158 {
158 if (info.Length() < 1) 159 if (info.Length() < 1)
159 return; 160 return;
160 v8::Isolate* isolate = info.GetIsolate(); 161 v8::Isolate* isolate = info.GetIsolate();
161 162
162 v8::Handle<v8::Value> value = info[0]; 163 v8::Handle<v8::Value> value = info[0];
163 if (value->IsString()) { 164 if (value->IsString()) {
164 v8SetReturnValue(info, v8AtomicString(isolate, "string")); 165 v8SetReturnValue(info, v8AtomicString(isolate, "string"));
165 return; 166 return;
166 } 167 }
167 if (value->IsArray()) { 168 if (value->IsArray() || value->IsTypedArray()) {
168 v8SetReturnValue(info, v8AtomicString(isolate, "array")); 169 v8SetReturnValue(info, v8AtomicString(isolate, "array"));
169 return; 170 return;
170 } 171 }
171 if (value->IsBoolean()) { 172 if (value->IsBoolean()) {
172 v8SetReturnValue(info, v8AtomicString(isolate, "boolean")); 173 v8SetReturnValue(info, v8AtomicString(isolate, "boolean"));
173 return; 174 return;
174 } 175 }
175 if (value->IsNumber()) { 176 if (value->IsNumber()) {
176 v8SetReturnValue(info, v8AtomicString(isolate, "number")); 177 v8SetReturnValue(info, v8AtomicString(isolate, "number"));
177 return; 178 return;
178 } 179 }
180 if (value->IsSymbol()) {
181 v8SetReturnValue(info, v8AtomicString(isolate, "symbol"));
182 return;
183 }
179 if (value->IsDate()) { 184 if (value->IsDate()) {
180 v8SetReturnValue(info, v8AtomicString(isolate, "date")); 185 v8SetReturnValue(info, v8AtomicString(isolate, "date"));
181 return; 186 return;
182 } 187 }
183 if (value->IsRegExp()) { 188 if (value->IsRegExp()) {
184 v8SetReturnValue(info, v8AtomicString(isolate, "regexp")); 189 v8SetReturnValue(info, v8AtomicString(isolate, "regexp"));
185 return; 190 return;
186 } 191 }
187 if (V8Node::hasInstance(value, isolate)) { 192 if (V8Node::hasInstance(value, isolate)) {
188 v8SetReturnValue(info, v8AtomicString(isolate, "node")); 193 v8SetReturnValue(info, v8AtomicString(isolate, "node"));
189 return; 194 return;
190 } 195 }
191 if (V8NodeList::hasInstance(value, isolate)) { 196 if (V8NodeList::hasInstance(value, isolate)
197 || V8DOMTokenList::hasInstance(value, isolate)
198 || V8HTMLCollection::hasInstance(value, isolate)
199 || V8HTMLAllCollection::hasInstance(value, isolate)) {
192 v8SetReturnValue(info, v8AtomicString(isolate, "array")); 200 v8SetReturnValue(info, v8AtomicString(isolate, "array"));
193 return; 201 return;
194 } 202 }
195 if (V8HTMLCollection::hasInstance(value, isolate)) { 203 if (V8Int8Array::hasInstance(value, isolate)
204 || V8Int16Array::hasInstance(value, isolate)
205 || V8Int32Array::hasInstance(value, isolate)
206 || V8Uint8Array::hasInstance(value, isolate)
207 || V8Uint8ClampedArray::hasInstance(value, isolate)
yurys 2014/08/12 08:52:48 Why value->IsTypedArray check above is not enough?
aandrey 2014/08/12 09:49:48 You're right. Removed.
208 || V8Uint16Array::hasInstance(value, isolate)
209 || V8Uint32Array::hasInstance(value, isolate)
210 || V8Float32Array::hasInstance(value, isolate)
211 || V8Float64Array::hasInstance(value, isolate)) {
196 v8SetReturnValue(info, v8AtomicString(isolate, "array")); 212 v8SetReturnValue(info, v8AtomicString(isolate, "array"));
197 return; 213 return;
198 } 214 }
199 if (V8Int8Array::hasInstance(value, isolate) || V8Int16Array::hasInstance(va lue, isolate) || V8Int32Array::hasInstance(value, isolate)) {
200 v8SetReturnValue(info, v8AtomicString(isolate, "array"));
201 return;
202 }
203 if (V8Uint8Array::hasInstance(value, isolate) || V8Uint16Array::hasInstance( value, isolate) || V8Uint32Array::hasInstance(value, isolate)) {
204 v8SetReturnValue(info, v8AtomicString(isolate, "array"));
205 return;
206 }
207 if (V8Float32Array::hasInstance(value, isolate) || V8Float64Array::hasInstan ce(value, isolate)) {
208 v8SetReturnValue(info, v8AtomicString(isolate, "array"));
209 return;
210 }
211 if (V8Uint8ClampedArray::hasInstance(value, isolate)) {
212 v8SetReturnValue(info, v8AtomicString(isolate, "array"));
213 return;
214 }
215 } 215 }
216 216
217 void V8InjectedScriptHost::functionDetailsMethodCustom(const v8::FunctionCallbac kInfo<v8::Value>& info) 217 void V8InjectedScriptHost::functionDetailsMethodCustom(const v8::FunctionCallbac kInfo<v8::Value>& info)
218 { 218 {
219 if (info.Length() < 1) 219 if (info.Length() < 1)
220 return; 220 return;
221 221
222 v8::Isolate* isolate = info.GetIsolate(); 222 v8::Isolate* isolate = info.GetIsolate();
223 223
224 v8::Handle<v8::Value> value = info[0]; 224 v8::Handle<v8::Value> value = info[0];
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 InjectedScriptHost* host = V8InjectedScriptHost::toNative(info.Holder()); 509 InjectedScriptHost* host = V8InjectedScriptHost::toNative(info.Holder());
510 ScriptDebugServer& debugServer = host->scriptDebugServer(); 510 ScriptDebugServer& debugServer = host->scriptDebugServer();
511 debugServer.muteWarningsAndDeprecations(); 511 debugServer.muteWarningsAndDeprecations();
512 512
513 callFunctionMethodCustom(info); 513 callFunctionMethodCustom(info);
514 514
515 debugServer.unmuteWarningsAndDeprecations(); 515 debugServer.unmuteWarningsAndDeprecations();
516 } 516 }
517 517
518 } // namespace blink 518 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/inspector/console/console-format-expected.txt ('k') | Source/core/inspector/InjectedScriptSource.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698