| OLD | NEW |
| 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 | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All |
| 7 * rights reserved. | 7 * rights reserved. |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
| 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
| (...skipping 3014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3025 SetReadyState(kComplete); | 3025 SetReadyState(kComplete); |
| 3026 CheckCompleted(); | 3026 CheckCompleted(); |
| 3027 } | 3027 } |
| 3028 | 3028 |
| 3029 void Document::ImplicitClose() { | 3029 void Document::ImplicitClose() { |
| 3030 DCHECK(!InStyleRecalc()); | 3030 DCHECK(!InStyleRecalc()); |
| 3031 DCHECK(parser_); | 3031 DCHECK(parser_); |
| 3032 | 3032 |
| 3033 load_event_progress_ = kLoadEventInProgress; | 3033 load_event_progress_ = kLoadEventInProgress; |
| 3034 | 3034 |
| 3035 ScriptableDocumentParser* parser = GetScriptableDocumentParser(); | |
| 3036 well_formed_ = parser && parser->WellFormed(); | |
| 3037 | |
| 3038 // We have to clear the parser, in case someone document.write()s from the | 3035 // We have to clear the parser, in case someone document.write()s from the |
| 3039 // onLoad event handler, as in Radar 3206524. | 3036 // onLoad event handler, as in Radar 3206524. |
| 3040 DetachParser(); | 3037 DetachParser(); |
| 3041 | 3038 |
| 3042 if (GetFrame() && CanExecuteScripts(kNotAboutToExecuteScript)) { | 3039 if (GetFrame() && CanExecuteScripts(kNotAboutToExecuteScript)) { |
| 3043 ImageLoader::DispatchPendingLoadEvents(); | 3040 ImageLoader::DispatchPendingLoadEvents(); |
| 3044 ImageLoader::DispatchPendingErrorEvents(); | 3041 ImageLoader::DispatchPendingErrorEvents(); |
| 3045 } | 3042 } |
| 3046 | 3043 |
| 3047 // JS running below could remove the frame or destroy the LayoutView so we | 3044 // JS running below could remove the frame or destroy the LayoutView so we |
| (...skipping 2446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5494 DispatchEvent(Event::CreateBubble(EventTypeNames::DOMContentLoaded)); | 5491 DispatchEvent(Event::CreateBubble(EventTypeNames::DOMContentLoaded)); |
| 5495 if (!document_timing_.DomContentLoadedEventEnd()) | 5492 if (!document_timing_.DomContentLoadedEventEnd()) |
| 5496 document_timing_.MarkDomContentLoadedEventEnd(); | 5493 document_timing_.MarkDomContentLoadedEventEnd(); |
| 5497 SetParsingState(kFinishedParsing); | 5494 SetParsingState(kFinishedParsing); |
| 5498 | 5495 |
| 5499 // Ensure Custom Element callbacks are drained before DOMContentLoaded. | 5496 // Ensure Custom Element callbacks are drained before DOMContentLoaded. |
| 5500 // FIXME: Remove this ad-hoc checkpoint when DOMContentLoaded is dispatched in | 5497 // FIXME: Remove this ad-hoc checkpoint when DOMContentLoaded is dispatched in |
| 5501 // a queued task, which will do a checkpoint anyway. https://crbug.com/425790 | 5498 // a queued task, which will do a checkpoint anyway. https://crbug.com/425790 |
| 5502 Microtask::PerformCheckpoint(V8PerIsolateData::MainThreadIsolate()); | 5499 Microtask::PerformCheckpoint(V8PerIsolateData::MainThreadIsolate()); |
| 5503 | 5500 |
| 5501 ScriptableDocumentParser* parser = GetScriptableDocumentParser(); |
| 5502 well_formed_ = parser && parser->WellFormed(); |
| 5503 |
| 5504 if (LocalFrame* frame = this->GetFrame()) { | 5504 if (LocalFrame* frame = this->GetFrame()) { |
| 5505 // Don't update the layout tree if we haven't requested the main resource | 5505 // Don't update the layout tree if we haven't requested the main resource |
| 5506 // yet to avoid adding extra latency. Note that the first layout tree update | 5506 // yet to avoid adding extra latency. Note that the first layout tree update |
| 5507 // can be expensive since it triggers the parsing of the default stylesheets | 5507 // can be expensive since it triggers the parsing of the default stylesheets |
| 5508 // which are compiled-in. | 5508 // which are compiled-in. |
| 5509 const bool main_resource_was_already_requested = | 5509 const bool main_resource_was_already_requested = |
| 5510 frame->Loader().StateMachine()->CommittedFirstRealDocumentLoad(); | 5510 frame->Loader().StateMachine()->CommittedFirstRealDocumentLoad(); |
| 5511 | 5511 |
| 5512 // FrameLoader::finishedParsing() might end up calling | 5512 // FrameLoader::finishedParsing() might end up calling |
| 5513 // Document::implicitClose() if all resource loads are | 5513 // Document::implicitClose() if all resource loads are |
| (...skipping 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6814 } | 6814 } |
| 6815 | 6815 |
| 6816 void showLiveDocumentInstances() { | 6816 void showLiveDocumentInstances() { |
| 6817 WeakDocumentSet& set = liveDocumentSet(); | 6817 WeakDocumentSet& set = liveDocumentSet(); |
| 6818 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6818 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 6819 for (blink::Document* document : set) | 6819 for (blink::Document* document : set) |
| 6820 fprintf(stderr, "- Document %p URL: %s\n", document, | 6820 fprintf(stderr, "- Document %p URL: %s\n", document, |
| 6821 document->Url().GetString().Utf8().data()); | 6821 document->Url().GetString().Utf8().data()); |
| 6822 } | 6822 } |
| 6823 #endif | 6823 #endif |
| OLD | NEW |