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

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

Issue 1854423002: ASSERT -> {DCHECK|DCHECK_XX}, ENABLE(ASSERT) -> DCHECK_IS_ON() in dom (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mark svg/as-image/svg-nested.html crash on win Created 4 years, 8 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, 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 { 87 {
88 if (m_frame) 88 if (m_frame)
89 return m_frame; 89 return m_frame;
90 if (m_importsController) 90 if (m_importsController)
91 return m_importsController->master()->frame(); 91 return m_importsController->master()->frame();
92 return 0; 92 return 0;
93 } 93 }
94 94
95 SandboxFlags DocumentInit::getSandboxFlags() const 95 SandboxFlags DocumentInit::getSandboxFlags() const
96 { 96 {
97 ASSERT(frameForSecurityContext()); 97 DCHECK(frameForSecurityContext());
98 FrameLoader* loader = &frameForSecurityContext()->loader(); 98 FrameLoader* loader = &frameForSecurityContext()->loader();
99 SandboxFlags flags = loader->effectiveSandboxFlags(); 99 SandboxFlags flags = loader->effectiveSandboxFlags();
100 100
101 // If the load was blocked by X-Frame-Options or CSP, force the Document's 101 // If the load was blocked by X-Frame-Options or CSP, force the Document's
102 // origin to be unique, so that the blocked document appears to be a normal 102 // origin to be unique, so that the blocked document appears to be a normal
103 // cross-origin document's load per CSP spec: 103 // cross-origin document's load per CSP spec:
104 // https://www.w3.org/TR/CSP2/#directive-frame-ancestors 104 // https://www.w3.org/TR/CSP2/#directive-frame-ancestors
105 if (loader->documentLoader() && loader->documentLoader()->wasBlockedAfterXFr ameOptionsOrCSP()) 105 if (loader->documentLoader() && loader->documentLoader()->wasBlockedAfterXFr ameOptionsOrCSP())
106 flags |= SandboxOrigin; 106 flags |= SandboxOrigin;
107 107
108 return flags; 108 return flags;
109 } 109 }
110 110
111 bool DocumentInit::shouldEnforceStrictMixedContentChecking() const 111 bool DocumentInit::shouldEnforceStrictMixedContentChecking() const
112 { 112 {
113 ASSERT(frameForSecurityContext()); 113 DCHECK(frameForSecurityContext());
114 return frameForSecurityContext()->loader().shouldEnforceStrictMixedContentCh ecking(); 114 return frameForSecurityContext()->loader().shouldEnforceStrictMixedContentCh ecking();
115 } 115 }
116 116
117 SecurityContext::InsecureRequestsPolicy DocumentInit::getInsecureRequestsPolicy( ) const 117 SecurityContext::InsecureRequestsPolicy DocumentInit::getInsecureRequestsPolicy( ) const
118 { 118 {
119 ASSERT(frameForSecurityContext()); 119 DCHECK(frameForSecurityContext());
120 return frameForSecurityContext()->loader().getInsecureRequestsPolicy(); 120 return frameForSecurityContext()->loader().getInsecureRequestsPolicy();
121 } 121 }
122 122
123 SecurityContext::InsecureNavigationsSet* DocumentInit::insecureNavigationsToUpgr ade() const 123 SecurityContext::InsecureNavigationsSet* DocumentInit::insecureNavigationsToUpgr ade() const
124 { 124 {
125 ASSERT(frameForSecurityContext()); 125 DCHECK(frameForSecurityContext());
126 return frameForSecurityContext()->loader().insecureNavigationsToUpgrade(); 126 return frameForSecurityContext()->loader().insecureNavigationsToUpgrade();
127 } 127 }
128 128
129 bool DocumentInit::isHostedInReservedIPRange() const 129 bool DocumentInit::isHostedInReservedIPRange() const
130 { 130 {
131 if (LocalFrame* frame = frameForSecurityContext()) { 131 if (LocalFrame* frame = frameForSecurityContext()) {
132 if (DocumentLoader* loader = frame->loader().provisionalDocumentLoader() ? frame->loader().provisionalDocumentLoader() : frame->loader().documentLoader( )) { 132 if (DocumentLoader* loader = frame->loader().provisionalDocumentLoader() ? frame->loader().provisionalDocumentLoader() : frame->loader().documentLoader( )) {
133 if (!loader->response().remoteIPAddress().isEmpty()) 133 if (!loader->response().remoteIPAddress().isEmpty())
134 return Platform::current()->isReservedIPAddress(loader->response ().remoteIPAddress()); 134 return Platform::current()->isReservedIPAddress(loader->response ().remoteIPAddress());
135 } 135 }
136 } 136 }
137 return false; 137 return false;
138 } 138 }
139 139
140 Settings* DocumentInit::settings() const 140 Settings* DocumentInit::settings() const
141 { 141 {
142 ASSERT(frameForSecurityContext()); 142 DCHECK(frameForSecurityContext());
143 return frameForSecurityContext()->settings(); 143 return frameForSecurityContext()->settings();
144 } 144 }
145 145
146 KURL DocumentInit::parentBaseURL() const 146 KURL DocumentInit::parentBaseURL() const
147 { 147 {
148 return m_parent->baseURL(); 148 return m_parent->baseURL();
149 } 149 }
150 150
151 DocumentInit& DocumentInit::withRegistrationContext(CustomElementRegistrationCon text* registrationContext) 151 DocumentInit& DocumentInit::withRegistrationContext(CustomElementRegistrationCon text* registrationContext)
152 { 152 {
153 ASSERT(!m_createNewRegistrationContext && !m_registrationContext); 153 DCHECK(!m_createNewRegistrationContext);
154 DCHECK(!m_registrationContext);
154 m_registrationContext = registrationContext; 155 m_registrationContext = registrationContext;
155 return *this; 156 return *this;
156 } 157 }
157 158
158 DocumentInit& DocumentInit::withNewRegistrationContext() 159 DocumentInit& DocumentInit::withNewRegistrationContext()
159 { 160 {
160 ASSERT(!m_createNewRegistrationContext && !m_registrationContext); 161 DCHECK(!m_createNewRegistrationContext);
162 DCHECK(!m_registrationContext);
161 m_createNewRegistrationContext = true; 163 m_createNewRegistrationContext = true;
162 return *this; 164 return *this;
163 } 165 }
164 166
165 RawPtr<CustomElementRegistrationContext> DocumentInit::registrationContext(Docum ent* document) const 167 RawPtr<CustomElementRegistrationContext> DocumentInit::registrationContext(Docum ent* document) const
166 { 168 {
167 if (!document->isHTMLDocument() && !document->isXHTMLDocument()) 169 if (!document->isHTMLDocument() && !document->isXHTMLDocument())
168 return nullptr; 170 return nullptr;
169 171
170 if (m_createNewRegistrationContext) 172 if (m_createNewRegistrationContext)
171 return CustomElementRegistrationContext::create(); 173 return CustomElementRegistrationContext::create();
172 174
173 return m_registrationContext.get(); 175 return m_registrationContext.get();
174 } 176 }
175 177
176 RawPtr<Document> DocumentInit::contextDocument() const 178 RawPtr<Document> DocumentInit::contextDocument() const
177 { 179 {
178 return m_contextDocument; 180 return m_contextDocument;
179 } 181 }
180 182
181 DocumentInit DocumentInit::fromContext(RawPtr<Document> contextDocument, const K URL& url) 183 DocumentInit DocumentInit::fromContext(RawPtr<Document> contextDocument, const K URL& url)
182 { 184 {
183 return DocumentInit(url, 0, contextDocument, 0); 185 return DocumentInit(url, 0, contextDocument, 0);
184 } 186 }
185 187
186 } // namespace blink 188 } // namespace blink
187
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.cpp ('k') | third_party/WebKit/Source/core/dom/DocumentLifecycle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698