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

Side by Side Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 1760523004: CORS-RFC1918: Teach Workers about address spaces. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Oops. Created 4 years, 9 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 4900 matching lines...) Expand 10 before | Expand all | Expand 10 after
4911 4911
4912 bool Document::useSecureKeyboardEntryWhenActive() const 4912 bool Document::useSecureKeyboardEntryWhenActive() const
4913 { 4913 {
4914 return m_useSecureKeyboardEntryWhenActive; 4914 return m_useSecureKeyboardEntryWhenActive;
4915 } 4915 }
4916 4916
4917 void Document::initSecurityContext(const DocumentInit& initializer) 4917 void Document::initSecurityContext(const DocumentInit& initializer)
4918 { 4918 {
4919 ASSERT(!securityOrigin()); 4919 ASSERT(!securityOrigin());
4920 4920
4921 setHostedInReservedIPRange(initializer.isHostedInReservedIPRange());
4922
4923 if (!initializer.hasSecurityContext()) { 4921 if (!initializer.hasSecurityContext()) {
4924 // No source for a security context. 4922 // No source for a security context.
4925 // This can occur via document.implementation.createDocument(). 4923 // This can occur via document.implementation.createDocument().
4926 m_cookieURL = KURL(ParsedURLString, emptyString()); 4924 m_cookieURL = KURL(ParsedURLString, emptyString());
4927 setSecurityOrigin(SecurityOrigin::createUnique()); 4925 setSecurityOrigin(SecurityOrigin::createUnique());
4928 initContentSecurityPolicy(); 4926 initContentSecurityPolicy();
4929 return; 4927 return;
4930 } 4928 }
4931 4929
4932 // In the common case, create the security context from the currently 4930 // In the common case, create the security context from the currently
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
4982 // Some clients do not want local URLs to have access to other l ocal URLs. 4980 // Some clients do not want local URLs to have access to other l ocal URLs.
4983 securityOrigin()->blockLocalAccessFromLocalOrigin(); 4981 securityOrigin()->blockLocalAccessFromLocalOrigin();
4984 } 4982 }
4985 } 4983 }
4986 } 4984 }
4987 4985
4988 if (initializer.shouldTreatURLAsSrcdocDocument()) { 4986 if (initializer.shouldTreatURLAsSrcdocDocument()) {
4989 m_isSrcdocDocument = true; 4987 m_isSrcdocDocument = true;
4990 setBaseURLOverride(initializer.parentBaseURL()); 4988 setBaseURLOverride(initializer.parentBaseURL());
4991 } 4989 }
4990
4991 if (initializer.isHostedInReservedIPRange())
4992 setAddressSpace(securityOrigin()->isLocalhost() ? WebURLRequest::Address SpaceLocal : WebURLRequest::AddressSpacePrivate);
4993 else
4994 setAddressSpace(WebURLRequest::AddressSpacePublic);
4992 } 4995 }
4993 4996
4994 void Document::initContentSecurityPolicy(PassRefPtrWillBeRawPtr<ContentSecurityP olicy> csp) 4997 void Document::initContentSecurityPolicy(PassRefPtrWillBeRawPtr<ContentSecurityP olicy> csp)
4995 { 4998 {
4996 setContentSecurityPolicy(csp ? csp : ContentSecurityPolicy::create()); 4999 setContentSecurityPolicy(csp ? csp : ContentSecurityPolicy::create());
4997 if (m_frame && m_frame->tree().parent() && m_frame->tree().parent()->isLocal Frame()) { 5000 if (m_frame && m_frame->tree().parent() && m_frame->tree().parent()->isLocal Frame()) {
4998 ContentSecurityPolicy* parentCSP = toLocalFrame(m_frame->tree().parent() )->document()->contentSecurityPolicy(); 5001 ContentSecurityPolicy* parentCSP = toLocalFrame(m_frame->tree().parent() )->document()->contentSecurityPolicy();
4999 if (shouldInheritSecurityOriginFromOwner(m_url)) { 5002 if (shouldInheritSecurityOriginFromOwner(m_url)) {
5000 contentSecurityPolicy()->copyStateFrom(parentCSP); 5003 contentSecurityPolicy()->copyStateFrom(parentCSP);
5001 } else if (isPluginDocument()) { 5004 } else if (isPluginDocument()) {
(...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after
5982 #ifndef NDEBUG 5985 #ifndef NDEBUG
5983 using namespace blink; 5986 using namespace blink;
5984 void showLiveDocumentInstances() 5987 void showLiveDocumentInstances()
5985 { 5988 {
5986 Document::WeakDocumentSet& set = Document::liveDocumentSet(); 5989 Document::WeakDocumentSet& set = Document::liveDocumentSet();
5987 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5990 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5988 for (Document* document : set) 5991 for (Document* document : set)
5989 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5992 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5990 } 5993 }
5991 #endif 5994 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698