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

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

Issue 205523003: Remove beforeload events. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove more tests Created 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/html/forms/ImageInputType.cpp ('k') | Source/core/loader/ImageLoader.h » ('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 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 return true; 723 return true;
724 // FIXME: This case is a workaround for the fact that ctrl+clicking a form s ubmission incorrectly 724 // FIXME: This case is a workaround for the fact that ctrl+clicking a form s ubmission incorrectly
725 // sends as a GET rather than a POST if it creates a new window in a differe nt process. 725 // sends as a GET rather than a POST if it creates a new window in a differe nt process.
726 return request.formState() && action.shouldOpenInNewWindow(); 726 return request.formState() && action.shouldOpenInNewWindow();
727 } 727 }
728 728
729 void FrameLoader::load(const FrameLoadRequest& passedRequest) 729 void FrameLoader::load(const FrameLoadRequest& passedRequest)
730 { 730 {
731 ASSERT(m_frame->document()); 731 ASSERT(m_frame->document());
732 732
733 // Protect frame from getting blown away inside dispatchBeforeLoadEvent in l oadWithDocumentLoader.
734 RefPtr<LocalFrame> protect(m_frame); 733 RefPtr<LocalFrame> protect(m_frame);
735 734
736 if (m_inStopAllLoaders) 735 if (m_inStopAllLoaders)
737 return; 736 return;
738 737
739 FrameLoadRequest request(passedRequest); 738 FrameLoadRequest request(passedRequest);
740 if (!prepareRequestForThisFrame(request)) 739 if (!prepareRequestForThisFrame(request))
741 return; 740 return;
742 741
743 RefPtr<LocalFrame> targetFrame = request.formState() ? 0 : findFrameForNavig ation(AtomicString(request.frameName()), request.formState() ? request.formState ()->sourceDocument() : m_frame->document()); 742 RefPtr<LocalFrame> targetFrame = request.formState() ? 0 : findFrameForNavig ation(AtomicString(request.frameName()), request.formState() ? request.formState ()->sourceDocument() : m_frame->document());
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
1275 } 1274 }
1276 return shouldClose; 1275 return shouldClose;
1277 } 1276 }
1278 1277
1279 void FrameLoader::loadWithNavigationAction(const NavigationAction& action, Frame LoadType type, PassRefPtr<FormState> formState, const SubstituteData& substitute Data, ClientRedirectPolicy clientRedirect, const AtomicString& overrideEncoding) 1278 void FrameLoader::loadWithNavigationAction(const NavigationAction& action, Frame LoadType type, PassRefPtr<FormState> formState, const SubstituteData& substitute Data, ClientRedirectPolicy clientRedirect, const AtomicString& overrideEncoding)
1280 { 1279 {
1281 ASSERT(m_client->hasWebView()); 1280 ASSERT(m_client->hasWebView());
1282 if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::No Dismissal) 1281 if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::No Dismissal)
1283 return; 1282 return;
1284 1283
1285 // We skip dispatching the beforeload event on the frame owner if we've alre ady committed a real
1286 // document load because the event would leak subsequent activity by the fra me which the parent
1287 // frame isn't supposed to learn. For example, if the child frame navigated to a new URL, the
1288 // parent frame shouldn't learn the URL.
1289 const ResourceRequest& request = action.resourceRequest(); 1284 const ResourceRequest& request = action.resourceRequest();
1290 if (!m_stateMachine.committedFirstRealDocumentLoad() && m_frame->ownerElemen t() && !m_frame->ownerElement()->dispatchBeforeLoadEvent(request.url().string()) )
1291 return;
1292
1293 // Dispatching the beforeload event could have blown away the frame.
1294 if (!m_client)
1295 return;
1296 1285
1297 if (!m_stateMachine.startedFirstRealLoad()) 1286 if (!m_stateMachine.startedFirstRealLoad())
1298 m_stateMachine.advanceTo(FrameLoaderStateMachine::StartedFirstRealLoad); 1287 m_stateMachine.advanceTo(FrameLoaderStateMachine::StartedFirstRealLoad);
1299 1288
1300 // The current load should replace the history item if it is the first real 1289 // The current load should replace the history item if it is the first real
1301 // load of the frame. 1290 // load of the frame.
1302 bool replacesCurrentHistoryItem = false; 1291 bool replacesCurrentHistoryItem = false;
1303 if (type == FrameLoadTypeRedirectWithLockedBackForwardList 1292 if (type == FrameLoadTypeRedirectWithLockedBackForwardList
1304 || !m_stateMachine.committedFirstRealDocumentLoad()) { 1293 || !m_stateMachine.committedFirstRealDocumentLoad()) {
1305 replacesCurrentHistoryItem = true; 1294 replacesCurrentHistoryItem = true;
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1473 { 1462 {
1474 SandboxFlags flags = m_forcedSandboxFlags; 1463 SandboxFlags flags = m_forcedSandboxFlags;
1475 if (LocalFrame* parentFrame = m_frame->tree().parent()) 1464 if (LocalFrame* parentFrame = m_frame->tree().parent())
1476 flags |= parentFrame->document()->sandboxFlags(); 1465 flags |= parentFrame->document()->sandboxFlags();
1477 if (HTMLFrameOwnerElement* ownerElement = m_frame->ownerElement()) 1466 if (HTMLFrameOwnerElement* ownerElement = m_frame->ownerElement())
1478 flags |= ownerElement->sandboxFlags(); 1467 flags |= ownerElement->sandboxFlags();
1479 return flags; 1468 return flags;
1480 } 1469 }
1481 1470
1482 } // namespace WebCore 1471 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/forms/ImageInputType.cpp ('k') | Source/core/loader/ImageLoader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698