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

Side by Side Diff: chrome/browser/prerender/prerender_contents.cc

Issue 6627063: Ignore JavaScript messages (alert/confirm/prompt) during unload handlers. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Added a browsertest Created 9 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/prerender/prerender_contents.h" 5 #include "chrome/browser/prerender/prerender_contents.h"
6 6
7 #include "base/process_util.h" 7 #include "base/process_util.h"
8 #include "base/task.h" 8 #include "base/task.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/background_contents_service.h" 10 #include "chrome/browser/background_contents_service.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 212
213 title_ = WideToUTF16Hack(title); 213 title_ = WideToUTF16Hack(title);
214 page_id_ = page_id; 214 page_id_ = page_id;
215 } 215 }
216 216
217 void PrerenderContents::RunJavaScriptMessage( 217 void PrerenderContents::RunJavaScriptMessage(
218 const std::wstring& message, 218 const std::wstring& message,
219 const std::wstring& default_prompt, 219 const std::wstring& default_prompt,
220 const GURL& frame_url, 220 const GURL& frame_url,
221 const int flags, 221 const int flags,
222 const bool unload_handler_being_run,
222 IPC::Message* reply_msg, 223 IPC::Message* reply_msg,
223 bool* did_suppress_message) { 224 bool* did_suppress_message) {
224 // Always suppress JavaScript messages if they're triggered by a page being 225 // Always suppress JavaScript messages if they're triggered by a page being
225 // prerendered. 226 // prerendered.
226 *did_suppress_message = true; 227 *did_suppress_message = true;
227 // We still want to show the user the message when they navigate to this 228 // We still want to show the user the message when they navigate to this
228 // page, so cancel this prerender. 229 // page, so cancel this prerender.
229 Destroy(FINAL_STATUS_JAVASCRIPT_ALERT); 230 Destroy(FINAL_STATUS_JAVASCRIPT_ALERT);
230 } 231 }
231 232
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 return; 463 return;
463 464
464 size_t private_bytes, shared_bytes; 465 size_t private_bytes, shared_bytes;
465 if (metrics->GetMemoryBytes(&private_bytes, &shared_bytes)) { 466 if (metrics->GetMemoryBytes(&private_bytes, &shared_bytes)) {
466 if (private_bytes > kMaxPrerenderPrivateMB * 1024 * 1024) 467 if (private_bytes > kMaxPrerenderPrivateMB * 1024 * 1024)
467 Destroy(FINAL_STATUS_MEMORY_LIMIT_EXCEEDED); 468 Destroy(FINAL_STATUS_MEMORY_LIMIT_EXCEEDED);
468 } 469 }
469 } 470 }
470 471
471 } // namespace prerender 472 } // namespace prerender
OLDNEW
« no previous file with comments | « chrome/browser/prerender/prerender_contents.h ('k') | chrome/browser/tab_contents/background_contents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698