diff --git a/binary/chrome.manifest b/binary/chrome.manifest index 2af7f6ad..dc53910f 100644 --- a/binary/chrome.manifest +++ b/binary/chrome.manifest @@ -1,5 +1,8 @@ interfaces components/dactylIUtils.xpt +binary-component components/6.0-Linux_x86_64-gcc3/dactyl.so abi=Linux_x86_64-gcc3 appversion>=6.0 appversion<6.* +binary-component components/7.0-Linux_x86_64-gcc3/dactyl.so abi=Linux_x86_64-gcc3 appversion>=7.0 appversion<7.* +binary-component components/8.0-Linux_x86_64-gcc3/dactyl.so abi=Linux_x86_64-gcc3 platformversion>=8.0 platformversion<8.* binary-component components/9.0-Linux_x86_64-gcc3/dactyl.so abi=Linux_x86_64-gcc3 platformversion>=9.0 platformversion<9.* # vim:se tw=0 ft=cfg: diff --git a/binary/config.mk b/binary/config.mk index 5311c24a..aa423108 100644 --- a/binary/config.mk +++ b/binary/config.mk @@ -1,6 +1,11 @@ -PLATFORM = 9.0-Linux_x86_64-gcc3 -DEFINES = -DGECKO_MAJOR=9 -DGECKO_MINOR=0 +GECKO_MAJOR ?= 9 +GECKO_MINOR ?= 0 +ABI_OS ?= Linux +ABI_ARCH ?= x86_64 +ABI_COMPILER ?= gcc3 +ABI ?= $(GECKO_MAJOR).$(GECKO_MINOR)-$(ABI_OS)_$(ABI_ARCH)-$(ABI_COMPILER) +DEFINES = -DGECKO_MAJOR=$(GECKO_MAJOR) -DGECKO_MINOR=$(GECKO_MINOR) SED ?= sed -r diff --git a/binary/src/Makefile b/binary/src/Makefile index 774135c2..e40136a7 100644 --- a/binary/src/Makefile +++ b/binary/src/Makefile @@ -1,8 +1,8 @@ ROOT = .. XPTDIR = $(ROOT)/components/ -SODIR = $(ROOT)/components/$(PLATFORM)/ -OBJDIR = $(PLATFORM)/ +SODIR = $(ROOT)/components/$(ABI)/ +OBJDIR = $(ABI)/ MODULE = $(SODIR)dactyl @@ -21,7 +21,7 @@ GECKO_CONFIG_INCLUDE = -include mozilla-config.h GECKO_DEFINES = -DMOZILLA_STRICT_API -GECKO_INCLUDES = -I$(PLATFORM)/ \ +GECKO_INCLUDES = -I$(ABI)/ \ -I$(GECKO_SDK_PATH) \ -I$(GECKO_SDK_PATH)/idl \ -I$(GECKO_SDK_PATH)/include @@ -40,13 +40,13 @@ sinclude $(ROOT)/config.local.mk XPTS = $(XPIDLSRCS:%.idl=$(XPTDIR)%.xpt) OBJS = $(CPPSRCS:%.cpp=$(OBJDIR)%.o) -HEADERS = $(XPIDLSRCS:%.idl=$(PLATFORM)/%.h) +HEADERS = $(XPIDLSRCS:%.idl=$(ABI)/%.h) all: build $(OBJS): $(HEADERS) -$(PLATFORM)/%.h: %.idl +$(ABI)/%.h: %.idl $(IDL_H) $@ $(GECKO_INCLUDES) $< $(XPTDIR)%.xpt: %.idl @@ -71,9 +71,15 @@ dirs: $(XPTDIR) $(SODIR) $(OBJDIR) $(XPTDIR) $(SODIR) $(OBJDIR): mkdir -p $@ -build: dirs $(XPTS) $(MODULE).so +module: dirs $(MODULE).so + +xpts: $(XPTS) + +build: dirs module xpts clean: rm $(MODULE).so +.PHONY: module xpts build clean all depend + sinclude .depend diff --git a/binary/src/mozJSLoaderUtils.cpp b/binary/src/mozJSLoaderUtils.cpp index 8a4c517c..94b371be 100644 --- a/binary/src/mozJSLoaderUtils.cpp +++ b/binary/src/mozJSLoaderUtils.cpp @@ -35,8 +35,6 @@ * * ***** END LICENSE BLOCK ***** */ -#define JS_XDRScript JS_XDRScriptObject - #include "mozJSLoaderUtils.h" #include "nsAutoPtr.h" @@ -55,7 +53,7 @@ using namespace mozilla::scache; static nsresult ReadScriptFromStream(JSContext *cx, nsIObjectInputStream *stream, - JSScript **script) + JSScriptType **script) { *script = nsnull; @@ -110,7 +108,7 @@ ReadScriptFromStream(JSContext *cx, nsIObjectInputStream *stream, } static nsresult -WriteScriptToStream(JSContext *cx, JSScript *script, +WriteScriptToStream(JSContext *cx, JSScriptType *script, nsIObjectOutputStream *stream) { JSXDRState *xdr = JS_XDRNewMem(cx, JSXDR_ENCODE); @@ -152,7 +150,7 @@ WriteScriptToStream(JSContext *cx, JSScript *script, } nsresult -ReadCachedScript(nsIStartupCache* cache, nsACString &uri, JSContext *cx, JSScript **script) +ReadCachedScript(nsIStartupCache* cache, nsACString &uri, JSContext *cx, JSScriptType **script) { nsresult rv; @@ -173,7 +171,7 @@ ReadCachedScript(nsIStartupCache* cache, nsACString &uri, JSContext *cx, JSScrip } nsresult -WriteCachedScript(nsIStartupCache* cache, nsACString &uri, JSContext *cx, JSScript *script) +WriteCachedScript(nsIStartupCache* cache, nsACString &uri, JSContext *cx, JSScriptType *script) { nsresult rv; diff --git a/binary/src/mozJSLoaderUtils.h b/binary/src/mozJSLoaderUtils.h index b56e7296..65ce94ae 100644 --- a/binary/src/mozJSLoaderUtils.h +++ b/binary/src/mozJSLoaderUtils.h @@ -40,6 +40,10 @@ #ifndef mozJSLoaderUtils_h #define mozJSLoaderUtils_h + +#if defined(GECKO_MAJOR) && GECKO_MAJOR < 9 +#endif + /* * This is evil. Very evil. #define nsString_h___ @@ -50,6 +54,22 @@ #include "nsStringAPI.h" #include "jsapi.h" +#if defined(GECKO_MAJOR) && GECKO_MAJOR < 9 +#include "jsapi.h" +# define JS_XDRScript JS_XDRScriptObject + typedef JSObject JSScriptType; + +# define NewObjectInputStreamFromBuffer NS_NewObjectInputStreamFromBuffer +# define NewBufferFromStorageStream NS_NewBufferFromStorageStream +# if GECKO_MAJOR > 6 +# define NewObjectOutputWrappedStorageStream NS_NewObjectOutputWrappedStorageStream +# else +# define NewObjectOutputWrappedStorageStream(a, b, c) NS_NewObjectOutputWrappedStorageStream((a), (b)) +# endif +#else + typedef JSScript JSScriptType; +#endif + class nsIURI; namespace mozilla { @@ -60,9 +80,9 @@ class StartupCache; nsresult ReadCachedScript(nsIStartupCache* cache, nsACString &uri, - JSContext *cx, JSScript **scriptObj); + JSContext *cx, JSScriptType **scriptObj); nsresult WriteCachedScript(nsIStartupCache* cache, nsACString &uri, - JSContext *cx, JSScript *scriptObj); + JSContext *cx, JSScriptType *scriptObj); #endif /* mozJSLoaderUtils_h */ diff --git a/binary/src/subscriptLoader.cpp b/binary/src/subscriptLoader.cpp index ac62177a..5b3aa483 100644 --- a/binary/src/subscriptLoader.cpp +++ b/binary/src/subscriptLoader.cpp @@ -271,7 +271,7 @@ static nsresult ReadScript(nsIURI *uri, JSContext *cx, JSObject *target_obj, jschar *charset, const char *uriStr, nsIIOService *serv, nsIPrincipal *principal, - JSScript **scriptObjp) + JSScriptType **scriptObjp) { nsCOMPtr chan; nsCOMPtr instream; @@ -518,12 +518,17 @@ dactylUtils::LoadSubScript (const PRUnichar * aURL } bool writeScript = false; - JSScript *scriptObj = nsnull; + JSScriptType *scriptObj = nsnull; JSVersion version = cx->findVersion(); nsCAutoString cachePath; cachePath.Append("jssubloader/"); cachePath.Append(version); + if (charset) { + cachePath.Append("/"); + cachePath.Append(NS_ConvertUTF16toUTF8( + nsDependentString(reinterpret_cast(charset)))); + } if (false) // This is evil. Very evil. Unfortunately, the PathifyURI symbol is diff --git a/common/content/dactyl.js b/common/content/dactyl.js index 4fbb5507..e7b8a7e2 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -503,33 +503,33 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { if (isinstance(context, ["Sandbox"])) return Cu.evalInSandbox(str, context, "1.8", fileName, lineNumber); - else { - if (!context) - context = userContext || ctxt; - if (services.has("dactyl") && services.dactyl.evalInContext) - return services.dactyl.evalInContext(str, context, fileName, lineNumber); - else + if (!context) + context = userContext || ctxt; + + if (services.has("dactyl") && services.dactyl.evalInContext) + return services.dactyl.evalInContext(str, context, fileName, lineNumber); + + try { + context[EVAL_ERROR] = null; + context[EVAL_STRING] = str; + context[EVAL_RESULT] = null; + + this.loadScript("resource://dactyl-content/eval.js", context); + if (context[EVAL_ERROR]) { try { - context[EVAL_ERROR] = null; - context[EVAL_STRING] = str; - context[EVAL_RESULT] = null; - this.loadScript("resource://dactyl-content/eval.js", context); - if (context[EVAL_ERROR]) { - try { - context[EVAL_ERROR].fileName = info.file; - context[EVAL_ERROR].lineNumber += info.line; - } - catch (e) {} - throw context[EVAL_ERROR]; - } - return context[EVAL_RESULT]; - } - finally { - delete context[EVAL_ERROR]; - delete context[EVAL_RESULT]; - delete context[EVAL_STRING]; + context[EVAL_ERROR].fileName = info.file; + context[EVAL_ERROR].lineNumber += info.line; } + catch (e) {} + throw context[EVAL_ERROR]; + } + return context[EVAL_RESULT]; + } + finally { + delete context[EVAL_ERROR]; + delete context[EVAL_RESULT]; + delete context[EVAL_STRING]; } },