OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2011 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
662 // origin is inherited from the document that loaded the URL. | 662 // origin is inherited from the document that loaded the URL. |
663 if (Document::ShouldInheritSecurityOriginFromOwner(Url())) { | 663 if (Document::ShouldInheritSecurityOriginFromOwner(Url())) { |
664 Frame* owner_frame = frame_->Tree().Parent(); | 664 Frame* owner_frame = frame_->Tree().Parent(); |
665 if (!owner_frame) | 665 if (!owner_frame) |
666 owner_frame = frame_->Loader().Opener(); | 666 owner_frame = frame_->Loader().Opener(); |
667 if (owner_frame && owner_frame->IsLocalFrame()) | 667 if (owner_frame && owner_frame->IsLocalFrame()) |
668 owner = ToLocalFrame(owner_frame)->GetDocument(); | 668 owner = ToLocalFrame(owner_frame)->GetDocument(); |
669 } | 669 } |
670 DocumentInit init(owner, Url(), frame_); | 670 DocumentInit init(owner, Url(), frame_); |
671 init.WithNewRegistrationContext(); | 671 init.WithNewRegistrationContext(); |
672 frame_->Loader().Clear(); | |
673 DCHECK(frame_->GetPage()); | 672 DCHECK(frame_->GetPage()); |
674 | 673 |
675 ParserSynchronizationPolicy parsing_policy = kAllowAsynchronousParsing; | 674 ParserSynchronizationPolicy parsing_policy = kAllowAsynchronousParsing; |
676 if ((substitute_data_.IsValid() && substitute_data_.ForceSynchronousLoad()) || | 675 if ((substitute_data_.IsValid() && substitute_data_.ForceSynchronousLoad()) || |
677 !Document::ThreadedParsingEnabledForTesting()) | 676 !Document::ThreadedParsingEnabledForTesting()) |
678 parsing_policy = kForceSynchronousParsing; | 677 parsing_policy = kForceSynchronousParsing; |
679 | 678 |
680 InstallNewDocument(init, mime_type, encoding, | 679 InstallNewDocument(init, mime_type, encoding, |
681 InstallNewDocumentReason::kNavigation, parsing_policy, | 680 InstallNewDocumentReason::kNavigation, parsing_policy, |
682 overriding_url); | 681 overriding_url); |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1045 const DocumentInit& init, | 1044 const DocumentInit& init, |
1046 const AtomicString& mime_type, | 1045 const AtomicString& mime_type, |
1047 const AtomicString& encoding, | 1046 const AtomicString& encoding, |
1048 InstallNewDocumentReason reason, | 1047 InstallNewDocumentReason reason, |
1049 ParserSynchronizationPolicy parsing_policy, | 1048 ParserSynchronizationPolicy parsing_policy, |
1050 const KURL& overriding_url) { | 1049 const KURL& overriding_url) { |
1051 DCHECK_EQ(init.GetFrame(), frame_); | 1050 DCHECK_EQ(init.GetFrame(), frame_); |
1052 DCHECK(!frame_->GetDocument() || !frame_->GetDocument()->IsActive()); | 1051 DCHECK(!frame_->GetDocument() || !frame_->GetDocument()->IsActive()); |
1053 DCHECK_EQ(frame_->Tree().ChildCount(), 0u); | 1052 DCHECK_EQ(frame_->Tree().ChildCount(), 0u); |
1054 | 1053 |
1054 if (GetFrameLoader().StateMachine()->IsDisplayingInitialEmptyDocument()) { | |
1055 GetFrameLoader().StateMachine()->AdvanceTo( | |
1056 FrameLoaderStateMachine::kCommittedFirstRealLoad); | |
Nate Chapin
2017/05/17 18:18:59
This feels like a slightly weird place for this, b
dcheng
2017/05/22 21:23:26
Hmm... I think this is OK.
| |
1057 } | |
1058 | |
1055 SecurityOrigin* previous_security_origin = nullptr; | 1059 SecurityOrigin* previous_security_origin = nullptr; |
1056 if (frame_->GetDocument()) | 1060 if (frame_->GetDocument()) |
1057 previous_security_origin = frame_->GetDocument()->GetSecurityOrigin(); | 1061 previous_security_origin = frame_->GetDocument()->GetSecurityOrigin(); |
1058 | 1062 |
1059 if (!init.ShouldReuseDefaultView()) | 1063 if (!init.ShouldReuseDefaultView()) |
1060 frame_->SetDOMWindow(LocalDOMWindow::Create(*frame_)); | 1064 frame_->SetDOMWindow(LocalDOMWindow::Create(*frame_)); |
1061 | 1065 |
1062 Document* document = frame_->DomWindow()->InstallNewDocument(mime_type, init); | 1066 Document* document = frame_->DomWindow()->InstallNewDocument(mime_type, init); |
1063 | 1067 |
1064 if (ShouldClearWindowName(*frame_, previous_security_origin, *document)) { | 1068 if (ShouldClearWindowName(*frame_, previous_security_origin, *document)) { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1108 InstallNewDocumentReason::kJavascriptURL, | 1112 InstallNewDocumentReason::kJavascriptURL, |
1109 kForceSynchronousParsing, KURL()); | 1113 kForceSynchronousParsing, KURL()); |
1110 if (!source.IsNull()) | 1114 if (!source.IsNull()) |
1111 writer_->AppendReplacingData(source); | 1115 writer_->AppendReplacingData(source); |
1112 EndWriting(); | 1116 EndWriting(); |
1113 } | 1117 } |
1114 | 1118 |
1115 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); | 1119 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); |
1116 | 1120 |
1117 } // namespace blink | 1121 } // namespace blink |
OLD | NEW |