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

Side by Side Diff: Source/core/loader/FrameLoader.cpp

Issue 339593005: Set the target type when creating the request for main resource (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Switched to constructors Created 6 years, 6 months 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 | « Source/core/inspector/InspectorOverlay.cpp ('k') | Source/core/loader/NavigationScheduler.cpp » ('j') | 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) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
6 * Copyright (C) Research In Motion Limited 2009. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2009. All rights reserved.
7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> 7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com>
8 * Copyright (C) 2011 Google Inc. All rights reserved. 8 * Copyright (C) 2011 Google Inc. All rights reserved.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 763
764 void FrameLoader::reportLocalLoadFailed(LocalFrame* frame, const String& url) 764 void FrameLoader::reportLocalLoadFailed(LocalFrame* frame, const String& url)
765 { 765 {
766 ASSERT(!url.isEmpty()); 766 ASSERT(!url.isEmpty());
767 if (!frame) 767 if (!frame)
768 return; 768 return;
769 769
770 frame->document()->addConsoleMessage(SecurityMessageSource, ErrorMessageLeve l, "Not allowed to load local resource: " + url); 770 frame->document()->addConsoleMessage(SecurityMessageSource, ErrorMessageLeve l, "Not allowed to load local resource: " + url);
771 } 771 }
772 772
773 static ResourceRequest requestFromHistoryItem(HistoryItem* item, ResourceRequest CachePolicy cachePolicy) 773 static ResourceRequest requestFromHistoryItem(HistoryItem* item, ResourceRequest CachePolicy cachePolicy, Frame* frame)
774 { 774 {
775 RefPtr<FormData> formData = item->formData(); 775 RefPtr<FormData> formData = item->formData();
776 ResourceRequest request(item->url(), item->referrer()); 776 ResourceRequest request = ResourceRequest(item->url(), frame->isMainFrame(), item->referrer());
777 request.setCachePolicy(cachePolicy); 777 request.setCachePolicy(cachePolicy);
778 if (formData) { 778 if (formData) {
779 request.setHTTPMethod("POST"); 779 request.setHTTPMethod("POST");
780 request.setHTTPBody(formData); 780 request.setHTTPBody(formData);
781 request.setHTTPContentType(item->formContentType()); 781 request.setHTTPContentType(item->formContentType());
782 RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::createFromString (item->referrer().referrer); 782 RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::createFromString (item->referrer().referrer);
783 FrameLoader::addHTTPOriginIfNeeded(request, securityOrigin->toAtomicStri ng()); 783 FrameLoader::addHTTPOriginIfNeeded(request, securityOrigin->toAtomicStri ng());
784 } 784 }
785 return request; 785 return request;
786 } 786 }
787 787
788 void FrameLoader::reload(ReloadPolicy reloadPolicy, const KURL& overrideURL, con st AtomicString& overrideEncoding) 788 void FrameLoader::reload(ReloadPolicy reloadPolicy, const KURL& overrideURL, con st AtomicString& overrideEncoding)
789 { 789 {
790 if (!m_currentItem) 790 if (!m_currentItem)
791 return; 791 return;
792 792
793 ResourceRequestCachePolicy cachePolicy = reloadPolicy == EndToEndReload ? Re loadBypassingCache : ReloadIgnoringCacheData; 793 ResourceRequestCachePolicy cachePolicy = reloadPolicy == EndToEndReload ? Re loadBypassingCache : ReloadIgnoringCacheData;
794 ResourceRequest request = requestFromHistoryItem(m_currentItem.get(), cacheP olicy); 794 ResourceRequest request = requestFromHistoryItem(m_currentItem.get(), cacheP olicy, m_frame);
795 if (!overrideURL.isEmpty()) { 795 if (!overrideURL.isEmpty()) {
796 request.setURL(overrideURL); 796 request.setURL(overrideURL);
797 request.clearHTTPReferrer(); 797 request.clearHTTPReferrer();
798 } 798 }
799 799
800 FrameLoadType type = reloadPolicy == EndToEndReload ? FrameLoadTypeReloadFro mOrigin : FrameLoadTypeReload; 800 FrameLoadType type = reloadPolicy == EndToEndReload ? FrameLoadTypeReloadFro mOrigin : FrameLoadTypeReload;
801 loadWithNavigationAction(NavigationAction(request, type), type, nullptr, Sub stituteData(), CheckContentSecurityPolicy, NotClientRedirect, overrideEncoding); 801 loadWithNavigationAction(NavigationAction(request, type), type, nullptr, Sub stituteData(), CheckContentSecurityPolicy, NotClientRedirect, overrideEncoding);
802 } 802 }
803 803
804 void FrameLoader::stopAllLoaders() 804 void FrameLoader::stopAllLoaders()
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
1431 m_deferredHistoryLoad = DeferredHistoryLoad(item, historyLoadType, cache Policy); 1431 m_deferredHistoryLoad = DeferredHistoryLoad(item, historyLoadType, cache Policy);
1432 return; 1432 return;
1433 } 1433 }
1434 1434
1435 m_provisionalItem = item; 1435 m_provisionalItem = item;
1436 if (historyLoadType == HistorySameDocumentLoad) { 1436 if (historyLoadType == HistorySameDocumentLoad) {
1437 loadInSameDocument(item->url(), item->stateObject(), FrameLoadTypeBackFo rward, NotClientRedirect); 1437 loadInSameDocument(item->url(), item->stateObject(), FrameLoadTypeBackFo rward, NotClientRedirect);
1438 restoreScrollPositionAndViewState(); 1438 restoreScrollPositionAndViewState();
1439 return; 1439 return;
1440 } 1440 }
1441 loadWithNavigationAction(NavigationAction(requestFromHistoryItem(item, cache Policy), FrameLoadTypeBackForward), FrameLoadTypeBackForward, nullptr, Substitut eData(), CheckContentSecurityPolicy); 1441 loadWithNavigationAction(NavigationAction(requestFromHistoryItem(item, cache Policy, m_frame),
1442 FrameLoadTypeBackForward), FrameLoadTypeBackForward, nullptr, Substitute Data(), CheckContentSecurityPolicy);
1442 } 1443 }
1443 1444
1444 void FrameLoader::dispatchDocumentElementAvailable() 1445 void FrameLoader::dispatchDocumentElementAvailable()
1445 { 1446 {
1446 client()->documentElementAvailable(); 1447 client()->documentElementAvailable();
1447 } 1448 }
1448 1449
1449 void FrameLoader::dispatchDidClearDocumentOfWindowObject() 1450 void FrameLoader::dispatchDidClearDocumentOfWindowObject()
1450 { 1451 {
1451 if (!m_frame->script().canExecuteScripts(NotAboutToExecuteScript)) 1452 if (!m_frame->script().canExecuteScripts(NotAboutToExecuteScript))
(...skipping 22 matching lines...) Expand all
1474 // FIXME: We need a way to propagate sandbox flags to out-of-process frames. 1475 // FIXME: We need a way to propagate sandbox flags to out-of-process frames.
1475 Frame* parentFrame = m_frame->tree().parent(); 1476 Frame* parentFrame = m_frame->tree().parent();
1476 if (parentFrame && parentFrame->isLocalFrame()) 1477 if (parentFrame && parentFrame->isLocalFrame())
1477 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags(); 1478 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags();
1478 if (FrameOwner* frameOwner = m_frame->owner()) 1479 if (FrameOwner* frameOwner = m_frame->owner())
1479 flags |= frameOwner->sandboxFlags(); 1480 flags |= frameOwner->sandboxFlags();
1480 return flags; 1481 return flags;
1481 } 1482 }
1482 1483
1483 } // namespace WebCore 1484 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorOverlay.cpp ('k') | Source/core/loader/NavigationScheduler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698