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

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

Issue 2655463006: PlzNavigate: Enforce 'frame-src' CSP on the browser. (Closed)
Patch Set: Rebase. 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 2076 matching lines...) Expand 10 before | Expand all | Expand 10 after
2087 2087
2088 if (!frame()->owner() || !frame()->owner()->canRenderFallbackContent()) 2088 if (!frame()->owner() || !frame()->owner()->canRenderFallbackContent())
2089 return false; 2089 return false;
2090 2090
2091 FrameLoader& frameloader = frame()->loader(); 2091 FrameLoader& frameloader = frame()->loader();
2092 DCHECK(frameloader.provisionalDocumentLoader()); 2092 DCHECK(frameloader.provisionalDocumentLoader());
2093 frameloader.loadFailed(frameloader.provisionalDocumentLoader(), error); 2093 frameloader.loadFailed(frameloader.provisionalDocumentLoader(), error);
2094 return true; 2094 return true;
2095 } 2095 }
2096 2096
2097 // Called when a navigation is blocked because a Content Security Policy (CSP)
2098 // is infringed.
2099 void WebLocalFrameImpl::reportContentSecurityPolicyViolation(
2100 const blink::WebContentSecurityPolicyViolation& violation) {
2101 DCHECK(frame() && frame()->document());
2102 Document* document = frame()->document();
2103 Vector<String> reportEndpoints;
2104 for (const WebString& endPoint : violation.reportEndpoints)
2105 reportEndpoints.push_back(endPoint);
2106 document->contentSecurityPolicy()->reportViolation(
2107 violation.directive, /* directiveText */
2108 ContentSecurityPolicy::getDirectiveType(
2109 violation.effectiveDirective), /* effectiveType */
2110 violation.consoleMessage, /* consoleMessage */
2111 violation.blockedUrl, /* blockedUrl */
2112 reportEndpoints, /* reportEndpoints */
2113 violation.header, /* header */
2114 static_cast<ContentSecurityPolicyHeaderType>(violation.disposition),
2115 ContentSecurityPolicy::ViolationType::URLViolation, /* ViolationType */
2116 nullptr, /* LocalFrame */
2117 violation.afterRedirect ? RedirectStatus::FollowedRedirect
2118 : RedirectStatus::NoRedirect,
2119 // TODO(arthursonzogni, clamy) Provide the context line number here.
2120 // See http://crbug.com/690946
2121 0, /* contextLine */
2122 nullptr); /* Element */
2123 }
2124
2097 bool WebLocalFrameImpl::isLoading() const { 2125 bool WebLocalFrameImpl::isLoading() const {
2098 if (!frame() || !frame()->document()) 2126 if (!frame() || !frame()->document())
2099 return false; 2127 return false;
2100 return frame()->loader().stateMachine()->isDisplayingInitialEmptyDocument() || 2128 return frame()->loader().stateMachine()->isDisplayingInitialEmptyDocument() ||
2101 frame()->loader().hasProvisionalNavigation() || 2129 frame()->loader().hasProvisionalNavigation() ||
2102 !frame()->document()->loadEventFinished(); 2130 !frame()->document()->loadEventFinished();
2103 } 2131 }
2104 2132
2105 bool WebLocalFrameImpl::isNavigationScheduledWithin( 2133 bool WebLocalFrameImpl::isNavigationScheduledWithin(
2106 double intervalInSeconds) const { 2134 double intervalInSeconds) const {
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
2480 createMarkup(startPosition, endPosition, AnnotateForInterchange, 2508 createMarkup(startPosition, endPosition, AnnotateForInterchange,
2481 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); 2509 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs);
2482 } else { 2510 } else {
2483 clipHtml = 2511 clipHtml =
2484 createMarkup(endPosition, startPosition, AnnotateForInterchange, 2512 createMarkup(endPosition, startPosition, AnnotateForInterchange,
2485 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); 2513 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs);
2486 } 2514 }
2487 } 2515 }
2488 2516
2489 } // namespace blink 2517 } // 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