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 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 if (!document) | 657 if (!document) |
658 return; | 658 return; |
659 | 659 |
660 LocalFrame* frame = document->frame(); | 660 LocalFrame* frame = document->frame(); |
661 if (!frame) | 661 if (!frame) |
662 return; | 662 return; |
663 | 663 |
664 SecurityPolicyViolationEventInit violationData; | 664 SecurityPolicyViolationEventInit violationData; |
665 gatherSecurityPolicyViolationEventData(violationData, document, directiveTex
t, effectiveDirective, blockedURL, header); | 665 gatherSecurityPolicyViolationEventData(violationData, document, directiveTex
t, effectiveDirective, blockedURL, header); |
666 | 666 |
667 frame->domWindow()->enqueueDocumentEvent(SecurityPolicyViolationEvent::creat
e(EventTypeNames::securitypolicyviolation, violationData)); | 667 frame->localDOMWindow()->enqueueDocumentEvent(SecurityPolicyViolationEvent::
create(EventTypeNames::securitypolicyviolation, violationData)); |
668 | 668 |
669 if (reportEndpoints.isEmpty()) | 669 if (reportEndpoints.isEmpty()) |
670 return; | 670 return; |
671 | 671 |
672 // We need to be careful here when deciding what information to send to the | 672 // We need to be careful here when deciding what information to send to the |
673 // report-uri. Currently, we send only the current document's URL and the | 673 // report-uri. Currently, we send only the current document's URL and the |
674 // directive that was violated. The document's URL is safe to send because | 674 // directive that was violated. The document's URL is safe to send because |
675 // it's the document itself that's requesting that it be sent. You could | 675 // it's the document itself that's requesting that it be sent. You could |
676 // make an argument that we shouldn't send HTTPS document URLs to HTTP | 676 // make an argument that we shouldn't send HTTPS document URLs to HTTP |
677 // report-uris (for the same reasons that we supress the Referer in that | 677 // report-uris (for the same reasons that we supress the Referer in that |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 // Collisions have no security impact, so we can save space by storing only
the string's hash rather than the whole report. | 874 // Collisions have no security impact, so we can save space by storing only
the string's hash rather than the whole report. |
875 return !m_violationReportsSent.contains(report.impl()->hash()); | 875 return !m_violationReportsSent.contains(report.impl()->hash()); |
876 } | 876 } |
877 | 877 |
878 void ContentSecurityPolicy::didSendViolationReport(const String& report) | 878 void ContentSecurityPolicy::didSendViolationReport(const String& report) |
879 { | 879 { |
880 m_violationReportsSent.add(report.impl()->hash()); | 880 m_violationReportsSent.add(report.impl()->hash()); |
881 } | 881 } |
882 | 882 |
883 } // namespace blink | 883 } // namespace blink |
OLD | NEW |