| 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" | |
| 34 #include "bindings/core/v8/ScriptController.h" | 33 #include "bindings/core/v8/ScriptController.h" |
| 35 #include "bindings/core/v8/ScriptSourceCode.h" | 34 #include "bindings/core/v8/ScriptSourceCode.h" |
| 36 #include "bindings/core/v8/SourceLocation.h" | 35 #include "bindings/core/v8/SourceLocation.h" |
| 37 #include "bindings/core/v8/V8Binding.h" | 36 #include "bindings/core/v8/V8Binding.h" |
| 38 #include "bindings/core/v8/V8GCController.h" | 37 #include "bindings/core/v8/V8GCController.h" |
| 39 #include "bindings/core/v8/V8ScriptRunner.h" | 38 #include "bindings/core/v8/V8ScriptRunner.h" |
| 40 #include "core/dom/Document.h" | 39 #include "core/dom/Document.h" |
| 41 #include "core/dom/ExecutionContext.h" | 40 #include "core/dom/ExecutionContext.h" |
| 42 #include "core/frame/LocalFrame.h" | 41 #include "core/frame/LocalFrame.h" |
| 43 #include "core/workers/WorkerGlobalScope.h" | 42 #include "core/workers/WorkerGlobalScope.h" |
| 44 #include "core/workers/WorkerThread.h" | 43 #include "core/workers/WorkerThread.h" |
| 45 #include "platform/instrumentation/tracing/TraceEvent.h" | 44 #include "platform/instrumentation/tracing/TraceEvent.h" |
| 46 | 45 |
| 47 namespace blink { | 46 namespace blink { |
| 48 | 47 |
| 49 ScheduledAction* ScheduledAction::create(ScriptState* scriptState, | 48 ScheduledAction* ScheduledAction::create(ScriptState* scriptState, |
| 50 ExecutionContext* target, | |
| 51 const ScriptValue& handler, | 49 const ScriptValue& handler, |
| 52 const Vector<ScriptValue>& arguments) { | 50 const Vector<ScriptValue>& arguments) { |
| 53 ASSERT(handler.isFunction()); | 51 ASSERT(handler.isFunction()); |
| 54 if (!scriptState->world().isWorkerWorld()) { | |
| 55 CHECK(BindingSecurity::shouldAllowAccessToFrame( | |
| 56 enteredDOMWindow(scriptState->isolate()), toDocument(target)->frame(), | |
| 57 BindingSecurity::ErrorReportOption::DoNotReport)); | |
| 58 } | |
| 59 return new ScheduledAction(scriptState, handler, arguments); | 52 return new ScheduledAction(scriptState, handler, arguments); |
| 60 } | 53 } |
| 61 | 54 |
| 62 ScheduledAction* ScheduledAction::create(ScriptState* scriptState, | 55 ScheduledAction* ScheduledAction::create(ScriptState* scriptState, |
| 63 ExecutionContext* target, | |
| 64 const String& handler) { | 56 const String& handler) { |
| 65 if (!scriptState->world().isWorkerWorld()) { | |
| 66 CHECK(BindingSecurity::shouldAllowAccessToFrame( | |
| 67 enteredDOMWindow(scriptState->isolate()), toDocument(target)->frame(), | |
| 68 BindingSecurity::ErrorReportOption::DoNotReport)); | |
| 69 } | |
| 70 return new ScheduledAction(scriptState, handler); | 57 return new ScheduledAction(scriptState, handler); |
| 71 } | 58 } |
| 72 | 59 |
| 73 DEFINE_TRACE(ScheduledAction) { | 60 DEFINE_TRACE(ScheduledAction) { |
| 74 visitor->trace(m_code); | 61 visitor->trace(m_code); |
| 75 } | 62 } |
| 76 | 63 |
| 77 ScheduledAction::~ScheduledAction() { | 64 ScheduledAction::~ScheduledAction() { |
| 78 // Verify that owning DOMTimer has eagerly disposed. | 65 // Verify that owning DOMTimer has eagerly disposed. |
| 79 DCHECK(m_info.IsEmpty()); | 66 DCHECK(m_info.IsEmpty()); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 } | 176 } |
| 190 | 177 |
| 191 void ScheduledAction::createLocalHandlesForArgs( | 178 void ScheduledAction::createLocalHandlesForArgs( |
| 192 Vector<v8::Local<v8::Value>>* handles) { | 179 Vector<v8::Local<v8::Value>>* handles) { |
| 193 handles->reserveCapacity(m_info.Size()); | 180 handles->reserveCapacity(m_info.Size()); |
| 194 for (size_t i = 0; i < m_info.Size(); ++i) | 181 for (size_t i = 0; i < m_info.Size(); ++i) |
| 195 handles->push_back(m_info.Get(i)); | 182 handles->push_back(m_info.Get(i)); |
| 196 } | 183 } |
| 197 | 184 |
| 198 } // namespace blink | 185 } // namespace blink |
| OLD | NEW |