Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google, Inc. All rights reserved. | 2 * Copyright (C) 2011 Google, 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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 249 skipExactly<UChar>(position, end, ','); | 249 skipExactly<UChar>(position, end, ','); |
| 250 begin = position; | 250 begin = position; |
| 251 } | 251 } |
| 252 } | 252 } |
| 253 | 253 |
| 254 void ContentSecurityPolicy::setOverrideAllowInlineStyle(bool value) | 254 void ContentSecurityPolicy::setOverrideAllowInlineStyle(bool value) |
| 255 { | 255 { |
| 256 m_overrideInlineStyleAllowed = value; | 256 m_overrideInlineStyleAllowed = value; |
| 257 } | 257 } |
| 258 | 258 |
| 259 void ContentSecurityPolicy::setOverrideURLForSelf(const KURL& url) | |
| 260 { | |
| 261 // Create a temporary CSPSource so that 'self' expressions can be resolved b efore we bind to | |
| 262 // an execution context (for 'frame-ancestor' resolution, for example). This CSPSource will | |
| 263 // be overwritten when we bind this object to an execution context. | |
| 264 RefPtr<SecurityOrigin> origin = SecurityOrigin::create(url); | |
| 265 m_selfSource = adoptPtr(new CSPSource(this, origin->protocol(), origin->host (), origin->port(), String(), false, false)); | |
|
jochen (gone - plz use gerrit)
2014/09/11 12:49:44
bool parameters? sadness...
| |
| 266 } | |
| 267 | |
| 259 const String& ContentSecurityPolicy::deprecatedHeader() const | 268 const String& ContentSecurityPolicy::deprecatedHeader() const |
| 260 { | 269 { |
| 261 return m_policies.isEmpty() ? emptyString() : m_policies[0]->header(); | 270 return m_policies.isEmpty() ? emptyString() : m_policies[0]->header(); |
| 262 } | 271 } |
| 263 | 272 |
| 264 ContentSecurityPolicyHeaderType ContentSecurityPolicy::deprecatedHeaderType() co nst | 273 ContentSecurityPolicyHeaderType ContentSecurityPolicy::deprecatedHeaderType() co nst |
| 265 { | 274 { |
| 266 return m_policies.isEmpty() ? ContentSecurityPolicyHeaderTypeEnforce : m_pol icies[0]->headerType(); | 275 return m_policies.isEmpty() ? ContentSecurityPolicyHeaderTypeEnforce : m_pol icies[0]->headerType(); |
| 267 } | 276 } |
| 268 | 277 |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 617 if (callFrame.lineNumber()) { | 626 if (callFrame.lineNumber()) { |
| 618 KURL source = KURL(ParsedURLString, callFrame.sourceURL()); | 627 KURL source = KURL(ParsedURLString, callFrame.sourceURL()); |
| 619 init.sourceFile = stripURLForUseInReport(document, source); | 628 init.sourceFile = stripURLForUseInReport(document, source); |
| 620 init.lineNumber = callFrame.lineNumber(); | 629 init.lineNumber = callFrame.lineNumber(); |
| 621 init.columnNumber = callFrame.columnNumber(); | 630 init.columnNumber = callFrame.columnNumber(); |
| 622 } | 631 } |
| 623 } | 632 } |
| 624 | 633 |
| 625 void ContentSecurityPolicy::reportViolation(const String& directiveText, const S tring& effectiveDirective, const String& consoleMessage, const KURL& blockedURL, const Vector<String>& reportEndpoints, const String& header) | 634 void ContentSecurityPolicy::reportViolation(const String& directiveText, const S tring& effectiveDirective, const String& consoleMessage, const KURL& blockedURL, const Vector<String>& reportEndpoints, const String& header) |
| 626 { | 635 { |
| 636 // FIXME: Support sending 'frame-ancestor' reports (which occur before we're bound to an execution context) | |
| 637 if (!m_executionContext) | |
| 638 return; | |
| 639 | |
| 627 // FIXME: Support sending reports from worker. | 640 // FIXME: Support sending reports from worker. |
| 628 Document* document = this->document(); | 641 Document* document = this->document(); |
| 629 if (!document) | 642 if (!document) |
| 630 return; | 643 return; |
| 631 | 644 |
| 632 LocalFrame* frame = document->frame(); | 645 LocalFrame* frame = document->frame(); |
| 633 if (!frame) | 646 if (!frame) |
| 634 return; | 647 return; |
| 635 | 648 |
| 636 SecurityPolicyViolationEventInit violationData; | 649 SecurityPolicyViolationEventInit violationData; |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 840 // Collisions have no security impact, so we can save space by storing only the string's hash rather than the whole report. | 853 // Collisions have no security impact, so we can save space by storing only the string's hash rather than the whole report. |
| 841 return !m_violationReportsSent.contains(report.impl()->hash()); | 854 return !m_violationReportsSent.contains(report.impl()->hash()); |
| 842 } | 855 } |
| 843 | 856 |
| 844 void ContentSecurityPolicy::didSendViolationReport(const String& report) | 857 void ContentSecurityPolicy::didSendViolationReport(const String& report) |
| 845 { | 858 { |
| 846 m_violationReportsSent.add(report.impl()->hash()); | 859 m_violationReportsSent.add(report.impl()->hash()); |
| 847 } | 860 } |
| 848 | 861 |
| 849 } // namespace blink | 862 } // namespace blink |
| OLD | NEW |