| OLD | NEW |
| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 void V8InjectedScriptHost::isHTMLAllCollectionMethodCustom(const v8::FunctionCal
lbackInfo<v8::Value>& info) | 112 void V8InjectedScriptHost::isHTMLAllCollectionMethodCustom(const v8::FunctionCal
lbackInfo<v8::Value>& info) |
| 113 { | 113 { |
| 114 if (info.Length() < 1) | 114 if (info.Length() < 1) |
| 115 return; | 115 return; |
| 116 | 116 |
| 117 if (!info[0]->IsObject()) { | 117 if (!info[0]->IsObject()) { |
| 118 v8SetReturnValue(info, false); | 118 v8SetReturnValue(info, false); |
| 119 return; | 119 return; |
| 120 } | 120 } |
| 121 | 121 |
| 122 v8SetReturnValue(info, V8HTMLAllCollection::hasInstance(info[0], info.GetIso
late(), worldType(info.GetIsolate()))); | 122 v8SetReturnValue(info, V8HTMLAllCollection::hasInstance(info[0], info.GetIso
late())); |
| 123 } | 123 } |
| 124 | 124 |
| 125 void V8InjectedScriptHost::typeMethodCustom(const v8::FunctionCallbackInfo<v8::V
alue>& info) | 125 void V8InjectedScriptHost::typeMethodCustom(const v8::FunctionCallbackInfo<v8::V
alue>& info) |
| 126 { | 126 { |
| 127 if (info.Length() < 1) | 127 if (info.Length() < 1) |
| 128 return; | 128 return; |
| 129 v8::Isolate* isolate = info.GetIsolate(); | 129 v8::Isolate* isolate = info.GetIsolate(); |
| 130 | 130 |
| 131 v8::Handle<v8::Value> value = info[0]; | 131 v8::Handle<v8::Value> value = info[0]; |
| 132 if (value->IsString()) { | 132 if (value->IsString()) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 146 return; | 146 return; |
| 147 } | 147 } |
| 148 if (value->IsDate()) { | 148 if (value->IsDate()) { |
| 149 v8SetReturnValue(info, v8AtomicString(isolate, "date")); | 149 v8SetReturnValue(info, v8AtomicString(isolate, "date")); |
| 150 return; | 150 return; |
| 151 } | 151 } |
| 152 if (value->IsRegExp()) { | 152 if (value->IsRegExp()) { |
| 153 v8SetReturnValue(info, v8AtomicString(isolate, "regexp")); | 153 v8SetReturnValue(info, v8AtomicString(isolate, "regexp")); |
| 154 return; | 154 return; |
| 155 } | 155 } |
| 156 WrapperWorldType currentWorldType = worldType(isolate); | 156 if (V8Node::hasInstance(value, isolate)) { |
| 157 if (V8Node::hasInstance(value, isolate, currentWorldType)) { | |
| 158 v8SetReturnValue(info, v8AtomicString(isolate, "node")); | 157 v8SetReturnValue(info, v8AtomicString(isolate, "node")); |
| 159 return; | 158 return; |
| 160 } | 159 } |
| 161 if (V8NodeList::hasInstance(value, isolate, currentWorldType)) { | 160 if (V8NodeList::hasInstance(value, isolate)) { |
| 162 v8SetReturnValue(info, v8AtomicString(isolate, "array")); | 161 v8SetReturnValue(info, v8AtomicString(isolate, "array")); |
| 163 return; | 162 return; |
| 164 } | 163 } |
| 165 if (V8HTMLCollection::hasInstance(value, isolate, currentWorldType)) { | 164 if (V8HTMLCollection::hasInstance(value, isolate)) { |
| 166 v8SetReturnValue(info, v8AtomicString(isolate, "array")); | 165 v8SetReturnValue(info, v8AtomicString(isolate, "array")); |
| 167 return; | 166 return; |
| 168 } | 167 } |
| 169 if (V8Int8Array::hasInstance(value, isolate, currentWorldType) || V8Int16Arr
ay::hasInstance(value, isolate, currentWorldType) || V8Int32Array::hasInstance(v
alue, isolate, currentWorldType)) { | 168 if (V8Int8Array::hasInstance(value, isolate) || V8Int16Array::hasInstance(va
lue, isolate) || V8Int32Array::hasInstance(value, isolate)) { |
| 170 v8SetReturnValue(info, v8AtomicString(isolate, "array")); | 169 v8SetReturnValue(info, v8AtomicString(isolate, "array")); |
| 171 return; | 170 return; |
| 172 } | 171 } |
| 173 if (V8Uint8Array::hasInstance(value, isolate, currentWorldType) || V8Uint16A
rray::hasInstance(value, isolate, currentWorldType) || V8Uint32Array::hasInstanc
e(value, isolate, currentWorldType)) { | 172 if (V8Uint8Array::hasInstance(value, isolate) || V8Uint16Array::hasInstance(
value, isolate) || V8Uint32Array::hasInstance(value, isolate)) { |
| 174 v8SetReturnValue(info, v8AtomicString(isolate, "array")); | 173 v8SetReturnValue(info, v8AtomicString(isolate, "array")); |
| 175 return; | 174 return; |
| 176 } | 175 } |
| 177 if (V8Float32Array::hasInstance(value, isolate, currentWorldType) || V8Float
64Array::hasInstance(value, isolate, currentWorldType)) { | 176 if (V8Float32Array::hasInstance(value, isolate) || V8Float64Array::hasInstan
ce(value, isolate)) { |
| 178 v8SetReturnValue(info, v8AtomicString(isolate, "array")); | 177 v8SetReturnValue(info, v8AtomicString(isolate, "array")); |
| 179 return; | 178 return; |
| 180 } | 179 } |
| 181 if (V8Uint8ClampedArray::hasInstance(value, isolate, currentWorldType)) { | 180 if (V8Uint8ClampedArray::hasInstance(value, isolate)) { |
| 182 v8SetReturnValue(info, v8AtomicString(isolate, "array")); | 181 v8SetReturnValue(info, v8AtomicString(isolate, "array")); |
| 183 return; | 182 return; |
| 184 } | 183 } |
| 185 } | 184 } |
| 186 | 185 |
| 187 static bool setFunctionName(v8::Handle<v8::Object>& result, const v8::Handle<v8:
:Value>& value, v8::Isolate* isolate) | 186 static bool setFunctionName(v8::Handle<v8::Object>& result, const v8::Handle<v8:
:Value>& value, v8::Isolate* isolate) |
| 188 { | 187 { |
| 189 if (value->IsString() && v8::Handle<v8::String>::Cast(value)->Length()) { | 188 if (value->IsString() && v8::Handle<v8::String>::Cast(value)->Length()) { |
| 190 result->Set(v8AtomicString(isolate, "functionName"), value); | 189 result->Set(v8AtomicString(isolate, "functionName"), value); |
| 191 return true; | 190 return true; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 } | 271 } |
| 273 return result; | 272 return result; |
| 274 } | 273 } |
| 275 | 274 |
| 276 void V8InjectedScriptHost::getEventListenersMethodCustom(const v8::FunctionCallb
ackInfo<v8::Value>& info) | 275 void V8InjectedScriptHost::getEventListenersMethodCustom(const v8::FunctionCallb
ackInfo<v8::Value>& info) |
| 277 { | 276 { |
| 278 if (info.Length() < 1) | 277 if (info.Length() < 1) |
| 279 return; | 278 return; |
| 280 | 279 |
| 281 v8::Local<v8::Value> value = info[0]; | 280 v8::Local<v8::Value> value = info[0]; |
| 282 if (!V8Node::hasInstance(value, info.GetIsolate(), worldType(info.GetIsolate
()))) | 281 if (!V8Node::hasInstance(value, info.GetIsolate())) |
| 283 return; | 282 return; |
| 284 Node* node = V8Node::toNative(value->ToObject()); | 283 Node* node = V8Node::toNative(value->ToObject()); |
| 285 if (!node) | 284 if (!node) |
| 286 return; | 285 return; |
| 287 | 286 |
| 288 InjectedScriptHost* host = V8InjectedScriptHost::toNative(info.Holder()); | 287 InjectedScriptHost* host = V8InjectedScriptHost::toNative(info.Holder()); |
| 289 Vector<EventListenerInfo> listenersArray; | 288 Vector<EventListenerInfo> listenersArray; |
| 290 host->getEventListenersImpl(node, listenersArray); | 289 host->getEventListenersImpl(node, listenersArray); |
| 291 | 290 |
| 292 v8::Local<v8::Object> result = v8::Object::New(info.GetIsolate()); | 291 v8::Local<v8::Object> result = v8::Object::New(info.GetIsolate()); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 307 return; | 306 return; |
| 308 | 307 |
| 309 InjectedScriptHost* host = V8InjectedScriptHost::toNative(info.Holder()); | 308 InjectedScriptHost* host = V8InjectedScriptHost::toNative(info.Holder()); |
| 310 ScriptValue object(info[0], info.GetIsolate()); | 309 ScriptValue object(info[0], info.GetIsolate()); |
| 311 ScriptValue hints(info[1], info.GetIsolate()); | 310 ScriptValue hints(info[1], info.GetIsolate()); |
| 312 host->inspectImpl(object.toJSONValue(ScriptState::current()), hints.toJSONVa
lue(ScriptState::current())); | 311 host->inspectImpl(object.toJSONValue(ScriptState::current()), hints.toJSONVa
lue(ScriptState::current())); |
| 313 } | 312 } |
| 314 | 313 |
| 315 void V8InjectedScriptHost::databaseIdMethodCustom(const v8::FunctionCallbackInfo
<v8::Value>& info) | 314 void V8InjectedScriptHost::databaseIdMethodCustom(const v8::FunctionCallbackInfo
<v8::Value>& info) |
| 316 { | 315 { |
| 317 if (info.Length() > 0 && V8Database::hasInstance(info[0], info.GetIsolate(),
worldType(info.GetIsolate()))) { | 316 if (info.Length() > 0 && V8Database::hasInstance(info[0], info.GetIsolate())
) { |
| 318 Database* database = V8Database::toNative(v8::Handle<v8::Object>::Cast(i
nfo[0])); | 317 Database* database = V8Database::toNative(v8::Handle<v8::Object>::Cast(i
nfo[0])); |
| 319 if (database) { | 318 if (database) { |
| 320 InjectedScriptHost* host = V8InjectedScriptHost::toNative(info.Holde
r()); { | 319 InjectedScriptHost* host = V8InjectedScriptHost::toNative(info.Holde
r()); { |
| 321 v8SetReturnValueStringOrUndefined(info, host->databaseIdImpl(dat
abase), info.GetIsolate()); | 320 v8SetReturnValueStringOrUndefined(info, host->databaseIdImpl(dat
abase), info.GetIsolate()); |
| 322 return; | 321 return; |
| 323 } | 322 } |
| 324 } | 323 } |
| 325 } | 324 } |
| 326 } | 325 } |
| 327 | 326 |
| 328 void V8InjectedScriptHost::storageIdMethodCustom(const v8::FunctionCallbackInfo<
v8::Value>& info) | 327 void V8InjectedScriptHost::storageIdMethodCustom(const v8::FunctionCallbackInfo<
v8::Value>& info) |
| 329 { | 328 { |
| 330 if (info.Length() > 0 && V8Storage::hasInstance(info[0], info.GetIsolate(),
worldType(info.GetIsolate()))) { | 329 if (info.Length() > 0 && V8Storage::hasInstance(info[0], info.GetIsolate()))
{ |
| 331 Storage* storage = V8Storage::toNative(v8::Handle<v8::Object>::Cast(info
[0])); | 330 Storage* storage = V8Storage::toNative(v8::Handle<v8::Object>::Cast(info
[0])); |
| 332 if (storage) { | 331 if (storage) { |
| 333 InjectedScriptHost* host = V8InjectedScriptHost::toNative(info.Holde
r()); | 332 InjectedScriptHost* host = V8InjectedScriptHost::toNative(info.Holde
r()); |
| 334 v8SetReturnValueStringOrUndefined(info, host->storageIdImpl(storage)
, info.GetIsolate()); | 333 v8SetReturnValueStringOrUndefined(info, host->storageIdImpl(storage)
, info.GetIsolate()); |
| 335 return; | 334 return; |
| 336 } | 335 } |
| 337 } | 336 } |
| 338 } | 337 } |
| 339 | 338 |
| 340 void V8InjectedScriptHost::evaluateMethodCustom(const v8::FunctionCallbackInfo<v
8::Value>& info) | 339 void V8InjectedScriptHost::evaluateMethodCustom(const v8::FunctionCallbackInfo<v
8::Value>& info) |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 int lineNumber; | 438 int lineNumber; |
| 440 int columnNumber; | 439 int columnNumber; |
| 441 if (!getFunctionLocation(info, &scriptId, &lineNumber, &columnNumber)) | 440 if (!getFunctionLocation(info, &scriptId, &lineNumber, &columnNumber)) |
| 442 return; | 441 return; |
| 443 | 442 |
| 444 InjectedScriptHost* host = V8InjectedScriptHost::toNative(info.Holder()); | 443 InjectedScriptHost* host = V8InjectedScriptHost::toNative(info.Holder()); |
| 445 host->unmonitorFunction(scriptId, lineNumber, columnNumber); | 444 host->unmonitorFunction(scriptId, lineNumber, columnNumber); |
| 446 } | 445 } |
| 447 | 446 |
| 448 } // namespace WebCore | 447 } // namespace WebCore |
| OLD | NEW |