diff --git a/xpcom/build/Makefile.in b/xpcom/build/Makefile.in
--- a/xpcom/build/Makefile.in
+++ b/xpcom/build/Makefile.in
@@ -161,17 +161,18 @@ OS_LIBS += $(LIBICONV)
GARBAGE += $(XPCOM_GLUE_SRC_LCSRCS) $(XPCOM_GLUE_SRC_LCPPSRCS) $(XPCOM_GLUENS_SRC_LCPPSRCS) $(wildcard *.$(OBJ_SUFFIX))
include $(topsrcdir)/config/rules.mk
DEFINES += \
-D_IMPL_NS_COM \
-D_IMPL_NS_STRINGAPI \
-DEXPORT_XPT_API \
- -DEXPORT_XPTC_API
+ -DEXPORT_XPTC_API \
+ -DMOZ_WIDGET_TOOLKIT=\"$(MOZ_WIDGET_TOOLKIT)\"
EXTRA_DSO_LDOPTS += $(NSPR_LIBS)
ifdef GC_LEAK_DETECTOR
DEFINES += -DGC_LEAK_DETECTOR
endif
ifdef TARGET_XPCOM_ABI
diff --git a/xpcom/glue/Makefile.in b/xpcom/glue/Makefile.in
--- a/xpcom/glue/Makefile.in
+++ b/xpcom/glue/Makefile.in
@@ -157,11 +157,13 @@ include $(topsrcdir)/config/rules.mk
ifdef _MSC_VER
# Don't include directives about which CRT to use
OS_COMPILE_CXXFLAGS += -Zl
OS_COMPILE_CFLAGS += -Zl
DEFINES += -D_USE_ANSI_CPP
endif
+DEFINES += -DMOZ_WIDGET_TOOLKIT=\"$(MOZ_WIDGET_TOOLKIT)\"
+
ifdef TARGET_XPCOM_ABI
DEFINES += -DTARGET_XPCOM_ABI=\"$(TARGET_XPCOM_ABI)\"
endif
diff --git a/xpcom/glue/nsGREGlue.cpp b/xpcom/glue/nsGREGlue.cpp
--- a/xpcom/glue/nsGREGlue.cpp
+++ b/xpcom/glue/nsGREGlue.cpp
@@ -157,36 +157,46 @@ GRE_GetPathFromRegKey(HKEY aRegKey,
nsresult
GRE_GetGREPathWithProperties(const GREVersionRange *versions,
PRUint32 versionsLength,
const GREProperty *properties,
PRUint32 propertiesLength,
char *aBuffer, PRUint32 aBufLen)
{
+ // append the widget information to be able to have multiple xulrunners
+ // based on different widget toolkits installed
+ static const GREProperty kWidgetProperty =
+ { "widget", MOZ_WIDGET_TOOLKIT };
+
#ifdef TARGET_XPCOM_ABI
- // append the ABI to the properties to match only binary
+ // append the ABI to the properties to match only binary
// compatible GREs
- static const GREProperty kExtraProperty =
- { "abi", TARGET_XPCOM_ABI };
+ static const GREProperty kAbiProperty =
+ { "abi", TARGET_XPCOM_ABI };
+ GREProperty *allProperties = new GREProperty[propertiesLength + 2];
+#else
GREProperty *allProperties = new GREProperty[propertiesLength + 1];
+#endif
if (!allProperties)
return NS_ERROR_OUT_OF_MEMORY;
for (PRUint32 i=0; i<propertiesLength; i++) {
allProperties[i].property = properties[i].property;
allProperties[i].value = properties[i].value;
}
- allProperties[propertiesLength].property = kExtraProperty.property;
- allProperties[propertiesLength].value = kExtraProperty.value;
+ allProperties[propertiesLength].property = kWidgetProperty.property;
+ allProperties[propertiesLength].value = kWidgetProperty.value;
+#ifdef TARGET_XPCOM_ABI
+ allProperties[propertiesLength+1].property = kAbiProperty.property;
+ allProperties[propertiesLength+1].value = kAbiProperty.value;
+ PRUint32 allPropertiesLength = propertiesLength + 2;
+#else
PRUint32 allPropertiesLength = propertiesLength + 1;
-#else
- const GREProperty *allProperties = properties;
- PRUint32 allPropertiesLength = propertiesLength;
#endif
// if GRE_HOME is in the environment, use that GRE
const char* env = getenv("GRE_HOME");
if (env && *env) {
char p[MAXPATHLEN];
snprintf(p, sizeof(p), "%s" XPCOM_FILE_PATH_SEPARATOR XPCOM_DLL, env);
p[sizeof(p) - 1] = '\0';
diff --git a/xpcom/glue/standalone/Makefile.in b/xpcom/glue/standalone/Makefile.in
--- a/xpcom/glue/standalone/Makefile.in
+++ b/xpcom/glue/standalone/Makefile.in
@@ -120,14 +120,15 @@ OS_COMPILE_CFLAGS += -Zl
DEFINES += -D_USE_ANSI_CPP
endif
export:: $(XPCOM_GLUE_SRC_CSRCS) $(XPCOM_GLUE_SRC_CPPSRCS) $(topsrcdir)/xpcom/glue/nsStringAPI.cpp
$(INSTALL) $^ .
GARBAGE += nsStringAPI.cpp
-DEFINES += -DXPCOM_GLUE
+DEFINES += -DXPCOM_GLUE \
+ -DMOZ_WIDGET_TOOLKIT=\"$(MOZ_WIDGET_TOOLKIT)\"
ifdef TARGET_XPCOM_ABI
DEFINES += -DTARGET_XPCOM_ABI=\"$(TARGET_XPCOM_ABI)\"
endif
diff --git a/xulrunner/app/Makefile.in b/xulrunner/app/Makefile.in
--- a/xulrunner/app/Makefile.in
+++ b/xulrunner/app/Makefile.in
@@ -59,17 +59,18 @@ PROGRAM = xulrunner$(BIN_SUFFIX)
else
ifeq ($(OS_ARCH), BeOS)
PROGRAM = xulrunner$(BIN_SUFFIX)
else
PROGRAM = xulrunner-bin$(BIN_SUFFIX)
endif
endif
-DEFINES += -DXULRUNNER_PROGNAME=\"xulrunner\"
+DEFINES += -DXULRUNNER_PROGNAME=\"xulrunner\" \
+ -DMOZ_WIDGET_TOOLKIT=\"$(MOZ_WIDGET_TOOLKIT)\"
ifdef MOZ_JAVAXPCOM
DEFINES += -DMOZ_JAVAXPCOM
endif
ifdef TARGET_XPCOM_ABI
DEFINES += -DTARGET_XPCOM_ABI=\"$(TARGET_XPCOM_ABI)\"
endif
diff --git a/xulrunner/app/nsXULRunnerApp.cpp b/xulrunner/app/nsXULRunnerApp.cpp
--- a/xulrunner/app/nsXULRunnerApp.cpp
+++ b/xulrunner/app/nsXULRunnerApp.cpp
@@ -257,17 +257,18 @@ InstallXULApp(nsIFile* aXULRunnerDir,
if (NS_FAILED(rv))
return 3;
return 0;
}
static const GREProperty kGREProperties[] = {
- { "xulrunner", "true" }
+ { "xulrunner", "true" },
+ { "widget", MOZ_WIDGET_TOOLKIT }
#ifdef TARGET_XPCOM_ABI
, { "abi", TARGET_XPCOM_ABI }
#endif
#ifdef MOZ_JAVAXPCOM
, { "javaxpcom", "1" }
#endif
};
diff --git a/xulrunner/installer/Makefile.in b/xulrunner/installer/Makefile.in
--- a/xulrunner/installer/Makefile.in
+++ b/xulrunner/installer/Makefile.in
@@ -63,18 +63,18 @@ endif
include $(topsrcdir)/config/rules.mk
INSTALL_SDK = 1
include $(topsrcdir)/toolkit/mozapps/installer/packager.mk
$(MOZILLA_VERSION).system.conf: $(topsrcdir)/config/milestone.txt Makefile
- printf "[%s]\nGRE_PATH=%s\nxulrunner=true\nabi=%s" \
- $(MOZILLA_VERSION) $(installdir) $(TARGET_XPCOM_ABI)> $@
+ printf "[%s]\nGRE_PATH=%s\nxulrunner=true\nwidget=%s\nabi=%s" \
+ $(MOZILLA_VERSION) $(installdir) $(MOZ_WIDGET_TOOLKIT) $(TARGET_XPCOM_ABI)> $@
ifndef SKIP_GRE_REGISTRATION
# to register xulrunner per-user, override this with $HOME/.gre.d
regdir = /etc/gre.d
install:: $(MOZILLA_VERSION).system.conf
$(NSINSTALL) -D $(DESTDIR)$(regdir)
$(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)$(regdir)