OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google, Inc. All Rights Reserved. | 2 * Copyright (C) 2013 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 return FormData::create(reportObject->toJSONString().utf8().data()); | 100 return FormData::create(reportObject->toJSONString().utf8().data()); |
101 } | 101 } |
102 | 102 |
103 void XSSAuditorDelegate::didBlockScript(const XSSInfo& xssInfo) | 103 void XSSAuditorDelegate::didBlockScript(const XSSInfo& xssInfo) |
104 { | 104 { |
105 ASSERT(isMainThread()); | 105 ASSERT(isMainThread()); |
106 | 106 |
107 m_document->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorM
essageLevel, xssInfo.buildConsoleError())); | 107 m_document->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorM
essageLevel, xssInfo.buildConsoleError())); |
108 | 108 |
109 // stopAllLoaders can detach the LocalFrame, so protect it. | 109 // stopAllLoaders can detach the LocalFrame, so protect it. |
110 RefPtr<LocalFrame> protect(m_document->frame()); | 110 RefPtrWillBeRawPtr<LocalFrame> protect(m_document->frame()); |
111 FrameLoader& frameLoader = m_document->frame()->loader(); | 111 FrameLoader& frameLoader = m_document->frame()->loader(); |
112 if (xssInfo.m_didBlockEntirePage) | 112 if (xssInfo.m_didBlockEntirePage) |
113 frameLoader.stopAllLoaders(); | 113 frameLoader.stopAllLoaders(); |
114 | 114 |
115 if (!m_didSendNotifications) { | 115 if (!m_didSendNotifications) { |
116 m_didSendNotifications = true; | 116 m_didSendNotifications = true; |
117 | 117 |
118 frameLoader.client()->didDetectXSS(m_document->url(), xssInfo.m_didBlock
EntirePage); | 118 frameLoader.client()->didDetectXSS(m_document->url(), xssInfo.m_didBlock
EntirePage); |
119 | 119 |
120 if (!m_reportURL.isEmpty()) | 120 if (!m_reportURL.isEmpty()) |
121 PingLoader::sendViolationReport(m_document->frame(), m_reportURL, ge
nerateViolationReport(xssInfo), PingLoader::XSSAuditorViolationReport); | 121 PingLoader::sendViolationReport(m_document->frame(), m_reportURL, ge
nerateViolationReport(xssInfo), PingLoader::XSSAuditorViolationReport); |
122 } | 122 } |
123 | 123 |
124 if (xssInfo.m_didBlockEntirePage) | 124 if (xssInfo.m_didBlockEntirePage) |
125 m_document->frame()->navigationScheduler().schedulePageBlock(m_document,
Referrer()); | 125 m_document->frame()->navigationScheduler().schedulePageBlock(m_document,
Referrer()); |
126 } | 126 } |
127 | 127 |
128 } // namespace blink | 128 } // namespace blink |
OLD | NEW |