Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Side by Side Diff: third_party/WebKit/Source/web/WebLocalFrameImpl.cpp

Issue 2756913002: Revert of PlzNavigate: Enforce 'frame-src' CSP on the browser. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 2072 matching lines...) Expand 10 before | Expand all | Expand 10 after
2083 2083
2084 if (!frame()->owner() || !frame()->owner()->canRenderFallbackContent()) 2084 if (!frame()->owner() || !frame()->owner()->canRenderFallbackContent())
2085 return false; 2085 return false;
2086 2086
2087 FrameLoader& frameloader = frame()->loader(); 2087 FrameLoader& frameloader = frame()->loader();
2088 DCHECK(frameloader.provisionalDocumentLoader()); 2088 DCHECK(frameloader.provisionalDocumentLoader());
2089 frameloader.loadFailed(frameloader.provisionalDocumentLoader(), error); 2089 frameloader.loadFailed(frameloader.provisionalDocumentLoader(), error);
2090 return true; 2090 return true;
2091 } 2091 }
2092 2092
2093 // Called when a navigation is blocked because a Content Security Policy (CSP)
2094 // is infringed.
2095 void WebLocalFrameImpl::reportContentSecurityPolicyViolation(
2096 const blink::WebContentSecurityPolicyViolation& violation) {
2097 DCHECK(frame() && frame()->document());
2098 Document* document = frame()->document();
2099 Vector<String> reportEndpoints;
2100 for (const WebString& endPoint : violation.reportEndpoints)
2101 reportEndpoints.push_back(endPoint);
2102 document->contentSecurityPolicy()->reportViolation(
2103 violation.directive, /* directiveText */
2104 ContentSecurityPolicy::getDirectiveType(
2105 violation.effectiveDirective), /* effectiveType */
2106 violation.consoleMessage, /* consoleMessage */
2107 violation.blockedUrl, /* blockedUrl */
2108 reportEndpoints, /* reportEndpoints */
2109 violation.header, /* header */
2110 static_cast<ContentSecurityPolicyHeaderType>(violation.disposition),
2111 ContentSecurityPolicy::ViolationType::URLViolation, /* ViolationType */
2112 nullptr, /* LocalFrame */
2113 violation.afterRedirect ? RedirectStatus::FollowedRedirect
2114 : RedirectStatus::NoRedirect,
2115 // TODO(arthursonzogni, clamy) Provide the context line number here.
2116 // See http://crbug.com/690946
2117 0, /* contextLine */
2118 nullptr); /* Element */
2119 }
2120
2121 bool WebLocalFrameImpl::isLoading() const { 2093 bool WebLocalFrameImpl::isLoading() const {
2122 if (!frame() || !frame()->document()) 2094 if (!frame() || !frame()->document())
2123 return false; 2095 return false;
2124 return frame()->loader().stateMachine()->isDisplayingInitialEmptyDocument() || 2096 return frame()->loader().stateMachine()->isDisplayingInitialEmptyDocument() ||
2125 frame()->loader().hasProvisionalNavigation() || 2097 frame()->loader().hasProvisionalNavigation() ||
2126 !frame()->document()->loadEventFinished(); 2098 !frame()->document()->loadEventFinished();
2127 } 2099 }
2128 2100
2129 bool WebLocalFrameImpl::isNavigationScheduledWithin( 2101 bool WebLocalFrameImpl::isNavigationScheduledWithin(
2130 double intervalInSeconds) const { 2102 double intervalInSeconds) const {
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
2504 createMarkup(startPosition, endPosition, AnnotateForInterchange, 2476 createMarkup(startPosition, endPosition, AnnotateForInterchange,
2505 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); 2477 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs);
2506 } else { 2478 } else {
2507 clipHtml = 2479 clipHtml =
2508 createMarkup(endPosition, startPosition, AnnotateForInterchange, 2480 createMarkup(endPosition, startPosition, AnnotateForInterchange,
2509 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); 2481 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs);
2510 } 2482 }
2511 } 2483 }
2512 2484
2513 } // namespace blink 2485 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebLocalFrameImpl.h ('k') | third_party/WebKit/public/platform/WebContentSecurityPolicy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698