| 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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 bool DocumentLoader::isRedirectAfterPost(const ResourceRequest& newRequest, cons
t ResourceResponse& redirectResponse) | 289 bool DocumentLoader::isRedirectAfterPost(const ResourceRequest& newRequest, cons
t ResourceResponse& redirectResponse) |
| 290 { | 290 { |
| 291 int status = redirectResponse.httpStatusCode(); | 291 int status = redirectResponse.httpStatusCode(); |
| 292 if (((status >= 301 && status <= 303) || status == 307) | 292 if (((status >= 301 && status <= 303) || status == 307) |
| 293 && m_originalRequest.httpMethod() == "POST") | 293 && m_originalRequest.httpMethod() == "POST") |
| 294 return true; | 294 return true; |
| 295 | 295 |
| 296 return false; | 296 return false; |
| 297 } | 297 } |
| 298 | 298 |
| 299 bool DocumentLoader::shouldContinueForNavigationPolicy(const ResourceRequest& re
quest) | 299 bool DocumentLoader::shouldContinueForNavigationPolicy(const ResourceRequest& re
quest, bool isTransitionNavigation) |
| 300 { | 300 { |
| 301 // Don't ask if we are loading an empty URL. | 301 // Don't ask if we are loading an empty URL. |
| 302 if (request.url().isEmpty() || m_substituteData.isValid()) | 302 if (request.url().isEmpty() || m_substituteData.isValid()) |
| 303 return true; | 303 return true; |
| 304 | 304 |
| 305 // If we're loading content into a subframe, check against the parent's Cont
ent Security Policy | 305 // If we're loading content into a subframe, check against the parent's Cont
ent Security Policy |
| 306 // and kill the load if that check fails. | 306 // and kill the load if that check fails. |
| 307 if (m_frame->ownerElement() && !m_frame->ownerElement()->document().contentS
ecurityPolicy()->allowChildFrameFromSource(request.url())) { | 307 if (m_frame->ownerElement() && !m_frame->ownerElement()->document().contentS
ecurityPolicy()->allowChildFrameFromSource(request.url())) { |
| 308 // Fire a load event, as timing attacks would otherwise reveal that the | 308 // Fire a load event, as timing attacks would otherwise reveal that the |
| 309 // frame was blocked. This way, it looks like every other cross-origin | 309 // frame was blocked. This way, it looks like every other cross-origin |
| 310 // page load. | 310 // page load. |
| 311 m_frame->document()->enforceSandboxFlags(SandboxOrigin); | 311 m_frame->document()->enforceSandboxFlags(SandboxOrigin); |
| 312 m_frame->ownerElement()->dispatchEvent(Event::create(EventTypeNames::loa
d)); | 312 m_frame->ownerElement()->dispatchEvent(Event::create(EventTypeNames::loa
d)); |
| 313 return false; | 313 return false; |
| 314 } | 314 } |
| 315 | 315 |
| 316 NavigationPolicy policy = m_triggeringAction.policy(); | 316 NavigationPolicy policy = m_triggeringAction.policy(); |
| 317 policy = frameLoader()->client()->decidePolicyForNavigation(request, this, p
olicy); | 317 policy = frameLoader()->client()->decidePolicyForNavigation(request, this, p
olicy, isTransitionNavigation); |
| 318 if (policy == NavigationPolicyCurrentTab) | 318 if (policy == NavigationPolicyCurrentTab) |
| 319 return true; | 319 return true; |
| 320 if (policy == NavigationPolicyIgnore) | 320 if (policy == NavigationPolicyIgnore) |
| 321 return false; | 321 return false; |
| 322 if (!DOMWindow::allowPopUp(*m_frame) && !UserGestureIndicator::processingUse
rGesture()) | 322 if (!DOMWindow::allowPopUp(*m_frame) && !UserGestureIndicator::processingUse
rGesture()) |
| 323 return false; | 323 return false; |
| 324 frameLoader()->client()->loadURLExternally(request, policy); | 324 frameLoader()->client()->loadURLExternally(request, policy); |
| 325 return false; | 325 return false; |
| 326 } | 326 } |
| 327 | 327 |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 void DocumentLoader::replaceDocument(const String& source, Document* ownerDocume
nt) | 822 void DocumentLoader::replaceDocument(const String& source, Document* ownerDocume
nt) |
| 823 { | 823 { |
| 824 m_frame->loader().stopAllLoaders(); | 824 m_frame->loader().stopAllLoaders(); |
| 825 m_writer = createWriterFor(m_frame, ownerDocument, m_frame->document()->url(
), mimeType(), m_writer ? m_writer->encoding() : emptyAtom, m_writer ? m_writer
->encodingWasChosenByUser() : false, true); | 825 m_writer = createWriterFor(m_frame, ownerDocument, m_frame->document()->url(
), mimeType(), m_writer ? m_writer->encoding() : emptyAtom, m_writer ? m_writer
->encodingWasChosenByUser() : false, true); |
| 826 if (!source.isNull()) | 826 if (!source.isNull()) |
| 827 m_writer->appendReplacingData(source); | 827 m_writer->appendReplacingData(source); |
| 828 endWriting(m_writer.get()); | 828 endWriting(m_writer.get()); |
| 829 } | 829 } |
| 830 | 830 |
| 831 } // namespace WebCore | 831 } // namespace WebCore |
| OLD | NEW |