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

Side by Side Diff: Source/core/loader/FrameLoader.cpp

Issue 725593004: Prevent the load event from firing inside DOMContentLoaded (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
6 * Copyright (C) Research In Motion Limited 2009. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2009. All rights reserved.
7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> 7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com>
8 * Copyright (C) 2011 Google Inc. All rights reserved. 8 * Copyright (C) 2011 Google Inc. All rights reserved.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 } 174 }
175 m_frame->navigationScheduler().startTimer(); 175 m_frame->navigationScheduler().startTimer();
176 scheduleCheckCompleted(); 176 scheduleCheckCompleted();
177 } 177 }
178 } 178 }
179 179
180 void FrameLoader::stopLoading() 180 void FrameLoader::stopLoading()
181 { 181 {
182 if (m_frame->document() && m_frame->document()->parsing()) { 182 if (m_frame->document() && m_frame->document()->parsing()) {
183 finishedParsing(); 183 finishedParsing();
184 m_frame->document()->setParsing(false); 184 m_frame->document()->setParsingState(Document::Done);
185 } 185 }
186 186
187 if (Document* doc = m_frame->document()) { 187 if (Document* doc = m_frame->document()) {
188 // FIXME: HTML5 doesn't tell us to set the state to complete when aborti ng, but we do anyway to match legacy behavior. 188 // FIXME: HTML5 doesn't tell us to set the state to complete when aborti ng, but we do anyway to match legacy behavior.
189 // http://www.w3.org/Bugs/Public/show_bug.cgi?id=10537 189 // http://www.w3.org/Bugs/Public/show_bug.cgi?id=10537
190 doc->setReadyState(Document::Complete); 190 doc->setReadyState(Document::Complete);
191 } 191 }
192 192
193 // FIXME: This will cancel redirection timer, which really needs to be resta rted when restoring the frame from b/f cache. 193 // FIXME: This will cancel redirection timer, which really needs to be resta rted when restoring the frame from b/f cache.
194 m_frame->navigationScheduler().cancel(); 194 m_frame->navigationScheduler().cancel();
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 { 461 {
462 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); 462 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get());
463 463
464 if (m_frame->view()) 464 if (m_frame->view())
465 m_frame->view()->handleLoadCompleted(); 465 m_frame->view()->handleLoadCompleted();
466 466
467 if (m_frame->document()->isLoadCompleted() && m_stateMachine.committedFirstR ealDocumentLoad()) 467 if (m_frame->document()->isLoadCompleted() && m_stateMachine.committedFirstR ealDocumentLoad())
468 return; 468 return;
469 469
470 // Are we still parsing? 470 // Are we still parsing?
471 if (m_frame->document()->parsing()) 471 if (m_frame->document()->parsing() || m_frame->document()->isInDOMContentLoa ded())
472 return; 472 return;
473 473
474 // Still waiting imports? 474 // Still waiting imports?
475 if (!m_frame->document()->haveImportsLoaded()) 475 if (!m_frame->document()->haveImportsLoaded())
476 return; 476 return;
477 477
478 // Still waiting for images/scripts? 478 // Still waiting for images/scripts?
479 if (m_frame->document()->fetcher()->requestCount()) 479 if (m_frame->document()->fetcher()->requestCount())
480 return; 480 return;
481 481
(...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after
1455 // FIXME: We need a way to propagate sandbox flags to out-of-process frames. 1455 // FIXME: We need a way to propagate sandbox flags to out-of-process frames.
1456 Frame* parentFrame = m_frame->tree().parent(); 1456 Frame* parentFrame = m_frame->tree().parent();
1457 if (parentFrame && parentFrame->isLocalFrame()) 1457 if (parentFrame && parentFrame->isLocalFrame())
1458 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags(); 1458 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags();
1459 if (FrameOwner* frameOwner = m_frame->owner()) 1459 if (FrameOwner* frameOwner = m_frame->owner())
1460 flags |= frameOwner->sandboxFlags(); 1460 flags |= frameOwner->sandboxFlags();
1461 return flags; 1461 return flags;
1462 } 1462 }
1463 1463
1464 } // namespace blink 1464 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698