Discuz! Board

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1258|回复: 3
打印 上一主题 下一主题

自动升级更新相关

[复制链接]

1228

主题

1998

帖子

7598

积分

认证用户组

Rank: 5Rank: 5

积分
7598
跳转到指定楼层
楼主
发表于 2020-8-26 14:11:27 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 Qter 于 2020-8-26 15:52 编辑

aboutDialog.xhtml


MOZ_UPDATER
ac_add_options --enable-updater
ac_add_options --disable-updater
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
  1. if (AppConstants.MOZ_UPDATER) {
  2.     gAppUpdater = new appUpdater({ buttonAutoFocus: true });

  3.     let defaults = Services.prefs.getDefaultBranch("");
  4.     let channelLabel = document.getElementById("currentChannel");
  5.     channelLabel.value = defaults.getCharPref("app.update.channel");
  6.   }
复制代码
  1. MOZ_ARG_DISABLE_BOOL(updater,
  2. [  --disable-updater       Disable building of updater],
  3.     MOZ_UPDATER=,
  4.     MOZ_UPDATER=1 )

  5. if test -n "$MOZ_UPDATER"; then
  6.     AC_DEFINE(MOZ_UPDATER)
  7. fi
复制代码
aboutDialog-appUpdater.js
  1. function appUpdater(options = {}) {
  2.   XPCOMUtils.defineLazyServiceGetter(
  3.     this,
  4.     "aus",
  5.     "@mozilla.org/updates/update-service;1",
  6.     "nsIApplicationUpdateService"
  7.   );
  8.   XPCOMUtils.defineLazyServiceGetter(
  9.     this,
  10.     "checker",
  11.     "@mozilla.org/updates/update-checker;1",
  12.     "nsIUpdateChecker"
  13.   );
  14.   XPCOMUtils.defineLazyServiceGetter(
  15.     this,
  16.     "um",
  17.     "@mozilla.org/updates/update-manager;1",
  18.     "nsIUpdateManager"
  19.   );
  20. ....
复制代码
// true when updating has been disabled by enterprise policy
  get updateDisabledByPolicy() {
    return Services.policies && !Services.policies.isAllowed("appUpdate");
  },
回复

使用道具 举报

1228

主题

1998

帖子

7598

积分

认证用户组

Rank: 5Rank: 5

积分
7598
沙发
 楼主| 发表于 2020-8-26 16:26:08 | 只看该作者
  1. const PREF_APP_UPDATE_AUTO_MIGRATED = "app.update.auto.migrated";
  2.     const FILE_UPDATE_CONFIG_JSON = "update-config.json";
  3.             const CONFIG_APP_UPDATE_AUTO = "app.update.auto";
  4.       
  5.         let configValue = await readUpdateAutoConfig();
  6.           // If we read a value out of this file, don't later perform migration.
  7.           // If the file is deleted, we don't want some stale pref getting
  8.           // written to it just because a different profile performed migration.
  9.           Services.prefs.setBoolPref(PREF_APP_UPDATE_AUTO_MIGRATED, true);
  10.           return configValue;
  11.    
  12.     async function readUpdateAutoConfig() {
  13.       let configFile = FileUtils.getDir("UpdRootD", [], true);
  14.       configFile.append(FILE_UPDATE_CONFIG_JSON);
  15.       let binaryData = await OS.File.read(configFile.path);
  16.       let jsonData = new TextDecoder().decode(binaryData);
  17.       let configData = JSON.parse(jsonData);
  18.       return !!configData[CONFIG_APP_UPDATE_AUTO];
  19.     }
复制代码
回复 支持 反对

使用道具 举报

1228

主题

1998

帖子

7598

积分

认证用户组

Rank: 5Rank: 5

积分
7598
板凳
 楼主| 发表于 2020-8-26 16:33:40 | 只看该作者
const PREF_APP_UPDATE_LOG = "app.update.log";
const PREF_APP_UPDATE_LOG_FILE = "app.update.log.file";
回复 支持 反对

使用道具 举报

1228

主题

1998

帖子

7598

积分

认证用户组

Rank: 5Rank: 5

积分
7598
地板
 楼主| 发表于 2020-8-26 17:18:13 | 只看该作者
  1. XPCOMUtils.defineLazyServiceGetter(
  2.     this,
  3.     "checker",
  4.     "@mozilla.org/updates/update-checker;1",
  5.     "nsIUpdateChecker"
  6.   );
  7.   
  8.   根据 update-checker 搜索
  9.   https://searchfox.org/comm-central/source/mozilla/toolkit/mozapps/update/components.conf#22
  10.   
  11.   {
  12.         'cid': '{898CDC9B-E43F-422F-9CC4-2F6291B415A3}',
  13.         'contract_ids': ['@mozilla.org/updates/update-checker;1'],
  14.         'jsm': 'resource://gre/modules/UpdateService.jsm',
  15.         'constructor': 'Checker',
  16.     },
  17.    
  18.    
  19.     UpdateService.jsm 实现?
  20.    
  21.    
  22. XPCOMUtils.defineLazyServiceGetter(
  23.     this,
  24.     "aus",
  25.     "@mozilla.org/updates/update-service;1",
  26.     "nsIApplicationUpdateService"
  27.   );
  28.   
  29. https://searchfox.org/comm-central/source/mozilla/toolkit/mozapps/update/components.conf#10

  30. {
  31.         'cid': '{B3C290A6-3943-4B89-8BBE-C01EB7B3B311}',
  32.         'contract_ids': ['@mozilla.org/updates/update-service;1'],
  33.         'jsm': 'resource://gre/modules/UpdateService.jsm',
  34.         'constructor': 'UpdateService',
  35.     },
  36.    
  37.     UpdateService.jsm 实现?
  38.    

  39. const PREF_APP_UPDATE_BACKGROUNDERRORS = "app.update.backgroundErrors";
复制代码
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|firemail ( 粤ICP备15085507号-1 )

GMT+8, 2024-5-20 03:55 , Processed in 0.056612 second(s), 19 queries .

Powered by Discuz! X3

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表