OLD | NEW |
1 /* | 1 /* |
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) | 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) |
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) | 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) |
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) | 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) |
5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
rights reserved. | 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
rights reserved. |
6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ | 6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ |
7 | 7 |
8 This library is free software; you can redistribute it and/or | 8 This library is free software; you can redistribute it and/or |
9 modify it under the terms of the GNU Library General Public | 9 modify it under the terms of the GNU Library General Public |
10 License as published by the Free Software Foundation; either | 10 License as published by the Free Software Foundation; either |
(...skipping 28 matching lines...) Expand all Loading... |
39 #include "core/fetch/ImageResource.h" | 39 #include "core/fetch/ImageResource.h" |
40 #include "core/fetch/MemoryCache.h" | 40 #include "core/fetch/MemoryCache.h" |
41 #include "core/fetch/RawResource.h" | 41 #include "core/fetch/RawResource.h" |
42 #include "core/fetch/ResourceLoader.h" | 42 #include "core/fetch/ResourceLoader.h" |
43 #include "core/fetch/ResourceLoaderSet.h" | 43 #include "core/fetch/ResourceLoaderSet.h" |
44 #include "core/fetch/ScriptResource.h" | 44 #include "core/fetch/ScriptResource.h" |
45 #include "core/fetch/XSLStyleSheetResource.h" | 45 #include "core/fetch/XSLStyleSheetResource.h" |
46 #include "core/html/HTMLElement.h" | 46 #include "core/html/HTMLElement.h" |
47 #include "core/html/HTMLFrameOwnerElement.h" | 47 #include "core/html/HTMLFrameOwnerElement.h" |
48 #include "core/html/imports/HTMLImportsController.h" | 48 #include "core/html/imports/HTMLImportsController.h" |
| 49 #include "core/inspector/ConsoleMessage.h" |
49 #include "core/inspector/InspectorInstrumentation.h" | 50 #include "core/inspector/InspectorInstrumentation.h" |
50 #include "core/loader/DocumentLoader.h" | 51 #include "core/loader/DocumentLoader.h" |
51 #include "core/loader/FrameLoader.h" | 52 #include "core/loader/FrameLoader.h" |
52 #include "core/loader/FrameLoaderClient.h" | 53 #include "core/loader/FrameLoaderClient.h" |
53 #include "core/loader/PingLoader.h" | 54 #include "core/loader/PingLoader.h" |
54 #include "core/loader/SubstituteData.h" | 55 #include "core/loader/SubstituteData.h" |
55 #include "core/loader/UniqueIdentifier.h" | 56 #include "core/loader/UniqueIdentifier.h" |
56 #include "core/loader/appcache/ApplicationCacheHost.h" | 57 #include "core/loader/appcache/ApplicationCacheHost.h" |
57 #include "core/frame/LocalDOMWindow.h" | 58 #include "core/frame/LocalDOMWindow.h" |
58 #include "core/frame/LocalFrame.h" | 59 #include "core/frame/LocalFrame.h" |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 | 620 |
620 if (sourceOrigin->canRequest(url)) | 621 if (sourceOrigin->canRequest(url)) |
621 return true; | 622 return true; |
622 | 623 |
623 String errorDescription; | 624 String errorDescription; |
624 if (!resource->passesAccessControlCheck(sourceOrigin, errorDescription)) { | 625 if (!resource->passesAccessControlCheck(sourceOrigin, errorDescription)) { |
625 if (resource->type() == Resource::Font) | 626 if (resource->type() == Resource::Font) |
626 toFontResource(resource)->setCORSFailed(); | 627 toFontResource(resource)->setCORSFailed(); |
627 if (frame() && frame()->document()) { | 628 if (frame() && frame()->document()) { |
628 String resourceType = Resource::resourceTypeToString(resource->type(
), resource->options().initiatorInfo); | 629 String resourceType = Resource::resourceTypeToString(resource->type(
), resource->options().initiatorInfo); |
629 frame()->document()->addConsoleMessage(JSMessageSource, ErrorMessage
Level, resourceType + " from origin '" + SecurityOrigin::create(url)->toString()
+ "' has been blocked from loading by Cross-Origin Resource Sharing policy: " +
errorDescription); | 630 frame()->document()->addConsoleMessage(ConsoleMessage::create(JSMess
ageSource, ErrorMessageLevel, resourceType + " from origin '" + SecurityOrigin::
create(url)->toString() + "' has been blocked from loading by Cross-Origin Resou
rce Sharing policy: " + errorDescription)); |
630 } | 631 } |
631 return false; | 632 return false; |
632 } | 633 } |
633 return true; | 634 return true; |
634 } | 635 } |
635 | 636 |
636 bool ResourceFetcher::shouldLoadNewResource(Resource::Type type) const | 637 bool ResourceFetcher::shouldLoadNewResource(Resource::Type type) const |
637 { | 638 { |
638 if (!frame()) | 639 if (!frame()) |
639 return false; | 640 return false; |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1066 | 1067 |
1067 if (!frame()) | 1068 if (!frame()) |
1068 return; | 1069 return; |
1069 | 1070 |
1070 String message; | 1071 String message; |
1071 if (!m_document || m_document->url().isNull()) | 1072 if (!m_document || m_document->url().isNull()) |
1072 message = "Unsafe attempt to load URL " + url.elidedString() + '.'; | 1073 message = "Unsafe attempt to load URL " + url.elidedString() + '.'; |
1073 else | 1074 else |
1074 message = "Unsafe attempt to load URL " + url.elidedString() + " from fr
ame with URL " + m_document->url().elidedString() + ". Domains, protocols and po
rts must match.\n"; | 1075 message = "Unsafe attempt to load URL " + url.elidedString() + " from fr
ame with URL " + m_document->url().elidedString() + ". Domains, protocols and po
rts must match.\n"; |
1075 | 1076 |
1076 frame()->document()->addConsoleMessage(SecurityMessageSource, ErrorMessageLe
vel, message); | 1077 frame()->document()->addConsoleMessage(ConsoleMessage::create(SecurityMessag
eSource, ErrorMessageLevel, message)); |
1077 } | 1078 } |
1078 | 1079 |
1079 void ResourceFetcher::setAutoLoadImages(bool enable) | 1080 void ResourceFetcher::setAutoLoadImages(bool enable) |
1080 { | 1081 { |
1081 if (enable == m_autoLoadImages) | 1082 if (enable == m_autoLoadImages) |
1082 return; | 1083 return; |
1083 | 1084 |
1084 m_autoLoadImages = enable; | 1085 m_autoLoadImages = enable; |
1085 | 1086 |
1086 if (!m_autoLoadImages) | 1087 if (!m_autoLoadImages) |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1400 if (options.corsEnabled == IsCORSEnabled) { | 1401 if (options.corsEnabled == IsCORSEnabled) { |
1401 SecurityOrigin* sourceOrigin = options.securityOrigin.get(); | 1402 SecurityOrigin* sourceOrigin = options.securityOrigin.get(); |
1402 if (!sourceOrigin && document()) | 1403 if (!sourceOrigin && document()) |
1403 sourceOrigin = document()->securityOrigin(); | 1404 sourceOrigin = document()->securityOrigin(); |
1404 | 1405 |
1405 String errorMessage; | 1406 String errorMessage; |
1406 if (!CrossOriginAccessControl::handleRedirect(resource, sourceOrigin, re
quest, redirectResponse, options, errorMessage)) { | 1407 if (!CrossOriginAccessControl::handleRedirect(resource, sourceOrigin, re
quest, redirectResponse, options, errorMessage)) { |
1407 if (resource->type() == Resource::Font) | 1408 if (resource->type() == Resource::Font) |
1408 toFontResource(resource)->setCORSFailed(); | 1409 toFontResource(resource)->setCORSFailed(); |
1409 if (frame() && frame()->document()) | 1410 if (frame() && frame()->document()) |
1410 frame()->document()->addConsoleMessage(JSMessageSource, ErrorMes
sageLevel, errorMessage); | 1411 frame()->document()->addConsoleMessage(ConsoleMessage::create(JS
MessageSource, ErrorMessageLevel, errorMessage)); |
1411 return false; | 1412 return false; |
1412 } | 1413 } |
1413 } | 1414 } |
1414 if (resource->type() == Resource::Image && shouldDeferImageLoad(request.url(
))) | 1415 if (resource->type() == Resource::Image && shouldDeferImageLoad(request.url(
))) |
1415 return false; | 1416 return false; |
1416 return true; | 1417 return true; |
1417 } | 1418 } |
1418 | 1419 |
1419 #if !ENABLE(OILPAN) | 1420 #if !ENABLE(OILPAN) |
1420 void ResourceFetcher::refResourceLoaderHost() | 1421 void ResourceFetcher::refResourceLoaderHost() |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1519 } | 1520 } |
1520 } | 1521 } |
1521 | 1522 |
1522 void ResourceFetcher::trace(Visitor* visitor) | 1523 void ResourceFetcher::trace(Visitor* visitor) |
1523 { | 1524 { |
1524 visitor->trace(m_document); | 1525 visitor->trace(m_document); |
1525 ResourceLoaderHost::trace(visitor); | 1526 ResourceLoaderHost::trace(visitor); |
1526 } | 1527 } |
1527 | 1528 |
1528 } | 1529 } |
OLD | NEW |