Merge extensions/python/xpcom changes from DOM_AGNOSTIC2_BRANCH into the

trunk.


git-svn-id: svn://10.0.0.236/trunk@187878 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mhammond%skippinet.com.au
2006-01-20 05:50:28 +00:00
parent 28dfbf4814
commit d394dc834d
56 changed files with 1710 additions and 958 deletions

View File

@@ -36,32 +36,33 @@
# ***** END LICENSE BLOCK *****
# regxpcom.py - basically the standard regxpcom.cpp ported to Python.
# In general, you should use regxpcom.exe instead of this.
from xpcom import components, _xpcom
from xpcom.client import Component
import sys
import os
registrar = Component(_xpcom.GetComponentRegistrar(),
components.interfaces.nsIComponentRegistrar)
def ProcessArgs(args):
unregister = 0
for arg in args:
spec = components.classes['@mozilla.org/file/local;1'].createInstance()
spec = spec.QueryInterface(components.interfaces.nsILocalFile)
spec.initWithPath(os.path.abspath(arg))
if arg == "-u":
unregister = 1
registrar.autoUnregister(spec)
print "Successfully unregistered", spec.path
else:
spec = components.classes['@mozilla.org/file/local;1'].createInstance()
spec = spec.QueryInterface(components.interfaces.nsILocalFile)
spec.initWithPath(os.path.abspath(arg))
if unregister:
components.manager.autoUnregisterComponent( components.manager.NS_Startup, spec)
print "Successfully unregistered", spec.path
else:
components.manager.autoRegisterComponent( components.manager.NS_Startup, spec)
print "Successfully registered", spec.path
unregister = 0
registrar.autoRegister(spec)
print "Successfully registered", spec.path
import xpcom
if len(sys.argv) < 2:
components.manager.autoRegister( components.manager.NS_Startup, None)
registrar.autoRegister( None)
else:
ProcessArgs(sys.argv[1:])
_xpcom.NS_ShutdownXPCOM()
#_xpcom.NS_ShutdownXPCOM()