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

Side by Side Diff: third_party/WebKit/Source/core/dom/Document.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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 4886 matching lines...) Expand 10 before | Expand all | Expand 10 after
4897 m_cookieURL = KURL(ParsedURLString, emptyString()); 4897 m_cookieURL = KURL(ParsedURLString, emptyString());
4898 setSecurityOrigin(SecurityOrigin::createUnique()); 4898 setSecurityOrigin(SecurityOrigin::createUnique());
4899 initContentSecurityPolicy(); 4899 initContentSecurityPolicy();
4900 // Unique security origins cannot have a suborigin 4900 // Unique security origins cannot have a suborigin
4901 return; 4901 return;
4902 } 4902 }
4903 4903
4904 // In the common case, create the security context from the currently 4904 // In the common case, create the security context from the currently
4905 // loading URL with a fresh content security policy. 4905 // loading URL with a fresh content security policy.
4906 enforceSandboxFlags(initializer.getSandboxFlags()); 4906 enforceSandboxFlags(initializer.getSandboxFlags());
4907 if (initializer.shouldEnforceStrictMixedContentChecking()) 4907 setInsecureRequestPolicy(initializer.getInsecureRequestPolicy());
4908 enforceStrictMixedContentChecking();
4909 setInsecureRequestsPolicy(initializer.getInsecureRequestsPolicy());
4910 if (initializer.insecureNavigationsToUpgrade()) { 4908 if (initializer.insecureNavigationsToUpgrade()) {
4911 for (auto toUpgrade : *initializer.insecureNavigationsToUpgrade()) 4909 for (auto toUpgrade : *initializer.insecureNavigationsToUpgrade())
4912 addInsecureNavigationUpgrade(toUpgrade); 4910 addInsecureNavigationUpgrade(toUpgrade);
4913 } 4911 }
4914 4912
4915 if (isSandboxed(SandboxOrigin)) { 4913 if (isSandboxed(SandboxOrigin)) {
4916 m_cookieURL = m_url; 4914 m_cookieURL = m_url;
4917 setSecurityOrigin(SecurityOrigin::createUnique()); 4915 setSecurityOrigin(SecurityOrigin::createUnique());
4918 // If we're supposed to inherit our security origin from our 4916 // If we're supposed to inherit our security origin from our
4919 // owner, but we're also sandboxed, the only things we inherit are 4917 // owner, but we're also sandboxed, the only things we inherit are
(...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after
5855 { 5853 {
5856 if (frame()) 5854 if (frame())
5857 return m_frame->frameScheduler()->timerTaskRunner(); 5855 return m_frame->frameScheduler()->timerTaskRunner();
5858 if (m_importsController) 5856 if (m_importsController)
5859 return m_importsController->master()->timerTaskRunner(); 5857 return m_importsController->master()->timerTaskRunner();
5860 if (m_contextDocument) 5858 if (m_contextDocument)
5861 return m_contextDocument->timerTaskRunner(); 5859 return m_contextDocument->timerTaskRunner();
5862 return Platform::current()->currentThread()->scheduler()->timerTaskRunner(); 5860 return Platform::current()->currentThread()->scheduler()->timerTaskRunner();
5863 } 5861 }
5864 5862
5865 void Document::enforceStrictMixedContentChecking() 5863 void Document::enforceInsecureRequestPolicy(WebInsecureRequestPolicy policy)
5866 { 5864 {
5867 securityContext().setShouldEnforceStrictMixedContentChecking(true); 5865 // Combine the new policy with the existing policy, as a base policy may be
5868 if (frame()) 5866 // inherited from a remote parent before this page's policy is set. In other
5867 // words, insecure requests should be upgraded or blocked if _either_ the
5868 // existing policy or the newly enforced policy triggers upgrades or
5869 // blockage.
5870 setInsecureRequestPolicy(getInsecureRequestPolicy() | policy);
5871
5872 if (frame() && policy & kBlockAllMixedContent)
5869 frame()->loader().client()->didEnforceStrictMixedContentChecking(); 5873 frame()->loader().client()->didEnforceStrictMixedContentChecking();
5870 } 5874 }
5871 5875
5872 void Document::setShadowCascadeOrder(ShadowCascadeOrder order) 5876 void Document::setShadowCascadeOrder(ShadowCascadeOrder order)
5873 { 5877 {
5874 DCHECK_NE(order, ShadowCascadeOrder::ShadowCascadeNone); 5878 DCHECK_NE(order, ShadowCascadeOrder::ShadowCascadeNone);
5875 5879
5876 if (order == m_shadowCascadeOrder) 5880 if (order == m_shadowCascadeOrder)
5877 return; 5881 return;
5878 5882
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
5985 #ifndef NDEBUG 5989 #ifndef NDEBUG
5986 using namespace blink; 5990 using namespace blink;
5987 void showLiveDocumentInstances() 5991 void showLiveDocumentInstances()
5988 { 5992 {
5989 WeakDocumentSet& set = liveDocumentSet(); 5993 WeakDocumentSet& set = liveDocumentSet();
5990 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5994 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5991 for (Document* document : set) 5995 for (Document* document : set)
5992 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data()); 5996 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data());
5993 } 5997 }
5994 #endif 5998 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.h ('k') | third_party/WebKit/Source/core/dom/DocumentInit.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698