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