| OLD | NEW |
| 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 Loading... |
| 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::createMainResourceRequest( |
| 777 item->url(), frame->isMainFrame(), item->referrer()); |
| 777 request.setCachePolicy(cachePolicy); | 778 request.setCachePolicy(cachePolicy); |
| 778 if (formData) { | 779 if (formData) { |
| 779 request.setHTTPMethod("POST"); | 780 request.setHTTPMethod("POST"); |
| 780 request.setHTTPBody(formData); | 781 request.setHTTPBody(formData); |
| 781 request.setHTTPContentType(item->formContentType()); | 782 request.setHTTPContentType(item->formContentType()); |
| 782 RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::createFromString
(item->referrer().referrer); | 783 RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::createFromString
(item->referrer().referrer); |
| 783 FrameLoader::addHTTPOriginIfNeeded(request, securityOrigin->toAtomicStri
ng()); | 784 FrameLoader::addHTTPOriginIfNeeded(request, securityOrigin->toAtomicStri
ng()); |
| 784 } | 785 } |
| 785 return request; | 786 return request; |
| 786 } | 787 } |
| 787 | 788 |
| 788 void FrameLoader::reload(ReloadPolicy reloadPolicy, const KURL& overrideURL, con
st AtomicString& overrideEncoding) | 789 void FrameLoader::reload(ReloadPolicy reloadPolicy, const KURL& overrideURL, con
st AtomicString& overrideEncoding) |
| 789 { | 790 { |
| 790 if (!m_currentItem) | 791 if (!m_currentItem) |
| 791 return; | 792 return; |
| 792 | 793 |
| 793 ResourceRequestCachePolicy cachePolicy = reloadPolicy == EndToEndReload ? Re
loadBypassingCache : ReloadIgnoringCacheData; | 794 ResourceRequestCachePolicy cachePolicy = reloadPolicy == EndToEndReload ? Re
loadBypassingCache : ReloadIgnoringCacheData; |
| 794 ResourceRequest request = requestFromHistoryItem(m_currentItem.get(), cacheP
olicy); | 795 ResourceRequest request = requestFromHistoryItem(m_currentItem.get(), cacheP
olicy, m_frame); |
| 795 if (!overrideURL.isEmpty()) { | 796 if (!overrideURL.isEmpty()) { |
| 796 request.setURL(overrideURL); | 797 request.setURL(overrideURL); |
| 797 request.clearHTTPReferrer(); | 798 request.clearHTTPReferrer(); |
| 798 } | 799 } |
| 799 | 800 |
| 800 FrameLoadType type = reloadPolicy == EndToEndReload ? FrameLoadTypeReloadFro
mOrigin : FrameLoadTypeReload; | 801 FrameLoadType type = reloadPolicy == EndToEndReload ? FrameLoadTypeReloadFro
mOrigin : FrameLoadTypeReload; |
| 801 loadWithNavigationAction(NavigationAction(request, type), type, nullptr, Sub
stituteData(), NotClientRedirect, overrideEncoding); | 802 loadWithNavigationAction(NavigationAction(request, type), type, nullptr, Sub
stituteData(), NotClientRedirect, overrideEncoding); |
| 802 } | 803 } |
| 803 | 804 |
| 804 void FrameLoader::stopAllLoaders() | 805 void FrameLoader::stopAllLoaders() |
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1431 m_deferredHistoryLoad = DeferredHistoryLoad(item, historyLoadType, cache
Policy); | 1432 m_deferredHistoryLoad = DeferredHistoryLoad(item, historyLoadType, cache
Policy); |
| 1432 return; | 1433 return; |
| 1433 } | 1434 } |
| 1434 | 1435 |
| 1435 m_provisionalItem = item; | 1436 m_provisionalItem = item; |
| 1436 if (historyLoadType == HistorySameDocumentLoad) { | 1437 if (historyLoadType == HistorySameDocumentLoad) { |
| 1437 loadInSameDocument(item->url(), item->stateObject(), FrameLoadTypeBackFo
rward, NotClientRedirect); | 1438 loadInSameDocument(item->url(), item->stateObject(), FrameLoadTypeBackFo
rward, NotClientRedirect); |
| 1438 restoreScrollPositionAndViewState(); | 1439 restoreScrollPositionAndViewState(); |
| 1439 return; | 1440 return; |
| 1440 } | 1441 } |
| 1441 loadWithNavigationAction(NavigationAction(requestFromHistoryItem(item, cache
Policy), FrameLoadTypeBackForward), FrameLoadTypeBackForward, nullptr, Substitut
eData()); | 1442 loadWithNavigationAction(NavigationAction(requestFromHistoryItem(item, cache
Policy, m_frame), FrameLoadTypeBackForward), FrameLoadTypeBackForward, nullptr,
SubstituteData()); |
| 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 Loading... |
| 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 |
| OLD | NEW |