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

Side by Side Diff: Source/core/fetch/ResourceFetcher.cpp

Issue 348853009: Refactor mixed content checks against the top frame into MixedContentChecker. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: WSS. Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ 6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 break; 430 break;
431 431
432 case Resource::MainResource: 432 case Resource::MainResource:
433 case Resource::LinkPrefetch: 433 case Resource::LinkPrefetch:
434 case Resource::LinkSubresource: 434 case Resource::LinkSubresource:
435 // These cannot affect the current document. 435 // These cannot affect the current document.
436 treatment = TreatAsAlwaysAllowedContent; 436 treatment = TreatAsAlwaysAllowedContent;
437 break; 437 break;
438 } 438 }
439 } 439 }
440 // FIXME: We need a way to access the top-level frame's mixedContentChecker when that frame
441 // is in a different process from the current frame. Until that is done, we always allow
442 // loads in remote frames.
443 if (frame() && !frame()->tree().top()->isLocalFrame())
444 return true;
445 if (treatment == TreatAsActiveContent) { 440 if (treatment == TreatAsActiveContent) {
446 if (LocalFrame* f = frame()) { 441 if (LocalFrame* f = frame()) {
447 if (!f->loader().mixedContentChecker()->canRunInsecureContent(m_docu ment->securityOrigin(), url)) 442 if (!f->loader().mixedContentChecker()->canRunInsecureContent(m_docu ment->securityOrigin(), url))
448 return false; 443 return false;
449 Frame* top = f->tree().top();
450 if (top != f && !toLocalFrame(top)->loader().mixedContentChecker()-> canRunInsecureContent(toLocalFrame(top)->document()->securityOrigin(), url))
451 return false;
452 } 444 }
453 } else if (treatment == TreatAsPassiveContent) { 445 } else if (treatment == TreatAsPassiveContent) {
454 if (LocalFrame* f = frame()) { 446 if (LocalFrame* f = frame()) {
455 Frame* top = f->tree().top(); 447 if (!f->loader().mixedContentChecker()->canDisplayInsecureContent(m_ document->securityOrigin(), url))
456 if (!toLocalFrame(top)->loader().mixedContentChecker()->canDisplayIn secureContent(toLocalFrame(top)->document()->securityOrigin(), url))
457 return false; 448 return false;
458 if (MixedContentChecker::isMixedContent(toLocalFrame(top)->document( )->securityOrigin(), url)) { 449 if (MixedContentChecker::isMixedContent(f->document()->securityOrigi n(), url) || MixedContentChecker::isMixedContent(toLocalFrame(frame()->tree().to p())->document()->securityOrigin(), url)) {
459 switch (type) { 450 switch (type) {
460 case Resource::TextTrack:
461 UseCounter::count(toLocalFrame(top)->document(), UseCounter: :MixedContentTextTrack);
462 break;
463
464 case Resource::Raw: 451 case Resource::Raw:
465 UseCounter::count(toLocalFrame(top)->document(), UseCounter: :MixedContentRaw); 452 UseCounter::count(f->document(), UseCounter::MixedContentRaw );
466 break; 453 break;
467 454
468 case Resource::Image: 455 case Resource::Image:
469 UseCounter::count(toLocalFrame(top)->document(), UseCounter: :MixedContentImage); 456 UseCounter::count(f->document(), UseCounter::MixedContentIma ge);
470 break; 457 break;
471 458
472 case Resource::Media: 459 case Resource::Media:
473 UseCounter::count(toLocalFrame(top)->document(), UseCounter: :MixedContentMedia); 460 UseCounter::count(f->document(), UseCounter::MixedContentMed ia);
474 break; 461 break;
475 462
476 default: 463 default:
477 ASSERT_NOT_REACHED(); 464 ASSERT_NOT_REACHED();
478 } 465 }
479 } 466 }
480 } 467 }
481 } else { 468 } else {
482 ASSERT(treatment == TreatAsAlwaysAllowedContent); 469 ASSERT(treatment == TreatAsAlwaysAllowedContent);
483 } 470 }
(...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after
1498 } 1485 }
1499 } 1486 }
1500 1487
1501 void ResourceFetcher::trace(Visitor* visitor) 1488 void ResourceFetcher::trace(Visitor* visitor)
1502 { 1489 {
1503 visitor->trace(m_document); 1490 visitor->trace(m_document);
1504 ResourceLoaderHost::trace(visitor); 1491 ResourceLoaderHost::trace(visitor);
1505 } 1492 }
1506 1493
1507 } 1494 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698