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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 bool DocumentLoader::isRedirectAfterPost(const ResourceRequest& newRequest, cons
t ResourceResponse& redirectResponse) | 260 bool DocumentLoader::isRedirectAfterPost(const ResourceRequest& newRequest, cons
t ResourceResponse& redirectResponse) |
261 { | 261 { |
262 int status = redirectResponse.httpStatusCode(); | 262 int status = redirectResponse.httpStatusCode(); |
263 if (((status >= 301 && status <= 303) || status == 307) | 263 if (((status >= 301 && status <= 303) || status == 307) |
264 && m_originalRequest.httpMethod() == "POST") | 264 && m_originalRequest.httpMethod() == "POST") |
265 return true; | 265 return true; |
266 | 266 |
267 return false; | 267 return false; |
268 } | 268 } |
269 | 269 |
270 bool DocumentLoader::shouldContinueForNavigationPolicy(const ResourceRequest& re
quest, ContentSecurityPolicyDisposition shouldCheckMainWorldContentSecurityPolic
y, NavigationPolicy policy, bool isTransitionNavigation) | 270 bool DocumentLoader::shouldContinueForNavigationPolicy(const ResourceRequest& re
quest, ContentSecurityPolicyDisposition shouldCheckMainWorldContentSecurityPolic
y, NavigationPolicy policy) |
271 { | 271 { |
272 // Don't ask if we are loading an empty URL. | 272 // Don't ask if we are loading an empty URL. |
273 if (request.url().isEmpty() || m_substituteData.isValid()) | 273 if (request.url().isEmpty() || m_substituteData.isValid()) |
274 return true; | 274 return true; |
275 | 275 |
276 // If we're loading content into a subframe, check against the parent's Cont
ent Security Policy | 276 // If we're loading content into a subframe, check against the parent's Cont
ent Security Policy |
277 // and kill the load if that check fails, unless we should bypass the main w
orld's CSP. | 277 // and kill the load if that check fails, unless we should bypass the main w
orld's CSP. |
278 // FIXME: CSP checks are broken for OOPI. For now, this policy always allows
frames with a remote parent... | 278 // FIXME: CSP checks are broken for OOPI. For now, this policy always allows
frames with a remote parent... |
279 if ((shouldCheckMainWorldContentSecurityPolicy == CheckContentSecurityPolicy
) && (m_frame->deprecatedLocalOwner() && !m_frame->deprecatedLocalOwner()->docum
ent().contentSecurityPolicy()->allowChildFrameFromSource(request.url(), request.
followedRedirect() ? ContentSecurityPolicy::DidRedirect : ContentSecurityPolicy:
:DidNotRedirect))) { | 279 if ((shouldCheckMainWorldContentSecurityPolicy == CheckContentSecurityPolicy
) && (m_frame->deprecatedLocalOwner() && !m_frame->deprecatedLocalOwner()->docum
ent().contentSecurityPolicy()->allowChildFrameFromSource(request.url(), request.
followedRedirect() ? ContentSecurityPolicy::DidRedirect : ContentSecurityPolicy:
:DidNotRedirect))) { |
280 // Fire a load event, as timing attacks would otherwise reveal that the | 280 // Fire a load event, as timing attacks would otherwise reveal that the |
281 // frame was blocked. This way, it looks like every other cross-origin | 281 // frame was blocked. This way, it looks like every other cross-origin |
282 // page load. | 282 // page load. |
283 m_frame->document()->enforceSandboxFlags(SandboxOrigin); | 283 m_frame->document()->enforceSandboxFlags(SandboxOrigin); |
284 m_frame->owner()->dispatchLoad(); | 284 m_frame->owner()->dispatchLoad(); |
285 return false; | 285 return false; |
286 } | 286 } |
287 | 287 |
288 policy = frameLoader()->client()->decidePolicyForNavigation(request, this, p
olicy, isTransitionNavigation); | 288 policy = frameLoader()->client()->decidePolicyForNavigation(request, this, p
olicy); |
289 if (policy == NavigationPolicyCurrentTab) | 289 if (policy == NavigationPolicyCurrentTab) |
290 return true; | 290 return true; |
291 if (policy == NavigationPolicyIgnore) | 291 if (policy == NavigationPolicyIgnore) |
292 return false; | 292 return false; |
293 if (!LocalDOMWindow::allowPopUp(*m_frame) && !UserGestureIndicator::processi
ngUserGesture()) | 293 if (!LocalDOMWindow::allowPopUp(*m_frame) && !UserGestureIndicator::processi
ngUserGesture()) |
294 return false; | 294 return false; |
295 frameLoader()->client()->loadURLExternally(request, policy); | 295 frameLoader()->client()->loadURLExternally(request, policy); |
296 return false; | 296 return false; |
297 } | 297 } |
298 | 298 |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 ASSERT(!frame->document() || !frame->document()->isActive()); | 743 ASSERT(!frame->document() || !frame->document()->isActive()); |
744 ASSERT(frame->tree().childCount() == 0); | 744 ASSERT(frame->tree().childCount() == 0); |
745 | 745 |
746 if (!init.shouldReuseDefaultView()) | 746 if (!init.shouldReuseDefaultView()) |
747 frame->setDOMWindow(LocalDOMWindow::create(*frame)); | 747 frame->setDOMWindow(LocalDOMWindow::create(*frame)); |
748 | 748 |
749 RefPtrWillBeRawPtr<Document> document = frame->localDOMWindow()->installNewD
ocument(mimeType, init); | 749 RefPtrWillBeRawPtr<Document> document = frame->localDOMWindow()->installNewD
ocument(mimeType, init); |
750 if (ownerDocument) { | 750 if (ownerDocument) { |
751 document->setCookieURL(ownerDocument->cookieURL()); | 751 document->setCookieURL(ownerDocument->cookieURL()); |
752 document->setSecurityOrigin(ownerDocument->securityOrigin()); | 752 document->setSecurityOrigin(ownerDocument->securityOrigin()); |
753 if (ownerDocument->isTransitionDocument()) | |
754 document->setIsTransitionDocument(true); | |
755 } | 753 } |
756 | 754 |
757 frame->loader().didBeginDocument(dispatch); | 755 frame->loader().didBeginDocument(dispatch); |
758 | 756 |
759 return DocumentWriter::create(document.get(), parsingPolicy, mimeType, encod
ing); | 757 return DocumentWriter::create(document.get(), parsingPolicy, mimeType, encod
ing); |
760 } | 758 } |
761 | 759 |
762 const AtomicString& DocumentLoader::mimeType() const | 760 const AtomicString& DocumentLoader::mimeType() const |
763 { | 761 { |
764 if (m_writer) | 762 if (m_writer) |
765 return m_writer->mimeType(); | 763 return m_writer->mimeType(); |
766 return m_response.mimeType(); | 764 return m_response.mimeType(); |
767 } | 765 } |
768 | 766 |
769 // This is only called by FrameLoader::replaceDocumentWhileExecutingJavaScriptUR
L() | 767 // This is only called by FrameLoader::replaceDocumentWhileExecutingJavaScriptUR
L() |
770 void DocumentLoader::replaceDocumentWhileExecutingJavaScriptURL(const DocumentIn
it& init, const String& source, Document* ownerDocument) | 768 void DocumentLoader::replaceDocumentWhileExecutingJavaScriptURL(const DocumentIn
it& init, const String& source, Document* ownerDocument) |
771 { | 769 { |
772 m_writer = createWriterFor(ownerDocument, init, mimeType(), m_writer ? m_wri
ter->encoding() : emptyAtom, true, ForceSynchronousParsing); | 770 m_writer = createWriterFor(ownerDocument, init, mimeType(), m_writer ? m_wri
ter->encoding() : emptyAtom, true, ForceSynchronousParsing); |
773 if (!source.isNull()) | 771 if (!source.isNull()) |
774 m_writer->appendReplacingData(source); | 772 m_writer->appendReplacingData(source); |
775 endWriting(m_writer.get()); | 773 endWriting(m_writer.get()); |
776 } | 774 } |
777 | 775 |
778 } // namespace blink | 776 } // namespace blink |
OLD | NEW |