diff --git a/browser/components/preferences/in-content/tests/browser_advanced_update.js b/browser/components/preferences/in-content/tests/browser_advanced_update.js index 3dd06570306e..42301456eadb 100644 --- a/browser/components/preferences/in-content/tests/browser_advanced_update.js +++ b/browser/components/preferences/in-content/tests/browser_advanced_update.js @@ -14,8 +14,6 @@ const mockUpdateManager = { _originalClassId: "", - _originalFactory: null, - QueryInterface: ChromeUtils.generateQI([Ci.nsIUpdateManager]), createInstance(outer, iiD) { @@ -29,8 +27,6 @@ const mockUpdateManager = { let registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar); if (!registrar.isCIDRegistered(this._mockClassId)) { this._originalClassId = registrar.contractIDToCID(this.contractId); - this._originalFactory = Cm.getClassObject(Cc[this.contractId], Ci.nsIFactory); - registrar.unregisterFactory(this._originalClassId, this._originalFactory); registrar.registerFactory(this._mockClassId, "Unregister after testing", this.contractId, this); } }, @@ -38,7 +34,7 @@ const mockUpdateManager = { unregister() { let registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar); registrar.unregisterFactory(this._mockClassId, this); - registrar.registerFactory(this._originalClassId, "", this.contractId, this._originalFactory); + registrar.registerFactory(this._originalClassId, "", this.contractId, null); }, get updateCount() { diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in index b2bfab550e5b..1cafe61f9989 100644 --- a/browser/installer/package-manifest.in +++ b/browser/installer/package-manifest.in @@ -225,8 +225,6 @@ @RESPATH@/components/amWebAPI.js #ifdef MOZ_UPDATER @RESPATH@/components/nsUpdateService.manifest -@RESPATH@/components/nsUpdateService.js -@RESPATH@/components/nsUpdateServiceStub.js #endif @RESPATH@/components/nsUpdateTimerManager.manifest @RESPATH@/components/nsUpdateTimerManager.js diff --git a/mobile/android/installer/package-manifest.in b/mobile/android/installer/package-manifest.in index 2c5351b9a5c4..133505106e7a 100644 --- a/mobile/android/installer/package-manifest.in +++ b/mobile/android/installer/package-manifest.in @@ -156,8 +156,6 @@ #ifndef MOZ_GECKOVIEW_JAR #ifdef MOZ_UPDATER @BINPATH@/components/nsUpdateService.manifest -@BINPATH@/components/nsUpdateService.js -@BINPATH@/components/nsUpdateServiceStub.js #endif #endif diff --git a/toolkit/mozapps/update/nsUpdateService.js b/toolkit/mozapps/update/UpdateService.jsm similarity index 99% rename from toolkit/mozapps/update/nsUpdateService.js rename to toolkit/mozapps/update/UpdateService.jsm index 50c8a8bffde8..5106d99c7874 100644 --- a/toolkit/mozapps/update/nsUpdateService.js +++ b/toolkit/mozapps/update/UpdateService.jsm @@ -4367,5 +4367,4 @@ UpdatePrompt.prototype = { QueryInterface: ChromeUtils.generateQI([Ci.nsIUpdatePrompt]), }; -var components = [UpdateService, Checker, UpdatePrompt, UpdateManager]; -this.NSGetFactory = XPCOMUtils.generateNSGetFactory(components); +var EXPORTED_SYMBOLS = ["UpdateService", "Checker", "UpdatePrompt", "UpdateManager"]; diff --git a/toolkit/mozapps/update/nsUpdateServiceStub.js b/toolkit/mozapps/update/UpdateServiceStub.jsm similarity index 98% rename from toolkit/mozapps/update/nsUpdateServiceStub.js rename to toolkit/mozapps/update/UpdateServiceStub.jsm index 49df7361acba..5c75a43b2d08 100644 --- a/toolkit/mozapps/update/nsUpdateServiceStub.js +++ b/toolkit/mozapps/update/UpdateServiceStub.jsm @@ -61,7 +61,7 @@ UpdateServiceStub.prototype = { QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver]), }; -this.NSGetFactory = XPCOMUtils.generateNSGetFactory([UpdateServiceStub]); +var EXPORTED_SYMBOLS = ["UpdateServiceStub"]; /** * This function should be called when there are files in the old update diff --git a/toolkit/mozapps/update/components.conf b/toolkit/mozapps/update/components.conf new file mode 100644 index 000000000000..55edfc04dd7f --- /dev/null +++ b/toolkit/mozapps/update/components.conf @@ -0,0 +1,40 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Classes = [ + { + 'cid': '{B3C290A6-3943-4B89-8BBE-C01EB7B3B311}', + 'contract_ids': ['@mozilla.org/updates/update-service;1'], + 'jsm': 'resource://gre/modules/UpdateService.jsm', + 'constructor': 'UpdateService', + }, + { + 'cid': '{093C2356-4843-4C65-8709-D7DBCBBE7DFB}', + 'contract_ids': ['@mozilla.org/updates/update-manager;1'], + 'jsm': 'resource://gre/modules/UpdateService.jsm', + 'constructor': 'UpdateManager', + }, + { + 'cid': '{898CDC9B-E43F-422F-9CC4-2F6291B415A3}', + 'contract_ids': ['@mozilla.org/updates/update-checker;1'], + 'jsm': 'resource://gre/modules/UpdateService.jsm', + 'constructor': 'Checker', + }, + { + 'cid': '{27ABA825-35B5-4018-9FDD-F99250A0E722}', + 'contract_ids': ['@mozilla.org/updates/update-prompt;1'], + 'jsm': 'resource://gre/modules/UpdateService.jsm', + 'constructor': 'UpdatePrompt', + }, + + { + 'cid': '{e43b0010-04ba-4da6-b523-1f92580bc150}', + 'contract_ids': ['@mozilla.org/updates/update-service-stub;1'], + 'jsm': 'resource://gre/modules/UpdateServiceStub.jsm', + 'constructor': 'UpdateServiceStub', + 'categories': {'profile-after-change': 'nsUpdateServiceStub'}, + }, +] diff --git a/toolkit/mozapps/update/moz.build b/toolkit/mozapps/update/moz.build index c286c34216ea..ddfda4571c31 100644 --- a/toolkit/mozapps/update/moz.build +++ b/toolkit/mozapps/update/moz.build @@ -17,16 +17,20 @@ XPIDL_SOURCES += [ TEST_DIRS += ['tests'] EXTRA_COMPONENTS += [ - 'nsUpdateService.js', 'nsUpdateService.manifest', - 'nsUpdateServiceStub.js', ] EXTRA_JS_MODULES += [ 'UpdateListener.jsm', + 'UpdateService.jsm', + 'UpdateServiceStub.jsm', 'UpdateTelemetry.jsm', ] +XPCOM_MANIFESTS += [ + 'components.conf', +] + JAR_MANIFESTS += ['jar.mn'] with Files('**'): diff --git a/toolkit/mozapps/update/nsUpdateService.manifest b/toolkit/mozapps/update/nsUpdateService.manifest index 59dbf0b5a8b8..a8d2534b1e81 100644 --- a/toolkit/mozapps/update/nsUpdateService.manifest +++ b/toolkit/mozapps/update/nsUpdateService.manifest @@ -1,12 +1 @@ -component {B3C290A6-3943-4B89-8BBE-C01EB7B3B311} nsUpdateService.js -contract @mozilla.org/updates/update-service;1 {B3C290A6-3943-4B89-8BBE-C01EB7B3B311} category update-timer nsUpdateService @mozilla.org/updates/update-service;1,getService,background-update-timer,app.update.interval,43200,86400 -component {093C2356-4843-4C65-8709-D7DBCBBE7DFB} nsUpdateService.js -contract @mozilla.org/updates/update-manager;1 {093C2356-4843-4C65-8709-D7DBCBBE7DFB} -component {898CDC9B-E43F-422F-9CC4-2F6291B415A3} nsUpdateService.js -contract @mozilla.org/updates/update-checker;1 {898CDC9B-E43F-422F-9CC4-2F6291B415A3} -component {27ABA825-35B5-4018-9FDD-F99250A0E722} nsUpdateService.js -contract @mozilla.org/updates/update-prompt;1 {27ABA825-35B5-4018-9FDD-F99250A0E722} -component {e43b0010-04ba-4da6-b523-1f92580bc150} nsUpdateServiceStub.js -contract @mozilla.org/updates/update-service-stub;1 {e43b0010-04ba-4da6-b523-1f92580bc150} -category profile-after-change nsUpdateServiceStub @mozilla.org/updates/update-service-stub;1