OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "bindings/core/v8/PrivateScriptRunner.h" | 6 #include "bindings/core/v8/PrivateScriptRunner.h" |
7 | 7 |
8 #include "bindings/core/v8/DOMWrapperWorld.h" | 8 #include "bindings/core/v8/DOMWrapperWorld.h" |
9 #include "bindings/core/v8/ExceptionState.h" | 9 #include "bindings/core/v8/ExceptionState.h" |
10 #include "bindings/core/v8/V8Binding.h" | 10 #include "bindings/core/v8/V8Binding.h" |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 RELEASE_ASSERT_NOT_REACHED(); | 221 RELEASE_ASSERT_NOT_REACHED(); |
222 } | 222 } |
223 | 223 |
224 isInitialized = v8Boolean(true, isolate); | 224 isInitialized = v8Boolean(true, isolate); |
225 V8HiddenValue::setHiddenValue(isolate, holderObject, V8HiddenValue::priv
ateScriptObjectIsInitialized(isolate), isInitialized); | 225 V8HiddenValue::setHiddenValue(isolate, holderObject, V8HiddenValue::priv
ateScriptObjectIsInitialized(isolate), isInitialized); |
226 } | 226 } |
227 } | 227 } |
228 | 228 |
229 v8::Local<v8::Value> PrivateScriptRunner::installClassIfNeeded(Document* documen
t, String className) | 229 v8::Local<v8::Value> PrivateScriptRunner::installClassIfNeeded(Document* documen
t, String className) |
230 { | 230 { |
| 231 if (!document->contextDocument()->frame()) |
| 232 return v8::Local<v8::Value>(); |
| 233 |
231 v8::HandleScope handleScope(toIsolate(document)); | 234 v8::HandleScope handleScope(toIsolate(document)); |
232 ScriptState* scriptState = ScriptState::forWorld(document->contextDocument()
->frame(), DOMWrapperWorld::privateScriptIsolatedWorld()); | 235 ScriptState* scriptState = ScriptState::forWorld(document->contextDocument()
->frame(), DOMWrapperWorld::privateScriptIsolatedWorld()); |
233 if (!scriptState->contextIsValid()) | 236 if (!scriptState->contextIsValid()) |
234 return v8::Local<v8::Value>(); | 237 return v8::Local<v8::Value>(); |
235 | 238 |
236 ScriptState::Scope scope(scriptState); | 239 ScriptState::Scope scope(scriptState); |
237 return classObjectOfPrivateScript(scriptState, className); | 240 return classObjectOfPrivateScript(scriptState, className); |
238 } | 241 } |
239 | 242 |
240 namespace { | 243 namespace { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 v8::Local<v8::Value> result; | 353 v8::Local<v8::Value> result; |
351 if (!V8ScriptRunner::callFunction(v8::Local<v8::Function>::Cast(method), scr
iptState->executionContext(), holder, argc, argv, scriptState->isolate()).ToLoca
l(&result)) { | 354 if (!V8ScriptRunner::callFunction(v8::Local<v8::Function>::Cast(method), scr
iptState->executionContext(), holder, argc, argv, scriptState->isolate()).ToLoca
l(&result)) { |
352 rethrowExceptionInPrivateScript(scriptState->isolate(), block, scriptSta
teInUserScript, ExceptionState::ExecutionContext, methodName, className); | 355 rethrowExceptionInPrivateScript(scriptState->isolate(), block, scriptSta
teInUserScript, ExceptionState::ExecutionContext, methodName, className); |
353 block.ReThrow(); | 356 block.ReThrow(); |
354 return v8::Local<v8::Value>(); | 357 return v8::Local<v8::Value>(); |
355 } | 358 } |
356 return result; | 359 return result; |
357 } | 360 } |
358 | 361 |
359 } // namespace blink | 362 } // namespace blink |
OLD | NEW |