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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 } | 381 } |
382 | 382 |
383 v8::Handle<v8::String> expression = info[0]->ToString(isolate); | 383 v8::Handle<v8::String> expression = info[0]->ToString(isolate); |
384 if (expression.IsEmpty()) { | 384 if (expression.IsEmpty()) { |
385 isolate->ThrowException(v8::Exception::Error(v8::String::NewFromUtf8(iso
late, "The argument must be a string."))); | 385 isolate->ThrowException(v8::Exception::Error(v8::String::NewFromUtf8(iso
late, "The argument must be a string."))); |
386 return; | 386 return; |
387 } | 387 } |
388 | 388 |
389 ASSERT(isolate->InContext()); | 389 ASSERT(isolate->InContext()); |
390 v8::TryCatch tryCatch; | 390 v8::TryCatch tryCatch; |
391 v8::Handle<v8::Script> script = V8ScriptRunner::compileScript(expression, St
ring(), TextPosition(), 0, 0, isolate); | 391 v8::Handle<v8::Script> script = V8ScriptRunner::compileScript(expression, St
ring(), TextPosition(), isolate); |
392 v8::Handle<v8::Value> result = V8ScriptRunner::runCompiledScript(isolate, sc
ript, currentExecutionContext(isolate)); | 392 v8::Handle<v8::Value> result = V8ScriptRunner::runCompiledScript(isolate, sc
ript, currentExecutionContext(isolate)); |
393 | 393 |
394 v8::Local<v8::Object> wrappedResult = v8::Object::New(isolate); | 394 v8::Local<v8::Object> wrappedResult = v8::Object::New(isolate); |
395 if (tryCatch.HasCaught()) { | 395 if (tryCatch.HasCaught()) { |
396 wrappedResult->Set(v8::String::NewFromUtf8(isolate, "result"), tryCatch.
Exception()); | 396 wrappedResult->Set(v8::String::NewFromUtf8(isolate, "result"), tryCatch.
Exception()); |
397 wrappedResult->Set(v8::String::NewFromUtf8(isolate, "exceptionDetails"),
JavaScriptCallFrame::createExceptionDetails(isolate, tryCatch.Message())); | 397 wrappedResult->Set(v8::String::NewFromUtf8(isolate, "exceptionDetails"),
JavaScriptCallFrame::createExceptionDetails(isolate, tryCatch.Message())); |
398 } else { | 398 } else { |
399 wrappedResult->Set(v8::String::NewFromUtf8(isolate, "result"), result); | 399 wrappedResult->Set(v8::String::NewFromUtf8(isolate, "result"), result); |
400 wrappedResult->Set(v8::String::NewFromUtf8(isolate, "exceptionDetails"),
v8::Undefined(isolate)); | 400 wrappedResult->Set(v8::String::NewFromUtf8(isolate, "exceptionDetails"),
v8::Undefined(isolate)); |
401 } | 401 } |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 void V8InjectedScriptHost::setNonEnumPropertyMethodCustom(const v8::FunctionCall
backInfo<v8::Value>& info) | 531 void V8InjectedScriptHost::setNonEnumPropertyMethodCustom(const v8::FunctionCall
backInfo<v8::Value>& info) |
532 { | 532 { |
533 if (info.Length() < 3 || !info[0]->IsObject() || !info[1]->IsString()) | 533 if (info.Length() < 3 || !info[0]->IsObject() || !info[1]->IsString()) |
534 return; | 534 return; |
535 | 535 |
536 v8::Local<v8::Object> object = info[0]->ToObject(info.GetIsolate()); | 536 v8::Local<v8::Object> object = info[0]->ToObject(info.GetIsolate()); |
537 object->ForceSet(info[1], info[2], v8::DontEnum); | 537 object->ForceSet(info[1], info[2], v8::DontEnum); |
538 } | 538 } |
539 | 539 |
540 } // namespace blink | 540 } // namespace blink |
OLD | NEW |