Index: third_party/WebKit/Source/core/frame/DOMTimer.cpp |
diff --git a/third_party/WebKit/Source/core/frame/DOMTimer.cpp b/third_party/WebKit/Source/core/frame/DOMTimer.cpp |
index 78da1a72b2de6f537282463ed404223098a766dc..cc6414042f59f2cc012350610a1ca1f3d08da43b 100644 |
--- a/third_party/WebKit/Source/core/frame/DOMTimer.cpp |
+++ b/third_party/WebKit/Source/core/frame/DOMTimer.cpp |
@@ -72,6 +72,10 @@ DOMTimer::DOMTimer(ExecutionContext* context, PassOwnPtrWillBeRawPtr<ScheduledAc |
, m_nestingLevel(context->timers()->timerNestingLevel() + 1) |
, m_action(action) |
{ |
+ // Store the creating worldId, as the timer is fired in the main world. |
+ ASSERT(v8::Isolate::GetCurrent()->InContext()); |
+ m_originWorld = PassRefPtr<DOMWrapperWorld>(DOMWrapperWorld::current(v8::Isolate::GetCurrent()).originWorld()); |
+ |
ASSERT(timeoutID > 0); |
if (shouldForwardUserGesture(interval, m_nestingLevel)) |
m_userGestureToken = UserGestureIndicator::currentToken(); |
@@ -104,6 +108,8 @@ void DOMTimer::fired() |
ASSERT(!context->activeDOMObjectsAreSuspended()); |
// Only the first execution of a multi-shot timer should get an affirmative user gesture indicator. |
UserGestureIndicator gestureIndicator(m_userGestureToken.release()); |
+ // Ensure the origin world is propagated to the action and is reset afterwards. |
+ DOMWrapperWorld::OriginWorldScope worldScope(m_originWorld); |
TRACE_EVENT1("devtools.timeline", "TimerFire", "data", InspectorTimerFireEvent::data(context, m_timeoutID)); |
InspectorInstrumentationCookie cookie = InspectorInstrumentation::willFireTimer(context, m_timeoutID); |