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

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

Issue 25269006: Initial iframe loads shouldn't add session history items. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rewriting the fix in a different way and adding a test. Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after
1332 // We skip dispatching the beforeload event on the frame owner if we've alre ady committed a real 1332 // We skip dispatching the beforeload event on the frame owner if we've alre ady committed a real
1333 // document load because the event would leak subsequent activity by the fra me which the parent 1333 // document load because the event would leak subsequent activity by the fra me which the parent
1334 // frame isn't supposed to learn. For example, if the child frame navigated to a new URL, the 1334 // frame isn't supposed to learn. For example, if the child frame navigated to a new URL, the
1335 // parent frame shouldn't learn the URL. 1335 // parent frame shouldn't learn the URL.
1336 if (!m_stateMachine.committedFirstRealDocumentLoad() && m_frame->ownerElemen t() && !m_frame->ownerElement()->dispatchBeforeLoadEvent(request.url().string()) ) 1336 if (!m_stateMachine.committedFirstRealDocumentLoad() && m_frame->ownerElemen t() && !m_frame->ownerElement()->dispatchBeforeLoadEvent(request.url().string()) )
1337 return; 1337 return;
1338 1338
1339 if (!m_stateMachine.startedFirstRealLoad()) 1339 if (!m_stateMachine.startedFirstRealLoad())
1340 m_stateMachine.advanceTo(FrameLoaderStateMachine::StartedFirstRealLoad); 1340 m_stateMachine.advanceTo(FrameLoaderStateMachine::StartedFirstRealLoad);
1341 1341
1342 // The current load should replace the history item if it is the first real
1343 // load of the frame. FrameLoadTypeRedirectWithLockedBackForwardList is a
1344 // proxy for history()->currentItemShouldBeReplaced().
1345 bool replacesCurrentHistoryItem = false;
1346 if (type == FrameLoadTypeRedirectWithLockedBackForwardList
1347 || !m_stateMachine.committedFirstRealDocumentLoad()) {
1348 replacesCurrentHistoryItem = true;
1349 }
1350
1342 m_policyDocumentLoader = m_client->createDocumentLoader(request, substituteD ata.isValid() ? substituteData : defaultSubstituteDataForURL(request.url())); 1351 m_policyDocumentLoader = m_client->createDocumentLoader(request, substituteD ata.isValid() ? substituteData : defaultSubstituteDataForURL(request.url()));
1343 m_policyDocumentLoader->setFrame(m_frame); 1352 m_policyDocumentLoader->setFrame(m_frame);
1344 m_policyDocumentLoader->setTriggeringAction(action); 1353 m_policyDocumentLoader->setTriggeringAction(action);
1345 m_policyDocumentLoader->setReplacesCurrentHistoryItem(type == FrameLoadTypeR edirectWithLockedBackForwardList); 1354 m_policyDocumentLoader->setReplacesCurrentHistoryItem(replacesCurrentHistory Item);
1346 m_policyDocumentLoader->setIsClientRedirect(m_startingClientRedirect); 1355 m_policyDocumentLoader->setIsClientRedirect(m_startingClientRedirect);
1347 1356
1348 if (Frame* parent = m_frame->tree()->parent()) 1357 if (Frame* parent = m_frame->tree()->parent())
1349 m_policyDocumentLoader->setOverrideEncoding(parent->loader()->documentLo ader()->overrideEncoding()); 1358 m_policyDocumentLoader->setOverrideEncoding(parent->loader()->documentLo ader()->overrideEncoding());
1350 else if (!overrideEncoding.isEmpty()) 1359 else if (!overrideEncoding.isEmpty())
1351 m_policyDocumentLoader->setOverrideEncoding(overrideEncoding); 1360 m_policyDocumentLoader->setOverrideEncoding(overrideEncoding);
1352 else if (m_documentLoader) 1361 else if (m_documentLoader)
1353 m_policyDocumentLoader->setOverrideEncoding(m_documentLoader->overrideEn coding()); 1362 m_policyDocumentLoader->setOverrideEncoding(m_documentLoader->overrideEn coding());
1354 1363
1355 // stopAllLoaders can detach the Frame, so protect it. 1364 // stopAllLoaders can detach the Frame, so protect it.
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
1598 { 1607 {
1599 SandboxFlags flags = m_forcedSandboxFlags; 1608 SandboxFlags flags = m_forcedSandboxFlags;
1600 if (Frame* parentFrame = m_frame->tree()->parent()) 1609 if (Frame* parentFrame = m_frame->tree()->parent())
1601 flags |= parentFrame->document()->sandboxFlags(); 1610 flags |= parentFrame->document()->sandboxFlags();
1602 if (HTMLFrameOwnerElement* ownerElement = m_frame->ownerElement()) 1611 if (HTMLFrameOwnerElement* ownerElement = m_frame->ownerElement())
1603 flags |= ownerElement->sandboxFlags(); 1612 flags |= ownerElement->sandboxFlags();
1604 return flags; 1613 return flags;
1605 } 1614 }
1606 1615
1607 } // namespace WebCore 1616 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698