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

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

Issue 278133002: Don't save history state for frames that were initially blocked due to mixed content. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 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
« no previous file with comments | « LayoutTests/http/tests/security/mixedContent/insecure-iframe-in-main-frame-expected.txt ('k') | no next file » | 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 277
278 m_currentItem->setURL(m_documentLoader->urlForHistory()); 278 m_currentItem->setURL(m_documentLoader->urlForHistory());
279 m_currentItem->setDocumentState(m_frame->document()->formElementsState()); 279 m_currentItem->setDocumentState(m_frame->document()->formElementsState());
280 m_currentItem->setTarget(m_frame->tree().uniqueName()); 280 m_currentItem->setTarget(m_frame->tree().uniqueName());
281 if (isPushOrReplaceState) 281 if (isPushOrReplaceState)
282 m_currentItem->setStateObject(stateObject); 282 m_currentItem->setStateObject(stateObject);
283 m_currentItem->setReferrer(Referrer(m_documentLoader->request().httpReferrer (), m_documentLoader->request().referrerPolicy())); 283 m_currentItem->setReferrer(Referrer(m_documentLoader->request().httpReferrer (), m_documentLoader->request().referrerPolicy()));
284 m_currentItem->setFormInfoFromRequest(isPushOrReplaceState ? ResourceRequest () : m_documentLoader->request()); 284 m_currentItem->setFormInfoFromRequest(isPushOrReplaceState ? ResourceRequest () : m_documentLoader->request());
285 } 285 }
286 286
287 static HistoryCommitType loadTypeToCommitType(FrameLoadType type, bool isValidHi storyURL) 287 static HistoryCommitType loadTypeToCommitType(FrameLoadType type)
288 { 288 {
289 switch (type) { 289 switch (type) {
290 case FrameLoadTypeStandard: 290 case FrameLoadTypeStandard:
291 return isValidHistoryURL ? StandardCommit : HistoryInertCommit; 291 return StandardCommit;
292 case FrameLoadTypeInitialInChildFrame: 292 case FrameLoadTypeInitialInChildFrame:
293 return InitialCommitInChildFrame; 293 return InitialCommitInChildFrame;
294 case FrameLoadTypeBackForward: 294 case FrameLoadTypeBackForward:
295 return BackForwardCommit; 295 return BackForwardCommit;
296 default: 296 default:
297 break; 297 break;
298 } 298 }
299 return HistoryInertCommit; 299 return HistoryInertCommit;
300 } 300 }
301 301
302 void FrameLoader::receivedFirstData() 302 void FrameLoader::receivedFirstData()
303 { 303 {
304 if (m_stateMachine.creatingInitialEmptyDocument()) 304 if (m_stateMachine.creatingInitialEmptyDocument())
305 return; 305 return;
306 306
307 bool isValidHistoryURL = !m_documentLoader->urlForHistory().isEmpty() && (!o pener() || m_currentItem || !m_documentLoader->originalRequest().url().isEmpty() ); 307 HistoryCommitType historyCommitType = loadTypeToCommitType(m_loadType);
308 HistoryCommitType historyCommitType = loadTypeToCommitType(m_loadType, isVal idHistoryURL); 308 if (historyCommitType == StandardCommit && (m_documentLoader->urlForHistory( ).isEmpty() || (opener() && !m_currentItem && m_documentLoader->originalRequest( ).url().isEmpty())))
309 historyCommitType = HistoryInertCommit;
310 else if (historyCommitType == InitialCommitInChildFrame && MixedContentCheck er::isMixedContent(m_frame->tree().top()->document()->securityOrigin(), m_docume ntLoader->url()))
311 historyCommitType = HistoryInertCommit;
309 setHistoryItemStateForCommit(historyCommitType); 312 setHistoryItemStateForCommit(historyCommitType);
310 313
311 if (!m_stateMachine.committedMultipleRealLoads() && m_loadType == FrameLoadT ypeStandard) 314 if (!m_stateMachine.committedMultipleRealLoads() && m_loadType == FrameLoadT ypeStandard)
312 m_stateMachine.advanceTo(FrameLoaderStateMachine::CommittedMultipleRealL oads); 315 m_stateMachine.advanceTo(FrameLoaderStateMachine::CommittedMultipleRealL oads);
313 316
314 m_client->dispatchDidCommitLoad(m_frame, m_currentItem.get(), historyCommitT ype); 317 m_client->dispatchDidCommitLoad(m_frame, m_currentItem.get(), historyCommitT ype);
315 318
316 InspectorInstrumentation::didCommitLoad(m_frame, m_documentLoader.get()); 319 InspectorInstrumentation::didCommitLoad(m_frame, m_documentLoader.get());
317 m_frame->page()->didCommitLoad(m_frame); 320 m_frame->page()->didCommitLoad(m_frame);
318 dispatchDidClearDocumentOfWindowObject(); 321 dispatchDidClearDocumentOfWindowObject();
(...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1430 { 1433 {
1431 SandboxFlags flags = m_forcedSandboxFlags; 1434 SandboxFlags flags = m_forcedSandboxFlags;
1432 if (LocalFrame* parentFrame = m_frame->tree().parent()) 1435 if (LocalFrame* parentFrame = m_frame->tree().parent())
1433 flags |= parentFrame->document()->sandboxFlags(); 1436 flags |= parentFrame->document()->sandboxFlags();
1434 if (HTMLFrameOwnerElement* ownerElement = m_frame->ownerElement()) 1437 if (HTMLFrameOwnerElement* ownerElement = m_frame->ownerElement())
1435 flags |= ownerElement->sandboxFlags(); 1438 flags |= ownerElement->sandboxFlags();
1436 return flags; 1439 return flags;
1437 } 1440 }
1438 1441
1439 } // namespace WebCore 1442 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/security/mixedContent/insecure-iframe-in-main-frame-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698