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

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 2858743003: Don’t call functions on a possibly-deleted object (Closed)
Patch Set: comment Created 3 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/frame_host/render_frame_host_impl.h" 5 #include "content/browser/frame_host/render_frame_host_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 2925 matching lines...) Expand 10 before | Expand all | Expand 10 after
2936 2936
2937 void RenderFrameHostImpl::DeleteSurroundingTextInCodePoints(int before, 2937 void RenderFrameHostImpl::DeleteSurroundingTextInCodePoints(int before,
2938 int after) { 2938 int after) {
2939 Send(new InputMsg_DeleteSurroundingTextInCodePoints(routing_id_, before, 2939 Send(new InputMsg_DeleteSurroundingTextInCodePoints(routing_id_, before,
2940 after)); 2940 after));
2941 } 2941 }
2942 2942
2943 void RenderFrameHostImpl::JavaScriptDialogClosed( 2943 void RenderFrameHostImpl::JavaScriptDialogClosed(
2944 IPC::Message* reply_msg, 2944 IPC::Message* reply_msg,
2945 bool success, 2945 bool success,
2946 const base::string16& user_input, 2946 const base::string16& user_input) {
2947 bool dialog_was_suppressed) {
2948 GetProcess()->SetIgnoreInputEvents(false); 2947 GetProcess()->SetIgnoreInputEvents(false);
2949 2948
2950 SendJavaScriptDialogReply(reply_msg, success, user_input); 2949 SendJavaScriptDialogReply(reply_msg, success, user_input);
2951 2950
2952 // If executing as part of beforeunload event handling, there may have been 2951 // If executing as part of beforeunload event handling, there may have been
2953 // timers stopped in this frame or a frame up in the frame hierarchy. Restart 2952 // timers stopped in this frame or a frame up in the frame hierarchy. Restart
2954 // any timers that were stopped in OnRunBeforeUnloadConfirm(). 2953 // any timers that were stopped in OnRunBeforeUnloadConfirm().
2955 for (RenderFrameHostImpl* frame = this; frame; frame = frame->GetParent()) { 2954 for (RenderFrameHostImpl* frame = this; frame; frame = frame->GetParent()) {
2956 if (frame->is_waiting_for_beforeunload_ack_) { 2955 if (frame->is_waiting_for_beforeunload_ack_ &&
2957 // If we are waiting for a beforeunload ack and the user has suppressed 2956 frame->beforeunload_timeout_) {
2958 // messages, kill the tab immediately. A page that's spamming is 2957 frame->beforeunload_timeout_->Start(
2959 // presumably malicious, so there's no point in continuing to run its 2958 TimeDelta::FromMilliseconds(RenderViewHostImpl::kUnloadTimeoutMS));
2960 // script and dragging out the process.
2961 if (dialog_was_suppressed) {
2962 frame->SimulateBeforeUnloadAck();
2963 } else if (frame->beforeunload_timeout_) {
2964 frame->beforeunload_timeout_->Start(
2965 TimeDelta::FromMilliseconds(RenderViewHostImpl::kUnloadTimeoutMS));
2966 }
2967 } 2959 }
2968 } 2960 }
2969 } 2961 }
2970 2962
2971 void RenderFrameHostImpl::SendJavaScriptDialogReply( 2963 void RenderFrameHostImpl::SendJavaScriptDialogReply(
2972 IPC::Message* reply_msg, 2964 IPC::Message* reply_msg,
2973 bool success, 2965 bool success,
2974 const base::string16& user_input) { 2966 const base::string16& user_input) {
2975 FrameHostMsg_RunJavaScriptDialog::WriteReplyParams(reply_msg, success, 2967 FrameHostMsg_RunJavaScriptDialog::WriteReplyParams(reply_msg, success,
2976 user_input); 2968 user_input);
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after
3856 } 3848 }
3857 3849
3858 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame( 3850 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame(
3859 const std::string& interface_name, 3851 const std::string& interface_name,
3860 mojo::ScopedMessagePipeHandle pipe) { 3852 mojo::ScopedMessagePipeHandle pipe) {
3861 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe)); 3853 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe));
3862 } 3854 }
3863 #endif 3855 #endif
3864 3856
3865 } // namespace content 3857 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698