зеркало из https://github.com/mozilla/gecko-dev.git
Fix a bunch of test failures caused by typos or other issues from bug 568691.
This commit is contained in:
Родитель
b2733352bf
Коммит
e15eaaca54
|
@ -143,6 +143,4 @@ ContentAreaDropListener.prototype =
|
|||
};
|
||||
|
||||
var components = [ContentAreaDropListener];
|
||||
function NSGetModule(compMgr, fileSpec) {
|
||||
return XPCOMUtils.generateModule(components);
|
||||
}
|
||||
const NSGetFactory = XPCOMUtils.generateNSGetFactory(components);
|
||||
|
|
|
@ -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"].
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче