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 } |
| 220 NOTREACHED(); |
| 221 return kSPANavTypeSameDocumentBackwardOrForward; |
| 222 } |
| 223 |
198 ResourceRequest FrameLoader::ResourceRequestForReload( | 224 ResourceRequest FrameLoader::ResourceRequestForReload( |
199 FrameLoadType frame_load_type, | 225 FrameLoadType frame_load_type, |
200 const KURL& override_url, | 226 const KURL& override_url, |
201 ClientRedirectPolicy client_redirect_policy) { | 227 ClientRedirectPolicy client_redirect_policy) { |
202 DCHECK(IsReloadLoadType(frame_load_type)); | 228 DCHECK(IsReloadLoadType(frame_load_type)); |
203 WebCachePolicy cache_policy = | 229 WebCachePolicy cache_policy = |
204 frame_load_type == kFrameLoadTypeReloadBypassingCache | 230 frame_load_type == kFrameLoadTypeReloadBypassingCache |
205 ? WebCachePolicy::kBypassingCache | 231 ? WebCachePolicy::kBypassingCache |
206 : WebCachePolicy::kValidatingCacheData; | 232 : WebCachePolicy::kValidatingCacheData; |
207 if (!document_loader_ || !document_loader_->GetHistoryItem()) | 233 if (!document_loader_ || !document_loader_->GetHistoryItem()) |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 return allowed; | 510 return allowed; |
485 } | 511 } |
486 | 512 |
487 void FrameLoader::UpdateForSameDocumentNavigation( | 513 void FrameLoader::UpdateForSameDocumentNavigation( |
488 const KURL& new_url, | 514 const KURL& new_url, |
489 SameDocumentNavigationSource same_document_navigation_source, | 515 SameDocumentNavigationSource same_document_navigation_source, |
490 PassRefPtr<SerializedScriptValue> data, | 516 PassRefPtr<SerializedScriptValue> data, |
491 HistoryScrollRestorationType scroll_restoration_type, | 517 HistoryScrollRestorationType scroll_restoration_type, |
492 FrameLoadType type, | 518 FrameLoadType type, |
493 Document* initiating_document) { | 519 Document* initiating_document) { |
| 520 SinglePageAppNavigationType single_page_app_navigation_type = |
| 521 CategorizeSinglePageAppNavigation(same_document_navigation_source, type); |
| 522 UMA_HISTOGRAM_ENUMERATION( |
| 523 "RendererScheduler.UpdateForSameDocumentNavigationCount", |
| 524 single_page_app_navigation_type, kSPANavTypeCount); |
| 525 |
494 TRACE_EVENT1("blink", "FrameLoader::updateForSameDocumentNavigation", "url", | 526 TRACE_EVENT1("blink", "FrameLoader::updateForSameDocumentNavigation", "url", |
495 new_url.GetString().Ascii().data()); | 527 new_url.GetString().Ascii().data()); |
496 | 528 |
497 // Generate start and stop notifications only when loader is completed so that | 529 // 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 | 530 // 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 | 531 // handler. See https://bugs.webkit.org/show_bug.cgi?id=31838 |
500 // Do not fire the notifications if the frame is concurrently navigating away | 532 // Do not fire the notifications if the frame is concurrently navigating away |
501 // from the document, since a new document is already loading. | 533 // from the document, since a new document is already loading. |
502 bool was_loading = frame_->IsLoading(); | 534 bool was_loading = frame_->IsLoading(); |
503 if (!was_loading) | 535 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 | 1731 // 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 | 1732 // 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. | 1733 // whether the DCHECK is right, investigate removing this special case. |
1702 bool replace_current_item = load_type == kFrameLoadTypeReplaceCurrentItem && | 1734 bool replace_current_item = load_type == kFrameLoadTypeReplaceCurrentItem && |
1703 (!Opener() || !request.Url().IsEmpty()); | 1735 (!Opener() || !request.Url().IsEmpty()); |
1704 loader->SetReplacesCurrentHistoryItem(replace_current_item); | 1736 loader->SetReplacesCurrentHistoryItem(replace_current_item); |
1705 return loader; | 1737 return loader; |
1706 } | 1738 } |
1707 | 1739 |
1708 } // namespace blink | 1740 } // namespace blink |
OLD | NEW |