OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. |
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> | 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> |
6 * Copyright (C) Research In Motion Limited 2009. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2009. All rights reserved. |
7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> | 7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> |
8 * Copyright (C) 2011 Google Inc. All rights reserved. | 8 * Copyright (C) 2011 Google Inc. All rights reserved. |
9 * | 9 * |
10 * Redistribution and use in source and binary forms, with or without | 10 * Redistribution and use in source and binary forms, with or without |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 return; | 318 return; |
319 | 319 |
320 // DocumentLoader::replaceDocumentWhileExecutingJavaScriptURL can cause the
DocumentLoader to get deref'ed and possible destroyed, | 320 // DocumentLoader::replaceDocumentWhileExecutingJavaScriptURL can cause the
DocumentLoader to get deref'ed and possible destroyed, |
321 // so protect it with a RefPtr. | 321 // so protect it with a RefPtr. |
322 RefPtrWillBeRawPtr<DocumentLoader> documentLoader(m_frame->document()->loade
r()); | 322 RefPtrWillBeRawPtr<DocumentLoader> documentLoader(m_frame->document()->loade
r()); |
323 | 323 |
324 UseCounter::count(*m_frame->document(), UseCounter::ReplaceDocumentViaJavaSc
riptURL); | 324 UseCounter::count(*m_frame->document(), UseCounter::ReplaceDocumentViaJavaSc
riptURL); |
325 | 325 |
326 // Prepare a DocumentInit before clearing the frame, because it may need to | 326 // Prepare a DocumentInit before clearing the frame, because it may need to |
327 // inherit an aliased security context. | 327 // inherit an aliased security context. |
328 DocumentInit init(m_frame->document()->url(), m_frame); | 328 DocumentInit init(ownerDocument, m_frame->document()->url(), m_frame); |
329 init.withNewRegistrationContext(); | 329 init.withNewRegistrationContext(); |
330 | 330 |
331 stopAllLoaders(); | 331 stopAllLoaders(); |
332 // Don't allow any new child frames to load in this frame: attaching a new | 332 // Don't allow any new child frames to load in this frame: attaching a new |
333 // child frame during or after detaching children results in an attached | 333 // child frame during or after detaching children results in an attached |
334 // frame on a detached DOM tree, which is bad. | 334 // frame on a detached DOM tree, which is bad. |
335 SubframeLoadingDisabler disabler(m_frame->document()); | 335 SubframeLoadingDisabler disabler(m_frame->document()); |
336 m_frame->detachChildren(); | 336 m_frame->detachChildren(); |
337 m_frame->document()->detach(); | 337 m_frame->document()->detach(); |
338 clear(); | 338 clear(); |
339 | 339 |
340 // detachChildren() potentially detaches the frame from the document. The | 340 // detachChildren() potentially detaches the frame from the document. The |
341 // loading cannot continue in that case. | 341 // loading cannot continue in that case. |
342 if (!m_frame->page()) | 342 if (!m_frame->page()) |
343 return; | 343 return; |
344 | 344 |
345 client()->transitionToCommittedForNewPage(); | 345 client()->transitionToCommittedForNewPage(); |
346 documentLoader->replaceDocumentWhileExecutingJavaScriptURL(init, source, own
erDocument); | 346 documentLoader->replaceDocumentWhileExecutingJavaScriptURL(init, source); |
347 } | 347 } |
348 | 348 |
349 void FrameLoader::receivedMainResourceRedirect(const KURL& newURL) | 349 void FrameLoader::receivedMainResourceRedirect(const KURL& newURL) |
350 { | 350 { |
351 client()->dispatchDidReceiveServerRedirectForProvisionalLoad(); | 351 client()->dispatchDidReceiveServerRedirectForProvisionalLoad(); |
352 // If a back/forward navigation redirects cross-origin, don't reuse any stat
e from the HistoryItem. | 352 // If a back/forward navigation redirects cross-origin, don't reuse any stat
e from the HistoryItem. |
353 if (m_provisionalItem && !SecurityOrigin::create(m_provisionalItem->url())->
isSameSchemeHostPort(SecurityOrigin::create(newURL).get())) | 353 if (m_provisionalItem && !SecurityOrigin::create(m_provisionalItem->url())->
isSameSchemeHostPort(SecurityOrigin::create(newURL).get())) |
354 m_provisionalItem.clear(); | 354 m_provisionalItem.clear(); |
355 } | 355 } |
356 | 356 |
(...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1561 // FIXME: We need a way to propagate insecure requests policy flags to | 1561 // FIXME: We need a way to propagate insecure requests policy flags to |
1562 // out-of-process frames. For now, we'll always use default behavior. | 1562 // out-of-process frames. For now, we'll always use default behavior. |
1563 if (!parentFrame->isLocalFrame()) | 1563 if (!parentFrame->isLocalFrame()) |
1564 return nullptr; | 1564 return nullptr; |
1565 | 1565 |
1566 ASSERT(toLocalFrame(parentFrame)->document()); | 1566 ASSERT(toLocalFrame(parentFrame)->document()); |
1567 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade()
; | 1567 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade()
; |
1568 } | 1568 } |
1569 | 1569 |
1570 } // namespace blink | 1570 } // namespace blink |
OLD | NEW |