| 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 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 #include "core/css/CSSMarkup.h" | 29 #include "core/css/CSSMarkup.h" |
| 30 #include "core/css/StyleSheetContents.h" | 30 #include "core/css/StyleSheetContents.h" |
| 31 #include "core/dom/Document.h" | 31 #include "core/dom/Document.h" |
| 32 #include "core/dom/Node.h" | 32 #include "core/dom/Node.h" |
| 33 #include "core/fetch/FetchInitiatorTypeNames.h" | 33 #include "core/fetch/FetchInitiatorTypeNames.h" |
| 34 #include "core/fetch/FetchRequest.h" | 34 #include "core/fetch/FetchRequest.h" |
| 35 #include "core/fetch/FontResource.h" | 35 #include "core/fetch/FontResource.h" |
| 36 #include "core/fetch/ResourceFetcher.h" | 36 #include "core/fetch/ResourceFetcher.h" |
| 37 #include "core/loader/MixedContentChecker.h" | 37 #include "core/loader/MixedContentChecker.h" |
| 38 #include "platform/CrossOriginAttributeValue.h" |
| 38 #include "platform/fonts/FontCache.h" | 39 #include "platform/fonts/FontCache.h" |
| 39 #include "platform/fonts/FontCustomPlatformData.h" | 40 #include "platform/fonts/FontCustomPlatformData.h" |
| 40 #include "platform/weborigin/SecurityPolicy.h" | 41 #include "platform/weborigin/SecurityPolicy.h" |
| 41 #include "wtf/text/StringBuilder.h" | 42 #include "wtf/text/StringBuilder.h" |
| 42 | 43 |
| 43 namespace blink { | 44 namespace blink { |
| 44 | 45 |
| 45 bool CSSFontFaceSrcValue::isSupportedFormat() const | 46 bool CSSFontFaceSrcValue::isSupportedFormat() const |
| 46 { | 47 { |
| 47 // Normally we would just check the format, but in order to avoid conflicts
with the old WinIE style of font-face, | 48 // Normally we would just check the format, but in order to avoid conflicts
with the old WinIE style of font-face, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 75 return m_fetched && m_fetched->loadFailedOrCanceled(); | 76 return m_fetched && m_fetched->loadFailedOrCanceled(); |
| 76 } | 77 } |
| 77 | 78 |
| 78 static void setCrossOriginAccessControl(FetchRequest& request, SecurityOrigin* s
ecurityOrigin) | 79 static void setCrossOriginAccessControl(FetchRequest& request, SecurityOrigin* s
ecurityOrigin) |
| 79 { | 80 { |
| 80 // Local fonts are accessible from file: URLs even when | 81 // Local fonts are accessible from file: URLs even when |
| 81 // allowFileAccessFromFileURLs is false. | 82 // allowFileAccessFromFileURLs is false. |
| 82 if (request.url().isLocalFile()) | 83 if (request.url().isLocalFile()) |
| 83 return; | 84 return; |
| 84 | 85 |
| 85 StoredCredentials allowCredentials = DoNotAllowStoredCredentials; | 86 request.setCrossOriginAccessControl(securityOrigin, CrossOriginAttributeAnon
ymous); |
| 86 bool sameOriginRequest = securityOrigin->canRequestNoSuborigin(request.url()
); | |
| 87 // Include credentials for same origin requests (and assume that | |
| 88 // redirects out of origin will be handled per Fetch spec.) | |
| 89 if (sameOriginRequest) | |
| 90 allowCredentials = AllowStoredCredentials; | |
| 91 request.setCrossOriginAccessControl(securityOrigin, allowCredentials, Client
DidNotRequestCredentials); | |
| 92 } | 87 } |
| 93 | 88 |
| 94 FontResource* CSSFontFaceSrcValue::fetch(Document* document) | 89 FontResource* CSSFontFaceSrcValue::fetch(Document* document) |
| 95 { | 90 { |
| 96 if (!m_fetched) { | 91 if (!m_fetched) { |
| 97 FetchRequest request(ResourceRequest(document->completeURL(m_resource)),
FetchInitiatorTypeNames::css); | 92 FetchRequest request(ResourceRequest(document->completeURL(m_resource)),
FetchInitiatorTypeNames::css); |
| 98 request.setContentSecurityCheck(m_shouldCheckContentSecurityPolicy); | 93 request.setContentSecurityCheck(m_shouldCheckContentSecurityPolicy); |
| 99 SecurityOrigin* securityOrigin = document->securityOrigin(); | 94 SecurityOrigin* securityOrigin = document->securityOrigin(); |
| 100 setCrossOriginAccessControl(request, securityOrigin); | 95 setCrossOriginAccessControl(request, securityOrigin); |
| 101 request.mutableResourceRequest().setHTTPReferrer(SecurityPolicy::generat
eReferrer(m_referrer.referrerPolicy, request.url(), m_referrer.referrer)); | 96 request.mutableResourceRequest().setHTTPReferrer(SecurityPolicy::generat
eReferrer(m_referrer.referrerPolicy, request.url(), m_referrer.referrer)); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 123 m_fetched->lastResourceRequest().url(), MixedContentChecker::SendReport)
; | 118 m_fetched->lastResourceRequest().url(), MixedContentChecker::SendReport)
; |
| 124 document->fetcher()->requestLoadStarted(m_fetched.get(), request, ResourceFe
tcher::ResourceLoadingFromCache); | 119 document->fetcher()->requestLoadStarted(m_fetched.get(), request, ResourceFe
tcher::ResourceLoadingFromCache); |
| 125 } | 120 } |
| 126 | 121 |
| 127 bool CSSFontFaceSrcValue::equals(const CSSFontFaceSrcValue& other) const | 122 bool CSSFontFaceSrcValue::equals(const CSSFontFaceSrcValue& other) const |
| 128 { | 123 { |
| 129 return m_isLocal == other.m_isLocal && m_format == other.m_format && m_resou
rce == other.m_resource; | 124 return m_isLocal == other.m_isLocal && m_format == other.m_format && m_resou
rce == other.m_resource; |
| 130 } | 125 } |
| 131 | 126 |
| 132 } | 127 } |
| OLD | NEW |