| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 ScriptValue InjectedScriptHost::nodeAsScriptValue(ScriptState* scriptState, Node
* node) | 73 ScriptValue InjectedScriptHost::nodeAsScriptValue(ScriptState* scriptState, Node
* node) |
| 74 { | 74 { |
| 75 ScriptState::Scope scope(scriptState); | 75 ScriptState::Scope scope(scriptState); |
| 76 v8::Isolate* isolate = scriptState->isolate(); | 76 v8::Isolate* isolate = scriptState->isolate(); |
| 77 ExceptionState exceptionState(ExceptionState::ExecutionContext, "nodeAsScrip
tValue", "InjectedScriptHost", scriptState->context()->Global(), isolate); | 77 ExceptionState exceptionState(ExceptionState::ExecutionContext, "nodeAsScrip
tValue", "InjectedScriptHost", scriptState->context()->Global(), isolate); |
| 78 if (!BindingSecurity::shouldAllowAccessToNode(isolate, node, exceptionState)
) | 78 if (!BindingSecurity::shouldAllowAccessToNode(isolate, node, exceptionState)
) |
| 79 return ScriptValue(scriptState, v8::Null(isolate)); | 79 return ScriptValue(scriptState, v8::Null(isolate)); |
| 80 return ScriptValue(scriptState, toV8(node, scriptState->context()->Global(),
isolate)); | 80 return ScriptValue(scriptState, toV8(node, scriptState->context()->Global(),
isolate)); |
| 81 } | 81 } |
| 82 | 82 |
| 83 EventTarget* InjectedScriptHost::scriptValueAsEventTarget(ScriptState* scriptSta
te, ScriptValue value) |
| 84 { |
| 85 ScriptState::Scope scope(scriptState); |
| 86 if (!value.isObject() || value.isNull()) |
| 87 return nullptr; |
| 88 v8::Isolate* isolate = scriptState->isolate(); |
| 89 EventTarget* target = V8EventTarget::toImplWithTypeCheck(isolate, v8::Local<
v8::Object>::Cast(value.v8Value())); |
| 90 |
| 91 // We need to handle a LocalDOMWindow specially, because a LocalDOMWindow wr
apper exists on a prototype chain. |
| 92 if (!target) |
| 93 target = toDOMWindow(isolate, v8::Local<v8::Object>::Cast(value.v8Value(
))); |
| 94 |
| 95 if (!target || !target->executionContext()) |
| 96 return nullptr; |
| 97 return target; |
| 98 } |
| 99 |
| 83 void V8InjectedScriptHost::inspectedObjectMethodCustom(const v8::FunctionCallbac
kInfo<v8::Value>& info) | 100 void V8InjectedScriptHost::inspectedObjectMethodCustom(const v8::FunctionCallbac
kInfo<v8::Value>& info) |
| 84 { | 101 { |
| 85 if (info.Length() < 1) | 102 if (info.Length() < 1) |
| 86 return; | 103 return; |
| 87 | 104 |
| 88 if (!info[0]->IsInt32()) { | 105 if (!info[0]->IsInt32()) { |
| 89 V8ThrowException::throwTypeError(info.GetIsolate(), "argument has to be
an integer"); | 106 V8ThrowException::throwTypeError(info.GetIsolate(), "argument has to be
an integer"); |
| 90 return; | 107 return; |
| 91 } | 108 } |
| 92 | 109 |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 InjectedScriptNative* injectedScriptNative = InjectedScriptNative::fromInjec
tedScriptHost(info.Holder()); | 615 InjectedScriptNative* injectedScriptNative = InjectedScriptNative::fromInjec
tedScriptHost(info.Holder()); |
| 599 if (!injectedScriptNative) | 616 if (!injectedScriptNative) |
| 600 return; | 617 return; |
| 601 int id = info[0]->ToInt32(info.GetIsolate())->Value(); | 618 int id = info[0]->ToInt32(info.GetIsolate())->Value(); |
| 602 String groupName = injectedScriptNative->groupName(id); | 619 String groupName = injectedScriptNative->groupName(id); |
| 603 if (!groupName.isEmpty()) | 620 if (!groupName.isEmpty()) |
| 604 info.GetReturnValue().Set(v8String(info.GetIsolate(), groupName)); | 621 info.GetReturnValue().Set(v8String(info.GetIsolate(), groupName)); |
| 605 } | 622 } |
| 606 | 623 |
| 607 } // namespace blink | 624 } // namespace blink |
| OLD | NEW |