| 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 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 | 628 |
| 628 if (sourceOrigin->canRequest(url)) | 629 if (sourceOrigin->canRequest(url)) |
| 629 return true; | 630 return true; |
| 630 | 631 |
| 631 String errorDescription; | 632 String errorDescription; |
| 632 if (!resource->passesAccessControlCheck(sourceOrigin, errorDescription)) { | 633 if (!resource->passesAccessControlCheck(sourceOrigin, errorDescription)) { |
| 633 if (resource->type() == Resource::Font) | 634 if (resource->type() == Resource::Font) |
| 634 toFontResource(resource)->setCORSFailed(); | 635 toFontResource(resource)->setCORSFailed(); |
| 635 if (frame() && frame()->document()) { | 636 if (frame() && frame()->document()) { |
| 636 String resourceType = Resource::resourceTypeToString(resource->type(
), resource->options().initiatorInfo); | 637 String resourceType = Resource::resourceTypeToString(resource->type(
), resource->options().initiatorInfo); |
| 637 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); | 638 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)); |
| 638 } | 639 } |
| 639 return false; | 640 return false; |
| 640 } | 641 } |
| 641 return true; | 642 return true; |
| 642 } | 643 } |
| 643 | 644 |
| 644 bool ResourceFetcher::shouldLoadNewResource(Resource::Type type) const | 645 bool ResourceFetcher::shouldLoadNewResource(Resource::Type type) const |
| 645 { | 646 { |
| 646 if (!frame()) | 647 if (!frame()) |
| 647 return false; | 648 return false; |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1077 | 1078 |
| 1078 if (!frame()) | 1079 if (!frame()) |
| 1079 return; | 1080 return; |
| 1080 | 1081 |
| 1081 String message; | 1082 String message; |
| 1082 if (!m_document || m_document->url().isNull()) | 1083 if (!m_document || m_document->url().isNull()) |
| 1083 message = "Unsafe attempt to load URL " + url.elidedString() + '.'; | 1084 message = "Unsafe attempt to load URL " + url.elidedString() + '.'; |
| 1084 else | 1085 else |
| 1085 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"; | 1086 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"; |
| 1086 | 1087 |
| 1087 frame()->document()->addConsoleMessage(SecurityMessageSource, ErrorMessageLe
vel, message); | 1088 frame()->document()->addConsoleMessage(ConsoleMessage::create(SecurityMessag
eSource, ErrorMessageLevel, message)); |
| 1088 } | 1089 } |
| 1089 | 1090 |
| 1090 void ResourceFetcher::setAutoLoadImages(bool enable) | 1091 void ResourceFetcher::setAutoLoadImages(bool enable) |
| 1091 { | 1092 { |
| 1092 if (enable == m_autoLoadImages) | 1093 if (enable == m_autoLoadImages) |
| 1093 return; | 1094 return; |
| 1094 | 1095 |
| 1095 m_autoLoadImages = enable; | 1096 m_autoLoadImages = enable; |
| 1096 | 1097 |
| 1097 if (!m_autoLoadImages) | 1098 if (!m_autoLoadImages) |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1418 if (options.corsEnabled == IsCORSEnabled) { | 1419 if (options.corsEnabled == IsCORSEnabled) { |
| 1419 SecurityOrigin* sourceOrigin = options.securityOrigin.get(); | 1420 SecurityOrigin* sourceOrigin = options.securityOrigin.get(); |
| 1420 if (!sourceOrigin && document()) | 1421 if (!sourceOrigin && document()) |
| 1421 sourceOrigin = document()->securityOrigin(); | 1422 sourceOrigin = document()->securityOrigin(); |
| 1422 | 1423 |
| 1423 String errorMessage; | 1424 String errorMessage; |
| 1424 if (!CrossOriginAccessControl::handleRedirect(resource, sourceOrigin, re
quest, redirectResponse, options, errorMessage)) { | 1425 if (!CrossOriginAccessControl::handleRedirect(resource, sourceOrigin, re
quest, redirectResponse, options, errorMessage)) { |
| 1425 if (resource->type() == Resource::Font) | 1426 if (resource->type() == Resource::Font) |
| 1426 toFontResource(resource)->setCORSFailed(); | 1427 toFontResource(resource)->setCORSFailed(); |
| 1427 if (frame() && frame()->document()) | 1428 if (frame() && frame()->document()) |
| 1428 frame()->document()->addConsoleMessage(JSMessageSource, ErrorMes
sageLevel, errorMessage); | 1429 frame()->document()->addConsoleMessage(ConsoleMessage::create(JS
MessageSource, ErrorMessageLevel, errorMessage)); |
| 1429 return false; | 1430 return false; |
| 1430 } | 1431 } |
| 1431 } | 1432 } |
| 1432 if (resource->type() == Resource::Image && shouldDeferImageLoad(request.url(
))) | 1433 if (resource->type() == Resource::Image && shouldDeferImageLoad(request.url(
))) |
| 1433 return false; | 1434 return false; |
| 1434 return true; | 1435 return true; |
| 1435 } | 1436 } |
| 1436 | 1437 |
| 1437 #if !ENABLE(OILPAN) | 1438 #if !ENABLE(OILPAN) |
| 1438 void ResourceFetcher::refResourceLoaderHost() | 1439 void ResourceFetcher::refResourceLoaderHost() |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1539 | 1540 |
| 1540 void ResourceFetcher::trace(Visitor* visitor) | 1541 void ResourceFetcher::trace(Visitor* visitor) |
| 1541 { | 1542 { |
| 1542 visitor->trace(m_document); | 1543 visitor->trace(m_document); |
| 1543 visitor->trace(m_loaders); | 1544 visitor->trace(m_loaders); |
| 1544 visitor->trace(m_multipartLoaders); | 1545 visitor->trace(m_multipartLoaders); |
| 1545 ResourceLoaderHost::trace(visitor); | 1546 ResourceLoaderHost::trace(visitor); |
| 1546 } | 1547 } |
| 1547 | 1548 |
| 1548 } | 1549 } |
| OLD | NEW |