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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 return; | 183 return; |
185 } | 184 } |
186 if (V8Float32Array::hasInstance(value, isolate) || V8Float64Array::hasInstan
ce(value, isolate)) { | 185 if (V8Float32Array::hasInstance(value, isolate) || V8Float64Array::hasInstan
ce(value, isolate)) { |
187 v8SetReturnValue(info, v8AtomicString(isolate, "array")); | 186 v8SetReturnValue(info, v8AtomicString(isolate, "array")); |
188 return; | 187 return; |
189 } | 188 } |
190 if (V8Uint8ClampedArray::hasInstance(value, isolate)) { | 189 if (V8Uint8ClampedArray::hasInstance(value, isolate)) { |
191 v8SetReturnValue(info, v8AtomicString(isolate, "array")); | 190 v8SetReturnValue(info, v8AtomicString(isolate, "array")); |
192 return; | 191 return; |
193 } | 192 } |
| 193 // FIXMEDART: remove this. |
194 if (DartHandleProxy::isDartProxy(value)) { | 194 if (DartHandleProxy::isDartProxy(value)) { |
195 const char* type = DartHandleProxy::getJavaScriptType(value); | 195 const char* type = DartHandleProxy::getJavaScriptType(value); |
196 if (type) | 196 if (type) |
197 v8SetReturnValue(info, v8AtomicString(isolate, type)); | 197 v8SetReturnValue(info, v8AtomicString(isolate, type)); |
198 return; | 198 return; |
199 } | 199 } |
200 } | 200 } |
201 | 201 |
202 static bool setFunctionName(v8::Handle<v8::Object>& result, const v8::Handle<v8:
:Value>& value, v8::Isolate* isolate) | 202 static bool setFunctionName(v8::Handle<v8::Object>& result, const v8::Handle<v8:
:Value>& value, v8::Isolate* isolate) |
203 { | 203 { |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 isolate->ThrowException(v8::Exception::Error(v8::String::NewFromUtf8(iso
late, "One argument expected."))); | 339 isolate->ThrowException(v8::Exception::Error(v8::String::NewFromUtf8(iso
late, "One argument expected."))); |
340 return; | 340 return; |
341 } | 341 } |
342 | 342 |
343 v8::Handle<v8::String> expression = info[0]->ToString(); | 343 v8::Handle<v8::String> expression = info[0]->ToString(); |
344 if (expression.IsEmpty()) { | 344 if (expression.IsEmpty()) { |
345 isolate->ThrowException(v8::Exception::Error(v8::String::NewFromUtf8(iso
late, "The argument must be a string."))); | 345 isolate->ThrowException(v8::Exception::Error(v8::String::NewFromUtf8(iso
late, "The argument must be a string."))); |
346 return; | 346 return; |
347 } | 347 } |
348 | 348 |
349 // FIXME(dartbug.com/13804): refactor DartInjectedScriptHostHelper to instea
d | |
350 // subclass InjectedScriptHost. | |
351 v8::Handle<v8::Value> dartResult = DartInjectedScriptHostHelper::evaluateIfD
artContext(info.Holder(), expression); | |
352 if (!dartResult.IsEmpty()) { | |
353 v8SetReturnValue(info, dartResult); | |
354 return; | |
355 } | |
356 | |
357 ASSERT(!isolate->GetCurrentContext().IsEmpty()); | 349 ASSERT(!isolate->GetCurrentContext().IsEmpty()); |
358 v8::TryCatch tryCatch; | 350 v8::TryCatch tryCatch; |
359 v8::Handle<v8::Value> result = V8ScriptRunner::compileAndRunInternalScript(e
xpression, info.GetIsolate()); | 351 v8::Handle<v8::Value> result = V8ScriptRunner::compileAndRunInternalScript(e
xpression, info.GetIsolate()); |
360 if (tryCatch.HasCaught()) { | 352 if (tryCatch.HasCaught()) { |
361 v8SetReturnValue(info, tryCatch.ReThrow()); | 353 v8SetReturnValue(info, tryCatch.ReThrow()); |
362 return; | 354 return; |
363 } | 355 } |
364 v8SetReturnValue(info, result); | 356 v8SetReturnValue(info, result); |
365 } | 357 } |
366 | 358 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 OwnPtr<v8::Handle<v8::Value>[]> argv = adoptArrayPtr(new v8::Handle<v8::Valu
e>[argc]); | 455 OwnPtr<v8::Handle<v8::Value>[]> argv = adoptArrayPtr(new v8::Handle<v8::Valu
e>[argc]); |
464 for (size_t i = 0; i < argc; ++i) | 456 for (size_t i = 0; i < argc; ++i) |
465 argv[i] = info[i + 2]; | 457 argv[i] = info[i + 2]; |
466 | 458 |
467 v8::Local<v8::Value> result = function->Call(receiver, argc, argv.get()); | 459 v8::Local<v8::Value> result = function->Call(receiver, argc, argv.get()); |
468 debugServer.unmuteWarningsAndDeprecations(); | 460 debugServer.unmuteWarningsAndDeprecations(); |
469 v8SetReturnValue(info, result); | 461 v8SetReturnValue(info, result); |
470 } | 462 } |
471 | 463 |
472 } // namespace WebCore | 464 } // namespace WebCore |
OLD | NEW |