merge: cleanup after blassey left
authorNA@w2k-pro
Wed, 06 May 2009 01:55:49 +0200
changeset 28019 8cd07d7f9d8b4b98acf805ccecb5d07675bb7107
parent 28017 f13ca2edd3743d0fd6c9c59cd330e8146955b1e9 (current diff)
parent 28018 47f7fce3bf9d65709f180de5dfa4623cfe8718b8 (diff)
child 28021 ae1a6296a59239c7fa505cfc815276b31bd71029
push id6843
push usersgautherie.bz@free.fr
push dateTue, 05 May 2009 23:59:14 +0000
treeherdermozilla-central@251caf79eba3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone1.9.2a1pre
merge: cleanup after blassey left
--- a/toolkit/content/commonDialog.js
+++ b/toolkit/content/commonDialog.js
@@ -1,9 +1,8 @@
-/* -*- Mode: C;  c-basic-offset: 2; tab-width: 2; indent-tabs-mode: nil; -*- */
 /* ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  *
  * The contents of this file are subject to the Mozilla Public License Version
  * 1.1 (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  * http://www.mozilla.org/MPL/
  *
@@ -34,23 +33,19 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-const Ci = Components.interfaces;
-const Cr = Components.results;
-const Cc = Components.classes;
-
 // parameters to gCommonDialogParam.Get() are defined in nsPIPromptService.idl
 var gCommonDialogParam = 
-  window.arguments[0].QueryInterface(Ci.nsIDialogParamBlock);
+  window.arguments[0].QueryInterface(Components.interfaces.nsIDialogParamBlock);
   
 function showControls()
 {
   // This is called before onload fires, so we can't be certain that any elements
   // in the document have their bindings ready, so don't call any methods/properties
   // here on xul elements that come from xbl bindings.
   
   // show the required textboxes and set their initial values
@@ -101,53 +96,28 @@ function setLabelForNode(aNode, aLabel, 
   }
 
   // XXXjag bug 325251
   // Need to set this after aNode.setAttribute("value", aLabel);
   if (accessKey)
     aNode.accessKey = accessKey;
 }
 
-var softkbObserver = {
- QueryInterface: function (aIID) {
-    if (aIID.equals(Ci.nsISupports) ||
-        aIID.equals(Ci.nsIObserver))
-      return this;
-    throw Cr.NS_ERROR_NO_INTERFACE;
-  },
- observe: function(subject, topic, data) {
-    if (topic === "softkb-change") {
-      var rect = JSON.parse(data);
-      if (rect) {
-        var height = rect.bottom - rect.top;
-        var width = rect.right - rect.left;
-        var top = (rect.top + (height - window.innerHeight) / 2);
-        var left = (rect.left + width - window.innerWidth) / 2);
-        window.moveTo(left, top);
-      }
-    }
-  }
-};
-
 function commonDialogOnLoad()
 {
   // limit the dialog to the screen width
   document.getElementById("filler").maxWidth = screen.availWidth;
 
   // set the document title
 #ifdef XP_MACOSX
   setElementText("info.title", gCommonDialogParam.GetString(12), true);
 #else
   document.title = gCommonDialogParam.GetString(12);
 #endif
 
-  var observerService = Cc["@mozilla.org/observer-service;1"]
-                          .getService(Ci.nsIObserverService);
-  observerService.addObserver(softkbObserver, "softkb-change", false);
-
   // set the number of command buttons
   var nButtons = gCommonDialogParam.GetInt(2);
   var dialog = document.documentElement;
   switch (nButtons) {
     case 1:
       dialog.getButton("cancel").hidden = true;
       break;
     case 4:
@@ -207,18 +177,18 @@ function commonDialogOnLoad()
     document.documentElement.getButton(dButton).focus();
 #endif
   }
 
   if (gCommonDialogParam.GetInt(6) != 0) // delay button enable
   {
     var delayInterval = 2000;
     try {
-      var prefs = Cc["@mozilla.org/preferences-service;1"]
-                    .getService(Ci.nsIPrefBranch);
+      var prefs = Components.classes["@mozilla.org/preferences-service;1"]
+                  .getService(Components.interfaces.nsIPrefBranch);
       delayInterval = prefs.getIntPref("security.dialog_enable_delay");
     } catch (e) {}
 
     document.documentElement.getButton("accept").disabled = true;
     document.documentElement.getButton("extra1").disabled = true;
     document.documentElement.getButton("extra2").disabled = true;
 
     setTimeout(commonDialogReenableButtons, delayInterval);
@@ -228,29 +198,23 @@ function commonDialogOnLoad()
   }
 
   getAttention();
 
   // play sound
   try {
     var sound = gCommonDialogParam.GetString(13);
     if (sound) {
-      Cc["@mozilla.org/sound;1"]
-        .createInstance(Ci.nsISound)
-        .playSystemSound(sound);
+      Components.classes["@mozilla.org/sound;1"]
+                .createInstance(Components.interfaces.nsISound)
+                .playSystemSound(sound);
     }
   } catch (e) { }
 }
 
-function commonDialogOnUnload(){
-  var observerService = Cc["@mozilla.org/observer-service;1"]
-                          .getService(Ci.nsIObserverService);
-  observerService.removeObserver(softkbObserver, "softkb-change");
-}
-
 var gDelayExpired = false;
 var gBlurred = false;
 
 function commonDialogBlur(aEvent)
 {
   if (aEvent.target != document)
     return;
   gBlurred = true;
--- a/toolkit/content/commonDialog.xul
+++ b/toolkit/content/commonDialog.xul
@@ -5,17 +5,16 @@
 <?xml-stylesheet href="chrome://global/skin/commonDialog.css" type="text/css"?>
 
 <!DOCTYPE dialog SYSTEM "chrome://global/locale/commonDialog.dtd">
 
 <dialog id="commonDialog"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 
         aria-describedby="info.body"
         onload="commonDialogOnLoad();"
-        onunload="commonDialogOnUnload();"
         ondialogaccept="return commonDialogOnAccept();"
         ondialogextra1="return commonDialogOnExtra1();"
         ondialogextra2="return commonDialogOnExtra2();"
         buttonpack="center">
     
   <script type="application/javascript" src="chrome://global/content/commonDialog.js"/>
   <script type="application/x-javascript" src="chrome://global/content/globalOverlay.js"/>