diff --git a/content/base/src/contentAreaDropListener.js b/content/base/src/contentAreaDropListener.js index 0807138a60e..504a9dc51e8 100644 --- a/content/base/src/contentAreaDropListener.js +++ b/content/base/src/contentAreaDropListener.js @@ -143,6 +143,4 @@ ContentAreaDropListener.prototype = }; var components = [ContentAreaDropListener]; -function NSGetModule(compMgr, fileSpec) { - return XPCOMUtils.generateModule(components); -} +const NSGetFactory = XPCOMUtils.generateNSGetFactory(components); diff --git a/netwerk/test/unit/test_bug336501.js b/netwerk/test/unit/test_bug336501.js index 6cfdeb73ab1..c27aff5e9be 100644 --- a/netwerk/test/unit/test_bug336501.js +++ b/netwerk/test/unit/test_bug336501.js @@ -2,9 +2,7 @@ var Cc = Components.classes; var Ci = Components.interfaces; function run_test() { - var f = - Cc["@mozilla.org/file/directory_service;1"]. - getService(Ci.nsIProperties).get("ComRegF", Ci.nsIFile); + var f = do_get_file('test_bug336501.js'); var fis = Cc["@mozilla.org/network/file-input-stream;1"]. diff --git a/toolkit/components/places/tests/unit/nsDummyObserver.manifest b/toolkit/components/places/tests/unit/nsDummyObserver.manifest index b194333fa99..d7e15f6437a 100644 --- a/toolkit/components/places/tests/unit/nsDummyObserver.manifest +++ b/toolkit/components/places/tests/unit/nsDummyObserver.manifest @@ -1,4 +1,4 @@ component 62e221d3-68c3-4e1a-8943-a27beb5005fe nsDummyObserver.js contract @mozilla.org/places/test/dummy-observer;1 62e221d3-68c3-4e1a-8943-a27beb5005fe -category bookmark-observers nsDummyObserver -category history-observers nsDummyObserver +category bookmark-observers nsDummyObserver @mozilla.org/places/test/dummy-observer;1 +category history-observers nsDummyObserver @mozilla.org/places/test/dummy-observer;1 diff --git a/toolkit/content/tests/chrome/RegisterUnregisterChrome.js b/toolkit/content/tests/chrome/RegisterUnregisterChrome.js index 3936d4c514b..eb09077d06c 100644 --- a/toolkit/content/tests/chrome/RegisterUnregisterChrome.js +++ b/toolkit/content/tests/chrome/RegisterUnregisterChrome.js @@ -7,74 +7,10 @@ const Cc = Components.classes; const Ci = Components.interfaces; const Cr = Components.results; -let gDirSvc = Cc["@mozilla.org/file/directory_service;1"]. - getService(Ci.nsIDirectoryService); let gChromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"]. getService(Ci.nsIXULChromeRegistry); let gPrefs = Cc["@mozilla.org/preferences-service;1"]. getService(Ci.nsIPrefBranch); -var gProvider, gHasChrome, gHasSkins; - -function ArrayEnumerator(array) -{ - this.array = array; -} - -ArrayEnumerator.prototype = { - pos: 0, - - hasMoreElements: function() { - return this.pos < this.array.length; - }, - - getNext: function() { - if (this.pos < this.array.length) - return this.array[this.pos++]; - throw Cr.NS_ERROR_FAILURE; - }, - - QueryInterface: function(iid) { - if (iid.equals(Ci.nsISimpleEnumerator) - || iid.equals(Ci.nsISupports)) - return this; - - throw Cr.NS_ERROR_NO_INTERFACE; - } -}; - -function ChromeProvider(manifests) -{ - this._manifests = manifests; -} - -ChromeProvider.prototype = { - getFile: function(prop, persistent) { - throw Cr.NS_ERROR_FAILURE; - }, - - getFiles: function(prop) { - if (prop == NS_CHROME_MANIFESTS_FILE_LIST) { - return new ArrayEnumerator(this._manifests); - } - throw Cr.NS_ERROR_FAILURE; - }, - - QueryInterface: function(iid) { - if (iid.equals(Ci.nsIDirectoryServiceProvider) - || iid.equals(Ci.nsIDirectoryServiceProvider2) - || iid.equals(Ci.nsISupports)) - return this; - - throw Cr.NS_ERROR_NO_INTERFACE; - } -}; - -function registerManifests(manifests) -{ - let provider = new ChromeProvider(manifests); - gDirSvc.registerProvider(provider); - return provider; -} function refreshChrome() { @@ -92,26 +28,18 @@ function registerCustomChrome(chromedir, hasChrome, hasSkins) // Disable XUL cache temporarily gPrefs.setBoolPref(XUL_CACHE_PREF, true); - // Register our manifest - let manifests = []; - let currentManifests = gDirSvc.QueryInterface(Ci.nsIProperties) - .get(NS_CHROME_MANIFESTS_FILE_LIST, - Ci.nsISimpleEnumerator); - while (currentManifests.hasMoreElements()) - manifests.push(currentManifests.getNext()); let uri = Cc["@mozilla.org/network/io-service;1"]. getService(Ci.nsIIOService).newURI(chromedir, null, null); uri = gChromeReg.convertChromeURL(uri); let newChromePath = uri.QueryInterface(Ci.nsIFileURL).file; - manifests.push(newChromePath); - gProvider = registerManifests(manifests); + Components.manager.QueryInterface(Ci.nsIComponentRegistrar). + autoRegister(newChromePath); refreshChrome(); return uri; } function cleanupCustomChrome() { - gDirSvc.unregisterProvider(gProvider); refreshChrome(); gPrefs.clearUserPref(XUL_CACHE_PREF); } diff --git a/toolkit/mozapps/downloads/tests/unit/test_privatebrowsing_downloadLastDir.js b/toolkit/mozapps/downloads/tests/unit/test_privatebrowsing_downloadLastDir.js index 8285808f058..980c5d17bcd 100644 --- a/toolkit/mozapps/downloads/tests/unit/test_privatebrowsing_downloadLastDir.js +++ b/toolkit/mozapps/downloads/tests/unit/test_privatebrowsing_downloadLastDir.js @@ -43,7 +43,7 @@ const Cr = Components.results; const Cm = Components.manager.QueryInterface(Ci.nsIComponentRegistrar); const FILE_PICKER_CID = "@mozilla.org/filepicker;1"; -const FILE_PICKER_ID = Components.ID(Cc[FILE_PICKER_CID].number); +const FILE_PICKER_ID = Components.ID("fa71ce55-6524-4744-ba75-71a4c126cfa3"); const FILE_PICKER_DESCRIPTION = "File Picker Test Service"; // Code borrowed from toolkit/components/downloadmgr/test/unit/head_download_manager.js @@ -259,5 +259,4 @@ function run_test() dirSvc.QueryInterface(Ci.nsIDirectoryService).unregisterProvider(provider); obs.removeObserver(observer, "TEST_FILEPICKER_GETFILE", false); obs.removeObserver(observer, "TEST_FILEPICKER_SETDISPLAYDIRECTORY", false); - Cm.unregisterFactory(FILE_PICKER_ID, factory); }