| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 3 * Copyright (C) 2012 Google Inc. All Rights Reserved. | 3 * Copyright (C) 2012 Google Inc. All Rights Reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 { | 229 { |
| 230 String unusedErrorMessage; | 230 String unusedErrorMessage; |
| 231 return isSecureContext(unusedErrorMessage, privilegeContextCheck); | 231 return isSecureContext(unusedErrorMessage, privilegeContextCheck); |
| 232 } | 232 } |
| 233 | 233 |
| 234 String ExecutionContext::outgoingReferrer() const | 234 String ExecutionContext::outgoingReferrer() const |
| 235 { | 235 { |
| 236 return url().strippedForUseAsReferrer(); | 236 return url().strippedForUseAsReferrer(); |
| 237 } | 237 } |
| 238 | 238 |
| 239 void ExecutionContext::parseAndSetReferrerPolicy(const String& policies) | 239 void ExecutionContext::parseAndSetReferrerPolicy(const String& policies, bool su
pportLegacyKeywords) |
| 240 { | 240 { |
| 241 ReferrerPolicy referrerPolicy = ReferrerPolicyDefault; | 241 ReferrerPolicy referrerPolicy = ReferrerPolicyDefault; |
| 242 | 242 |
| 243 Vector<String> tokens; | 243 Vector<String> tokens; |
| 244 policies.split(',', true, tokens); | 244 policies.split(',', true, tokens); |
| 245 for (const auto& token : tokens) { | 245 for (const auto& token : tokens) { |
| 246 ReferrerPolicy currentResult; | 246 ReferrerPolicy currentResult; |
| 247 if (SecurityPolicy::referrerPolicyFromString(token, ¤tResult)) { | 247 if ((supportLegacyKeywords ? SecurityPolicy::referrerPolicyFromStringWit
hLegacyKeywords(token, ¤tResult) : SecurityPolicy::referrerPolicyFromStrin
g(token, ¤tResult))) { |
| 248 referrerPolicy = currentResult; | 248 referrerPolicy = currentResult; |
| 249 } | 249 } |
| 250 } | 250 } |
| 251 | 251 |
| 252 if (referrerPolicy == ReferrerPolicyDefault) { | 252 if (referrerPolicy == ReferrerPolicyDefault) { |
| 253 addConsoleMessage(ConsoleMessage::create(RenderingMessageSource, ErrorMe
ssageLevel, "Failed to set referrer policy: The value '" + policies + "' is not
one of 'always', 'default', 'never', 'no-referrer', 'no-referrer-when-downgrade'
, 'origin', 'origin-when-crossorigin', or 'unsafe-url'. The referrer policy has
been left unchanged.")); | 253 addConsoleMessage(ConsoleMessage::create(RenderingMessageSource, ErrorMe
ssageLevel, "Failed to set referrer policy: The value '" + policies + "' is not
one of " + (supportLegacyKeywords ? "'always', 'default', 'never', 'origin-when-
crossorigin', " : "") + "'no-referrer', 'no-referrer-when-downgrade', 'origin',
'origin-when-cross-origin', or 'unsafe-url'. The referrer policy has been left u
nchanged.")); |
| 254 return; | 254 return; |
| 255 } | 255 } |
| 256 | 256 |
| 257 setReferrerPolicy(referrerPolicy); | 257 setReferrerPolicy(referrerPolicy); |
| 258 } | 258 } |
| 259 | 259 |
| 260 void ExecutionContext::setReferrerPolicy(ReferrerPolicy referrerPolicy) | 260 void ExecutionContext::setReferrerPolicy(ReferrerPolicy referrerPolicy) |
| 261 { | 261 { |
| 262 // When a referrer policy has already been set, the latest value takes prece
dence. | 262 // When a referrer policy has already been set, the latest value takes prece
dence. |
| 263 UseCounter::count(this, UseCounter::SetReferrerPolicy); | 263 UseCounter::count(this, UseCounter::SetReferrerPolicy); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 274 | 274 |
| 275 DEFINE_TRACE(ExecutionContext) | 275 DEFINE_TRACE(ExecutionContext) |
| 276 { | 276 { |
| 277 visitor->trace(m_publicURLManager); | 277 visitor->trace(m_publicURLManager); |
| 278 visitor->trace(m_pendingExceptions); | 278 visitor->trace(m_pendingExceptions); |
| 279 ContextLifecycleNotifier::trace(visitor); | 279 ContextLifecycleNotifier::trace(visitor); |
| 280 Supplementable<ExecutionContext>::trace(visitor); | 280 Supplementable<ExecutionContext>::trace(visitor); |
| 281 } | 281 } |
| 282 | 282 |
| 283 } // namespace blink | 283 } // namespace blink |
| OLD | NEW |