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 22 matching lines...) Expand all Loading... |
33 | 33 |
34 #include "V8Database.h" | 34 #include "V8Database.h" |
35 #include "V8EventTarget.h" | 35 #include "V8EventTarget.h" |
36 #include "V8HTMLAllCollection.h" | 36 #include "V8HTMLAllCollection.h" |
37 #include "V8HTMLCollection.h" | 37 #include "V8HTMLCollection.h" |
38 #include "V8Node.h" | 38 #include "V8Node.h" |
39 #include "V8NodeList.h" | 39 #include "V8NodeList.h" |
40 #include "V8Storage.h" | 40 #include "V8Storage.h" |
41 #include "bindings/common/ScriptValue.h" | 41 #include "bindings/common/ScriptValue.h" |
42 #include "bindings/dart/DartHandleProxy.h" | 42 #include "bindings/dart/DartHandleProxy.h" |
43 #include "bindings/dart/DartInjectedScriptHostHelper.h" | |
44 #include "bindings/v8/BindingSecurity.h" | 43 #include "bindings/v8/BindingSecurity.h" |
45 #include "bindings/v8/ScriptDebugServer.h" | 44 #include "bindings/v8/ScriptDebugServer.h" |
46 #include "bindings/v8/V8AbstractEventListener.h" | 45 #include "bindings/v8/V8AbstractEventListener.h" |
47 #include "bindings/v8/V8Binding.h" | 46 #include "bindings/v8/V8Binding.h" |
48 #include "bindings/v8/V8ExceptionState.h" | 47 #include "bindings/v8/V8ExceptionState.h" |
49 #include "bindings/v8/V8ScriptRunner.h" | 48 #include "bindings/v8/V8ScriptRunner.h" |
50 #include "bindings/v8/custom/V8Float32ArrayCustom.h" | 49 #include "bindings/v8/custom/V8Float32ArrayCustom.h" |
51 #include "bindings/v8/custom/V8Float64ArrayCustom.h" | 50 #include "bindings/v8/custom/V8Float64ArrayCustom.h" |
52 #include "bindings/v8/custom/V8Int16ArrayCustom.h" | 51 #include "bindings/v8/custom/V8Int16ArrayCustom.h" |
53 #include "bindings/v8/custom/V8Int32ArrayCustom.h" | 52 #include "bindings/v8/custom/V8Int32ArrayCustom.h" |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 return; | 182 return; |
184 } | 183 } |
185 if (V8Float32Array::hasInstance(value, isolate) || V8Float64Array::hasInstan
ce(value, isolate)) { | 184 if (V8Float32Array::hasInstance(value, isolate) || V8Float64Array::hasInstan
ce(value, isolate)) { |
186 v8SetReturnValue(info, v8AtomicString(isolate, "array")); | 185 v8SetReturnValue(info, v8AtomicString(isolate, "array")); |
187 return; | 186 return; |
188 } | 187 } |
189 if (V8Uint8ClampedArray::hasInstance(value, isolate)) { | 188 if (V8Uint8ClampedArray::hasInstance(value, isolate)) { |
190 v8SetReturnValue(info, v8AtomicString(isolate, "array")); | 189 v8SetReturnValue(info, v8AtomicString(isolate, "array")); |
191 return; | 190 return; |
192 } | 191 } |
| 192 // FIXMEDART: remove this. |
193 if (DartHandleProxy::isDartProxy(value)) { | 193 if (DartHandleProxy::isDartProxy(value)) { |
194 const char* type = DartHandleProxy::getJavaScriptType(value); | 194 const char* type = DartHandleProxy::getJavaScriptType(value); |
195 if (type) | 195 if (type) |
196 v8SetReturnValue(info, v8AtomicString(isolate, type)); | 196 v8SetReturnValue(info, v8AtomicString(isolate, type)); |
197 return; | 197 return; |
198 } | 198 } |
199 } | 199 } |
200 | 200 |
201 static bool setFunctionName(v8::Handle<v8::Object>& result, const v8::Handle<v8:
:Value>& value, v8::Isolate* isolate) | 201 static bool setFunctionName(v8::Handle<v8::Object>& result, const v8::Handle<v8:
:Value>& value, v8::Isolate* isolate) |
202 { | 202 { |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 isolate->ThrowException(v8::Exception::Error(v8::String::NewFromUtf8(iso
late, "One argument expected."))); | 338 isolate->ThrowException(v8::Exception::Error(v8::String::NewFromUtf8(iso
late, "One argument expected."))); |
339 return; | 339 return; |
340 } | 340 } |
341 | 341 |
342 v8::Handle<v8::String> expression = info[0]->ToString(); | 342 v8::Handle<v8::String> expression = info[0]->ToString(); |
343 if (expression.IsEmpty()) { | 343 if (expression.IsEmpty()) { |
344 isolate->ThrowException(v8::Exception::Error(v8::String::NewFromUtf8(iso
late, "The argument must be a string."))); | 344 isolate->ThrowException(v8::Exception::Error(v8::String::NewFromUtf8(iso
late, "The argument must be a string."))); |
345 return; | 345 return; |
346 } | 346 } |
347 | 347 |
348 // FIXME(dartbug.com/13804): refactor DartInjectedScriptHostHelper to instea
d | |
349 // subclass InjectedScriptHost. | |
350 v8::Handle<v8::Value> dartResult = DartInjectedScriptHostHelper::evaluateIfD
artContext(info.Holder(), expression); | |
351 if (!dartResult.IsEmpty()) { | |
352 v8SetReturnValue(info, dartResult); | |
353 return; | |
354 } | |
355 | |
356 ASSERT(!isolate->GetCurrentContext().IsEmpty()); | 348 ASSERT(!isolate->GetCurrentContext().IsEmpty()); |
357 v8::TryCatch tryCatch; | 349 v8::TryCatch tryCatch; |
358 v8::Handle<v8::Value> result = V8ScriptRunner::compileAndRunInternalScript(e
xpression, info.GetIsolate()); | 350 v8::Handle<v8::Value> result = V8ScriptRunner::compileAndRunInternalScript(e
xpression, info.GetIsolate()); |
359 if (tryCatch.HasCaught()) { | 351 if (tryCatch.HasCaught()) { |
360 v8SetReturnValue(info, tryCatch.ReThrow()); | 352 v8SetReturnValue(info, tryCatch.ReThrow()); |
361 return; | 353 return; |
362 } | 354 } |
363 v8SetReturnValue(info, result); | 355 v8SetReturnValue(info, result); |
364 } | 356 } |
365 | 357 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 OwnPtr<v8::Handle<v8::Value>[]> argv = adoptArrayPtr(new v8::Handle<v8::Valu
e>[argc]); | 454 OwnPtr<v8::Handle<v8::Value>[]> argv = adoptArrayPtr(new v8::Handle<v8::Valu
e>[argc]); |
463 for (size_t i = 0; i < argc; ++i) | 455 for (size_t i = 0; i < argc; ++i) |
464 argv[i] = info[i + 2]; | 456 argv[i] = info[i + 2]; |
465 | 457 |
466 v8::Local<v8::Value> result = function->Call(receiver, argc, argv.get()); | 458 v8::Local<v8::Value> result = function->Call(receiver, argc, argv.get()); |
467 debugServer.unmuteWarningsAndDeprecations(); | 459 debugServer.unmuteWarningsAndDeprecations(); |
468 v8SetReturnValue(info, result); | 460 v8SetReturnValue(info, result); |
469 } | 461 } |
470 | 462 |
471 } // namespace WebCore | 463 } // namespace WebCore |
OLD | NEW |