| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2010 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 result.append(')'); | 66 result.append(')'); |
| 67 } | 67 } |
| 68 return result.toString(); | 68 return result.toString(); |
| 69 } | 69 } |
| 70 | 70 |
| 71 bool CSSFontFaceSrcValue::hasFailedOrCanceledSubresources() const | 71 bool CSSFontFaceSrcValue::hasFailedOrCanceledSubresources() const |
| 72 { | 72 { |
| 73 return m_fetched && m_fetched->loadFailedOrCanceled(); | 73 return m_fetched && m_fetched->loadFailedOrCanceled(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 bool CSSFontFaceSrcValue::shouldSetCrossOriginAccessControl(const KURL& resource
, SecurityOrigin* securityOrigin) | |
| 77 { | |
| 78 if (resource.isLocalFile() || resource.protocolIsData()) | |
| 79 return false; | |
| 80 return !securityOrigin->canRequestNoSuborigin(resource); | |
| 81 } | |
| 82 | |
| 83 FontResource* CSSFontFaceSrcValue::fetch(Document* document) | 76 FontResource* CSSFontFaceSrcValue::fetch(Document* document) |
| 84 { | 77 { |
| 85 if (!m_fetched) { | 78 if (!m_fetched) { |
| 86 FetchRequest request(ResourceRequest(document->completeURL(m_resource)),
FetchInitiatorTypeNames::css); | 79 FetchRequest request(ResourceRequest(document->completeURL(m_resource)),
FetchInitiatorTypeNames::css); |
| 87 request.setContentSecurityCheck(m_shouldCheckContentSecurityPolicy); | 80 request.setContentSecurityCheck(m_shouldCheckContentSecurityPolicy); |
| 88 SecurityOrigin* securityOrigin = document->securityOrigin(); | 81 SecurityOrigin* securityOrigin = document->securityOrigin(); |
| 89 if (shouldSetCrossOriginAccessControl(request.url(), securityOrigin)) { | 82 request.setCrossOriginAccessControl(securityOrigin, DoNotAllowStoredCred
entials); |
| 90 request.setCrossOriginAccessControl(securityOrigin, DoNotAllowStored
Credentials); | |
| 91 } | |
| 92 request.mutableResourceRequest().setHTTPReferrer(SecurityPolicy::generat
eReferrer(m_referrer.referrerPolicy, request.url(), m_referrer.referrer)); | 83 request.mutableResourceRequest().setHTTPReferrer(SecurityPolicy::generat
eReferrer(m_referrer.referrerPolicy, request.url(), m_referrer.referrer)); |
| 93 m_fetched = FontResource::fetch(request, document->fetcher()); | 84 m_fetched = FontResource::fetch(request, document->fetcher()); |
| 94 } else { | 85 } else { |
| 95 // FIXME: CSSFontFaceSrcValue::fetch is invoked when @font-face rule | 86 // FIXME: CSSFontFaceSrcValue::fetch is invoked when @font-face rule |
| 96 // is processed by StyleResolver / StyleEngine. | 87 // is processed by StyleResolver / StyleEngine. |
| 97 restoreCachedResourceIfNeeded(document); | 88 restoreCachedResourceIfNeeded(document); |
| 98 } | 89 } |
| 99 return m_fetched.get(); | 90 return m_fetched.get(); |
| 100 } | 91 } |
| 101 | 92 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 114 m_fetched->lastResourceRequest().url(), MixedContentChecker::SendReport)
; | 105 m_fetched->lastResourceRequest().url(), MixedContentChecker::SendReport)
; |
| 115 document->fetcher()->requestLoadStarted(m_fetched.get(), request, ResourceFe
tcher::ResourceLoadingFromCache); | 106 document->fetcher()->requestLoadStarted(m_fetched.get(), request, ResourceFe
tcher::ResourceLoadingFromCache); |
| 116 } | 107 } |
| 117 | 108 |
| 118 bool CSSFontFaceSrcValue::equals(const CSSFontFaceSrcValue& other) const | 109 bool CSSFontFaceSrcValue::equals(const CSSFontFaceSrcValue& other) const |
| 119 { | 110 { |
| 120 return m_isLocal == other.m_isLocal && m_format == other.m_format && m_resou
rce == other.m_resource; | 111 return m_isLocal == other.m_isLocal && m_format == other.m_format && m_resou
rce == other.m_resource; |
| 121 } | 112 } |
| 122 | 113 |
| 123 } | 114 } |
| OLD | NEW |