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

Side by Side Diff: Source/core/loader/FrameLoader.cpp

Issue 303793003: Make mixed content checking and CSP aware of RemoteFrames (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Improved comments Created 6 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) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
6 * Copyright (C) Research In Motion Limited 2009. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2009. All rights reserved.
7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> 7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com>
8 * Copyright (C) 2011 Google Inc. All rights reserved. 8 * Copyright (C) 2011 Google Inc. All rights reserved.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
(...skipping 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after
1323 { 1323 {
1324 String userAgent = this->userAgent(request.url()); 1324 String userAgent = this->userAgent(request.url());
1325 ASSERT(!userAgent.isNull()); 1325 ASSERT(!userAgent.isNull());
1326 request.setHTTPUserAgent(AtomicString(userAgent)); 1326 request.setHTTPUserAgent(AtomicString(userAgent));
1327 } 1327 }
1328 1328
1329 bool FrameLoader::shouldInterruptLoadForXFrameOptions(const String& content, con st KURL& url, unsigned long requestIdentifier) 1329 bool FrameLoader::shouldInterruptLoadForXFrameOptions(const String& content, con st KURL& url, unsigned long requestIdentifier)
1330 { 1330 {
1331 UseCounter::count(m_frame->domWindow()->document(), UseCounter::XFrameOption s); 1331 UseCounter::count(m_frame->domWindow()->document(), UseCounter::XFrameOption s);
1332 1332
1333 LocalFrame* topFrame = m_frame->tree().top(); 1333 Frame* topFrame = m_frame->tree().top();
1334 if (m_frame == topFrame) 1334 if (m_frame == topFrame)
1335 return false; 1335 return false;
1336 1336
1337 XFrameOptionsDisposition disposition = parseXFrameOptionsHeader(content); 1337 XFrameOptionsDisposition disposition = parseXFrameOptionsHeader(content);
1338 1338
1339 switch (disposition) { 1339 switch (disposition) {
1340 case XFrameOptionsSameOrigin: { 1340 case XFrameOptionsSameOrigin: {
1341 UseCounter::count(m_frame->domWindow()->document(), UseCounter::XFrameOp tionsSameOrigin); 1341 UseCounter::count(m_frame->domWindow()->document(), UseCounter::XFrameOp tionsSameOrigin);
1342 RefPtr<SecurityOrigin> origin = SecurityOrigin::create(url); 1342 RefPtr<SecurityOrigin> origin = SecurityOrigin::create(url);
1343 if (!origin->isSameSchemeHostPort(topFrame->document()->securityOrigin() )) 1343 // Out-of-process ancestors are always a different origin.
1344 if (!topFrame->isLocalFrame() || !origin->isSameSchemeHostPort(toLocalFr ame(topFrame)->document()->securityOrigin()))
1344 return true; 1345 return true;
1345 for (LocalFrame* frame = m_frame->tree().parent(); frame; frame = frame- >tree().parent()) { 1346 for (Frame* frame = m_frame->tree().parent(); frame; frame = frame->tree ().parent()) {
1346 if (!origin->isSameSchemeHostPort(frame->document()->securityOrigin( ))) { 1347 if (!frame->isLocalFrame() || !origin->isSameSchemeHostPort(toLocalF rame(frame)->document()->securityOrigin())) {
1347 UseCounter::count(m_frame->domWindow()->document(), UseCounter:: XFrameOptionsSameOriginWithBadAncestorChain); 1348 UseCounter::count(m_frame->domWindow()->document(), UseCounter:: XFrameOptionsSameOriginWithBadAncestorChain);
1348 break; 1349 break;
1349 } 1350 }
1350 } 1351 }
1351 return false; 1352 return false;
1352 } 1353 }
1353 case XFrameOptionsDeny: 1354 case XFrameOptionsDeny:
1354 return true; 1355 return true;
1355 case XFrameOptionsAllowAll: 1356 case XFrameOptionsAllowAll:
1356 return false; 1357 return false;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1431 { 1432 {
1432 if (!m_frame->script().canExecuteScripts(NotAboutToExecuteScript)) 1433 if (!m_frame->script().canExecuteScripts(NotAboutToExecuteScript))
1433 return; 1434 return;
1434 1435
1435 client()->dispatchDidClearWindowObjectInMainWorld(); 1436 client()->dispatchDidClearWindowObjectInMainWorld();
1436 } 1437 }
1437 1438
1438 SandboxFlags FrameLoader::effectiveSandboxFlags() const 1439 SandboxFlags FrameLoader::effectiveSandboxFlags() const
1439 { 1440 {
1440 SandboxFlags flags = m_forcedSandboxFlags; 1441 SandboxFlags flags = m_forcedSandboxFlags;
1441 if (LocalFrame* parentFrame = m_frame->tree().parent()) 1442 // FIXME: We need a way to propagate sandbox flags to out-of-process frames.
1442 flags |= parentFrame->document()->sandboxFlags(); 1443 Frame* parentFrame = m_frame->tree().parent();
1444 if (parentFrame && parentFrame->isLocalFrame())
1445 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags();
1443 if (FrameOwner* frameOwner = m_frame->ownerElement()) 1446 if (FrameOwner* frameOwner = m_frame->ownerElement())
1444 flags |= frameOwner->sandboxFlags(); 1447 flags |= frameOwner->sandboxFlags();
1445 return flags; 1448 return flags;
1446 } 1449 }
1447 1450
1448 } // namespace WebCore 1451 } // namespace WebCore
OLDNEW
« Source/core/frame/csp/CSPDirectiveList.cpp ('K') | « Source/core/loader/DocumentLoader.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698