| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 Node* InjectedScriptHost::scriptValueAsNode(ScriptValue value) | 67 Node* InjectedScriptHost::scriptValueAsNode(ScriptValue value) |
| 68 { | 68 { |
| 69 v8::HandleScope scope(value.isolate()); | 69 v8::HandleScope scope(value.isolate()); |
| 70 if (!value.isObject() || value.isNull()) | 70 if (!value.isObject() || value.isNull()) |
| 71 return 0; | 71 return 0; |
| 72 return V8Node::toNative(v8::Handle<v8::Object>::Cast(value.v8Value())); | 72 return V8Node::toNative(v8::Handle<v8::Object>::Cast(value.v8Value())); |
| 73 } | 73 } |
| 74 | 74 |
| 75 ScriptValue InjectedScriptHost::nodeAsScriptValue(ScriptState* scriptState, Node
* node) | 75 ScriptValue InjectedScriptHost::nodeAsScriptValue(ScriptState* scriptState, Node
* node) |
| 76 { | 76 { |
| 77 ScriptState::Scope scope(scriptState); |
| 77 v8::Isolate* isolate = scriptState->isolate(); | 78 v8::Isolate* isolate = scriptState->isolate(); |
| 78 v8::HandleScope scope(isolate); | 79 ExceptionState exceptionState(ExceptionState::ExecutionContext, "nodeAsScrip
tValue", "InjectedScriptHost", scriptState->context()->Global(), isolate); |
| 79 v8::Local<v8::Context> context = scriptState->context(); | |
| 80 v8::Context::Scope contextScope(context); | |
| 81 | |
| 82 ExceptionState exceptionState(ExceptionState::ExecutionContext, "nodeAsScrip
tValue", "InjectedScriptHost", context->Global(), isolate); | |
| 83 if (!BindingSecurity::shouldAllowAccessToNode(isolate, node, exceptionState)
) | 80 if (!BindingSecurity::shouldAllowAccessToNode(isolate, node, exceptionState)
) |
| 84 return ScriptValue(scriptState, v8::Null(isolate)); | 81 return ScriptValue(scriptState, v8::Null(isolate)); |
| 85 return ScriptValue(scriptState, toV8(node, context->Global(), isolate)); | 82 return ScriptValue(scriptState, toV8(node, scriptState->context()->Global(),
isolate)); |
| 86 } | 83 } |
| 87 | 84 |
| 88 void V8InjectedScriptHost::inspectedObjectMethodCustom(const v8::FunctionCallbac
kInfo<v8::Value>& info) | 85 void V8InjectedScriptHost::inspectedObjectMethodCustom(const v8::FunctionCallbac
kInfo<v8::Value>& info) |
| 89 { | 86 { |
| 90 if (info.Length() < 1) | 87 if (info.Length() < 1) |
| 91 return; | 88 return; |
| 92 | 89 |
| 93 if (!info[0]->IsInt32()) { | 90 if (!info[0]->IsInt32()) { |
| 94 throwTypeError("argument has to be an integer", info.GetIsolate()); | 91 throwTypeError("argument has to be an integer", info.GetIsolate()); |
| 95 return; | 92 return; |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 OwnPtr<v8::Handle<v8::Value>[]> argv = adoptArrayPtr(new v8::Handle<v8::Valu
e>[argc]); | 438 OwnPtr<v8::Handle<v8::Value>[]> argv = adoptArrayPtr(new v8::Handle<v8::Valu
e>[argc]); |
| 442 for (size_t i = 0; i < argc; ++i) | 439 for (size_t i = 0; i < argc; ++i) |
| 443 argv[i] = info[i + 2]; | 440 argv[i] = info[i + 2]; |
| 444 | 441 |
| 445 v8::Local<v8::Value> result = function->Call(receiver, argc, argv.get()); | 442 v8::Local<v8::Value> result = function->Call(receiver, argc, argv.get()); |
| 446 debugServer.unmuteWarningsAndDeprecations(); | 443 debugServer.unmuteWarningsAndDeprecations(); |
| 447 v8SetReturnValue(info, result); | 444 v8SetReturnValue(info, result); |
| 448 } | 445 } |
| 449 | 446 |
| 450 } // namespace WebCore | 447 } // namespace WebCore |
| OLD | NEW |