OLD | NEW |
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 4096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4107 | 4107 |
4108 // Schedule dropping of the DocumentSharedObjectPool. We keep it alive for a
while after parsing finishes | 4108 // Schedule dropping of the DocumentSharedObjectPool. We keep it alive for a
while after parsing finishes |
4109 // so that dynamically inserted content can also benefit from sharing optimi
zations. | 4109 // so that dynamically inserted content can also benefit from sharing optimi
zations. |
4110 // Note that we don't refresh the timer on pool access since that could lead
to huge caches being kept | 4110 // Note that we don't refresh the timer on pool access since that could lead
to huge caches being kept |
4111 // alive indefinitely by something innocuous like JS setting .innerHTML repe
atedly on a timer. | 4111 // alive indefinitely by something innocuous like JS setting .innerHTML repe
atedly on a timer. |
4112 static const int timeToKeepSharedObjectPoolAliveAfterParsingFinishedInSecond
s = 10; | 4112 static const int timeToKeepSharedObjectPoolAliveAfterParsingFinishedInSecond
s = 10; |
4113 m_sharedObjectPoolClearTimer.startOneShot(timeToKeepSharedObjectPoolAliveAft
erParsingFinishedInSeconds); | 4113 m_sharedObjectPoolClearTimer.startOneShot(timeToKeepSharedObjectPoolAliveAft
erParsingFinishedInSeconds); |
4114 | 4114 |
4115 // Parser should have picked up all preloads by now | 4115 // Parser should have picked up all preloads by now |
4116 m_fetcher->clearPreloads(); | 4116 m_fetcher->clearPreloads(); |
| 4117 |
| 4118 if (m_import) |
| 4119 m_import->didFinishParsing(); |
4117 } | 4120 } |
4118 | 4121 |
4119 void Document::sharedObjectPoolClearTimerFired(Timer<Document>*) | 4122 void Document::sharedObjectPoolClearTimerFired(Timer<Document>*) |
4120 { | 4123 { |
4121 m_sharedObjectPool.clear(); | 4124 m_sharedObjectPool.clear(); |
4122 } | 4125 } |
4123 | 4126 |
4124 void Document::didAccessStyleResolver() | 4127 void Document::didAccessStyleResolver() |
4125 { | 4128 { |
4126 static const int timeBeforeThrowingAwayStyleResolverAfterLastUseInSeconds =
60; | 4129 static const int timeBeforeThrowingAwayStyleResolverAfterLastUseInSeconds =
60; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4206 initSecurityContext(DocumentInit(m_url, m_frame, m_import)); | 4209 initSecurityContext(DocumentInit(m_url, m_frame, m_import)); |
4207 } | 4210 } |
4208 | 4211 |
4209 void Document::initSecurityContext(const DocumentInit& initializer) | 4212 void Document::initSecurityContext(const DocumentInit& initializer) |
4210 { | 4213 { |
4211 if (haveInitializedSecurityOrigin()) { | 4214 if (haveInitializedSecurityOrigin()) { |
4212 ASSERT(securityOrigin()); | 4215 ASSERT(securityOrigin()); |
4213 return; | 4216 return; |
4214 } | 4217 } |
4215 | 4218 |
4216 if (!initializer.frame()) { | 4219 if (!initializer.hasSecurityContext()) { |
4217 // No source for a security context. | 4220 // No source for a security context. |
4218 // This can occur via document.implementation.createDocument(). | 4221 // This can occur via document.implementation.createDocument(). |
4219 m_cookieURL = KURL(ParsedURLString, emptyString()); | 4222 m_cookieURL = KURL(ParsedURLString, emptyString()); |
4220 setSecurityOrigin(SecurityOrigin::createUnique()); | 4223 setSecurityOrigin(SecurityOrigin::createUnique()); |
4221 setContentSecurityPolicy(ContentSecurityPolicy::create(this)); | 4224 setContentSecurityPolicy(ContentSecurityPolicy::create(this)); |
4222 return; | 4225 return; |
4223 } | 4226 } |
4224 | 4227 |
4225 // In the common case, create the security context from the currently | 4228 // In the common case, create the security context from the currently |
4226 // loading URL with a fresh content security policy. | 4229 // loading URL with a fresh content security policy. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4278 securityOrigin()->grantLoadLocalResources(); | 4281 securityOrigin()->grantLoadLocalResources(); |
4279 return; | 4282 return; |
4280 } | 4283 } |
4281 | 4284 |
4282 m_cookieURL = ownerFrame->document()->cookieURL(); | 4285 m_cookieURL = ownerFrame->document()->cookieURL(); |
4283 // We alias the SecurityOrigins to match Firefox, see Bug 15313 | 4286 // We alias the SecurityOrigins to match Firefox, see Bug 15313 |
4284 // https://bugs.webkit.org/show_bug.cgi?id=15313 | 4287 // https://bugs.webkit.org/show_bug.cgi?id=15313 |
4285 setSecurityOrigin(ownerFrame->document()->securityOrigin()); | 4288 setSecurityOrigin(ownerFrame->document()->securityOrigin()); |
4286 } | 4289 } |
4287 | 4290 |
4288 void Document::initContentSecurityPolicy() | 4291 void Document::initContentSecurityPolicy(const ContentSecurityPolicyResponseHead
ers& headers) |
4289 { | 4292 { |
4290 if (!m_frame->tree()->parent() || (!shouldInheritSecurityOriginFromOwner(m_u
rl) && !isPluginDocument())) | 4293 if (m_frame && m_frame->tree()->parent() && (shouldInheritSecurityOriginFrom
Owner(m_url) || isPluginDocument())) |
4291 return; | 4294 contentSecurityPolicy()->copyStateFrom(m_frame->tree()->parent()->docume
nt()->contentSecurityPolicy()); |
4292 | 4295 contentSecurityPolicy()->didReceiveHeaders(headers); |
4293 contentSecurityPolicy()->copyStateFrom(m_frame->tree()->parent()->document()
->contentSecurityPolicy()); | |
4294 } | 4296 } |
4295 | 4297 |
4296 void Document::didUpdateSecurityOrigin() | 4298 void Document::didUpdateSecurityOrigin() |
4297 { | 4299 { |
4298 if (!m_frame) | 4300 if (!m_frame) |
4299 return; | 4301 return; |
4300 m_frame->script()->updateSecurityOrigin(); | 4302 m_frame->script()->updateSecurityOrigin(); |
4301 } | 4303 } |
4302 | 4304 |
4303 bool Document::isContextThread() const | 4305 bool Document::isContextThread() const |
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5089 { | 5091 { |
5090 return DocumentLifecycleNotifier::create(this); | 5092 return DocumentLifecycleNotifier::create(this); |
5091 } | 5093 } |
5092 | 5094 |
5093 DocumentLifecycleNotifier* Document::lifecycleNotifier() | 5095 DocumentLifecycleNotifier* Document::lifecycleNotifier() |
5094 { | 5096 { |
5095 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec
ycleNotifier()); | 5097 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec
ycleNotifier()); |
5096 } | 5098 } |
5097 | 5099 |
5098 } // namespace WebCore | 5100 } // namespace WebCore |
OLD | NEW |