| 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 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 if (!canRequest(resource->type(), resource->resourceRequest(), url, resource
->options(), resource->isUnusedPreload(), FetchRequest::UseDefaultOriginRestrict
ionForType)) | 605 if (!canRequest(resource->type(), resource->resourceRequest(), url, resource
->options(), resource->isUnusedPreload(), FetchRequest::UseDefaultOriginRestrict
ionForType)) |
| 606 return false; | 606 return false; |
| 607 | 607 |
| 608 if (!sourceOrigin && document()) | 608 if (!sourceOrigin && document()) |
| 609 sourceOrigin = document()->securityOrigin(); | 609 sourceOrigin = document()->securityOrigin(); |
| 610 | 610 |
| 611 if (sourceOrigin->canRequest(url)) | 611 if (sourceOrigin->canRequest(url)) |
| 612 return true; | 612 return true; |
| 613 | 613 |
| 614 String errorDescription; | 614 String errorDescription; |
| 615 if (!resource->passesAccessControlCheck(sourceOrigin, errorDescription)) { | 615 if (!resource->passesAccessControlCheck(document(), sourceOrigin, errorDescr
iption)) { |
| 616 if (resource->type() == Resource::Font) | 616 if (resource->type() == Resource::Font) |
| 617 toFontResource(resource)->setCORSFailed(); | 617 toFontResource(resource)->setCORSFailed(); |
| 618 if (frame() && frame()->document()) { | 618 if (frame() && frame()->document()) { |
| 619 String resourceType = Resource::resourceTypeToString(resource->type(
), resource->options().initiatorInfo); | 619 String resourceType = Resource::resourceTypeToString(resource->type(
), resource->options().initiatorInfo); |
| 620 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::
create(JSMessageSource, ErrorMessageLevel, resourceType + " from origin '" + Sec
urityOrigin::create(url)->toString() + "' has been blocked from loading by Cross
-Origin Resource Sharing policy: " + errorDescription); | 620 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::
create(JSMessageSource, ErrorMessageLevel, resourceType + " from origin '" + Sec
urityOrigin::create(url)->toString() + "' has been blocked from loading by Cross
-Origin Resource Sharing policy: " + errorDescription); |
| 621 consoleMessage->markAsAsync(); | 621 consoleMessage->markAsAsync(); |
| 622 frame()->document()->addConsoleMessage(consoleMessage); | 622 frame()->document()->addConsoleMessage(consoleMessage); |
| 623 } | 623 } |
| 624 return false; | 624 return false; |
| 625 } | 625 } |
| (...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1448 bool ResourceFetcher::canAccessRedirect(Resource* resource, ResourceRequest& req
uest, const ResourceResponse& redirectResponse, ResourceLoaderOptions& options) | 1448 bool ResourceFetcher::canAccessRedirect(Resource* resource, ResourceRequest& req
uest, const ResourceResponse& redirectResponse, ResourceLoaderOptions& options) |
| 1449 { | 1449 { |
| 1450 if (!canRequest(resource->type(), request, request.url(), options, resource-
>isUnusedPreload(), FetchRequest::UseDefaultOriginRestrictionForType)) | 1450 if (!canRequest(resource->type(), request, request.url(), options, resource-
>isUnusedPreload(), FetchRequest::UseDefaultOriginRestrictionForType)) |
| 1451 return false; | 1451 return false; |
| 1452 if (options.corsEnabled == IsCORSEnabled) { | 1452 if (options.corsEnabled == IsCORSEnabled) { |
| 1453 SecurityOrigin* sourceOrigin = options.securityOrigin.get(); | 1453 SecurityOrigin* sourceOrigin = options.securityOrigin.get(); |
| 1454 if (!sourceOrigin && document()) | 1454 if (!sourceOrigin && document()) |
| 1455 sourceOrigin = document()->securityOrigin(); | 1455 sourceOrigin = document()->securityOrigin(); |
| 1456 | 1456 |
| 1457 String errorMessage; | 1457 String errorMessage; |
| 1458 if (!CrossOriginAccessControl::handleRedirect(resource, sourceOrigin, re
quest, redirectResponse, options, errorMessage)) { | 1458 if (!CrossOriginAccessControl::handleRedirect(document(), resource, sour
ceOrigin, request, redirectResponse, options, errorMessage)) { |
| 1459 if (resource->type() == Resource::Font) | 1459 if (resource->type() == Resource::Font) |
| 1460 toFontResource(resource)->setCORSFailed(); | 1460 toFontResource(resource)->setCORSFailed(); |
| 1461 if (frame() && frame()->document()) | 1461 if (frame() && frame()->document()) |
| 1462 frame()->document()->addConsoleMessage(ConsoleMessage::create(JS
MessageSource, ErrorMessageLevel, errorMessage)); | 1462 frame()->document()->addConsoleMessage(ConsoleMessage::create(JS
MessageSource, ErrorMessageLevel, errorMessage)); |
| 1463 return false; | 1463 return false; |
| 1464 } | 1464 } |
| 1465 } | 1465 } |
| 1466 if (resource->type() == Resource::Image && shouldDeferImageLoad(request.url(
))) | 1466 if (resource->type() == Resource::Image && shouldDeferImageLoad(request.url(
))) |
| 1467 return false; | 1467 return false; |
| 1468 return true; | 1468 return true; |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1578 | 1578 |
| 1579 void ResourceFetcher::trace(Visitor* visitor) | 1579 void ResourceFetcher::trace(Visitor* visitor) |
| 1580 { | 1580 { |
| 1581 visitor->trace(m_document); | 1581 visitor->trace(m_document); |
| 1582 visitor->trace(m_loaders); | 1582 visitor->trace(m_loaders); |
| 1583 visitor->trace(m_nonBlockingLoaders); | 1583 visitor->trace(m_nonBlockingLoaders); |
| 1584 ResourceLoaderHost::trace(visitor); | 1584 ResourceLoaderHost::trace(visitor); |
| 1585 } | 1585 } |
| 1586 | 1586 |
| 1587 } | 1587 } |
| OLD | NEW |