Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007-2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2007-2009 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 12 matching lines...) Expand all Loading... | |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "bindings/core/v8/ScheduledAction.h" | 31 #include "bindings/core/v8/ScheduledAction.h" |
| 32 | 32 |
| 33 #include "bindings/core/v8/BindingSecurity.h" | |
| 33 #include "bindings/core/v8/ScriptController.h" | 34 #include "bindings/core/v8/ScriptController.h" |
| 34 #include "bindings/core/v8/ScriptSourceCode.h" | 35 #include "bindings/core/v8/ScriptSourceCode.h" |
| 35 #include "bindings/core/v8/SourceLocation.h" | 36 #include "bindings/core/v8/SourceLocation.h" |
| 36 #include "bindings/core/v8/V8Binding.h" | 37 #include "bindings/core/v8/V8Binding.h" |
| 37 #include "bindings/core/v8/V8GCController.h" | 38 #include "bindings/core/v8/V8GCController.h" |
| 38 #include "bindings/core/v8/V8ScriptRunner.h" | 39 #include "bindings/core/v8/V8ScriptRunner.h" |
| 39 #include "core/dom/Document.h" | 40 #include "core/dom/Document.h" |
| 40 #include "core/dom/ExecutionContext.h" | 41 #include "core/dom/ExecutionContext.h" |
| 41 #include "core/frame/LocalFrame.h" | 42 #include "core/frame/LocalFrame.h" |
| 42 #include "core/workers/WorkerGlobalScope.h" | 43 #include "core/workers/WorkerGlobalScope.h" |
| 43 #include "core/workers/WorkerThread.h" | 44 #include "core/workers/WorkerThread.h" |
| 44 #include "platform/instrumentation/tracing/TraceEvent.h" | 45 #include "platform/instrumentation/tracing/TraceEvent.h" |
| 45 | 46 |
| 46 namespace blink { | 47 namespace blink { |
| 47 | 48 |
| 48 ScheduledAction* ScheduledAction::create(ScriptState* scriptState, | 49 ScheduledAction* ScheduledAction::create(ScriptState* scriptState, |
| 50 ExecutionContext* target, | |
|
haraken
2017/02/21 13:10:20
Is the target execution context different from scr
jochen (gone - plz use gerrit)
2017/02/21 13:13:02
possibly - you could invoke setTimeout on a same-o
haraken
2017/02/21 13:23:10
Ah, right.
Maybe would it be nicer to move the CH
| |
| 49 const ScriptValue& handler, | 51 const ScriptValue& handler, |
| 50 const Vector<ScriptValue>& arguments) { | 52 const Vector<ScriptValue>& arguments) { |
| 51 ASSERT(handler.isFunction()); | 53 ASSERT(handler.isFunction()); |
| 54 if (!scriptState->world().isWorkerWorld()) { | |
| 55 CHECK(BindingSecurity::shouldAllowAccessToFrame( | |
| 56 enteredDOMWindow(scriptState->isolate()), toDocument(target)->frame(), | |
| 57 BindingSecurity::ErrorReportOption::DoNotReport)); | |
| 58 } | |
| 52 return new ScheduledAction(scriptState, handler, arguments); | 59 return new ScheduledAction(scriptState, handler, arguments); |
| 53 } | 60 } |
| 54 | 61 |
| 55 ScheduledAction* ScheduledAction::create(ScriptState* scriptState, | 62 ScheduledAction* ScheduledAction::create(ScriptState* scriptState, |
| 63 ExecutionContext* target, | |
| 56 const String& handler) { | 64 const String& handler) { |
| 65 if (!scriptState->world().isWorkerWorld()) { | |
| 66 CHECK(BindingSecurity::shouldAllowAccessToFrame( | |
| 67 enteredDOMWindow(scriptState->isolate()), toDocument(target)->frame(), | |
| 68 BindingSecurity::ErrorReportOption::DoNotReport)); | |
| 69 } | |
| 57 return new ScheduledAction(scriptState, handler); | 70 return new ScheduledAction(scriptState, handler); |
| 58 } | 71 } |
| 59 | 72 |
| 60 DEFINE_TRACE(ScheduledAction) { | 73 DEFINE_TRACE(ScheduledAction) { |
| 61 visitor->trace(m_code); | 74 visitor->trace(m_code); |
| 62 } | 75 } |
| 63 | 76 |
| 64 ScheduledAction::~ScheduledAction() { | 77 ScheduledAction::~ScheduledAction() { |
| 65 // Verify that owning DOMTimer has eagerly disposed. | 78 // Verify that owning DOMTimer has eagerly disposed. |
| 66 DCHECK(m_info.IsEmpty()); | 79 DCHECK(m_info.IsEmpty()); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 176 } | 189 } |
| 177 | 190 |
| 178 void ScheduledAction::createLocalHandlesForArgs( | 191 void ScheduledAction::createLocalHandlesForArgs( |
| 179 Vector<v8::Local<v8::Value>>* handles) { | 192 Vector<v8::Local<v8::Value>>* handles) { |
| 180 handles->reserveCapacity(m_info.Size()); | 193 handles->reserveCapacity(m_info.Size()); |
| 181 for (size_t i = 0; i < m_info.Size(); ++i) | 194 for (size_t i = 0; i < m_info.Size(); ++i) |
| 182 handles->push_back(m_info.Get(i)); | 195 handles->push_back(m_info.Get(i)); |
| 183 } | 196 } |
| 184 | 197 |
| 185 } // namespace blink | 198 } // namespace blink |
| OLD | NEW |