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 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 } | 643 } |
644 | 644 |
645 // Always use the initiating document to generate the referrer. | 645 // Always use the initiating document to generate the referrer. |
646 // We need to generateReferrerHeader(), because we might not have enforced R
eferrerPolicy or https->http | 646 // We need to generateReferrerHeader(), because we might not have enforced R
eferrerPolicy or https->http |
647 // referrer suppression yet. | 647 // referrer suppression yet. |
648 String argsReferrer(request.httpReferrer()); | 648 String argsReferrer(request.httpReferrer()); |
649 if (argsReferrer.isEmpty()) | 649 if (argsReferrer.isEmpty()) |
650 argsReferrer = originDocument->outgoingReferrer(); | 650 argsReferrer = originDocument->outgoingReferrer(); |
651 String referrer = SecurityPolicy::generateReferrerHeader(originDocument->ref
errerPolicy(), request.url(), argsReferrer); | 651 String referrer = SecurityPolicy::generateReferrerHeader(originDocument->ref
errerPolicy(), request.url(), argsReferrer); |
652 | 652 |
653 request.setHTTPReferrer(referrer); | 653 request.setHTTPReferrer(AtomicString(referrer)); |
654 RefPtr<SecurityOrigin> referrerOrigin = SecurityOrigin::createFromString(ref
errer); | 654 RefPtr<SecurityOrigin> referrerOrigin = SecurityOrigin::createFromString(ref
errer); |
655 addHTTPOriginIfNeeded(request, referrerOrigin->toString()); | 655 addHTTPOriginIfNeeded(request, referrerOrigin->toAtomicString()); |
656 } | 656 } |
657 | 657 |
658 bool FrameLoader::isScriptTriggeredFormSubmissionInChildFrame(const FrameLoadReq
uest& request) const | 658 bool FrameLoader::isScriptTriggeredFormSubmissionInChildFrame(const FrameLoadReq
uest& request) const |
659 { | 659 { |
660 // If this is a child frame and the form submission was triggered by a scrip
t, lock the back/forward list | 660 // If this is a child frame and the form submission was triggered by a scrip
t, lock the back/forward list |
661 // to match IE and Opera. | 661 // to match IE and Opera. |
662 // See https://bugs.webkit.org/show_bug.cgi?id=32383 for the original motiva
tion for this. | 662 // See https://bugs.webkit.org/show_bug.cgi?id=32383 for the original motiva
tion for this. |
663 if (!m_frame->tree().parent() || UserGestureIndicator::processingUserGesture
()) | 663 if (!m_frame->tree().parent() || UserGestureIndicator::processingUserGesture
()) |
664 return false; | 664 return false; |
665 return request.formState() && request.formState()->formSubmissionTrigger() =
= SubmittedByJavaScript; | 665 return request.formState() && request.formState()->formSubmissionTrigger() =
= SubmittedByJavaScript; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 // Protect frame from getting blown away inside dispatchBeforeLoadEvent in l
oadWithDocumentLoader. | 713 // Protect frame from getting blown away inside dispatchBeforeLoadEvent in l
oadWithDocumentLoader. |
714 RefPtr<Frame> protect(m_frame); | 714 RefPtr<Frame> protect(m_frame); |
715 | 715 |
716 if (m_inStopAllLoaders) | 716 if (m_inStopAllLoaders) |
717 return; | 717 return; |
718 | 718 |
719 FrameLoadRequest request(passedRequest); | 719 FrameLoadRequest request(passedRequest); |
720 if (!prepareRequestForThisFrame(request)) | 720 if (!prepareRequestForThisFrame(request)) |
721 return; | 721 return; |
722 | 722 |
723 RefPtr<Frame> targetFrame = request.formState() ? 0 : findFrameForNavigation
(request.frameName(), request.formState() ? request.formState()->sourceDocument(
) : m_frame->document()); | 723 RefPtr<Frame> targetFrame = request.formState() ? 0 : findFrameForNavigation
(AtomicString(request.frameName()), request.formState() ? request.formState()->s
ourceDocument() : m_frame->document()); |
724 if (targetFrame && targetFrame != m_frame) { | 724 if (targetFrame && targetFrame != m_frame) { |
725 request.setFrameName("_self"); | 725 request.setFrameName("_self"); |
726 targetFrame->loader().load(request); | 726 targetFrame->loader().load(request); |
727 if (Page* page = targetFrame->page()) | 727 if (Page* page = targetFrame->page()) |
728 page->chrome().focus(); | 728 page->chrome().focus(); |
729 return; | 729 return; |
730 } | 730 } |
731 | 731 |
732 FrameLoadType newLoadType = determineFrameLoadType(request); | 732 FrameLoadType newLoadType = determineFrameLoadType(request); |
733 NavigationAction action(request.resourceRequest(), newLoadType, request.form
State(), request.triggeringEvent()); | 733 NavigationAction action(request.resourceRequest(), newLoadType, request.form
State(), request.triggeringEvent()); |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1168 // layer. | 1168 // layer. |
1169 if (request.httpMethod() == "GET" || request.httpMethod() == "HEAD") | 1169 if (request.httpMethod() == "GET" || request.httpMethod() == "HEAD") |
1170 return; | 1170 return; |
1171 | 1171 |
1172 // For non-GET and non-HEAD methods, always send an Origin header so the | 1172 // For non-GET and non-HEAD methods, always send an Origin header so the |
1173 // server knows we support this feature. | 1173 // server knows we support this feature. |
1174 | 1174 |
1175 if (origin.isEmpty()) { | 1175 if (origin.isEmpty()) { |
1176 // If we don't know what origin header to attach, we attach the value | 1176 // If we don't know what origin header to attach, we attach the value |
1177 // for an empty origin. | 1177 // for an empty origin. |
1178 request.setHTTPOrigin(SecurityOrigin::createUnique()->toString()); | 1178 request.setHTTPOrigin(SecurityOrigin::createUnique()->toAtomicString()); |
1179 return; | 1179 return; |
1180 } | 1180 } |
1181 | 1181 |
1182 request.setHTTPOrigin(origin); | 1182 request.setHTTPOrigin(origin); |
1183 } | 1183 } |
1184 | 1184 |
1185 const ResourceRequest& FrameLoader::originalRequest() const | 1185 const ResourceRequest& FrameLoader::originalRequest() const |
1186 { | 1186 { |
1187 return activeDocumentLoader()->originalRequestCopy(); | 1187 return activeDocumentLoader()->originalRequestCopy(); |
1188 } | 1188 } |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1366 m_provisionalDocumentLoader->appendRedirect(m_provisionalDocumentLoader->req
uest().url()); | 1366 m_provisionalDocumentLoader->appendRedirect(m_provisionalDocumentLoader->req
uest().url()); |
1367 m_client->dispatchDidStartProvisionalLoad(); | 1367 m_client->dispatchDidStartProvisionalLoad(); |
1368 ASSERT(m_provisionalDocumentLoader); | 1368 ASSERT(m_provisionalDocumentLoader); |
1369 m_provisionalDocumentLoader->startLoadingMainResource(); | 1369 m_provisionalDocumentLoader->startLoadingMainResource(); |
1370 } | 1370 } |
1371 | 1371 |
1372 void FrameLoader::applyUserAgent(ResourceRequest& request) | 1372 void FrameLoader::applyUserAgent(ResourceRequest& request) |
1373 { | 1373 { |
1374 String userAgent = this->userAgent(request.url()); | 1374 String userAgent = this->userAgent(request.url()); |
1375 ASSERT(!userAgent.isNull()); | 1375 ASSERT(!userAgent.isNull()); |
1376 request.setHTTPUserAgent(userAgent); | 1376 request.setHTTPUserAgent(AtomicString(userAgent)); |
1377 } | 1377 } |
1378 | 1378 |
1379 bool FrameLoader::shouldInterruptLoadForXFrameOptions(const String& content, con
st KURL& url, unsigned long requestIdentifier) | 1379 bool FrameLoader::shouldInterruptLoadForXFrameOptions(const String& content, con
st KURL& url, unsigned long requestIdentifier) |
1380 { | 1380 { |
1381 UseCounter::count(m_frame->domWindow(), UseCounter::XFrameOptions); | 1381 UseCounter::count(m_frame->domWindow(), UseCounter::XFrameOptions); |
1382 | 1382 |
1383 Frame* topFrame = m_frame->tree().top(); | 1383 Frame* topFrame = m_frame->tree().top(); |
1384 if (m_frame == topFrame) | 1384 if (m_frame == topFrame) |
1385 return false; | 1385 return false; |
1386 | 1386 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1475 } | 1475 } |
1476 | 1476 |
1477 RefPtr<FormData> formData = item->formData(); | 1477 RefPtr<FormData> formData = item->formData(); |
1478 ResourceRequest request(item->url()); | 1478 ResourceRequest request(item->url()); |
1479 request.setHTTPReferrer(item->referrer()); | 1479 request.setHTTPReferrer(item->referrer()); |
1480 if (formData) { | 1480 if (formData) { |
1481 request.setHTTPMethod("POST"); | 1481 request.setHTTPMethod("POST"); |
1482 request.setHTTPBody(formData); | 1482 request.setHTTPBody(formData); |
1483 request.setHTTPContentType(item->formContentType()); | 1483 request.setHTTPContentType(item->formContentType()); |
1484 RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::createFromString
(item->referrer()); | 1484 RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::createFromString
(item->referrer()); |
1485 addHTTPOriginIfNeeded(request, securityOrigin->toString()); | 1485 addHTTPOriginIfNeeded(request, securityOrigin->toAtomicString()); |
1486 } | 1486 } |
1487 | 1487 |
1488 loadWithNavigationAction(NavigationAction(request, FrameLoadTypeBackForward,
formData), FrameLoadTypeBackForward, 0, SubstituteData()); | 1488 loadWithNavigationAction(NavigationAction(request, FrameLoadTypeBackForward,
formData), FrameLoadTypeBackForward, 0, SubstituteData()); |
1489 } | 1489 } |
1490 | 1490 |
1491 void FrameLoader::dispatchDocumentElementAvailable() | 1491 void FrameLoader::dispatchDocumentElementAvailable() |
1492 { | 1492 { |
1493 m_client->documentElementAvailable(); | 1493 m_client->documentElementAvailable(); |
1494 } | 1494 } |
1495 | 1495 |
(...skipping 25 matching lines...) Expand all Loading... |
1521 { | 1521 { |
1522 SandboxFlags flags = m_forcedSandboxFlags; | 1522 SandboxFlags flags = m_forcedSandboxFlags; |
1523 if (Frame* parentFrame = m_frame->tree().parent()) | 1523 if (Frame* parentFrame = m_frame->tree().parent()) |
1524 flags |= parentFrame->document()->sandboxFlags(); | 1524 flags |= parentFrame->document()->sandboxFlags(); |
1525 if (HTMLFrameOwnerElement* ownerElement = m_frame->ownerElement()) | 1525 if (HTMLFrameOwnerElement* ownerElement = m_frame->ownerElement()) |
1526 flags |= ownerElement->sandboxFlags(); | 1526 flags |= ownerElement->sandboxFlags(); |
1527 return flags; | 1527 return flags; |
1528 } | 1528 } |
1529 | 1529 |
1530 } // namespace WebCore | 1530 } // namespace WebCore |
OLD | NEW |