Modified:
trunk/gom/ChangeLog
trunk/gom/include/gommacros.h
trunk/gom/include/xpgom/Makefile.inc
trunk/gom/src/xpgom/xgGomModule.cc
trunk/gom/src/xpgom/xpgom.js
Log:
2008-08-05 jacob berkman <ja...@ilovegom.org>
* src/xpgom/xgGomModule.cc (nsGomModuleConstructor): use a proper
module constructor to initialize Gtk
* include/gommacros.h (GOM_ASTRING_TO_GSTRING): remove bogus
optimization that referenced free memory
Modified: trunk/gom/ChangeLog
==============================================================================
--- trunk/gom/ChangeLog (original)
+++ trunk/gom/ChangeLog Tue Aug 5 10:00:30 2008
@@ -1,3 +1,11 @@
+2008-08-05 jacob berkman <ja...@ilovegom.org>
+
+ * src/xpgom/xgGomModule.cc (nsGomModuleConstructor): use a proper
+ module constructor to initialize Gtk
+
+ * include/gommacros.h (GOM_ASTRING_TO_GSTRING): remove bogus
+ optimization that referenced free memory
+
2008-08-04 jacob berkman <ja...@ilovegom.org>
* src/xpgom/xgGomModule.cc: xgDOMImplementation has an init
Modified: trunk/gom/include/gommacros.h
==============================================================================
--- trunk/gom/include/gommacros.h (original)
+++ trunk/gom/include/gommacros.h Tue Aug 5 10:00:30 2008
@@ -160,14 +160,11 @@
#define GOM_UNSET_WEAK(p) GOM_SET_WEAK(p, NULL)
#define GOM_ASTRING_TO_GSTRING(_aCString, _aString, _errval) \
- const char *_aCString; \
- { \
- nsCAutoString _aCString##String; \
- if (NS_FAILED (NS_UTF16ToCString (_aString,
NS_CSTRING_ENCODING_UTF8, _aCString##String))) { \
- return _errval; \
- } \
- _aCString = _aCString##String.get(); \
- }
+ nsCAutoString _aCString##String; \
+ if (NS_FAILED (NS_UTF16ToCString (_aString, NS_CSTRING_ENCODING_UTF8,
_aCString##String))) { \
+ return _errval; \
+ } \
+ const char *_aCString = _aCString##String.get();
#define GOM_GERROR_TO_NSRESULT(_err) \
(_err->domain == GOM_DOM_EXCEPTION_ERROR) ? NS_ERROR_GENERATE_FAILURE
(NS_ERROR_MODULE_DOM, _err->code) : NS_ERROR_UNEXPECTED;
Modified: trunk/gom/include/xpgom/Makefile.inc
==============================================================================
--- trunk/gom/include/xpgom/Makefile.inc (original)
+++ trunk/gom/include/xpgom/Makefile.inc Tue Aug 5 10:00:30 2008
@@ -2,7 +2,7 @@
# xpgomincludedir := $(includedir)/gom-0/xpgom
# xpgominclude_HEADERS :=
-noinst_HEADERS += xgDOMImplementation.hh
-noinst_HEADERS += xgDocument.hh
-noinst_HEADERS += xgNode.hh
-noinst_HEADERS += xgObject.hh
+noinst_HEADERS += include/xpgom/xgDOMImplementation.hh
+noinst_HEADERS += include/xpgom/xgDocument.hh
+noinst_HEADERS += include/xpgom/xgNode.hh
+noinst_HEADERS += include/xpgom/xgObject.hh
Modified: trunk/gom/src/xpgom/xgGomModule.cc
==============================================================================
--- trunk/gom/src/xpgom/xgGomModule.cc (original)
+++ trunk/gom/src/xpgom/xgGomModule.cc Tue Aug 5 10:00:30 2008
@@ -34,6 +34,7 @@
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(xgDOMImplementation, Init);
+#if 0
static NS_METHOD
xgGomRegistrationProc (nsIComponentManager *aCompMgr,
nsIFile *aPath,
@@ -48,7 +49,6 @@
return NS_OK;
}
-#if 0
static NS_METHOD
xgGomUnregistrationProc (nsIComponentManager *aCompMgr,
nsIFile *aPath,
@@ -66,13 +66,21 @@
"DOM Implementation",
XG_DOMIMPLEMENTATION_CID, XG_DOMIMPLEMENTATION_CONTRACTID,
xgDOMImplementationConstructor,
- xgGomRegistrationProc, NULL, NULL,
+ /* xgGomRegistrationProc */ NULL, NULL, NULL,
NS_CI_INTERFACE_GETTER_NAME (xgDOMImplementation),
NULL,
&NS_CLASSINFO_NAME(xgDOMImplementation)
}
};
-NS_IMPL_NSGETMODULE(nsGomModule, components)
-
+static nsresult
+nsGomModuleConstructor (nsIModule *self)
+{
+ if (!gtk_init_check (NULL, NULL)) {
+ g_warning ("Could not initialize Gtk; Gom module unavailable.");
+ return NS_ERROR_NOT_AVAILABLE;
+ }
+ return NS_OK;
+}
+NS_IMPL_NSGETMODULE_WITH_CTOR(nsGomModule, components,
nsGomModuleConstructor)
Modified: trunk/gom/src/xpgom/xpgom.js
==============================================================================
--- trunk/gom/src/xpgom/xpgom.js (original)
+++ trunk/gom/src/xpgom/xpgom.js Tue Aug 5 10:00:30 2008
@@ -1,7 +1,10 @@
-(function () {
+(function (args) {
print (dom =
Components.classes["@ilovegom.org/dom-implementation;1"].createInstance(Components.interfaces.nsIDOMDOMImplementation));
print (dom.hasFeature ("xml", "1.0"));
print (doc = dom.createDocument (null, "gom", null));
print (doc.nodeType);
print (doc.nodeName);
-})();
+ for (var i = 0; i < args.length; i++) {
+ print ('args[' + i + '] = ' + args[i]);
+ }
+})(arguments);