Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: third_party/WebKit/Source/core/loader/FrameLoader.cpp

Issue 1685003002: Plumb the correct owner document through DocumentInit::m_owner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 return; 322 return;
323 323
324 // DocumentLoader::replaceDocumentWhileExecutingJavaScriptURL can cause the DocumentLoader to get deref'ed and possible destroyed, 324 // DocumentLoader::replaceDocumentWhileExecutingJavaScriptURL can cause the DocumentLoader to get deref'ed and possible destroyed,
325 // so protect it with a RefPtr. 325 // so protect it with a RefPtr.
326 RefPtrWillBeRawPtr<DocumentLoader> documentLoader(m_frame->document()->loade r()); 326 RefPtrWillBeRawPtr<DocumentLoader> documentLoader(m_frame->document()->loade r());
327 327
328 UseCounter::count(*m_frame->document(), UseCounter::ReplaceDocumentViaJavaSc riptURL); 328 UseCounter::count(*m_frame->document(), UseCounter::ReplaceDocumentViaJavaSc riptURL);
329 329
330 // Prepare a DocumentInit before clearing the frame, because it may need to 330 // Prepare a DocumentInit before clearing the frame, because it may need to
331 // inherit an aliased security context. 331 // inherit an aliased security context.
332 DocumentInit init(m_frame->document()->url(), m_frame); 332 DocumentInit init(ownerDocument, m_frame->document()->url(), m_frame);
333 init.withNewRegistrationContext(); 333 init.withNewRegistrationContext();
334 334
335 stopAllLoaders(); 335 stopAllLoaders();
336 // Don't allow any new child frames to load in this frame: attaching a new 336 // Don't allow any new child frames to load in this frame: attaching a new
337 // child frame during or after detaching children results in an attached 337 // child frame during or after detaching children results in an attached
338 // frame on a detached DOM tree, which is bad. 338 // frame on a detached DOM tree, which is bad.
339 SubframeLoadingDisabler disabler(m_frame->document()); 339 SubframeLoadingDisabler disabler(m_frame->document());
340 m_frame->detachChildren(); 340 m_frame->detachChildren();
341 m_frame->document()->detach(); 341 m_frame->document()->detach();
342 clear(); 342 clear();
343 343
344 // detachChildren() potentially detaches the frame from the document. The 344 // detachChildren() potentially detaches the frame from the document. The
345 // loading cannot continue in that case. 345 // loading cannot continue in that case.
346 if (!m_frame->page()) 346 if (!m_frame->page())
347 return; 347 return;
348 348
349 client()->transitionToCommittedForNewPage(); 349 client()->transitionToCommittedForNewPage();
350 documentLoader->replaceDocumentWhileExecutingJavaScriptURL(init, source, own erDocument); 350 documentLoader->replaceDocumentWhileExecutingJavaScriptURL(init, source);
351 } 351 }
352 352
353 void FrameLoader::receivedMainResourceRedirect(const KURL& newURL) 353 void FrameLoader::receivedMainResourceRedirect(const KURL& newURL)
354 { 354 {
355 client()->dispatchDidReceiveServerRedirectForProvisionalLoad(); 355 client()->dispatchDidReceiveServerRedirectForProvisionalLoad();
356 // If a back/forward navigation redirects cross-origin, don't reuse any stat e from the HistoryItem. 356 // If a back/forward navigation redirects cross-origin, don't reuse any stat e from the HistoryItem.
357 if (m_provisionalItem && !SecurityOrigin::create(m_provisionalItem->url())-> isSameSchemeHostPort(SecurityOrigin::create(newURL).get())) 357 if (m_provisionalItem && !SecurityOrigin::create(m_provisionalItem->url())-> isSameSchemeHostPort(SecurityOrigin::create(newURL).get()))
358 m_provisionalItem.clear(); 358 m_provisionalItem.clear();
359 } 359 }
360 360
(...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after
1571 // FIXME: We need a way to propagate insecure requests policy flags to 1571 // FIXME: We need a way to propagate insecure requests policy flags to
1572 // out-of-process frames. For now, we'll always use default behavior. 1572 // out-of-process frames. For now, we'll always use default behavior.
1573 if (!parentFrame->isLocalFrame()) 1573 if (!parentFrame->isLocalFrame())
1574 return nullptr; 1574 return nullptr;
1575 1575
1576 ASSERT(toLocalFrame(parentFrame)->document()); 1576 ASSERT(toLocalFrame(parentFrame)->document());
1577 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade() ; 1577 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade() ;
1578 } 1578 }
1579 1579
1580 } // namespace blink 1580 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698