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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 #include "core/fetch/ResourceLoader.h" | 50 #include "core/fetch/ResourceLoader.h" |
51 #include "core/frame/LocalDOMWindow.h" | 51 #include "core/frame/LocalDOMWindow.h" |
52 #include "core/frame/FrameHost.h" | 52 #include "core/frame/FrameHost.h" |
53 #include "core/frame/FrameView.h" | 53 #include "core/frame/FrameView.h" |
54 #include "core/frame/LocalFrame.h" | 54 #include "core/frame/LocalFrame.h" |
55 #include "core/frame/PinchViewport.h" | 55 #include "core/frame/PinchViewport.h" |
56 #include "core/frame/csp/ContentSecurityPolicy.h" | 56 #include "core/frame/csp/ContentSecurityPolicy.h" |
57 #include "core/html/HTMLFormElement.h" | 57 #include "core/html/HTMLFormElement.h" |
58 #include "core/html/HTMLFrameOwnerElement.h" | 58 #include "core/html/HTMLFrameOwnerElement.h" |
59 #include "core/html/parser/HTMLParserIdioms.h" | 59 #include "core/html/parser/HTMLParserIdioms.h" |
| 60 #include "core/inspector/ConsoleMessage.h" |
60 #include "core/inspector/InspectorController.h" | 61 #include "core/inspector/InspectorController.h" |
61 #include "core/inspector/InspectorInstrumentation.h" | 62 #include "core/inspector/InspectorInstrumentation.h" |
62 #include "core/loader/DocumentLoadTiming.h" | 63 #include "core/loader/DocumentLoadTiming.h" |
63 #include "core/loader/DocumentLoader.h" | 64 #include "core/loader/DocumentLoader.h" |
64 #include "core/loader/FormState.h" | 65 #include "core/loader/FormState.h" |
65 #include "core/loader/FormSubmission.h" | 66 #include "core/loader/FormSubmission.h" |
66 #include "core/loader/FrameFetchContext.h" | 67 #include "core/loader/FrameFetchContext.h" |
67 #include "core/loader/FrameLoadRequest.h" | 68 #include "core/loader/FrameLoadRequest.h" |
68 #include "core/loader/FrameLoaderClient.h" | 69 #include "core/loader/FrameLoaderClient.h" |
69 #include "core/loader/ProgressTracker.h" | 70 #include "core/loader/ProgressTracker.h" |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 CString encodedSrcdoc = srcdoc.utf8(); | 792 CString encodedSrcdoc = srcdoc.utf8(); |
792 return SubstituteData(SharedBuffer::create(encodedSrcdoc.data(), encodedSrcd
oc.length()), "text/html", "UTF-8", KURL()); | 793 return SubstituteData(SharedBuffer::create(encodedSrcdoc.data(), encodedSrcd
oc.length()), "text/html", "UTF-8", KURL()); |
793 } | 794 } |
794 | 795 |
795 void FrameLoader::reportLocalLoadFailed(LocalFrame* frame, const String& url) | 796 void FrameLoader::reportLocalLoadFailed(LocalFrame* frame, const String& url) |
796 { | 797 { |
797 ASSERT(!url.isEmpty()); | 798 ASSERT(!url.isEmpty()); |
798 if (!frame) | 799 if (!frame) |
799 return; | 800 return; |
800 | 801 |
801 frame->document()->addConsoleMessage(SecurityMessageSource, ErrorMessageLeve
l, "Not allowed to load local resource: " + url); | 802 frame->document()->addConsoleMessage(ConsoleMessage::create(SecurityMessageS
ource, ErrorMessageLevel, "Not allowed to load local resource: " + url)); |
802 } | 803 } |
803 | 804 |
804 // static | 805 // static |
805 ResourceRequest FrameLoader::requestFromHistoryItem(HistoryItem* item, ResourceR
equestCachePolicy cachePolicy) | 806 ResourceRequest FrameLoader::requestFromHistoryItem(HistoryItem* item, ResourceR
equestCachePolicy cachePolicy) |
806 { | 807 { |
807 RefPtr<FormData> formData = item->formData(); | 808 RefPtr<FormData> formData = item->formData(); |
808 ResourceRequest request(item->url(), item->referrer()); | 809 ResourceRequest request(item->url(), item->referrer()); |
809 request.setCachePolicy(cachePolicy); | 810 request.setCachePolicy(cachePolicy); |
810 if (formData) { | 811 if (formData) { |
811 request.setHTTPMethod("POST"); | 812 request.setHTTPMethod("POST"); |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1265 | 1266 |
1266 if (i == targetFrames.size()) | 1267 if (i == targetFrames.size()) |
1267 shouldClose = true; | 1268 shouldClose = true; |
1268 } | 1269 } |
1269 return shouldClose; | 1270 return shouldClose; |
1270 } | 1271 } |
1271 | 1272 |
1272 bool FrameLoader::validateTransitionNavigationMode() | 1273 bool FrameLoader::validateTransitionNavigationMode() |
1273 { | 1274 { |
1274 if (frame()->document()->inQuirksMode()) { | 1275 if (frame()->document()->inQuirksMode()) { |
1275 frame()->document()->addConsoleMessage(JSMessageSource, ErrorMessageLeve
l, "Ignoring transition elements due to quirks mode."); | 1276 frame()->document()->addConsoleMessage(ConsoleMessage::create(JSMessageS
ource, ErrorMessageLevel, "Ignoring transition elements due to quirks mode.")); |
1276 return false; | 1277 return false; |
1277 } | 1278 } |
1278 | 1279 |
1279 // FIXME(oysteine): Also check for width=device-width here, to avoid zoom/sc
aling issues. | 1280 // FIXME(oysteine): Also check for width=device-width here, to avoid zoom/sc
aling issues. |
1280 return true; | 1281 return true; |
1281 } | 1282 } |
1282 | 1283 |
1283 bool FrameLoader::dispatchNavigationTransitionData() | 1284 bool FrameLoader::dispatchNavigationTransitionData() |
1284 { | 1285 { |
1285 Vector<Document::TransitionElementData> elementData; | 1286 Vector<Document::TransitionElementData> elementData; |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1398 UseCounter::count(m_frame->domWindow()->document(), UseCounter::
XFrameOptionsSameOriginWithBadAncestorChain); | 1399 UseCounter::count(m_frame->domWindow()->document(), UseCounter::
XFrameOptionsSameOriginWithBadAncestorChain); |
1399 break; | 1400 break; |
1400 } | 1401 } |
1401 } | 1402 } |
1402 return false; | 1403 return false; |
1403 } | 1404 } |
1404 case XFrameOptionsDeny: | 1405 case XFrameOptionsDeny: |
1405 return true; | 1406 return true; |
1406 case XFrameOptionsAllowAll: | 1407 case XFrameOptionsAllowAll: |
1407 return false; | 1408 return false; |
1408 case XFrameOptionsConflict: | 1409 case XFrameOptionsConflict: { |
1409 m_frame->document()->addConsoleMessageWithRequestIdentifier(JSMessageSou
rce, ErrorMessageLevel, "Multiple 'X-Frame-Options' headers with conflicting val
ues ('" + content + "') encountered when loading '" + url.elidedString() + "'. F
alling back to 'DENY'.", requestIdentifier); | 1410 RefPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(JSMessage
Source, ErrorMessageLevel, "Multiple 'X-Frame-Options' headers with conflicting
values ('" + content + "') encountered when loading '" + url.elidedString() + "'
. Falling back to 'DENY'."); |
| 1411 consoleMessage->setRequestIdentifier(requestIdentifier); |
| 1412 m_frame->document()->addMessage(consoleMessage.release()); |
1410 return true; | 1413 return true; |
1411 case XFrameOptionsInvalid: | 1414 } |
1412 m_frame->document()->addConsoleMessageWithRequestIdentifier(JSMessageSou
rce, ErrorMessageLevel, "Invalid 'X-Frame-Options' header encountered when loadi
ng '" + url.elidedString() + "': '" + content + "' is not a recognized directive
. The header will be ignored.", requestIdentifier); | 1415 case XFrameOptionsInvalid: { |
| 1416 RefPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(JSMessage
Source, ErrorMessageLevel, "Invalid 'X-Frame-Options' header encountered when lo
ading '" + url.elidedString() + "': '" + content + "' is not a recognized direct
ive. The header will be ignored."); |
| 1417 consoleMessage->setRequestIdentifier(requestIdentifier); |
| 1418 m_frame->document()->addMessage(consoleMessage.release()); |
1413 return false; | 1419 return false; |
| 1420 } |
1414 default: | 1421 default: |
1415 ASSERT_NOT_REACHED(); | 1422 ASSERT_NOT_REACHED(); |
1416 return false; | 1423 return false; |
1417 } | 1424 } |
1418 } | 1425 } |
1419 | 1426 |
1420 bool FrameLoader::shouldTreatURLAsSameAsCurrent(const KURL& url) const | 1427 bool FrameLoader::shouldTreatURLAsSameAsCurrent(const KURL& url) const |
1421 { | 1428 { |
1422 return m_currentItem && url == m_currentItem->url(); | 1429 return m_currentItem && url == m_currentItem->url(); |
1423 } | 1430 } |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1495 // FIXME: We need a way to propagate sandbox flags to out-of-process frames. | 1502 // FIXME: We need a way to propagate sandbox flags to out-of-process frames. |
1496 Frame* parentFrame = m_frame->tree().parent(); | 1503 Frame* parentFrame = m_frame->tree().parent(); |
1497 if (parentFrame && parentFrame->isLocalFrame()) | 1504 if (parentFrame && parentFrame->isLocalFrame()) |
1498 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags(); | 1505 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags(); |
1499 if (FrameOwner* frameOwner = m_frame->owner()) | 1506 if (FrameOwner* frameOwner = m_frame->owner()) |
1500 flags |= frameOwner->sandboxFlags(); | 1507 flags |= frameOwner->sandboxFlags(); |
1501 return flags; | 1508 return flags; |
1502 } | 1509 } |
1503 | 1510 |
1504 } // namespace blink | 1511 } // namespace blink |
OLD | NEW |