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 // FIXME: CSP checks are broken for OOPI. For now, this policy always allows
frames with a remote parent... | 307 // FIXME: CSP checks are broken for OOPI. For now, this policy always allows
frames with a remote parent... |
308 if (m_frame->deprecatedLocalOwner() && !m_frame->deprecatedLocalOwner()->doc
ument().contentSecurityPolicy()->allowChildFrameFromSource(request.url())) { | 308 if (m_frame->deprecatedLocalOwner() && !m_frame->deprecatedLocalOwner()->doc
ument().contentSecurityPolicy()->allowChildFrameFromSource(request.url())) { |
309 // Fire a load event, as timing attacks would otherwise reveal that the | 309 // Fire a load event, as timing attacks would otherwise reveal that the |
310 // frame was blocked. This way, it looks like every other cross-origin | 310 // frame was blocked. This way, it looks like every other cross-origin |
311 // page load. | 311 // page load. |
312 m_frame->document()->enforceSandboxFlags(SandboxOrigin); | 312 m_frame->document()->enforceSandboxFlags(SandboxOrigin); |
313 m_frame->owner()->dispatchLoad(); | 313 m_frame->owner()->dispatchLoad(); |
314 return false; | 314 return false; |
315 } | 315 } |
316 | 316 |
317 NavigationPolicy policy = m_triggeringAction.policy(); | 317 NavigationPolicy policy = m_triggeringAction.policy(); |
318 policy = frameLoader()->client()->decidePolicyForNavigation(request, this, p
olicy); | 318 policy = frameLoader()->client()->decidePolicyForNavigation(request, this, p
olicy, isTransitionNavigation); |
319 if (policy == NavigationPolicyCurrentTab) | 319 if (policy == NavigationPolicyCurrentTab) |
320 return true; | 320 return true; |
321 if (policy == NavigationPolicyIgnore) | 321 if (policy == NavigationPolicyIgnore) |
322 return false; | 322 return false; |
323 if (!DOMWindow::allowPopUp(*m_frame) && !UserGestureIndicator::processingUse
rGesture()) | 323 if (!DOMWindow::allowPopUp(*m_frame) && !UserGestureIndicator::processingUse
rGesture()) |
324 return false; | 324 return false; |
325 frameLoader()->client()->loadURLExternally(request, policy); | 325 frameLoader()->client()->loadURLExternally(request, policy); |
326 return false; | 326 return false; |
327 } | 327 } |
328 | 328 |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 void DocumentLoader::replaceDocument(const String& source, Document* ownerDocume
nt) | 828 void DocumentLoader::replaceDocument(const String& source, Document* ownerDocume
nt) |
829 { | 829 { |
830 m_frame->loader().stopAllLoaders(); | 830 m_frame->loader().stopAllLoaders(); |
831 m_writer = createWriterFor(m_frame, ownerDocument, m_frame->document()->url(
), mimeType(), m_writer ? m_writer->encoding() : emptyAtom, m_writer ? m_writer
->encodingWasChosenByUser() : false, true); | 831 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 if (!source.isNull()) | 832 if (!source.isNull()) |
833 m_writer->appendReplacingData(source); | 833 m_writer->appendReplacingData(source); |
834 endWriting(m_writer.get()); | 834 endWriting(m_writer.get()); |
835 } | 835 } |
836 | 836 |
837 } // namespace WebCore | 837 } // namespace WebCore |
OLD | NEW |