home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 November / CHIP_2011_11.iso / Programy / Narzedzia / AIMP2 / aimp_2.61.583.exe / $TEMP / YandexPackSetup.msi / fil3DD1AE30F0E519337F60FC9D3C19333A < prev    next >
Text File  |  2010-07-12  |  21KB  |  577 lines

  1. var gYaInstaller = {
  2.   __installed: true,
  3.   __lastEmActionRequestedName: "",
  4.   
  5.   get isBarUninstalled() {
  6.     return this.__installed == false;
  7.   },
  8.   
  9.   APP_ACTION_QUIT_TOPIC: "quit-application",
  10.   EM_ACTION_REQUESTED_TOPIC: "em-action-requested",
  11.   
  12.   LASTVERSION_PREF_NAME: "yasearch.general.lastVersion",
  13.   
  14.   NEW_ADDONS_LIST_PREF_NAME: "extensions.newAddons",
  15.   CHECK_GLOBAL_INSTALL_PREF_NAME: "yasearch.general.checkGlobalInstall",
  16.   CHECK_GLOBAL_INSTALL_POST_CHECK: 1,
  17.   CHECK_GLOBAL_INSTALL_CHECKED: 2,
  18.   
  19.   CHECK_TOOLBAR_COLLAPSED_PREF_NAME: "yasearch.general.checkToolbarCollapsed",
  20.   
  21.   init: function() {
  22.     this._checkGlobalPostInstall();
  23.     
  24.     OBSERVER_SERVICE.addObserver(this, "Ya-GUID-Response", false);
  25.     OBSERVER_SERVICE.addObserver(this, this.EM_ACTION_REQUESTED_TOPIC, false);
  26.     OBSERVER_SERVICE.addObserver(this, this.APP_ACTION_QUIT_TOPIC, false);
  27.     this.proccessInstall();
  28.   },
  29.   
  30.   uninit: function() {
  31.     OBSERVER_SERVICE.removeObserver(this, "Ya-GUID-Response");
  32.     OBSERVER_SERVICE.removeObserver(this, this.APP_ACTION_QUIT_TOPIC);
  33.     OBSERVER_SERVICE.removeObserver(this, this.EM_ACTION_REQUESTED_TOPIC);
  34.     
  35.     if (this.isBarUninstalled)
  36.       this.proccessUninstall();
  37.     else
  38.       this._checkGlobalInstall();
  39.   },
  40.   
  41.   observe: function(aSubject, aTopic, aData) {
  42.     switch (aTopic) {
  43.       case "Ya-GUID-Response":
  44.         if (aData === "SENDED")
  45.           this.sttInstall = true;
  46.         
  47.         break;
  48.         
  49.       case this.EM_ACTION_REQUESTED_TOPIC:
  50.         aSubject.QueryInterface(Ci.nsIUpdateItem);
  51.  
  52.         if (aSubject.id === EXT_ID) {
  53.           switch (aData) {
  54.             case "item-uninstalled":
  55.             case "item-upgraded":
  56.               gYaSearchService.setIntPref(this.CHECK_TOOLBAR_COLLAPSED_PREF_NAME, 1);
  57.               break;
  58.             
  59.             case "item-cancel-action":
  60.               if (this.__lastEmActionRequestedName && this.__lastEmActionRequestedName == aData)
  61.                 gYaSearchService.resetPref(this.CHECK_TOOLBAR_COLLAPSED_PREF_NAME);
  62.               break;
  63.           }
  64.           
  65.           this.__installed = !(aData == "item-uninstalled");
  66.           this.__lastEmActionRequestedName = aData;
  67.         }
  68.         
  69.         break;
  70.       
  71.       case this.APP_ACTION_QUIT_TOPIC:
  72.         this.uninit();
  73.         break;
  74.       
  75.       default:
  76.         break;
  77.     }
  78.   },
  79.   
  80.   _checkGlobalInstall: function() {
  81.     let yaSearchService = gYaSearchService;
  82.     
  83.     try {
  84.       let installCheckValue = yaSearchService.getIntPref(this.CHECK_GLOBAL_INSTALL_PREF_NAME);
  85.       yaSearchService.setIntPref(this.CHECK_GLOBAL_INSTALL_PREF_NAME, this.CHECK_GLOBAL_INSTALL_CHECKED);
  86.       
  87.       if (installCheckValue)
  88.         return;
  89.       
  90.       if (!(yaSearchService.AppBarType == "barff" && yaSearchService.getCharPref("app.distributor") == "yandex"))
  91.         return;
  92.       
  93.       let extManager = Cc["@mozilla.org/extensions/manager;1"].getService(Ci.nsIExtensionManager);
  94.       let barExtItem = extManager.getItemForID(EXT_ID);
  95.       
  96.       if (barExtItem.installLocationKey !== "app-global")
  97.         return;
  98.       
  99.       let barInstallDir = yaSearchService.getInstallDir();
  100.       
  101.       let profileDir = Cc["@mozilla.org/file/directory_service;1"]
  102.                          .getService(Ci.nsIProperties)
  103.                          .get("ProfD", Ci.nsIFile);
  104.       
  105.       if (profileDir.contains(barInstallDir.parent, false))
  106.         return;
  107.       
  108.       let currentProcDir = Cc["@mozilla.org/file/directory_service;1"]
  109.                              .getService(Ci.nsIProperties)
  110.                              .get("CurProcD", Ci.nsIFile);
  111.       
  112.       if (!currentProcDir.contains(barInstallDir.parent, false))
  113.         return;
  114.       
  115.       profileDir.append("extensions");
  116.       
  117.       let barInstallProfileDir = profileDir.clone();
  118.       barInstallProfileDir.append(EXT_ID);
  119.       
  120.       if (barInstallProfileDir.exists() && barInstallProfileDir.isDirectory())
  121.         return;
  122.       
  123.       try {
  124.         barInstallDir.copyTo(profileDir, "");
  125.       } catch (ex) {
  126.         barInstallProfileDir.remove(true);
  127.         return;
  128.       }
  129.       
  130.       yaSearchService.setIntPref(this.CHECK_GLOBAL_INSTALL_PREF_NAME, this.CHECK_GLOBAL_INSTALL_POST_CHECK);
  131.       
  132.     } catch (e) {
  133.       yaSearchService.log(e);
  134.     }
  135.   },
  136.   
  137.   _checkGlobalPostInstall: function() {
  138.     if (gYaSearchService.getIntPref(this.CHECK_GLOBAL_INSTALL_PREF_NAME) == this.CHECK_GLOBAL_INSTALL_POST_CHECK) {
  139.       if (gYaSearchService.getCharPref(this.NEW_ADDONS_LIST_PREF_NAME) === EXT_ID)
  140.         gYaSearchService.resetPref(this.NEW_ADDONS_LIST_PREF_NAME);
  141.     }
  142.   },
  143.   
  144.   proccessInstall: function() {
  145.     var currentVersion = gYaSearchService.barExtensionMajorVersion;
  146.     var lastVersion = gYaSearchService.getCharPref(this.LASTVERSION_PREF_NAME);
  147.     
  148.     this._checkToolbarCollapsed(lastVersion, currentVersion);
  149.     
  150.     if (lastVersion == currentVersion)
  151.       return;
  152.     
  153.     gYaSearchService.setCharPref(this.LASTVERSION_PREF_NAME, currentVersion);
  154.     
  155.     if ("vendorDataMergeClids" in gYaSearchService)
  156.       gYaSearchService.vendorDataMergeClids();
  157.     
  158.     if (lastVersion == "0") {
  159.       gYaSearchService.timeGuid = null;
  160.       gYaSearchService.checkNeedSendGuid();
  161.       
  162.       this._changePreferencesOnInstall();
  163.       
  164.       if (!gYaSearchService.checkKeywordURL)
  165.         gYaSearchService.checkKeywordURL = "check";
  166.       
  167.     } else {
  168.       try {
  169.         if (typeof(gYaOverlay) === "object" && "migrateWidgets" in gYaOverlay)
  170.           gYaOverlay.migrateWidgets(lastVersion);
  171.       } catch(e) {
  172.         gYaSearchService.log(e);
  173.       }
  174.       
  175.       this._migratePreferencesOnInstall(lastVersion);
  176.     }
  177.     
  178.     var versionComparator = Cc["@mozilla.org/xpcom/version-comparator;1"].getService(Ci.nsIVersionComparator);
  179.     if (versionComparator.compare(currentVersion, lastVersion) == 1) {
  180.       gYaSearchService.showLocalWelcomePage = true;
  181.       
  182.       var welcomepageVersion = gYaSearchService.getCharPref("yasearch.welcomepage.version");
  183.       var welcomepageVersionIntroduced = gYaSearchService.getCharPref("yasearch.welcomepage.version.introduced");
  184.       if (welcomepageVersionIntroduced == "0" && lastVersion == "4.0.0")
  185.         welcomepageVersionIntroduced = "4.0.0";
  186.       
  187.       if (gYaSearchService.getBoolPref("yasearch.welcomepage.dontshow")) {
  188.         gYaSearchService.resetPref("yasearch.welcomepage.dontshow");
  189.         gYaSearchService.showLocalWelcomePage = false;
  190.       }
  191.       
  192.       var regKeyPath = "Software\\Yandex\\Toolbar",
  193.           regKeyParam = "VersionIntroducedFx";
  194.       
  195.       var versionFromWinReg = gYaSearchService.WinReg.read("HKCU", regKeyPath, regKeyParam) || 
  196.                               gYaSearchService.WinReg.read("HKLM", regKeyPath, regKeyParam);
  197.       
  198.       if (versionFromWinReg && versionComparator.compare(welcomepageVersionIntroduced, versionFromWinReg) == -1)
  199.         welcomepageVersionIntroduced = versionFromWinReg;
  200.       
  201.       if (welcomepageVersionIntroduced && versionComparator.compare(welcomepageVersion, welcomepageVersionIntroduced) < 1) {
  202.         gYaSearchService.showLocalWelcomePage = false;
  203.       } else {
  204.         welcomepageVersionIntroduced = welcomepageVersion;
  205.       }
  206.       
  207.       gYaSearchService.setCharPref("yasearch.welcomepage.version.introduced", welcomepageVersionIntroduced);
  208.     }
  209.     
  210.     if (lastVersion == "0") {
  211.       try {
  212.         this._addStartMenuLinks();
  213.       } catch(e) {}
  214.     }
  215.   },
  216.   
  217.   _checkToolbarCollapsed: function(aLastVersion, aCurrentVersion) {
  218.     let checkToolbarCollapsed = gYaSearchService.getIntPref(this.CHECK_TOOLBAR_COLLAPSED_PREF_NAME);
  219.     if (checkToolbarCollapsed) {
  220.       gYaSearchService.resetPref(this.CHECK_TOOLBAR_COLLAPSED_PREF_NAME);
  221.       
  222.       if (checkToolbarCollapsed == 1 && typeof(gYaOverlay) === "object" && "setToolbarCollapsedState" in gYaOverlay) {
  223.         if (aLastVersion == "0" || aLastVersion === aCurrentVersion) {
  224.           gYaOverlay.setToolbarCollapsedState(false);
  225.         }
  226.       }
  227.     }
  228.   },
  229.   
  230.   _changePreferencesOnInstall: function() {
  231.     var exportCheckedName = "yasearch.general.ui.bookmarks.prefs.yaruExportChecked";
  232.     if (!gYaSearchService.prefBranch.prefHasUserValue(exportCheckedName)) {
  233.       gYaSearchService.setBoolPref(exportCheckedName, true);
  234.     }
  235.     
  236.     this._checkFTabData();
  237.     
  238.     try {
  239.         if (gYaSearchService.isYaOnlineInstalled) {
  240.           gYaSearchService.setBoolPref("yasearch.mail.ui.notification.enabled",  false);
  241.           gYaSearchService.setBoolPref("yasearch.feeds.ui.notification.enabled", false);
  242.         }
  243.     } catch (ex) {}
  244.   },
  245.   
  246.   _migratePreferencesOnInstall: function(aLastVersion) {
  247.     var versionComparator = Cc["@mozilla.org/xpcom/version-comparator;1"].getService(Ci.nsIVersionComparator);
  248.     if (versionComparator.compare(aLastVersion, "4.2.2") < 1) {
  249.       this.sttInstall = true;
  250.     }
  251.     
  252.     if (aLastVersion == "3.5.3") {
  253.       let oldPublicBookmarksPrefName = "yasearch.general.ui.bookmarks.prefs.yaruPublicValue",
  254.           newPublicBookmarksPrefName = "yasearch.general.ui.bookmarks.prefs.yaruPublicVal";
  255.       
  256.       let oldPublicBookmarksPrefValue = gYaSearchService.getIntPref(oldPublicBookmarksPrefName) || 10;
  257.       
  258.       if (oldPublicBookmarksPrefValue) {
  259.         gYaSearchService.setIntPref(newPublicBookmarksPrefName, oldPublicBookmarksPrefValue);
  260.       }
  261.       
  262.     } else if (aLastVersion == "4.0.0") {
  263.       let hpDefencePrefName = "yasearch.defence.homepage.changes";
  264.       let hpDefencePrefValues = (gYaSearchService.getCharPref(hpDefencePrefName) || "").split("|");
  265.       
  266.       if (hpDefencePrefValues.length == 3) {
  267.         hpDefencePrefValues.push("0");
  268.         gYaSearchService.setCharPref(hpDefencePrefName, hpDefencePrefValues.join("|"));
  269.       }
  270.       
  271.     }
  272.     
  273.     let oldBookmarksPrefName = "yasearch.general.ui.boomarks.open";
  274.     if (gYaSearchService.getBoolPref(oldBookmarksPrefName)) {
  275.       gYaSearchService.setIntPref("yasearch.general.ui.bookmarks.action", 0);
  276.     }
  277.     
  278.     // aLastVersion <= 5.0.1 (remove old services data file)
  279.     if (versionComparator.compare(aLastVersion, "5.0.1") < 1) {
  280.       let yandexDir = gYaSearchService.getYandexDir();
  281.       if (yandexDir) {
  282.         let fileToRemove = yandexDir.clone();
  283.         fileToRemove.append("services.mybar.xml");
  284.         
  285.         if (fileToRemove.exists() && fileToRemove.isFile()) {
  286.           try {
  287.             fileToRemove.remove(true);
  288.           } catch(e) {}
  289.         }
  290.       }
  291.     }
  292.     
  293.     this._checkFTabData();
  294.   },
  295.   
  296.   _checkFTabData: function() {
  297.     try {
  298.       let yandexDir = gYaSearchService.getYandexDir();
  299.       if (!yandexDir)
  300.         return;
  301.       
  302.       let ftabFileName = "ftab.data.xml";
  303.       let ftabFile = yandexDir.clone();
  304.       ftabFile.append(ftabFileName);
  305.       
  306.       if (ftabFile.exists() && ftabFile.isFile())
  307.         return;
  308.       
  309.       let ftabDefaultFile = gYaSearchService.getContentDir();
  310.       ftabDefaultFile.append("ftab");
  311.       ftabDefaultFile.append("def." + ftabFileName);
  312.       
  313.       if (!(ftabDefaultFile.exists() && ftabDefaultFile.isFile()))
  314.         return;
  315.       
  316.       let ftabContent = gYaSearchService.readFile(ftabDefaultFile);
  317.       if (!ftabContent)
  318.         return;
  319.       
  320.       let clid = gYaSearchService.vendorData.clid7;
  321.       let urlPrefix = "http://clck.yandex.ru/redir/dtype=stred/pid=12/cid=70328/path=";
  322.       
  323.       let yandexLink = urlPrefix + "Yandex/url*http://" +
  324.                        gYaSearchService.getLocaleDependedUrl("YandexWwwHost") + "/" + (clid ? "?clid=" + clid : "");
  325.       let mailLink = urlPrefix + "Mail/url*http://" + gYaSearchService.getLocaleDependedUrl("MailHost") + "/";
  326.       let fotkiLink = urlPrefix + "Fotki/url*http://" + gYaSearchService.getLocaleDependedUrl("FotkiHost") + "/";
  327.       
  328.       ftabContent = ftabContent.replace(/%yandex%/g, yandexLink)
  329.                                .replace(/%mail%/g, mailLink)
  330.                                .replace(/%fotki%/g, fotkiLink);
  331.       
  332.       let ftabDoc = gYaSearchService.domParser.parseFromString(ftabContent, "text/xml");
  333.       let ftabXML = gYaSearchService.safeE4Xml(ftabDoc, null, "data");
  334.       if (ftabXML)
  335.         gYaSearchService.writeFile(ftabFile, ftabXML.toXMLString());
  336.       
  337.     } catch(e) {}
  338.   },
  339.   
  340.   _write1251File: function(aFile, aData) {
  341.     var uConverter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
  342.                           .createInstance(Ci.nsIScriptableUnicodeConverter);
  343.     uConverter.charset = "windows-1251";
  344.     var chunk = uConverter.ConvertFromUnicode(aData);
  345.     
  346.     var os = Cc["@mozilla.org/network/file-output-stream;1"].createInstance(Ci.nsIFileOutputStream);
  347.     os.init(aFile, 0x02 | 0x08 | 0x20, 0755, 0);
  348.     var result = os.write(chunk, chunk.length);
  349.     os.close();
  350.   },
  351.   
  352.   _addStartMenuLinks: function() {
  353.     if (!gYaSearchService.windowsOS || gYaSearchService.AppBarType === "barffport")
  354.       return;
  355.     
  356.     this._removeStartMenuLinks();
  357.     
  358.     var iconFile = gYaSearchService.getChromeDir();
  359.     iconFile.append("skin");
  360.     iconFile.append("classic");
  361.     iconFile.append("images");
  362.     iconFile.append("bar-logo.ico");
  363.     
  364.     var iconFilePath = iconFile.path;
  365.     
  366.     var progsBarDir = this._getProgsBarDir();
  367.     if (!progsBarDir)
  368.       return;
  369.     
  370.     var welcomeLocalFilePath = function __welcomeLocalFilePath() {
  371.       try {
  372.         var reg = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(Ci.nsIChromeRegistry);
  373.         var ioSvc = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
  374.         var chromeURL = ioSvc.newURI("chrome://yasearch/locale/first-start/welcome.html", null, null);
  375.         var fileURL = reg.convertChromeURL(chromeURL);
  376.         return decodeURIComponent(fileURL.path).replace(/\//g, '\\').replace(/\\/,'');
  377.       } catch(e) {}
  378.       
  379.       return gYaSearchService.getString("windowsStartMenuUrlWelcomePage");
  380.     }();
  381.     
  382.     ["OnlineHelp", "WelcomePage"].forEach(function(aLinkType) {
  383.       var shortcutURL = aLinkType == "WelcomePage" ? welcomeLocalFilePath :
  384.                                                      gYaSearchService.getString("windowsStartMenuUrl" + aLinkType);
  385.       
  386.       var linkFile = progsBarDir.clone();
  387.       linkFile.append(gYaSearchService.getString("windowsStartMenuName" + aLinkType) + ".url");
  388.       
  389.       if (!linkFile.exists() || !linkFile.isFile()) {
  390.         try {
  391.           linkFile.create(Ci.nsIFile.NORMAL_FILE_TYPE, 0755);
  392.           
  393.           if (linkFile.exists() && linkFile.isFile()) {
  394.             var fileContent = "[InternetShortcut]" +
  395.                               "\r\nURL=" + shortcutURL +
  396.                               "\r\nIconFile=" + iconFilePath +
  397.                               "\r\nIconIndex=0" +
  398.                               "\r\n";
  399.             
  400.             this._write1251File(linkFile, fileContent);
  401.           }
  402.         } catch(e) {}
  403.       }
  404.     }, this);
  405.   },
  406.   
  407.   _removeStartMenuLinks: function() {
  408.     if (!gYaSearchService.windowsOS)
  409.       return;
  410.     
  411.     var progsBarDir = this._getProgsBarDir();
  412.     if (!progsBarDir)
  413.       return;
  414.     
  415.     ["OnlineHelp", "WelcomePage"].forEach(function(aLinkType) {
  416.       var linkFile = progsBarDir.clone();
  417.       linkFile.append(gYaSearchService.getString("windowsStartMenuName" + aLinkType) + ".url");
  418.       
  419.       if (linkFile.exists() && linkFile.isFile()) {
  420.         try { linkFile.remove(true); } catch(e) {}
  421.       }
  422.     }, this)
  423.     
  424.     if (!progsBarDir.directoryEntries.hasMoreElements()) {
  425.       var parentDir = progsBarDir.parent;
  426.       try {
  427.         progsBarDir.remove(true);
  428.         if (!parentDir.directoryEntries.hasMoreElements()) {
  429.           parentDir.remove(true);
  430.         }
  431.       } catch(e) {}
  432.     }
  433.     
  434.     try {
  435.       var cmPrgs = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties).get("CmPrgs", Ci.nsIFile);
  436.       if (cmPrgs && cmPrgs.exists() && cmPrgs.isDirectory()) {
  437.         cmPrgs.append(this._YandexName);
  438.         if (cmPrgs.exists() && cmPrgs.isDirectory() && !cmPrgs.directoryEntries.hasMoreElements()) {
  439.           cmPrgs.remove(true);
  440.         }
  441.       }
  442.     } catch(e) {}
  443.   },
  444.   
  445.   _getProgsBarDir: function() {
  446.     try {
  447.       var programsDir = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties).get("Progs", Ci.nsIFile);
  448.       
  449.       if (programsDir && programsDir.exists() && programsDir.isDirectory()) {
  450.         programsDir.append(this._YandexName);
  451.         
  452.         if (!programsDir.exists() || !programsDir.isDirectory()) {
  453.           try {
  454.             programsDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0755);
  455.           } catch(e) {}
  456.         }
  457.         
  458.         if (programsDir.exists() && programsDir.isDirectory()) {
  459.           var barFolder = programsDir.clone();
  460.           barFolder.append(this._YandexBarName);
  461.           
  462.           if (!barFolder.exists() || !barFolder.isDirectory()) {
  463.             try {
  464.               barFolder.create(Ci.nsIFile.DIRECTORY_TYPE, 0755);
  465.             } catch(e) {}
  466.           }
  467.           
  468.           if (barFolder.exists() && barFolder.isDirectory())
  469.             return barFolder;
  470.         }
  471.       }
  472.     } catch(e){}
  473.     
  474.     return null;
  475.   },
  476.   
  477.   get _YandexName() {
  478.     return UConverter.ConvertToUnicode("╨»╨╜╨┤╨╡╨║╤ü");
  479.   },
  480.   
  481.   get _YandexBarName() {
  482.     return UConverter.ConvertToUnicode("╨»╨╜╨┤╨╡╨║╤ü.╨æ╨░╤Ç");
  483.   },
  484.   
  485.   STT_PREF_NAME: "yasearch.general.stt",
  486.   
  487.   get sttInstall() {
  488.     let stt = gYaSearchService.getCharPref(this.STT_PREF_NAME);
  489.     return stt !== '{"s":{"i":4}}';
  490.   },
  491.   
  492.   set sttInstall() {
  493.     gYaSearchService.setCharPref(this.STT_PREF_NAME, '{"s":{"i":4}}');
  494.   },
  495.   
  496.   proccessUninstall: function() {
  497.     //if (gYaSearchService.getCharPref("general.useragent.extra.yandexp"))
  498.       //gYaSearchService.setCharPref("general.useragent.extra.yandexp", "s027vp");
  499.     
  500.     gYaSearchService.resetPref(this.LASTVERSION_PREF_NAME);
  501.     gYaSearchService.resetPref("yasearch.license.accepted");
  502.     gYaSearchService.resetPref("yasearch.welcomepage.version.introduced");
  503.     gYaSearchService.resetPref(this.STT_PREF_NAME);
  504.     
  505.     let vendorFileName = gYaSearchService.vendorFileName;
  506.     gYaSearchService.resetPref("yasearch.general.app.bar.type");
  507.     
  508.     if (typeof(gYaStorage) === "object" && "shutdown" in gYaStorage)
  509.       gYaStorage.shutdown();
  510.     
  511.     try {
  512.       gYaSearchService.yaAuth.PasswordManager.removeAllUsersData();
  513.     } catch (ex) {}
  514.     
  515.     var yandexDir = gYaSearchService.getYandexDir();
  516.     if (yandexDir) {
  517.       ["cities.data.xml", "regions.data.xml", "services.mybar.xml", "maps.data.xml",
  518.        "services.data.xml", "ftab.data.xml", "yasearch-storage.sqlite"]
  519.       .forEach(function(aFileName) {
  520.         var fileToRemove = yandexDir.clone();
  521.         fileToRemove.append(aFileName);
  522.         if (fileToRemove.exists() && fileToRemove.isFile()) {
  523.           try {
  524.             fileToRemove.remove(true);
  525.           } catch(e) {}
  526.         }
  527.       }, this);
  528.       
  529.       if (!yandexDir.directoryEntries.hasMoreElements()) {
  530.         try {
  531.           yandexDir.remove(true);
  532.         } catch(e) {}
  533.       }
  534.     }
  535.     
  536.     var yaAppDir = gYaSearchService.getYaAppDir();
  537.     if (yaAppDir) {
  538.       ["r1-barff", vendorFileName]
  539.       .forEach(function(aFileName) {
  540.         if (aFileName) {
  541.           var fileToRemove = yaAppDir.clone();
  542.           fileToRemove.append(aFileName);
  543.           if (fileToRemove.exists() && fileToRemove.isFile()) {
  544.             try {
  545.               fileToRemove.remove(true);
  546.             } catch(e) {}
  547.           }
  548.         }
  549.       }, this);
  550.     }
  551.     
  552.     this._removeStartMenuLinks();
  553.     
  554.     this._sendUninstallRequest();
  555.   },
  556.   
  557.   _sendUninstallRequest: function() {
  558.     let url = gYaSearchService.generateGUIDStatusURL;
  559.     if (!url)
  560.       return;
  561.     
  562.     let versionData = gYaSearchService.versionData;
  563.     let data2Server = [];
  564.     
  565.     for each (var prop in ["yasoft", "ui", "ver", "os", "clid"])
  566.       if (versionData[prop])
  567.         data2Server.push(prop + "=" + encodeURIComponent(versionData[prop]));
  568.     
  569.     data2Server.push("stat=uninstall");
  570.     
  571.     url += data2Server.join("&");
  572.     
  573.     let req = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.nsIXMLHttpRequest);
  574.     req.open("GET", url, false);
  575.     req.send(null);
  576.   }
  577. }