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

Unified Diff: Source/core/frame/LocalDOMWindow.cpp

Issue 1172603004: Fix crash when an onorientationchange event detaches an iframe. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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
« no previous file with comments | « no previous file | Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/frame/LocalDOMWindow.cpp
diff --git a/Source/core/frame/LocalDOMWindow.cpp b/Source/core/frame/LocalDOMWindow.cpp
index 97179dffc684d668a491d62c2e04e7a5c7423c7c..77a5df26a54ab0fd2a0f7b51bbdafcb58753e5c6 100644
--- a/Source/core/frame/LocalDOMWindow.cpp
+++ b/Source/core/frame/LocalDOMWindow.cpp
@@ -518,21 +518,19 @@ void LocalDOMWindow::reset()
void LocalDOMWindow::sendOrientationChangeEvent()
{
ASSERT(RuntimeEnabledFeatures::orientationEventEnabled());
+ ASSERT(frame()->isMainFrame());
- // Before dispatching the event, build a list of the child frames to
- // also send the event to, to mitigate side effects from event handlers
+ // Before dispatching the event, build a list of all frames in the page
+ // to send the event to, to mitigate side effects from event handlers
// potentially interfering with others.
- WillBeHeapVector<RefPtrWillBeMember<Frame>> childFrames;
- for (Frame* child = frame()->tree().firstChild(); child; child = child->tree().nextSibling()) {
- childFrames.append(child);
- }
-
- dispatchEvent(Event::create(EventTypeNames::orientationchange));
+ WillBeHeapVector<RefPtrWillBeMember<Frame>> frames;
+ for (Frame* f = frame(); f; f = f->tree().traverseNext())
+ frames.append(f);
- for (size_t i = 0; i < childFrames.size(); ++i) {
- if (!childFrames[i]->isLocalFrame())
+ for (size_t i = 0; i < frames.size(); ++i) {
+ if (!frames[i]->isLocalFrame())
continue;
- toLocalFrame(childFrames[i].get())->localDOMWindow()->sendOrientationChangeEvent();
+ toLocalFrame(frames[i].get())->localDOMWindow()->dispatchEvent(Event::create(EventTypeNames::orientationchange));
dcheng 2015/06/10 17:46:12 Out of curiosity, what happens when we try to disp
esprehn 2015/06/11 01:57:12 That works fine, for example in script I can do:
}
}
« no previous file with comments | « no previous file | Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698