Fixing bug 405239. Cookie confirmation dialog focuses a newly opened background tab. r+sr+a=jonas@sicking.cc
authorJohnny Stenback <jst@mozilla.com>
Wed, 26 Nov 2008 20:59:47 -0500
changeset 21978 ec97a4036c9a17af1bf53d705d803ccc17662fd9
parent 21977 2e30d8025fa4f74d1100744707a3a4f1ee28ae44
child 21979 4c6331befc51e5562e0ac955579cfaabc06df655
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs405239
milestone1.9.1b3pre
Fixing bug 405239. Cookie confirmation dialog focuses a newly opened background tab. r+sr+a=jonas@sicking.cc
extensions/cookie/nsCookiePromptService.cpp
--- a/extensions/cookie/nsCookiePromptService.cpp
+++ b/extensions/cookie/nsCookiePromptService.cpp
@@ -85,26 +85,26 @@ nsCookiePromptService::CookieDialog(nsID
   rv = objects->AppendElement(aCookie, PR_FALSE);
   if (NS_FAILED(rv)) return rv;
 
   block->SetObjects(objects);
 
   nsCOMPtr<nsIWindowWatcher> wwatcher = do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv);
   if (NS_FAILED(rv)) return rv;
 
-  nsCOMPtr<nsIDOMWindow> parent = aParent;
-  if (!parent) {
-    wwatcher->GetActiveWindow(getter_AddRefs(parent));
-  }
-
   nsCOMPtr<nsISupports> arguments = do_QueryInterface(block);
   nsCOMPtr<nsIDOMWindow> dialog;
-  rv = wwatcher->OpenWindow(parent, "chrome://cookie/content/cookieAcceptDialog.xul", "_blank",
-                             "centerscreen,chrome,modal,titlebar", arguments,
-                             getter_AddRefs(dialog));
+
+  // Given the nature of this dialog and the frequency of it popping
+  // up for those few users that have it enabled we do not want this
+  // dialog to be parented at a window. Pass in nsnull as the
+  // parent. See bug 405239 for more details.
+  rv = wwatcher->OpenWindow(nsnull, "chrome://cookie/content/cookieAcceptDialog.xul", "_blank",
+                            "centerscreen,chrome,modal,titlebar", arguments,
+                            getter_AddRefs(dialog));
 
   if (NS_FAILED(rv)) return rv;
 
   // get back output parameters
   PRBool tempValue;
   block->GetInt(nsICookieAcceptDialog::ACCEPT_COOKIE, &tempValue);
   *aAccept = tempValue;