OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights |
3 * reserved. | 3 * reserved. |
4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
6 * (http://www.torchmobile.com/) | 6 * (http://www.torchmobile.com/) |
7 * Copyright (C) 2008 Alp Toker <alp@atoker.com> | 7 * Copyright (C) 2008 Alp Toker <alp@atoker.com> |
8 * Copyright (C) Research In Motion Limited 2009. All rights reserved. | 8 * Copyright (C) Research In Motion Limited 2009. All rights reserved. |
9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> | 9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> |
10 * Copyright (C) 2011 Google Inc. All rights reserved. | 10 * Copyright (C) 2011 Google Inc. All rights reserved. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
71 #include "core/loader/ProgressTracker.h" | 71 #include "core/loader/ProgressTracker.h" |
72 #include "core/loader/appcache/ApplicationCacheHost.h" | 72 #include "core/loader/appcache/ApplicationCacheHost.h" |
73 #include "core/page/ChromeClient.h" | 73 #include "core/page/ChromeClient.h" |
74 #include "core/page/CreateWindow.h" | 74 #include "core/page/CreateWindow.h" |
75 #include "core/page/FrameTree.h" | 75 #include "core/page/FrameTree.h" |
76 #include "core/page/Page.h" | 76 #include "core/page/Page.h" |
77 #include "core/page/scrolling/ScrollingCoordinator.h" | 77 #include "core/page/scrolling/ScrollingCoordinator.h" |
78 #include "core/probe/CoreProbes.h" | 78 #include "core/probe/CoreProbes.h" |
79 #include "core/svg/graphics/SVGImage.h" | 79 #include "core/svg/graphics/SVGImage.h" |
80 #include "core/xml/parser/XMLDocumentParser.h" | 80 #include "core/xml/parser/XMLDocumentParser.h" |
81 #include "platform/Histogram.h" | |
81 #include "platform/InstanceCounters.h" | 82 #include "platform/InstanceCounters.h" |
82 #include "platform/PluginScriptForbiddenScope.h" | 83 #include "platform/PluginScriptForbiddenScope.h" |
83 #include "platform/ScriptForbiddenScope.h" | 84 #include "platform/ScriptForbiddenScope.h" |
84 #include "platform/WebFrameScheduler.h" | 85 #include "platform/WebFrameScheduler.h" |
85 #include "platform/bindings/DOMWrapperWorld.h" | 86 #include "platform/bindings/DOMWrapperWorld.h" |
86 #include "platform/instrumentation/tracing/TraceEvent.h" | 87 #include "platform/instrumentation/tracing/TraceEvent.h" |
87 #include "platform/loader/fetch/ResourceFetcher.h" | 88 #include "platform/loader/fetch/ResourceFetcher.h" |
88 #include "platform/loader/fetch/ResourceRequest.h" | 89 #include "platform/loader/fetch/ResourceRequest.h" |
89 #include "platform/network/HTTPParsers.h" | 90 #include "platform/network/HTTPParsers.h" |
90 #include "platform/network/NetworkUtils.h" | 91 #include "platform/network/NetworkUtils.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
188 !browser_side_navigation_enabled && | 189 !browser_side_navigation_enabled && |
189 !frame->GetDocument()->GetContentSecurityPolicy()->AllowFormAction( | 190 !frame->GetDocument()->GetContentSecurityPolicy()->AllowFormAction( |
190 request.Url(), request.GetRedirectStatus(), | 191 request.Url(), request.GetRedirectStatus(), |
191 SecurityViolationReportingPolicy::kReport, check_header_type)) { | 192 SecurityViolationReportingPolicy::kReport, check_header_type)) { |
192 return kNavigationPolicyIgnore; | 193 return kNavigationPolicyIgnore; |
193 } | 194 } |
194 | 195 |
195 return policy; | 196 return policy; |
196 } | 197 } |
197 | 198 |
199 static SinglePageAppNavigationType CategorizeSinglePageAppNavigation( | |
200 SameDocumentNavigationSource same_document_navigation_source, | |
201 FrameLoadType frame_load_type) { | |
202 // |SinglePageAppNavigationType| falls into this grid according to different | |
203 // combinations of |FrameLoadType| and |SameDocumentNavigationSource|: | |
204 // | |
205 // HistoryApi Default | |
206 // kFrameLoadTypeBackForward illegal otherFragmentNav | |
207 // !kFrameLoadTypeBackForward sameDocBack/Forward historyPushOrReplace | |
208 switch (same_document_navigation_source) { | |
209 case kSameDocumentNavigationDefault: | |
210 if (frame_load_type == kFrameLoadTypeBackForward) { | |
211 return kSPANavTypeSameDocumentBackwardOrForward; | |
212 } | |
213 return kSPANavTypeOtherFragmentNavigation; | |
214 case kSameDocumentNavigationHistoryApi: | |
215 // It's illegal to have both kSameDocumentNavigationHistoryApi and | |
216 // kFrameLoadTypeBackForward. | |
217 DCHECK(frame_load_type != kFrameLoadTypeBackForward); | |
218 return kSPANavTypeHistoryPushStateOrReplaceState; | |
219 default: | |
Liquan (Max) Gu
2017/07/04 18:37:39
Compiling failed because of CQ build's warning "no
tdresser
2017/07/04 18:42:39
DCHECK(false) -> NOTREACHED()
I don't think you n
Liquan (Max) Gu
2017/07/04 18:52:04
Done.
| |
220 // unreachable | |
221 DCHECK(false); | |
222 } | |
223 } | |
224 | |
198 ResourceRequest FrameLoader::ResourceRequestForReload( | 225 ResourceRequest FrameLoader::ResourceRequestForReload( |
199 FrameLoadType frame_load_type, | 226 FrameLoadType frame_load_type, |
200 const KURL& override_url, | 227 const KURL& override_url, |
201 ClientRedirectPolicy client_redirect_policy) { | 228 ClientRedirectPolicy client_redirect_policy) { |
202 DCHECK(IsReloadLoadType(frame_load_type)); | 229 DCHECK(IsReloadLoadType(frame_load_type)); |
203 WebCachePolicy cache_policy = | 230 WebCachePolicy cache_policy = |
204 frame_load_type == kFrameLoadTypeReloadBypassingCache | 231 frame_load_type == kFrameLoadTypeReloadBypassingCache |
205 ? WebCachePolicy::kBypassingCache | 232 ? WebCachePolicy::kBypassingCache |
206 : WebCachePolicy::kValidatingCacheData; | 233 : WebCachePolicy::kValidatingCacheData; |
207 if (!document_loader_ || !document_loader_->GetHistoryItem()) | 234 if (!document_loader_ || !document_loader_->GetHistoryItem()) |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
484 return allowed; | 511 return allowed; |
485 } | 512 } |
486 | 513 |
487 void FrameLoader::UpdateForSameDocumentNavigation( | 514 void FrameLoader::UpdateForSameDocumentNavigation( |
488 const KURL& new_url, | 515 const KURL& new_url, |
489 SameDocumentNavigationSource same_document_navigation_source, | 516 SameDocumentNavigationSource same_document_navigation_source, |
490 PassRefPtr<SerializedScriptValue> data, | 517 PassRefPtr<SerializedScriptValue> data, |
491 HistoryScrollRestorationType scroll_restoration_type, | 518 HistoryScrollRestorationType scroll_restoration_type, |
492 FrameLoadType type, | 519 FrameLoadType type, |
493 Document* initiating_document) { | 520 Document* initiating_document) { |
521 SinglePageAppNavigationType single_page_app_navigation_type = | |
522 CategorizeSinglePageAppNavigation(same_document_navigation_source, type); | |
523 UMA_HISTOGRAM_ENUMERATION( | |
524 "RendererScheduler.UpdateForSameDocumentNavigationCount", | |
525 single_page_app_navigation_type, kSPANavTypeCount); | |
526 | |
494 TRACE_EVENT1("blink", "FrameLoader::updateForSameDocumentNavigation", "url", | 527 TRACE_EVENT1("blink", "FrameLoader::updateForSameDocumentNavigation", "url", |
495 new_url.GetString().Ascii().data()); | 528 new_url.GetString().Ascii().data()); |
496 | 529 |
497 // Generate start and stop notifications only when loader is completed so that | 530 // Generate start and stop notifications only when loader is completed so that |
498 // we don't fire them for fragment redirection that happens in window.onload | 531 // we don't fire them for fragment redirection that happens in window.onload |
499 // handler. See https://bugs.webkit.org/show_bug.cgi?id=31838 | 532 // handler. See https://bugs.webkit.org/show_bug.cgi?id=31838 |
500 // Do not fire the notifications if the frame is concurrently navigating away | 533 // Do not fire the notifications if the frame is concurrently navigating away |
501 // from the document, since a new document is already loading. | 534 // from the document, since a new document is already loading. |
502 bool was_loading = frame_->IsLoading(); | 535 bool was_loading = frame_->IsLoading(); |
503 if (!was_loading) | 536 if (!was_loading) |
(...skipping 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1699 // TODO(japhet): This is needed because the browser process DCHECKs if the | 1732 // TODO(japhet): This is needed because the browser process DCHECKs if the |
1700 // first entry we commit in a new frame has replacement set. It's unclear | 1733 // first entry we commit in a new frame has replacement set. It's unclear |
1701 // whether the DCHECK is right, investigate removing this special case. | 1734 // whether the DCHECK is right, investigate removing this special case. |
1702 bool replace_current_item = load_type == kFrameLoadTypeReplaceCurrentItem && | 1735 bool replace_current_item = load_type == kFrameLoadTypeReplaceCurrentItem && |
1703 (!Opener() || !request.Url().IsEmpty()); | 1736 (!Opener() || !request.Url().IsEmpty()); |
1704 loader->SetReplacesCurrentHistoryItem(replace_current_item); | 1737 loader->SetReplacesCurrentHistoryItem(replace_current_item); |
1705 return loader; | 1738 return loader; |
1706 } | 1739 } |
1707 | 1740 |
1708 } // namespace blink | 1741 } // namespace blink |
OLD | NEW |