OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. |
3 * Copyright (C) 2009 Apple Inc. All rights reserved. | 3 * Copyright (C) 2009 Apple Inc. All rights reserved. |
4 * Copyright (C) 2014 Opera Software ASA. All rights reserved. | 4 * Copyright (C) 2014 Opera Software ASA. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions are | 7 * modification, are permitted provided that the following conditions are |
8 * met: | 8 * met: |
9 * | 9 * |
10 * * Redistributions of source code must retain the above copyright | 10 * * Redistributions of source code must retain the above copyright |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 v8::Isolate* isolate = toIsolate(frame); | 89 v8::Isolate* isolate = toIsolate(frame); |
90 return !isolate->InContext() || BindingSecurity::shouldAllowAccessToFrame(is
olate, frame); | 90 return !isolate->InContext() || BindingSecurity::shouldAllowAccessToFrame(is
olate, frame); |
91 } | 91 } |
92 | 92 |
93 ScriptController::ScriptController(LocalFrame* frame) | 93 ScriptController::ScriptController(LocalFrame* frame) |
94 : m_frame(frame) | 94 : m_frame(frame) |
95 , m_sourceURL(0) | 95 , m_sourceURL(0) |
96 , m_isolate(v8::Isolate::GetCurrent()) | 96 , m_isolate(v8::Isolate::GetCurrent()) |
97 , m_windowProxy(WindowProxy::create(frame, DOMWrapperWorld::mainWorld(), m_i
solate)) | 97 , m_windowProxy(WindowProxy::create(frame, DOMWrapperWorld::mainWorld(), m_i
solate)) |
98 , m_windowScriptNPObject(0) | 98 , m_windowScriptNPObject(0) |
| 99 , m_bypassMainWorldCSP(false) |
99 { | 100 { |
100 } | 101 } |
101 | 102 |
102 ScriptController::~ScriptController() | 103 ScriptController::~ScriptController() |
103 { | 104 { |
104 // WindowProxy::clearForClose() must be invoked before destruction starts. | 105 // WindowProxy::clearForClose() must be invoked before destruction starts. |
105 ASSERT(!m_windowProxy->isContextInitialized()); | 106 ASSERT(!m_windowProxy->isContextInitialized()); |
106 } | 107 } |
107 | 108 |
108 void ScriptController::clearScriptObjects() | 109 void ScriptController::clearScriptObjects() |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 m_isolatedWorlds.set(world.worldId(), isolatedWorldWindowProxy.relea
se()); | 234 m_isolatedWorlds.set(world.worldId(), isolatedWorldWindowProxy.relea
se()); |
234 } | 235 } |
235 } | 236 } |
236 if (!windowProxy->isContextInitialized() && windowProxy->initializeIfNeeded(
) && world.isMainWorld()) | 237 if (!windowProxy->isContextInitialized() && windowProxy->initializeIfNeeded(
) && world.isMainWorld()) |
237 m_frame->loader().dispatchDidClearWindowObjectInMainWorld(); | 238 m_frame->loader().dispatchDidClearWindowObjectInMainWorld(); |
238 return windowProxy; | 239 return windowProxy; |
239 } | 240 } |
240 | 241 |
241 bool ScriptController::shouldBypassMainWorldCSP() | 242 bool ScriptController::shouldBypassMainWorldCSP() |
242 { | 243 { |
| 244 if (m_bypassMainWorldCSP) |
| 245 return true; |
| 246 |
243 v8::Handle<v8::Context> context = m_isolate->GetCurrentContext(); | 247 v8::Handle<v8::Context> context = m_isolate->GetCurrentContext(); |
244 if (context.IsEmpty() || !toDOMWindow(context)) | 248 if (context.IsEmpty() || !toDOMWindow(context)) |
245 return false; | 249 return false; |
246 DOMWrapperWorld& world = DOMWrapperWorld::current(m_isolate); | 250 DOMWrapperWorld& world = DOMWrapperWorld::current(m_isolate); |
247 return world.isIsolatedWorld() ? world.isolatedWorldHasContentSecurityPolicy
() : false; | 251 return world.isIsolatedWorld() ? world.isolatedWorldHasContentSecurityPolicy
() : false; |
248 } | 252 } |
249 | 253 |
250 TextPosition ScriptController::eventHandlerPosition() const | 254 TextPosition ScriptController::eventHandlerPosition() const |
251 { | 255 { |
252 ScriptableDocumentParser* parser = m_frame->document()->scriptableDocumentPa
rser(); | 256 ScriptableDocumentParser* parser = m_frame->document()->scriptableDocumentPa
rser(); |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 resultArray->Set(i, evaluationResult); | 637 resultArray->Set(i, evaluationResult); |
634 } | 638 } |
635 | 639 |
636 if (results) { | 640 if (results) { |
637 for (size_t i = 0; i < resultArray->Length(); ++i) | 641 for (size_t i = 0; i < resultArray->Length(); ++i) |
638 results->append(handleScope.Escape(resultArray->Get(i))); | 642 results->append(handleScope.Escape(resultArray->Get(i))); |
639 } | 643 } |
640 } | 644 } |
641 | 645 |
642 } // namespace blink | 646 } // namespace blink |
OLD | NEW |