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

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

Issue 559503002: CSP: Move policy parsing out of Document. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Reworking. Created 6 years, 3 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) 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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 void FrameLoader::didBeginDocument(bool dispatch) 373 void FrameLoader::didBeginDocument(bool dispatch)
374 { 374 {
375 m_frame->document()->setReadyState(Document::Loading); 375 m_frame->document()->setReadyState(Document::Loading);
376 376
377 if (m_provisionalItem && m_loadType == FrameLoadTypeBackForward) 377 if (m_provisionalItem && m_loadType == FrameLoadTypeBackForward)
378 m_frame->domWindow()->statePopped(m_provisionalItem->stateObject()); 378 m_frame->domWindow()->statePopped(m_provisionalItem->stateObject());
379 379
380 if (dispatch) 380 if (dispatch)
381 dispatchDidClearDocumentOfWindowObject(); 381 dispatchDidClearDocumentOfWindowObject();
382 382
383 m_frame->document()->initContentSecurityPolicy(m_documentLoader ? ContentSec urityPolicyResponseHeaders(m_documentLoader->response()) : ContentSecurityPolicy ResponseHeaders()); 383 // FIXME: Move this to DocumentLoader::responseReceived, next to the X-Frame -Options checks.
384 RefPtr<ContentSecurityPolicy> csp = ContentSecurityPolicy::create();
385 if (m_documentLoader)
386 csp->didReceiveHeaders(ContentSecurityPolicyResponseHeaders(m_documentLo ader->response()));
387 m_frame->document()->initContentSecurityPolicy(csp);
384 388
385 if (!m_frame->document()->contentSecurityPolicy()->allowAncestors(m_frame)) { 389 if (!m_frame->document()->contentSecurityPolicy()->allowAncestors(m_frame)) {
386 didFailContentSecurityPolicyCheck(this); 390 didFailContentSecurityPolicyCheck(this);
387 return; 391 return;
388 } 392 }
389 393
390 Settings* settings = m_frame->document()->settings(); 394 Settings* settings = m_frame->document()->settings();
391 if (settings) { 395 if (settings) {
392 m_frame->document()->fetcher()->setImagesEnabled(settings->imagesEnabled ()); 396 m_frame->document()->fetcher()->setImagesEnabled(settings->imagesEnabled ());
393 m_frame->document()->fetcher()->setAutoLoadImages(settings->loadsImagesA utomatically()); 397 m_frame->document()->fetcher()->setAutoLoadImages(settings->loadsImagesA utomatically());
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after
1487 // FIXME: We need a way to propagate sandbox flags to out-of-process frames. 1491 // FIXME: We need a way to propagate sandbox flags to out-of-process frames.
1488 Frame* parentFrame = m_frame->tree().parent(); 1492 Frame* parentFrame = m_frame->tree().parent();
1489 if (parentFrame && parentFrame->isLocalFrame()) 1493 if (parentFrame && parentFrame->isLocalFrame())
1490 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags(); 1494 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags();
1491 if (FrameOwner* frameOwner = m_frame->owner()) 1495 if (FrameOwner* frameOwner = m_frame->owner())
1492 flags |= frameOwner->sandboxFlags(); 1496 flags |= frameOwner->sandboxFlags();
1493 return flags; 1497 return flags;
1494 } 1498 }
1495 1499
1496 } // namespace blink 1500 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/frame/csp/ContentSecurityPolicy.cpp ('k') | Source/core/workers/WorkerGlobalScope.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698