| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 bool DocumentLoader::isRedirectAfterPost(const ResourceRequest& newRequest, cons
t ResourceResponse& redirectResponse) | 290 bool DocumentLoader::isRedirectAfterPost(const ResourceRequest& newRequest, cons
t ResourceResponse& redirectResponse) |
| 291 { | 291 { |
| 292 int status = redirectResponse.httpStatusCode(); | 292 int status = redirectResponse.httpStatusCode(); |
| 293 if (((status >= 301 && status <= 303) || status == 307) | 293 if (((status >= 301 && status <= 303) || status == 307) |
| 294 && m_originalRequest.httpMethod() == "POST") | 294 && m_originalRequest.httpMethod() == "POST") |
| 295 return true; | 295 return true; |
| 296 | 296 |
| 297 return false; | 297 return false; |
| 298 } | 298 } |
| 299 | 299 |
| 300 bool DocumentLoader::shouldContinueForNavigationPolicy(const ResourceRequest& re
quest, ContentSecurityPolicyCheck shouldCheckMainWorldContentSecurityPolicy) | 300 bool DocumentLoader::shouldContinueForNavigationPolicy(const ResourceRequest& re
quest, ContentSecurityPolicyCheck shouldCheckMainWorldContentSecurityPolicy, boo
l isTransitionNavigation) |
| 301 { | 301 { |
| 302 // Don't ask if we are loading an empty URL. | 302 // Don't ask if we are loading an empty URL. |
| 303 if (request.url().isEmpty() || m_substituteData.isValid()) | 303 if (request.url().isEmpty() || m_substituteData.isValid()) |
| 304 return true; | 304 return true; |
| 305 | 305 |
| 306 // If we're loading content into a subframe, check against the parent's Cont
ent Security Policy | 306 // If we're loading content into a subframe, check against the parent's Cont
ent Security Policy |
| 307 // and kill the load if that check fails, unless we should bypass the main w
orld's CSP. | 307 // and kill the load if that check fails, unless we should bypass the main w
orld's CSP. |
| 308 // FIXME: CSP checks are broken for OOPI. For now, this policy always allows
frames with a remote parent... | 308 // FIXME: CSP checks are broken for OOPI. For now, this policy always allows
frames with a remote parent... |
| 309 if ((shouldCheckMainWorldContentSecurityPolicy == CheckContentSecurityPolicy
) && (m_frame->deprecatedLocalOwner() && !m_frame->deprecatedLocalOwner()->docum
ent().contentSecurityPolicy()->allowChildFrameFromSource(request.url()))) { | 309 if ((shouldCheckMainWorldContentSecurityPolicy == CheckContentSecurityPolicy
) && (m_frame->deprecatedLocalOwner() && !m_frame->deprecatedLocalOwner()->docum
ent().contentSecurityPolicy()->allowChildFrameFromSource(request.url()))) { |
| 310 // Fire a load event, as timing attacks would otherwise reveal that the | 310 // Fire a load event, as timing attacks would otherwise reveal that the |
| 311 // frame was blocked. This way, it looks like every other cross-origin | 311 // frame was blocked. This way, it looks like every other cross-origin |
| 312 // page load. | 312 // page load. |
| 313 m_frame->document()->enforceSandboxFlags(SandboxOrigin); | 313 m_frame->document()->enforceSandboxFlags(SandboxOrigin); |
| 314 m_frame->owner()->dispatchLoad(); | 314 m_frame->owner()->dispatchLoad(); |
| 315 return false; | 315 return false; |
| 316 } | 316 } |
| 317 | 317 |
| 318 NavigationPolicy policy = m_triggeringAction.policy(); | 318 NavigationPolicy policy = m_triggeringAction.policy(); |
| 319 policy = frameLoader()->client()->decidePolicyForNavigation(request, this, p
olicy); | 319 policy = frameLoader()->client()->decidePolicyForNavigation(request, this, p
olicy, isTransitionNavigation); |
| 320 if (policy == NavigationPolicyCurrentTab) | 320 if (policy == NavigationPolicyCurrentTab) |
| 321 return true; | 321 return true; |
| 322 if (policy == NavigationPolicyIgnore) | 322 if (policy == NavigationPolicyIgnore) |
| 323 return false; | 323 return false; |
| 324 if (!LocalDOMWindow::allowPopUp(*m_frame) && !UserGestureIndicator::processi
ngUserGesture()) | 324 if (!LocalDOMWindow::allowPopUp(*m_frame) && !UserGestureIndicator::processi
ngUserGesture()) |
| 325 return false; | 325 return false; |
| 326 frameLoader()->client()->loadURLExternally(request, policy); | 326 frameLoader()->client()->loadURLExternally(request, policy); |
| 327 return false; | 327 return false; |
| 328 } | 328 } |
| 329 | 329 |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 829 void DocumentLoader::replaceDocument(const String& source, Document* ownerDocume
nt) | 829 void DocumentLoader::replaceDocument(const String& source, Document* ownerDocume
nt) |
| 830 { | 830 { |
| 831 m_frame->loader().stopAllLoaders(); | 831 m_frame->loader().stopAllLoaders(); |
| 832 m_writer = createWriterFor(m_frame, ownerDocument, m_frame->document()->url(
), mimeType(), m_writer ? m_writer->encoding() : emptyAtom, m_writer ? m_writer
->encodingWasChosenByUser() : false, true); | 832 m_writer = createWriterFor(m_frame, ownerDocument, m_frame->document()->url(
), mimeType(), m_writer ? m_writer->encoding() : emptyAtom, m_writer ? m_writer
->encodingWasChosenByUser() : false, true); |
| 833 if (!source.isNull()) | 833 if (!source.isNull()) |
| 834 m_writer->appendReplacingData(source); | 834 m_writer->appendReplacingData(source); |
| 835 endWriting(m_writer.get()); | 835 endWriting(m_writer.get()); |
| 836 } | 836 } |
| 837 | 837 |
| 838 } // namespace WebCore | 838 } // namespace WebCore |
| OLD | NEW |