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 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 CString encodedSrcdoc = srcdoc.utf8(); | 777 CString encodedSrcdoc = srcdoc.utf8(); |
777 return SubstituteData(SharedBuffer::create(encodedSrcdoc.data(), encodedSrcd
oc.length()), "text/html", "UTF-8", KURL()); | 778 return SubstituteData(SharedBuffer::create(encodedSrcdoc.data(), encodedSrcd
oc.length()), "text/html", "UTF-8", KURL()); |
778 } | 779 } |
779 | 780 |
780 void FrameLoader::reportLocalLoadFailed(LocalFrame* frame, const String& url) | 781 void FrameLoader::reportLocalLoadFailed(LocalFrame* frame, const String& url) |
781 { | 782 { |
782 ASSERT(!url.isEmpty()); | 783 ASSERT(!url.isEmpty()); |
783 if (!frame) | 784 if (!frame) |
784 return; | 785 return; |
785 | 786 |
786 frame->document()->addConsoleMessage(SecurityMessageSource, ErrorMessageLeve
l, "Not allowed to load local resource: " + url); | 787 frame->document()->addConsoleMessage(ConsoleMessage::create(SecurityMessageS
ource, ErrorMessageLevel, "Not allowed to load local resource: " + url)); |
787 } | 788 } |
788 | 789 |
789 // static | 790 // static |
790 ResourceRequest FrameLoader::requestFromHistoryItem(HistoryItem* item, ResourceR
equestCachePolicy cachePolicy) | 791 ResourceRequest FrameLoader::requestFromHistoryItem(HistoryItem* item, ResourceR
equestCachePolicy cachePolicy) |
791 { | 792 { |
792 RefPtr<FormData> formData = item->formData(); | 793 RefPtr<FormData> formData = item->formData(); |
793 ResourceRequest request(item->url(), item->referrer()); | 794 ResourceRequest request(item->url(), item->referrer()); |
794 request.setCachePolicy(cachePolicy); | 795 request.setCachePolicy(cachePolicy); |
795 if (formData) { | 796 if (formData) { |
796 request.setHTTPMethod("POST"); | 797 request.setHTTPMethod("POST"); |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1250 | 1251 |
1251 if (i == targetFrames.size()) | 1252 if (i == targetFrames.size()) |
1252 shouldClose = true; | 1253 shouldClose = true; |
1253 } | 1254 } |
1254 return shouldClose; | 1255 return shouldClose; |
1255 } | 1256 } |
1256 | 1257 |
1257 bool FrameLoader::validateTransitionNavigationMode() | 1258 bool FrameLoader::validateTransitionNavigationMode() |
1258 { | 1259 { |
1259 if (frame()->document()->inQuirksMode()) { | 1260 if (frame()->document()->inQuirksMode()) { |
1260 frame()->document()->addConsoleMessage(JSMessageSource, ErrorMessageLeve
l, "Ignoring transition elements due to quirks mode."); | 1261 frame()->document()->addConsoleMessage(ConsoleMessage::create(JSMessageS
ource, ErrorMessageLevel, "Ignoring transition elements due to quirks mode.")); |
1261 return false; | 1262 return false; |
1262 } | 1263 } |
1263 | 1264 |
1264 // FIXME(oysteine): Also check for width=device-width here, to avoid zoom/sc
aling issues. | 1265 // FIXME(oysteine): Also check for width=device-width here, to avoid zoom/sc
aling issues. |
1265 return true; | 1266 return true; |
1266 } | 1267 } |
1267 | 1268 |
1268 bool FrameLoader::dispatchNavigationTransitionData() | 1269 bool FrameLoader::dispatchNavigationTransitionData() |
1269 { | 1270 { |
1270 Vector<Document::TransitionElementData> elementData; | 1271 Vector<Document::TransitionElementData> elementData; |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1383 UseCounter::count(m_frame->domWindow()->document(), UseCounter::
XFrameOptionsSameOriginWithBadAncestorChain); | 1384 UseCounter::count(m_frame->domWindow()->document(), UseCounter::
XFrameOptionsSameOriginWithBadAncestorChain); |
1384 break; | 1385 break; |
1385 } | 1386 } |
1386 } | 1387 } |
1387 return false; | 1388 return false; |
1388 } | 1389 } |
1389 case XFrameOptionsDeny: | 1390 case XFrameOptionsDeny: |
1390 return true; | 1391 return true; |
1391 case XFrameOptionsAllowAll: | 1392 case XFrameOptionsAllowAll: |
1392 return false; | 1393 return false; |
1393 case XFrameOptionsConflict: | 1394 case XFrameOptionsConflict: { |
1394 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); | 1395 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'."); |
| 1396 consoleMessage->setRequestIdentifier(requestIdentifier); |
| 1397 m_frame->document()->addMessage(consoleMessage.release()); |
1395 return true; | 1398 return true; |
1396 case XFrameOptionsInvalid: | 1399 } |
1397 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); | 1400 case XFrameOptionsInvalid: { |
| 1401 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."); |
| 1402 consoleMessage->setRequestIdentifier(requestIdentifier); |
| 1403 m_frame->document()->addMessage(consoleMessage.release()); |
1398 return false; | 1404 return false; |
| 1405 } |
1399 default: | 1406 default: |
1400 ASSERT_NOT_REACHED(); | 1407 ASSERT_NOT_REACHED(); |
1401 return false; | 1408 return false; |
1402 } | 1409 } |
1403 } | 1410 } |
1404 | 1411 |
1405 bool FrameLoader::shouldTreatURLAsSameAsCurrent(const KURL& url) const | 1412 bool FrameLoader::shouldTreatURLAsSameAsCurrent(const KURL& url) const |
1406 { | 1413 { |
1407 return m_currentItem && url == m_currentItem->url(); | 1414 return m_currentItem && url == m_currentItem->url(); |
1408 } | 1415 } |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1480 // FIXME: We need a way to propagate sandbox flags to out-of-process frames. | 1487 // FIXME: We need a way to propagate sandbox flags to out-of-process frames. |
1481 Frame* parentFrame = m_frame->tree().parent(); | 1488 Frame* parentFrame = m_frame->tree().parent(); |
1482 if (parentFrame && parentFrame->isLocalFrame()) | 1489 if (parentFrame && parentFrame->isLocalFrame()) |
1483 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags(); | 1490 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags(); |
1484 if (FrameOwner* frameOwner = m_frame->owner()) | 1491 if (FrameOwner* frameOwner = m_frame->owner()) |
1485 flags |= frameOwner->sandboxFlags(); | 1492 flags |= frameOwner->sandboxFlags(); |
1486 return flags; | 1493 return flags; |
1487 } | 1494 } |
1488 | 1495 |
1489 } // namespace blink | 1496 } // namespace blink |
OLD | NEW |