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

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, 10 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 2036 matching lines...) Expand 10 before | Expand all | Expand 10 after
2047 2047
2048 if (!frame()->owner() || !frame()->owner()->canRenderFallbackContent()) 2048 if (!frame()->owner() || !frame()->owner()->canRenderFallbackContent())
2049 return false; 2049 return false;
2050 2050
2051 FrameLoader& frameloader = frame()->loader(); 2051 FrameLoader& frameloader = frame()->loader();
2052 frameloader.clearNavigationHandledByClient(); 2052 frameloader.clearNavigationHandledByClient();
2053 frameloader.loadFailed(frameloader.documentLoader(), error); 2053 frameloader.loadFailed(frameloader.documentLoader(), error);
2054 return true; 2054 return true;
2055 } 2055 }
2056 2056
2057 // Called when a navigation is blocked because a Content Security Policy (CSP)
2058 // is infringed.
2059 void WebLocalFrameImpl::reportContentSecurityPolicyViolation(
2060 const blink::WebContentSecurityPolicyViolation& violation) {
2061 DCHECK(frame() && frame()->document());
2062 Document* document = frame()->document();
2063 Vector<String> reportEndpoints;
2064 for (const WebString& endPoint : violation.reportEndpoints)
2065 reportEndpoints.push_back(endPoint);
2066 document->contentSecurityPolicy()->reportViolation(
2067 violation.directive, /* directiveText */
2068 ContentSecurityPolicy::getDirectiveType(
2069 violation.effectiveDirective), /* effectiveType */
2070 violation.consoleMessage, /* consoleMessage */
2071 violation.blockedUrl, /* blockedUrl */
2072 reportEndpoints, /* reportEndpoints */
2073 violation.header, /* header */
2074 static_cast<ContentSecurityPolicyHeaderType>(violation.disposition),
2075 ContentSecurityPolicy::ViolationType::URLViolation); /* ViolationType */
alexmos 2017/02/24 06:40:28 Does this still need to extract out and explicitly
arthursonzogni 2017/02/24 16:13:30 I am not sure to understand, but if you mean that
alexmos 2017/03/01 02:22:28 Yes, this is what I meant. Thanks for fixing it!
2076 }
2077
2057 bool WebLocalFrameImpl::isLoading() const { 2078 bool WebLocalFrameImpl::isLoading() const {
2058 if (!frame() || !frame()->document()) 2079 if (!frame() || !frame()->document())
2059 return false; 2080 return false;
2060 return frame()->loader().stateMachine()->isDisplayingInitialEmptyDocument() || 2081 return frame()->loader().stateMachine()->isDisplayingInitialEmptyDocument() ||
2061 frame()->loader().hasProvisionalNavigation() || 2082 frame()->loader().hasProvisionalNavigation() ||
2062 !frame()->document()->loadEventFinished(); 2083 !frame()->document()->loadEventFinished();
2063 } 2084 }
2064 2085
2065 bool WebLocalFrameImpl::isNavigationScheduledWithin( 2086 bool WebLocalFrameImpl::isNavigationScheduledWithin(
2066 double intervalInSeconds) const { 2087 double intervalInSeconds) const {
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
2440 createMarkup(startPosition, endPosition, AnnotateForInterchange, 2461 createMarkup(startPosition, endPosition, AnnotateForInterchange,
2441 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); 2462 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs);
2442 } else { 2463 } else {
2443 clipHtml = 2464 clipHtml =
2444 createMarkup(endPosition, startPosition, AnnotateForInterchange, 2465 createMarkup(endPosition, startPosition, AnnotateForInterchange,
2445 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs); 2466 ConvertBlocksToInlines::NotConvert, ResolveNonLocalURLs);
2446 } 2467 }
2447 } 2468 }
2448 2469
2449 } // namespace blink 2470 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698