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

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

Issue 1451123002: Block javascript: document navigations during page dismissal events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added e-mail to AUTHORS Created 5 years, 1 month 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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 304
305 if (m_stateMachine.isDisplayingInitialEmptyDocument()) 305 if (m_stateMachine.isDisplayingInitialEmptyDocument())
306 m_stateMachine.advanceTo(FrameLoaderStateMachine::CommittedFirstRealLoad ); 306 m_stateMachine.advanceTo(FrameLoaderStateMachine::CommittedFirstRealLoad );
307 } 307 }
308 308
309 // This is only called by ScriptController::executeScriptIfJavaScriptURL 309 // This is only called by ScriptController::executeScriptIfJavaScriptURL
310 // and always contains the result of evaluating a javascript: url. 310 // and always contains the result of evaluating a javascript: url.
311 // This is the <iframe src="javascript:'html'"> case. 311 // This is the <iframe src="javascript:'html'"> case.
312 void FrameLoader::replaceDocumentWhileExecutingJavaScriptURL(const String& sourc e, Document* ownerDocument) 312 void FrameLoader::replaceDocumentWhileExecutingJavaScriptURL(const String& sourc e, Document* ownerDocument)
313 { 313 {
314 if (!m_frame->document()->loader()) 314 if (!m_frame->document()->loader() || m_frame->document()->pageDismissalEven tBeingDispatched() != Document::NoDismissal)
315 return; 315 return;
316 316
317 // DocumentLoader::replaceDocumentWhileExecutingJavaScriptURL can cause the DocumentLoader to get deref'ed and possible destroyed, 317 // DocumentLoader::replaceDocumentWhileExecutingJavaScriptURL can cause the DocumentLoader to get deref'ed and possible destroyed,
318 // so protect it with a RefPtr. 318 // so protect it with a RefPtr.
319 RefPtrWillBeRawPtr<DocumentLoader> documentLoader(m_frame->document()->loade r()); 319 RefPtrWillBeRawPtr<DocumentLoader> documentLoader(m_frame->document()->loade r());
320 320
321 UseCounter::count(*m_frame->document(), UseCounter::ReplaceDocumentViaJavaSc riptURL); 321 UseCounter::count(*m_frame->document(), UseCounter::ReplaceDocumentViaJavaSc riptURL);
322 322
323 // Prepare a DocumentInit before clearing the frame, because it may need to 323 // Prepare a DocumentInit before clearing the frame, because it may need to
324 // inherit an aliased security context. 324 // inherit an aliased security context.
(...skipping 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1550 // FIXME: We need a way to propagate insecure requests policy flags to 1550 // FIXME: We need a way to propagate insecure requests policy flags to
1551 // out-of-process frames. For now, we'll always use default behavior. 1551 // out-of-process frames. For now, we'll always use default behavior.
1552 if (!parentFrame->isLocalFrame()) 1552 if (!parentFrame->isLocalFrame())
1553 return nullptr; 1553 return nullptr;
1554 1554
1555 ASSERT(toLocalFrame(parentFrame)->document()); 1555 ASSERT(toLocalFrame(parentFrame)->document());
1556 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade() ; 1556 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade() ;
1557 } 1557 }
1558 1558
1559 } // namespace blink 1559 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/events/javascript-uri-navigation-blocked-in-unload-handler-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698