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 2026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2037 | 2037 |
2038 if (!frame()->owner() || !frame()->owner()->canRenderFallbackContent()) | 2038 if (!frame()->owner() || !frame()->owner()->canRenderFallbackContent()) |
2039 return false; | 2039 return false; |
2040 | 2040 |
2041 FrameLoader& frameloader = frame()->loader(); | 2041 FrameLoader& frameloader = frame()->loader(); |
2042 frameloader.clearNavigationHandledByClient(); | 2042 frameloader.clearNavigationHandledByClient(); |
2043 frameloader.loadFailed(frameloader.documentLoader(), error); | 2043 frameloader.loadFailed(frameloader.documentLoader(), error); |
2044 return true; | 2044 return true; |
2045 } | 2045 } |
2046 | 2046 |
| 2047 // Called when a navigation is blocked because a Content Security Policy (CSP) |
| 2048 // is infringed. |
| 2049 void WebLocalFrameImpl::contentSecurityPolicyViolation( |
| 2050 const blink::WebContentSecurityPolicyViolation& violation) { |
| 2051 DCHECK(frame() && frame()->document()); |
| 2052 Document* document = frame()->document(); |
| 2053 Vector<String> reportEndpoints; |
| 2054 for (const WebString& endPoint : violation.reportEndpoints) |
| 2055 reportEndpoints.push_back(endPoint); |
| 2056 document->contentSecurityPolicy()->reportViolation( |
| 2057 violation.directive, /* directiveText */ |
| 2058 ContentSecurityPolicy::getDirectiveType( |
| 2059 violation.effectiveDirective), /* effectiveType */ |
| 2060 violation.consoleMessage, /* consoleMessage */ |
| 2061 violation.blockedUrl, /* blockedUrl */ |
| 2062 reportEndpoints, /* reportEndpoints */ |
| 2063 violation.header, /* header */ |
| 2064 static_cast<ContentSecurityPolicyHeaderType>(violation.disposition), |
| 2065 ContentSecurityPolicy::ViolationType::URLViolation); /* ViolationType */ |
| 2066 } |
| 2067 |
2047 bool WebLocalFrameImpl::isLoading() const { | 2068 bool WebLocalFrameImpl::isLoading() const { |
2048 if (!frame() || !frame()->document()) | 2069 if (!frame() || !frame()->document()) |
2049 return false; | 2070 return false; |
2050 return frame()->loader().stateMachine()->isDisplayingInitialEmptyDocument() || | 2071 return frame()->loader().stateMachine()->isDisplayingInitialEmptyDocument() || |
2051 frame()->loader().hasProvisionalNavigation() || | 2072 frame()->loader().hasProvisionalNavigation() || |
2052 !frame()->document()->loadEventFinished(); | 2073 !frame()->document()->loadEventFinished(); |
2053 } | 2074 } |
2054 | 2075 |
2055 bool WebLocalFrameImpl::isNavigationScheduledWithin( | 2076 bool WebLocalFrameImpl::isNavigationScheduledWithin( |
2056 double intervalInSeconds) const { | 2077 double intervalInSeconds) const { |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2410 createMarkup(startPosition, endPosition, AnnotateForInterchange, | 2431 createMarkup(startPosition, endPosition, AnnotateForInterchange, |
2411 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); | 2432 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); |
2412 } else { | 2433 } else { |
2413 clipHtml = | 2434 clipHtml = |
2414 createMarkup(endPosition, startPosition, AnnotateForInterchange, | 2435 createMarkup(endPosition, startPosition, AnnotateForInterchange, |
2415 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); | 2436 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); |
2416 } | 2437 } |
2417 } | 2438 } |
2418 | 2439 |
2419 } // namespace blink | 2440 } // namespace blink |
OLD | NEW |