Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(479)

Unified Diff: third_party/WebKit/Source/core/frame/DOMTimer.cpp

Issue 1615523002: Transitively keep track of an isolated world's children scripts and worlds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..84b161db4c8586a784de859e82c2fc419248baad 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());
haraken 2016/01/21 10:16:15 Ditto.
+
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::OriginWorldPusher worldPusher(ScriptState::forMainWorld(toDocument(context)->frame())->world(), m_originWorld);
haraken 2016/01/21 16:41:33 For example, the world in this first parameter is
TRACE_EVENT1("devtools.timeline", "TimerFire", "data", InspectorTimerFireEvent::data(context, m_timeoutID));
InspectorInstrumentationCookie cookie = InspectorInstrumentation::willFireTimer(context, m_timeoutID);

Powered by Google App Engine
This is Rietveld 408576698