OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 2069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2080 FrameLoader& frameloader = frame()->loader(); | 2080 FrameLoader& frameloader = frame()->loader(); |
2081 DCHECK(frameloader.provisionalDocumentLoader()); | 2081 DCHECK(frameloader.provisionalDocumentLoader()); |
2082 frameloader.loadFailed(frameloader.provisionalDocumentLoader(), error); | 2082 frameloader.loadFailed(frameloader.provisionalDocumentLoader(), error); |
2083 return true; | 2083 return true; |
2084 } | 2084 } |
2085 | 2085 |
2086 // Called when a navigation is blocked because a Content Security Policy (CSP) | 2086 // Called when a navigation is blocked because a Content Security Policy (CSP) |
2087 // is infringed. | 2087 // is infringed. |
2088 void WebLocalFrameImpl::reportContentSecurityPolicyViolation( | 2088 void WebLocalFrameImpl::reportContentSecurityPolicyViolation( |
2089 const blink::WebContentSecurityPolicyViolation& violation) { | 2089 const blink::WebContentSecurityPolicyViolation& violation) { |
| 2090 addMessageToConsole(blink::WebConsoleMessage( |
| 2091 WebConsoleMessage::LevelError, violation.consoleMessage, |
| 2092 violation.sourceLocation.url, violation.sourceLocation.lineNumber, |
| 2093 violation.sourceLocation.columnNumber)); |
| 2094 |
| 2095 std::unique_ptr<SourceLocation> sourceLocation = SourceLocation::create( |
| 2096 violation.sourceLocation.url, violation.sourceLocation.lineNumber, |
| 2097 violation.sourceLocation.columnNumber, nullptr); |
| 2098 |
2090 DCHECK(frame() && frame()->document()); | 2099 DCHECK(frame() && frame()->document()); |
2091 Document* document = frame()->document(); | 2100 Document* document = frame()->document(); |
2092 Vector<String> reportEndpoints; | 2101 Vector<String> reportEndpoints; |
2093 for (const WebString& endPoint : violation.reportEndpoints) | 2102 for (const WebString& endPoint : violation.reportEndpoints) |
2094 reportEndpoints.push_back(endPoint); | 2103 reportEndpoints.push_back(endPoint); |
2095 document->contentSecurityPolicy()->reportViolation( | 2104 document->contentSecurityPolicy()->reportViolation( |
2096 violation.directive, /* directiveText */ | 2105 violation.directive, /* directiveText */ |
2097 ContentSecurityPolicy::getDirectiveType( | 2106 ContentSecurityPolicy::getDirectiveType( |
2098 violation.effectiveDirective), /* effectiveType */ | 2107 violation.effectiveDirective), /* effectiveType */ |
2099 violation.consoleMessage, /* consoleMessage */ | 2108 violation.consoleMessage, /* consoleMessage */ |
2100 violation.blockedUrl, /* blockedUrl */ | 2109 violation.blockedUrl, /* blockedUrl */ |
2101 reportEndpoints, /* reportEndpoints */ | 2110 reportEndpoints, /* reportEndpoints */ |
2102 violation.header, /* header */ | 2111 violation.header, /* header */ |
2103 static_cast<ContentSecurityPolicyHeaderType>(violation.disposition), | 2112 static_cast<ContentSecurityPolicyHeaderType>(violation.disposition), |
2104 ContentSecurityPolicy::ViolationType::URLViolation, /* ViolationType */ | 2113 ContentSecurityPolicy::ViolationType::URLViolation, /* ViolationType */ |
2105 // TODO(arthursonzogni, clamy): Provide the source location here | 2114 std::move(sourceLocation), nullptr, /* LocalFrame */ |
2106 // See http://crbug.com/690946 | |
2107 std::unique_ptr<SourceLocation>(), nullptr, /* LocalFrame */ | |
2108 violation.afterRedirect ? RedirectStatus::FollowedRedirect | 2115 violation.afterRedirect ? RedirectStatus::FollowedRedirect |
2109 : RedirectStatus::NoRedirect, | 2116 : RedirectStatus::NoRedirect, |
2110 nullptr); /* Element */ | 2117 nullptr); /* Element */ |
2111 } | 2118 } |
2112 | 2119 |
2113 bool WebLocalFrameImpl::isLoading() const { | 2120 bool WebLocalFrameImpl::isLoading() const { |
2114 if (!frame() || !frame()->document()) | 2121 if (!frame() || !frame()->document()) |
2115 return false; | 2122 return false; |
2116 return frame()->loader().stateMachine()->isDisplayingInitialEmptyDocument() || | 2123 return frame()->loader().stateMachine()->isDisplayingInitialEmptyDocument() || |
2117 frame()->loader().hasProvisionalNavigation() || | 2124 frame()->loader().hasProvisionalNavigation() || |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2503 createMarkup(startPosition, endPosition, AnnotateForInterchange, | 2510 createMarkup(startPosition, endPosition, AnnotateForInterchange, |
2504 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); | 2511 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); |
2505 } else { | 2512 } else { |
2506 clipHtml = | 2513 clipHtml = |
2507 createMarkup(endPosition, startPosition, AnnotateForInterchange, | 2514 createMarkup(endPosition, startPosition, AnnotateForInterchange, |
2508 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); | 2515 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); |
2509 } | 2516 } |
2510 } | 2517 } |
2511 | 2518 |
2512 } // namespace blink | 2519 } // namespace blink |
OLD | NEW |