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

Side by Side Diff: Source/core/dom/Document.cpp

Issue 774033002: Run Microtasks before dispatching onload (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebased PS2 Created 6 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 #include "core/dom/DocumentLifecycleObserver.h" 70 #include "core/dom/DocumentLifecycleObserver.h"
71 #include "core/dom/DocumentMarkerController.h" 71 #include "core/dom/DocumentMarkerController.h"
72 #include "core/dom/DocumentType.h" 72 #include "core/dom/DocumentType.h"
73 #include "core/dom/Element.h" 73 #include "core/dom/Element.h"
74 #include "core/dom/ElementDataCache.h" 74 #include "core/dom/ElementDataCache.h"
75 #include "core/dom/ElementRegistrationOptions.h" 75 #include "core/dom/ElementRegistrationOptions.h"
76 #include "core/dom/ElementTraversal.h" 76 #include "core/dom/ElementTraversal.h"
77 #include "core/dom/ExceptionCode.h" 77 #include "core/dom/ExceptionCode.h"
78 #include "core/dom/ExecutionContextTask.h" 78 #include "core/dom/ExecutionContextTask.h"
79 #include "core/dom/MainThreadTaskRunner.h" 79 #include "core/dom/MainThreadTaskRunner.h"
80 #include "core/dom/Microtask.h"
80 #include "core/dom/MutationObserver.h" 81 #include "core/dom/MutationObserver.h"
81 #include "core/dom/NodeChildRemovalTracker.h" 82 #include "core/dom/NodeChildRemovalTracker.h"
82 #include "core/dom/NodeFilter.h" 83 #include "core/dom/NodeFilter.h"
83 #include "core/dom/NodeIterator.h" 84 #include "core/dom/NodeIterator.h"
84 #include "core/dom/NodeRareData.h" 85 #include "core/dom/NodeRareData.h"
85 #include "core/dom/NodeRenderStyle.h" 86 #include "core/dom/NodeRenderStyle.h"
86 #include "core/dom/NodeRenderingTraversal.h" 87 #include "core/dom/NodeRenderingTraversal.h"
87 #include "core/dom/NodeTraversal.h" 88 #include "core/dom/NodeTraversal.h"
88 #include "core/dom/NodeWithIndex.h" 89 #include "core/dom/NodeWithIndex.h"
89 #include "core/dom/ProcessingInstruction.h" 90 #include "core/dom/ProcessingInstruction.h"
(...skipping 4530 matching lines...) Expand 10 before | Expand all | Expand 10 after
4620 ASSERT(!scriptableDocumentParser() || !m_parser->isParsing()); 4621 ASSERT(!scriptableDocumentParser() || !m_parser->isParsing());
4621 ASSERT(!scriptableDocumentParser() || m_readyState != Loading); 4622 ASSERT(!scriptableDocumentParser() || m_readyState != Loading);
4622 setParsingState(InDOMContentLoaded); 4623 setParsingState(InDOMContentLoaded);
4623 if (!m_documentTiming.domContentLoadedEventStart) 4624 if (!m_documentTiming.domContentLoadedEventStart)
4624 m_documentTiming.domContentLoadedEventStart = monotonicallyIncreasingTim e(); 4625 m_documentTiming.domContentLoadedEventStart = monotonicallyIncreasingTim e();
4625 dispatchEvent(Event::createBubble(EventTypeNames::DOMContentLoaded)); 4626 dispatchEvent(Event::createBubble(EventTypeNames::DOMContentLoaded));
4626 if (!m_documentTiming.domContentLoadedEventEnd) 4627 if (!m_documentTiming.domContentLoadedEventEnd)
4627 m_documentTiming.domContentLoadedEventEnd = monotonicallyIncreasingTime( ); 4628 m_documentTiming.domContentLoadedEventEnd = monotonicallyIncreasingTime( );
4628 setParsingState(FinishedParsing); 4629 setParsingState(FinishedParsing);
4629 4630
4631 // Empty microtask queue to ensure custom element is resolved before onload event.
dominicc (has gone to gerrit) 2014/12/17 14:31:03 I would remove this and put a FIXME with a link to
kouhei (in TOK) 2014/12/18 05:33:55 Done.
4632 Microtask::performCheckpoint();
4633
4630 // The loader's finishedParsing() method may invoke script that causes this object to 4634 // The loader's finishedParsing() method may invoke script that causes this object to
4631 // be dereferenced (when this document is in an iframe and the onload causes the iframe's src to change). 4635 // be dereferenced (when this document is in an iframe and the onload causes the iframe's src to change).
4632 // Keep it alive until we are done. 4636 // Keep it alive until we are done.
4633 RefPtrWillBeRawPtr<Document> protect(this); 4637 RefPtrWillBeRawPtr<Document> protect(this);
4634 4638
4635 if (RefPtrWillBeRawPtr<LocalFrame> frame = this->frame()) { 4639 if (RefPtrWillBeRawPtr<LocalFrame> frame = this->frame()) {
4636 // Don't update the render tree if we haven't requested the main resourc e yet to avoid 4640 // Don't update the render tree if we haven't requested the main resourc e yet to avoid
4637 // adding extra latency. Note that the first render tree update can be e xpensive since it 4641 // adding extra latency. Note that the first render tree update can be e xpensive since it
4638 // triggers the parsing of the default stylesheets which are compiled-in . 4642 // triggers the parsing of the default stylesheets which are compiled-in .
4639 const bool mainResourceWasAlreadyRequested = frame->loader().stateMachin e()->committedFirstRealDocumentLoad(); 4643 const bool mainResourceWasAlreadyRequested = frame->loader().stateMachin e()->committedFirstRealDocumentLoad();
(...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after
5845 #ifndef NDEBUG 5849 #ifndef NDEBUG
5846 using namespace blink; 5850 using namespace blink;
5847 void showLiveDocumentInstances() 5851 void showLiveDocumentInstances()
5848 { 5852 {
5849 WeakDocumentSet& set = liveDocumentSet(); 5853 WeakDocumentSet& set = liveDocumentSet();
5850 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5854 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5851 for (Document* document : set) 5855 for (Document* document : set)
5852 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5856 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5853 } 5857 }
5854 #endif 5858 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698