Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(430)

Side by Side Diff: Source/core/fetch/ResourceFetcher.cpp

Issue 344883006: Give the RequestFetcher access to cross-origin URLs when allowed (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 } 474 }
475 return true; 475 return true;
476 } 476 }
477 477
478 bool ResourceFetcher::canRequest(Resource::Type type, const KURL& url, const Res ourceLoaderOptions& options, bool forPreload, FetchRequest::OriginRestriction or iginRestriction) const 478 bool ResourceFetcher::canRequest(Resource::Type type, const KURL& url, const Res ourceLoaderOptions& options, bool forPreload, FetchRequest::OriginRestriction or iginRestriction) const
479 { 479 {
480 SecurityOrigin* securityOrigin = options.securityOrigin.get(); 480 SecurityOrigin* securityOrigin = options.securityOrigin.get();
481 if (!securityOrigin && document()) 481 if (!securityOrigin && document())
482 securityOrigin = document()->securityOrigin(); 482 securityOrigin = document()->securityOrigin();
483 483
484 if (securityOrigin && !securityOrigin->canDisplay(url)) { 484 if (originRestriction != FetchRequest::NoOriginRestriction && securityOrigin && !securityOrigin->canDisplay(url)) {
485 if (!forPreload) 485 if (!forPreload)
486 context().reportLocalLoadFailed(url); 486 context().reportLocalLoadFailed(url);
487 WTF_LOG(ResourceLoading, "ResourceFetcher::requestResource URL was not a llowed by SecurityOrigin::canDisplay"); 487 WTF_LOG(ResourceLoading, "ResourceFetcher::requestResource URL was not a llowed by SecurityOrigin::canDisplay");
488 return 0; 488 return 0;
489 } 489 }
490 490
491 // Some types of resources can be loaded only from the same origin. Other 491 // Some types of resources can be loaded only from the same origin. Other
492 // types of resources, like Images, Scripts, and CSS, can be loaded from 492 // types of resources, like Images, Scripts, and CSS, can be loaded from
493 // any URL. 493 // any URL.
494 switch (type) { 494 switch (type) {
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after
1493 } 1493 }
1494 } 1494 }
1495 1495
1496 void ResourceFetcher::trace(Visitor* visitor) 1496 void ResourceFetcher::trace(Visitor* visitor)
1497 { 1497 {
1498 visitor->trace(m_document); 1498 visitor->trace(m_document);
1499 ResourceLoaderHost::trace(visitor); 1499 ResourceLoaderHost::trace(visitor);
1500 } 1500 }
1501 1501
1502 } 1502 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698