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

Side by Side Diff: third_party/WebKit/Source/core/loader/MixedContentChecker.cpp

Issue 2040133003: Replace SecurityContext::InsecureRequestsPolicy with WebInsecureRequestPolicy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@combine-uir-block
Patch Set: Ugh. Created 4 years, 6 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 24 matching lines...) Expand all
35 #include "core/frame/UseCounter.h" 35 #include "core/frame/UseCounter.h"
36 #include "core/inspector/ConsoleMessage.h" 36 #include "core/inspector/ConsoleMessage.h"
37 #include "core/loader/DocumentLoader.h" 37 #include "core/loader/DocumentLoader.h"
38 #include "core/loader/FrameLoader.h" 38 #include "core/loader/FrameLoader.h"
39 #include "core/loader/FrameLoaderClient.h" 39 #include "core/loader/FrameLoaderClient.h"
40 #include "platform/RuntimeEnabledFeatures.h" 40 #include "platform/RuntimeEnabledFeatures.h"
41 #include "platform/network/NetworkUtils.h" 41 #include "platform/network/NetworkUtils.h"
42 #include "platform/weborigin/SchemeRegistry.h" 42 #include "platform/weborigin/SchemeRegistry.h"
43 #include "platform/weborigin/SecurityOrigin.h" 43 #include "platform/weborigin/SecurityOrigin.h"
44 #include "public/platform/WebAddressSpace.h" 44 #include "public/platform/WebAddressSpace.h"
45 #include "public/platform/WebInsecureRequestPolicy.h"
45 #include "wtf/text/StringBuilder.h" 46 #include "wtf/text/StringBuilder.h"
46 47
47 namespace blink { 48 namespace blink {
48 49
49 namespace { 50 namespace {
50 51
51 // When a frame is local, use its full URL to represent the main 52 // When a frame is local, use its full URL to represent the main
52 // resource. When the frame is remote, the full URL isn't accessible, so 53 // resource. When the frame is remote, the full URL isn't accessible, so
53 // use the origin. This function is used, for example, to determine the 54 // use the origin. This function is used, for example, to determine the
54 // URL to show in console messages about mixed content. 55 // URL to show in console messages about mixed content.
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 Settings* settings = mixedFrame->settings(); 322 Settings* settings = mixedFrame->settings();
322 // Use the current local frame's client; the embedder doesn't 323 // Use the current local frame's client; the embedder doesn't
323 // distinguish mixed content signals from different frames on the 324 // distinguish mixed content signals from different frames on the
324 // same page. 325 // same page.
325 FrameLoaderClient* client = frame->loader().client(); 326 FrameLoaderClient* client = frame->loader().client();
326 SecurityOrigin* securityOrigin = mixedFrame->securityContext()->getSecurityO rigin(); 327 SecurityOrigin* securityOrigin = mixedFrame->securityContext()->getSecurityO rigin();
327 bool allowed = false; 328 bool allowed = false;
328 329
329 // If we're in strict mode, we'll automagically fail everything, and intenti onally skip 330 // If we're in strict mode, we'll automagically fail everything, and intenti onally skip
330 // the client checks in order to prevent degrading the site's security UI. 331 // the client checks in order to prevent degrading the site's security UI.
331 bool strictMode = mixedFrame->securityContext()->shouldEnforceStrictMixedCon tentChecking() || settings->strictMixedContentChecking(); 332 bool strictMode = mixedFrame->securityContext()->getInsecureRequestPolicy() & kBlockAllMixedContent || settings->strictMixedContentChecking();
332 333
333 ContextType contextType = contextTypeFromContext(requestContext, mixedFrame) ; 334 ContextType contextType = contextTypeFromContext(requestContext, mixedFrame) ;
334 335
335 // If we're loading the main resource of a subframe, we need to take a close look at the loaded URL. 336 // If we're loading the main resource of a subframe, we need to take a close look at the loaded URL.
336 // If we're dealing with a CORS-enabled scheme, then block mixed frames as a ctive content. Otherwise, 337 // If we're dealing with a CORS-enabled scheme, then block mixed frames as a ctive content. Otherwise,
337 // treat frames as passive content. 338 // treat frames as passive content.
338 // 339 //
339 // FIXME: Remove this temporary hack once we have a reasonable API for launc hing external applications 340 // FIXME: Remove this temporary hack once we have a reasonable API for launc hing external applications
340 // via URLs. http://crbug.com/318788 and https://crbug.com/393481 341 // via URLs. http://crbug.com/318788 and https://crbug.com/393481
341 if (frameType == WebURLRequest::FrameTypeNested && !SchemeRegistry::shouldTr eatURLSchemeAsCORSEnabled(url.protocol())) 342 if (frameType == WebURLRequest::FrameTypeNested && !SchemeRegistry::shouldTr eatURLSchemeAsCORSEnabled(url.protocol()))
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 Settings* settings = mixedFrame->settings(); 414 Settings* settings = mixedFrame->settings();
414 // Use the current local frame's client; the embedder doesn't 415 // Use the current local frame's client; the embedder doesn't
415 // distinguish mixed content signals from different frames on the 416 // distinguish mixed content signals from different frames on the
416 // same page. 417 // same page.
417 FrameLoaderClient* client = frame->loader().client(); 418 FrameLoaderClient* client = frame->loader().client();
418 SecurityOrigin* securityOrigin = mixedFrame->securityContext()->getSecurityO rigin(); 419 SecurityOrigin* securityOrigin = mixedFrame->securityContext()->getSecurityO rigin();
419 bool allowed = false; 420 bool allowed = false;
420 421
421 // If we're in strict mode, we'll automagically fail everything, and intenti onally skip 422 // If we're in strict mode, we'll automagically fail everything, and intenti onally skip
422 // the client checks in order to prevent degrading the site's security UI. 423 // the client checks in order to prevent degrading the site's security UI.
423 bool strictMode = mixedFrame->securityContext()->shouldEnforceStrictMixedCon tentChecking() || settings->strictMixedContentChecking(); 424 bool strictMode = mixedFrame->securityContext()->getInsecureRequestPolicy() & kBlockAllMixedContent || settings->strictMixedContentChecking();
424 if (!strictMode) { 425 if (!strictMode) {
425 bool allowedPerSettings = settings && settings->allowRunningOfInsecureCo ntent(); 426 bool allowedPerSettings = settings && settings->allowRunningOfInsecureCo ntent();
426 allowed = client->allowRunningInsecureContent(allowedPerSettings, securi tyOrigin, url); 427 allowed = client->allowRunningInsecureContent(allowedPerSettings, securi tyOrigin, url);
427 } 428 }
428 429
429 if (allowed) 430 if (allowed)
430 client->didRunInsecureContent(securityOrigin, url); 431 client->didRunInsecureContent(securityOrigin, url);
431 432
432 if (reportingStatus == SendReport) 433 if (reportingStatus == SendReport)
433 logToConsoleAboutWebSocket(frame, mainResourceUrlForFrame(mixedFrame), u rl, allowed); 434 logToConsoleAboutWebSocket(frame, mainResourceUrlForFrame(mixedFrame), u rl, allowed);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 518
518 // See comment in shouldBlockFetch() about loading the main resource of a su bframe. 519 // See comment in shouldBlockFetch() about loading the main resource of a su bframe.
519 if (request.frameType() == WebURLRequest::FrameTypeNested && !SchemeRegistry ::shouldTreatURLSchemeAsCORSEnabled(request.url().protocol())) { 520 if (request.frameType() == WebURLRequest::FrameTypeNested && !SchemeRegistry ::shouldTreatURLSchemeAsCORSEnabled(request.url().protocol())) {
520 return ContextTypeOptionallyBlockable; 521 return ContextTypeOptionallyBlockable;
521 } 522 }
522 523
523 return contextTypeFromContext(request.requestContext(), mixedFrame); 524 return contextTypeFromContext(request.requestContext(), mixedFrame);
524 } 525 }
525 526
526 } // namespace blink 527 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/FrameLoader.cpp ('k') | third_party/WebKit/Source/modules/websockets/DOMWebSocket.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698