зеркало из https://github.com/mozilla/gecko-dev.git
Bug 674255 - Add nsIObserverService to special powers, r=ted
This commit is contained in:
Родитель
effd32fe9e
Коммит
879d1f5caf
|
@ -331,6 +331,24 @@ SpecialPowersAPI.prototype = {
|
|||
this.wrappedJSObject.SpecialPowers._applyPrefs();
|
||||
},
|
||||
|
||||
addObserver: function(obs, notification, weak) {
|
||||
var obsvc = Cc['@mozilla.org/observer-service;1']
|
||||
.getService(Ci.nsIObserverService);
|
||||
obsvc.addObserver(obs, notification, weak);
|
||||
},
|
||||
removeObserver: function(obs, notification) {
|
||||
var obsvc = Cc['@mozilla.org/observer-service;1']
|
||||
.getService(Ci.nsIObserverService);
|
||||
obsvc.removeObserver(obs, notification);
|
||||
},
|
||||
|
||||
can_QI: function(obj) {
|
||||
return obj.QueryInterface !== undefined;
|
||||
},
|
||||
do_QueryInterface: function(obj, iface) {
|
||||
return obj.QueryInterface(Ci[iface]);
|
||||
},
|
||||
|
||||
// Mimic the get*Pref API
|
||||
getBoolPref: function(aPrefName) {
|
||||
return (this._getPref(aPrefName, 'BOOL'));
|
||||
|
|
|
@ -81,6 +81,12 @@ function starttest(){
|
|||
ok(xhr, "createSystemXHR should not return null");
|
||||
is(xhr.readyState, XMLHttpRequest.UNSENT, "createSystemXHR should create an unsent XMLHttpRequest object");
|
||||
|
||||
// QueryInterface and getPrivilegedProps tests
|
||||
is(SpecialPowers.can_QI(SpecialPowers), false);
|
||||
ok(SpecialPowers.can_QI(window));
|
||||
ok(SpecialPowers.do_QueryInterface(window, "nsIDOMWindow"));
|
||||
is(SpecialPowers.getPrivilegedProps(SpecialPowers.do_QueryInterface(window, "nsIDOMWindow"), "document.nodeName"), "#document");
|
||||
|
||||
//try to run garbage collection
|
||||
SpecialPowers.gc();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче