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 2059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2070 | 2070 |
2071 if (!frame()->owner() || !frame()->owner()->canRenderFallbackContent()) | 2071 if (!frame()->owner() || !frame()->owner()->canRenderFallbackContent()) |
2072 return false; | 2072 return false; |
2073 | 2073 |
2074 FrameLoader& frameloader = frame()->loader(); | 2074 FrameLoader& frameloader = frame()->loader(); |
2075 DCHECK(frameloader.provisionalDocumentLoader()); | 2075 DCHECK(frameloader.provisionalDocumentLoader()); |
2076 frameloader.loadFailed(frameloader.provisionalDocumentLoader(), error); | 2076 frameloader.loadFailed(frameloader.provisionalDocumentLoader(), error); |
2077 return true; | 2077 return true; |
2078 } | 2078 } |
2079 | 2079 |
| 2080 // Called when a navigation is blocked because a Content Security Policy (CSP) |
| 2081 // is infringed. |
| 2082 void WebLocalFrameImpl::reportContentSecurityPolicyViolation( |
| 2083 const blink::WebContentSecurityPolicyViolation& violation) { |
| 2084 DCHECK(frame() && frame()->document()); |
| 2085 Document* document = frame()->document(); |
| 2086 Vector<String> reportEndpoints; |
| 2087 for (const WebString& endPoint : violation.reportEndpoints) |
| 2088 reportEndpoints.push_back(endPoint); |
| 2089 document->contentSecurityPolicy()->reportViolation( |
| 2090 violation.directive, /* directiveText */ |
| 2091 ContentSecurityPolicy::getDirectiveType( |
| 2092 violation.effectiveDirective), /* effectiveType */ |
| 2093 violation.consoleMessage, /* consoleMessage */ |
| 2094 violation.blockedUrl, /* blockedUrl */ |
| 2095 reportEndpoints, /* reportEndpoints */ |
| 2096 violation.header, /* header */ |
| 2097 static_cast<ContentSecurityPolicyHeaderType>(violation.disposition), |
| 2098 ContentSecurityPolicy::ViolationType::URLViolation, /* ViolationType */ |
| 2099 nullptr, /* LocalFrame */ |
| 2100 violation.afterRedirect ? RedirectStatus::FollowedRedirect |
| 2101 : RedirectStatus::NoRedirect, |
| 2102 // TODO(arthursonzogni, clamy) Provide the context line number here. |
| 2103 // See http://crbug.com/690946 |
| 2104 0, /* contextLine */ |
| 2105 nullptr); /* Element */ |
| 2106 } |
| 2107 |
2080 bool WebLocalFrameImpl::isLoading() const { | 2108 bool WebLocalFrameImpl::isLoading() const { |
2081 if (!frame() || !frame()->document()) | 2109 if (!frame() || !frame()->document()) |
2082 return false; | 2110 return false; |
2083 return frame()->loader().stateMachine()->isDisplayingInitialEmptyDocument() || | 2111 return frame()->loader().stateMachine()->isDisplayingInitialEmptyDocument() || |
2084 frame()->loader().hasProvisionalNavigation() || | 2112 frame()->loader().hasProvisionalNavigation() || |
2085 !frame()->document()->loadEventFinished(); | 2113 !frame()->document()->loadEventFinished(); |
2086 } | 2114 } |
2087 | 2115 |
2088 bool WebLocalFrameImpl::isNavigationScheduledWithin( | 2116 bool WebLocalFrameImpl::isNavigationScheduledWithin( |
2089 double intervalInSeconds) const { | 2117 double intervalInSeconds) const { |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2463 createMarkup(startPosition, endPosition, AnnotateForInterchange, | 2491 createMarkup(startPosition, endPosition, AnnotateForInterchange, |
2464 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); | 2492 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); |
2465 } else { | 2493 } else { |
2466 clipHtml = | 2494 clipHtml = |
2467 createMarkup(endPosition, startPosition, AnnotateForInterchange, | 2495 createMarkup(endPosition, startPosition, AnnotateForInterchange, |
2468 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); | 2496 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); |
2469 } | 2497 } |
2470 } | 2498 } |
2471 | 2499 |
2472 } // namespace blink | 2500 } // namespace blink |
OLD | NEW |