OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // inspector's stuff) the function is called a few lines below with Injected
ScriptHost wrapper, | 102 // inspector's stuff) the function is called a few lines below with Injected
ScriptHost wrapper, |
103 // injected script id and explicit reference to the inspected global object.
The function is expected | 103 // injected script id and explicit reference to the inspected global object.
The function is expected |
104 // to create and configure InjectedScript instance that is going to be used
by the inspector. | 104 // to create and configure InjectedScript instance that is going to be used
by the inspector. |
105 v8::Local<v8::Value> value; | 105 v8::Local<v8::Value> value; |
106 if (!V8ScriptRunner::compileAndRunInternalScript(v8String(isolate, scriptSou
rce), isolate).ToLocal(&value)) | 106 if (!V8ScriptRunner::compileAndRunInternalScript(v8String(isolate, scriptSou
rce), isolate).ToLocal(&value)) |
107 return ScriptValue(); | 107 return ScriptValue(); |
108 ASSERT(value->IsFunction()); | 108 ASSERT(value->IsFunction()); |
109 | 109 |
110 v8::Local<v8::Object> windowGlobal = inspectedScriptState->context()->Global
(); | 110 v8::Local<v8::Object> windowGlobal = inspectedScriptState->context()->Global
(); |
111 v8::Local<v8::Value> info[] = { scriptHostWrapper, windowGlobal, v8::Number:
:New(inspectedScriptState->isolate(), id) }; | 111 v8::Local<v8::Value> info[] = { scriptHostWrapper, windowGlobal, v8::Number:
:New(inspectedScriptState->isolate(), id) }; |
112 v8::Local<v8::Value> injectedScriptValue = V8ScriptRunner::callInternalFunct
ion(v8::Local<v8::Function>::Cast(value), windowGlobal, WTF_ARRAY_LENGTH(info),
info, inspectedScriptState->isolate()); | 112 v8::Local<v8::Value> injectedScriptValue; |
| 113 if (!V8ScriptRunner::callInternalFunction(v8::Local<v8::Function>::Cast(valu
e), windowGlobal, WTF_ARRAY_LENGTH(info), info, inspectedScriptState->isolate())
.ToLocal(&injectedScriptValue)) |
| 114 return ScriptValue(); |
113 return ScriptValue(inspectedScriptState, injectedScriptValue); | 115 return ScriptValue(inspectedScriptState, injectedScriptValue); |
114 } | 116 } |
115 | 117 |
116 bool InjectedScriptManager::canAccessInspectedWindow(ScriptState* scriptState) | 118 bool InjectedScriptManager::canAccessInspectedWindow(ScriptState* scriptState) |
117 { | 119 { |
118 ScriptState::Scope scope(scriptState); | 120 ScriptState::Scope scope(scriptState); |
119 v8::Local<v8::Object> global = scriptState->context()->Global(); | 121 v8::Local<v8::Object> global = scriptState->context()->Global(); |
120 if (global.IsEmpty()) | 122 if (global.IsEmpty()) |
121 return false; | 123 return false; |
122 v8::Local<v8::Object> holder = V8Window::findInstanceInPrototypeChain(global
, scriptState->isolate()); | 124 v8::Local<v8::Object> holder = V8Window::findInstanceInPrototypeChain(global
, scriptState->isolate()); |
123 if (holder.IsEmpty()) | 125 if (holder.IsEmpty()) |
124 return false; | 126 return false; |
125 LocalFrame* frame = toLocalDOMWindow(V8Window::toImpl(holder))->frame(); | 127 LocalFrame* frame = toLocalDOMWindow(V8Window::toImpl(holder))->frame(); |
126 | 128 |
127 return BindingSecurity::shouldAllowAccessToFrame(scriptState->isolate(), fra
me, DoNotReportSecurityError); | 129 return BindingSecurity::shouldAllowAccessToFrame(scriptState->isolate(), fra
me, DoNotReportSecurityError); |
128 } | 130 } |
129 | 131 |
130 void InjectedScriptManager::setWeakCallback(const v8::WeakCallbackData<v8::Objec
t, InjectedScriptManager::CallbackData>& data) | 132 void InjectedScriptManager::setWeakCallback(const v8::WeakCallbackData<v8::Objec
t, InjectedScriptManager::CallbackData>& data) |
131 { | 133 { |
132 InjectedScriptManager::CallbackData* callbackData = data.GetParameter(); | 134 InjectedScriptManager::CallbackData* callbackData = data.GetParameter(); |
133 callbackData->injectedScriptManager->removeCallbackData(callbackData); | 135 callbackData->injectedScriptManager->removeCallbackData(callbackData); |
134 } | 136 } |
135 | 137 |
136 } // namespace blink | 138 } // namespace blink |
OLD | NEW |