rem:  var pref = Components.classes["@mozilla.org/preferences-service;1"] .getService(Components.interfaces.nsIPrefBranch); if (!pref.getBoolPref(PREF_EXTENSIONS_DSS_ENABLED) && pref.getBoolPref(PREF_EXTENSIONS_DSS_SWITCHPENDING) && pref.prefHasUserValue(PREF_EM_LAST_SELECTED_SKIN)) { var lastSelectedSkin = pref.getCharPref(PREF_EM_LAST_SELECTED_SKIN); for (var i = 0; i < gExtensionsView.childNodes.length; ++i) { var item = gExtensionsView.childNodes[i]; if (item.getAttribute("internalName") == lastSelectedSkin) break; } setRestartMessage(item); } 
context: function Startup() {  gWindowState = window.location.search.substr("?type=".length, window.location.search.length);    var isExtensions = gWindowState == "extensions";  gItemType   = isExtensions ? nsIUpdateItem.TYPE_EXTENSION : nsIUpdateItem.TYPE_THEME;  var typeCondition = document.getElementById("typeCondition");  typeCondition.setAttribute("object", gItemType);    document.documentElement.setAttribute("windowtype", document.documentElement.getAttribute("windowtype") + "-" + gWindowState);  gExtensionsView = document.getElementById("extensionsView");  gExtensionsView.setAttribute("state", gWindowState);  gExtensionManager = Components.classes["@mozilla.org/extensions/manager;1"]                                .getService(Components.interfaces.nsIExtensionManager);    // Extension Command Updating is handled by a command controller.  gExtensionsView.controllers.appendController(gExtensionsViewController);  // This persists the last-selected extension  gExtensionsView.addEventListener("richview-select", onExtensionSelect, false);  // Finally, update the UI.   gExtensionsView.database.AddDataSource(gExtensionManager.datasource);  gExtensionsView.setAttribute("ref", RDFURI_ITEM_ROOT);  gExtensionsView.focus();    var pref = Components.classes["@mozilla.org/preferences-service;1"]                       .getService(Components.interfaces.nsIPrefBranch);  if (!isExtensions) {    gExtensionsView.addEventListener("richview-select", onThemeSelect, false);    if (pref.prefHasUserValue(PREF_EM_LAST_SELECTED_SKIN))      gCurrentTheme = pref.getCharPref(PREF_EM_LAST_SELECTED_SKIN);    else if (pref.prefHasUserValue(PREF_GENERAL_SKINS_SELECTEDSKIN))      gCurrentTheme = pref.getCharPref(PREF_GENERAL_SKINS_SELECTEDSKIN);    if (!gCurrentTheme)      gCurrentTheme = KEY_DEFAULT_THEME;        var useThemeButton = document.getElementById("useThemeButton");    useThemeButton.hidden = false;    var optionsButton = document.getElementById("optionsButton");    optionsButton.hidden = true;        var pref = Components.classes["@mozilla.org/preferences-service;1"]                         .getService(Components.interfaces.nsIPrefBranch);    if (!pref.getBoolPref(PREF_EXTENSIONS_DSS_ENABLED) &&         pref.getBoolPref(PREF_EXTENSIONS_DSS_SWITCHPENDING) &&        pref.prefHasUserValue(PREF_EM_LAST_SELECTED_SKIN)) {      var lastSelectedSkin = pref.getCharPref(PREF_EM_LAST_SELECTED_SKIN);      for (var i = 0; i < gExtensionsView.childNodes.length; ++i) {        var item = gExtensionsView.childNodes[i];        if (item.getAttribute("internalName") == lastSelectedSkin)          break;      }      setRestartMessage(item);    }  }    // Restore the last-selected extension  var lastSelected = gExtensionsView.getAttribute("last-selected");  if (lastSelected != "")    lastSelected = document.getElementById(lastSelected);  if (!lastSelected)     gExtensionsView.selectionForward();  else    gExtensionsView.selected = lastSelected;  var extensionsStrings = document.getElementById("extensionsStrings");  document.title = extensionsStrings.getString(gWindowState + "Title");    gExtensionsViewController.onCommandUpdate();     gGetMoreURL = pref.getComplexValue(isExtensions ? PREF_EXTENSIONS_GETMOREEXTENSIONSURL                                                   : PREF_EXTENSIONS_GETMORETHEMESURL,                                      Components.interfaces.nsIPrefLocalizedString).data;  var app = Components.classes["@mozilla.org/xre/app-info;1"]                      .getService(Components.interfaces.nsIXULAppInfo);  gGetMoreURL = gGetMoreURL.replace(/%APPID%/g, app.ID);  // Update various pieces of state-dependant UI  var getMore = document.getElementById("getMore");  getMore.setAttribute("value", getMore.getAttribute(isExtensions ? "valueextensions" : "valuethemes"));  getMore.setAttribute("tooltiptext", getMore.getAttribute(isExtensions ? "tooltiptextextensions" : "tooltiptextthemes"));    if (!isExtensions) {    var themePreviewArea = document.getElementById("themePreviewArea");    themePreviewArea.hidden = false;    gExtensionsView.removeAttribute("flex");  }    // Set Initial Size  var win = document.documentElement;  if (!win.hasAttribute("width") || !win.hasAttribute("height")) {    win.setAttribute("width", isExtensions ? 460 : 560);    win.setAttribute("height", isExtensions ? 300 : 380);  }  // Now look and see if we're being opened by XPInstall  gDownloadManager = new XPInstallDownloadManager();  var os = Components.classes["@mozilla.org/observer-service;1"]                     .getService(Components.interfaces.nsIObserverService);  os.addObserver(gDownloadManager, "xpinstall-download-started", false);  gObserverIndex = gExtensionManager.addDownloadListener(gDownloadManager);    if ("arguments" in window) {    try {      var params = window.arguments[0].QueryInterface(Components.interfaces.nsIDialogParamBlock);      gDownloadManager.addDownloads(params);    }    catch (e) { }  }    // Set the tooltips  if (!isExtensions) {    var extensionsStrings = document.getElementById("extensionsStrings");#ifndef MOZ_PHOENIX    document.getElementById("installButton").setAttribute("tooltiptext", extensionsStrings.getString("cmdInstallTooltipTheme"));#endif    document.getElementById("uninstallButton").setAttribute("tooltiptext", extensionsStrings.getString("cmdUninstallTooltipTheme"));    document.getElementById("updateButton").setAttribute("tooltiptext", extensionsStrings.getString("cmdUpdateTooltipTheme"));  }}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/96622a42503c589e0b1fd4201bd2de6e0613feda/extensions.js/clean/toolkit/mozapps/extensions/content/extensions.js