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

Side by Side Diff: Source/core/dom/DocumentInit.cpp

Issue 845303003: Tag SecurityContext objects as being hosted in reserved IP ranges. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Feedback. Created 5 years, 11 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
« no previous file with comments | « Source/core/dom/DocumentInit.h ('k') | Source/core/dom/SecurityContext.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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, 2010, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 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) 2010 Nokia Corporation and/or its subsidiary(-ies) 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
9 * Copyright (C) 2013 Google Inc. All rights reserved. 9 * Copyright (C) 2013 Google Inc. All rights reserved.
10 * 10 *
(...skipping 15 matching lines...) Expand all
26 */ 26 */
27 27
28 #include "config.h" 28 #include "config.h"
29 #include "core/dom/DocumentInit.h" 29 #include "core/dom/DocumentInit.h"
30 30
31 #include "core/dom/Document.h" 31 #include "core/dom/Document.h"
32 #include "core/dom/custom/CustomElementRegistrationContext.h" 32 #include "core/dom/custom/CustomElementRegistrationContext.h"
33 #include "core/frame/LocalFrame.h" 33 #include "core/frame/LocalFrame.h"
34 #include "core/html/HTMLFrameOwnerElement.h" 34 #include "core/html/HTMLFrameOwnerElement.h"
35 #include "core/html/imports/HTMLImportsController.h" 35 #include "core/html/imports/HTMLImportsController.h"
36 #include "core/loader/DocumentLoader.h"
36 #include "platform/RuntimeEnabledFeatures.h" 37 #include "platform/RuntimeEnabledFeatures.h"
38 #include "public/platform/Platform.h"
37 39
38 namespace blink { 40 namespace blink {
39 41
40 // FIXME: Broken with OOPI. 42 // FIXME: Broken with OOPI.
41 static Document* parentDocument(LocalFrame* frame) 43 static Document* parentDocument(LocalFrame* frame)
42 { 44 {
43 if (!frame) 45 if (!frame)
44 return 0; 46 return 0;
45 Element* ownerElement = frame->deprecatedLocalOwner(); 47 Element* ownerElement = frame->deprecatedLocalOwner();
46 if (!ownerElement) 48 if (!ownerElement)
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 ASSERT(frameForSecurityContext()); 118 ASSERT(frameForSecurityContext());
117 return frameForSecurityContext()->loader().effectiveSandboxFlags(); 119 return frameForSecurityContext()->loader().effectiveSandboxFlags();
118 } 120 }
119 121
120 bool DocumentInit::shouldEnforceStrictMixedContentChecking() const 122 bool DocumentInit::shouldEnforceStrictMixedContentChecking() const
121 { 123 {
122 ASSERT(frameForSecurityContext()); 124 ASSERT(frameForSecurityContext());
123 return frameForSecurityContext()->loader().shouldEnforceStrictMixedContentCh ecking(); 125 return frameForSecurityContext()->loader().shouldEnforceStrictMixedContentCh ecking();
124 } 126 }
125 127
128 bool DocumentInit::isHostedInReservedIPRange() const
129 {
130 if (LocalFrame* frame = frameForSecurityContext()) {
131 if (DocumentLoader* loader = frame->loader().provisionalDocumentLoader() ? frame->loader().provisionalDocumentLoader() : frame->loader().documentLoader( )) {
132 if (!loader->response().remoteIPAddress().isEmpty())
133 return Platform::current()->isReservedIPAddress(loader->response ().remoteIPAddress());
134 }
135 }
136 return false;
137 }
138
126 Settings* DocumentInit::settings() const 139 Settings* DocumentInit::settings() const
127 { 140 {
128 ASSERT(frameForSecurityContext()); 141 ASSERT(frameForSecurityContext());
129 return frameForSecurityContext()->settings(); 142 return frameForSecurityContext()->settings();
130 } 143 }
131 144
132 KURL DocumentInit::parentBaseURL() const 145 KURL DocumentInit::parentBaseURL() const
133 { 146 {
134 return m_parent->baseURL(); 147 return m_parent->baseURL();
135 } 148 }
(...skipping 28 matching lines...) Expand all
164 return m_contextDocument; 177 return m_contextDocument;
165 } 178 }
166 179
167 DocumentInit DocumentInit::fromContext(WeakPtrWillBeRawPtr<Document> contextDocu ment, const KURL& url) 180 DocumentInit DocumentInit::fromContext(WeakPtrWillBeRawPtr<Document> contextDocu ment, const KURL& url)
168 { 181 {
169 return DocumentInit(url, 0, contextDocument, 0); 182 return DocumentInit(url, 0, contextDocument, 0);
170 } 183 }
171 184
172 } // namespace blink 185 } // namespace blink
173 186
OLDNEW
« no previous file with comments | « Source/core/dom/DocumentInit.h ('k') | Source/core/dom/SecurityContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698