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 2050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2061 | 2061 |
2062 if (!frame()->owner() || !frame()->owner()->canRenderFallbackContent()) | 2062 if (!frame()->owner() || !frame()->owner()->canRenderFallbackContent()) |
2063 return false; | 2063 return false; |
2064 | 2064 |
2065 FrameLoader& frameloader = frame()->loader(); | 2065 FrameLoader& frameloader = frame()->loader(); |
2066 frameloader.clearNavigationHandledByClient(); | 2066 frameloader.clearNavigationHandledByClient(); |
2067 frameloader.loadFailed(frameloader.documentLoader(), error); | 2067 frameloader.loadFailed(frameloader.documentLoader(), error); |
2068 return true; | 2068 return true; |
2069 } | 2069 } |
2070 | 2070 |
| 2071 // Called when a navigation is blocked because a Content Security Policy (CSP) |
| 2072 // is infringed. |
| 2073 void WebLocalFrameImpl::reportContentSecurityPolicyViolation( |
| 2074 const blink::WebContentSecurityPolicyViolation& violation) { |
| 2075 DCHECK(frame() && frame()->document()); |
| 2076 Document* document = frame()->document(); |
| 2077 Vector<String> reportEndpoints; |
| 2078 for (const WebString& endPoint : violation.reportEndpoints) |
| 2079 reportEndpoints.push_back(endPoint); |
| 2080 document->contentSecurityPolicy()->reportViolation( |
| 2081 violation.directive, /* directiveText */ |
| 2082 ContentSecurityPolicy::getDirectiveType( |
| 2083 violation.effectiveDirective), /* effectiveType */ |
| 2084 violation.consoleMessage, /* consoleMessage */ |
| 2085 violation.blockedUrl, /* blockedUrl */ |
| 2086 reportEndpoints, /* reportEndpoints */ |
| 2087 violation.header, /* header */ |
| 2088 static_cast<ContentSecurityPolicyHeaderType>(violation.disposition), |
| 2089 ContentSecurityPolicy::ViolationType::URLViolation, /* ViolationType */ |
| 2090 nullptr, /* LocalFrame */ |
| 2091 violation.afterRedirect ? RedirectStatus::FollowedRedirect |
| 2092 : RedirectStatus::NoRedirect, |
| 2093 // TODO(arthursonzogni, clamy) Provide the context line number here. |
| 2094 // See http://crbug.com/690946 |
| 2095 0, /* contextLine */ |
| 2096 nullptr); /* Element */ |
| 2097 } |
| 2098 |
2071 bool WebLocalFrameImpl::isLoading() const { | 2099 bool WebLocalFrameImpl::isLoading() const { |
2072 if (!frame() || !frame()->document()) | 2100 if (!frame() || !frame()->document()) |
2073 return false; | 2101 return false; |
2074 return frame()->loader().stateMachine()->isDisplayingInitialEmptyDocument() || | 2102 return frame()->loader().stateMachine()->isDisplayingInitialEmptyDocument() || |
2075 frame()->loader().hasProvisionalNavigation() || | 2103 frame()->loader().hasProvisionalNavigation() || |
2076 !frame()->document()->loadEventFinished(); | 2104 !frame()->document()->loadEventFinished(); |
2077 } | 2105 } |
2078 | 2106 |
2079 bool WebLocalFrameImpl::isNavigationScheduledWithin( | 2107 bool WebLocalFrameImpl::isNavigationScheduledWithin( |
2080 double intervalInSeconds) const { | 2108 double intervalInSeconds) const { |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2454 createMarkup(startPosition, endPosition, AnnotateForInterchange, | 2482 createMarkup(startPosition, endPosition, AnnotateForInterchange, |
2455 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); | 2483 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); |
2456 } else { | 2484 } else { |
2457 clipHtml = | 2485 clipHtml = |
2458 createMarkup(endPosition, startPosition, AnnotateForInterchange, | 2486 createMarkup(endPosition, startPosition, AnnotateForInterchange, |
2459 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); | 2487 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); |
2460 } | 2488 } |
2461 } | 2489 } |
2462 | 2490 |
2463 } // namespace blink | 2491 } // namespace blink |
OLD | NEW |