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

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

Issue 230383003: Webfont CORS-enabled fetching with fallback (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add invalidator, retry only CORS failure Created 6 years, 8 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 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 563
564 if (sourceOrigin->canRequest(url)) 564 if (sourceOrigin->canRequest(url))
565 return true; 565 return true;
566 566
567 String errorDescription; 567 String errorDescription;
568 if (!resource->passesAccessControlCheck(sourceOrigin, errorDescription)) { 568 if (!resource->passesAccessControlCheck(sourceOrigin, errorDescription)) {
569 if (frame() && frame()->document()) { 569 if (frame() && frame()->document()) {
570 String resourceType = Resource::resourceTypeToString(resource->type( ), resource->options().initiatorInfo); 570 String resourceType = Resource::resourceTypeToString(resource->type( ), resource->options().initiatorInfo);
571 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); 571 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);
572 } 572 }
573
574 // FIXME: Remove later, http://crbug.com/286681
575 if (resource->type() == Resource::Font) {
576 FontResource* fontResource = toFontResource(resource);
577 fontResource->setCORSFailed();
578 }
573 return false; 579 return false;
574 } 580 }
575 return true; 581 return true;
576 } 582 }
577 583
578 bool ResourceFetcher::shouldLoadNewResource(Resource::Type type) const 584 bool ResourceFetcher::shouldLoadNewResource(Resource::Type type) const
579 { 585 {
580 if (!frame()) 586 if (!frame())
581 return false; 587 return false;
582 if (!m_documentLoader) 588 if (!m_documentLoader)
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
1400 case Revalidate: 1406 case Revalidate:
1401 ++m_revalidateCount; 1407 ++m_revalidateCount;
1402 return; 1408 return;
1403 case Use: 1409 case Use:
1404 ++m_useCount; 1410 ++m_useCount;
1405 return; 1411 return;
1406 } 1412 }
1407 } 1413 }
1408 1414
1409 } 1415 }
OLDNEW
« Source/core/css/CSSFontFaceSrcValue.cpp ('K') | « Source/core/fetch/FontResource.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698