Blame SOURCES/0001-pacrunner_mozjs-Also-support-mozjs-17.0.patch

2f2854
From cccc44ce0c8a251d987d0d83f05e93d31aa659d7 Mon Sep 17 00:00:00 2001
2f2854
From: Colin Walters <walters@verbum.org>
2f2854
Date: Mon, 3 Jun 2013 17:09:25 -0400
2f2854
Subject: [PATCH] pacrunner_mozjs: Also support mozjs-17.0
2f2854
2f2854
GNOME 3.10 is moving to hard require mozjs-17.0, so we should support
2f2854
it too.  See also:
2f2854
2f2854
https://bugs.freedesktop.org/show_bug.cgi?id=59830
2f2854
https://bugzilla.gnome.org/show_bug.cgi?id=690982
2f2854
---
2f2854
 libproxy/cmake/modules/pacrunner_mozjs.cmk |    8 +++++++-
2f2854
 libproxy/modules/pacrunner_mozjs.cpp       |   16 +++++++++++++---
2f2854
 2 files changed, 20 insertions(+), 4 deletions(-)
2f2854
2f2854
diff --git a/libproxy/cmake/modules/pacrunner_mozjs.cmk b/libproxy/cmake/modules/pacrunner_mozjs.cmk
2f2854
index 21072db..49856a6 100644
2f2854
--- a/libproxy/cmake/modules/pacrunner_mozjs.cmk
2f2854
+++ b/libproxy/cmake/modules/pacrunner_mozjs.cmk
2f2854
@@ -14,7 +14,13 @@ elseif(NOT APPLE)
2f2854
       include_directories(${MOZJS_INCLUDE_DIRS})
2f2854
       link_directories(${MOZJS_LIBRARY_DIRS})
2f2854
     else()
2f2854
-      set(MOZJS_FOUND 0)
2f2854
+      pkg_search_module(MOZJS mozjs-17.0)
2f2854
+      if(MOZJS_FOUND)
2f2854
+        include_directories(${MOZJS_INCLUDE_DIRS})
2f2854
+        link_directories(${MOZJS_LIBRARY_DIRS})
2f2854
+      else()
2f2854
+        set(MOZJS_FOUND 0)
2f2854
+      endif()
2f2854
     endif()
2f2854
   else()
2f2854
     set(MOZJS_FOUND 0)
2f2854
diff --git a/libproxy/modules/pacrunner_mozjs.cpp b/libproxy/modules/pacrunner_mozjs.cpp
2f2854
index abb4b9d..f5e678c 100644
2f2854
--- a/libproxy/modules/pacrunner_mozjs.cpp
2f2854
+++ b/libproxy/modules/pacrunner_mozjs.cpp
2f2854
@@ -19,6 +19,7 @@
2f2854
 
2f2854
 #include <cstring> // ?
2f2854
 #include <unistd.h> // gethostname
2f2854
+#include <stdint.h>
2f2854
 
2f2854
 #include "../extension_pacrunner.hpp"
2f2854
 using namespace libproxy;
2f2854
@@ -76,12 +77,12 @@ static JSBool dnsResolve_(JSContext *cx, jsval hostname, jsval *vp) {
2f2854
 		return true;
2f2854
 }
2f2854
 
2f2854
-static JSBool dnsResolve(JSContext *cx, uintN /*argc*/, jsval *vp) {
2f2854
+static JSBool dnsResolve(JSContext *cx, uint32_t /*argc*/, jsval *vp) {
2f2854
 	jsval *argv = JS_ARGV(cx, vp);
2f2854
 	return dnsResolve_(cx, argv[0], vp);
2f2854
 }
2f2854
 
2f2854
-static JSBool myIpAddress(JSContext *cx, uintN /*argc*/, jsval *vp) {
2f2854
+static JSBool myIpAddress(JSContext *cx, uint32_t /*argc*/, jsval *vp) {
2f2854
 	char *hostname = (char *) JS_malloc(cx, 1024);
2f2854
 	if (!gethostname(hostname, 1023)) {
2f2854
 		JSString *myhost = JS_NewStringCopyN(cx, hostname, strlen(hostname));
2f2854
@@ -98,7 +99,12 @@ static JSBool myIpAddress(JSContext *cx, uintN /*argc*/, jsval *vp) {
2f2854
 static JSClass cls = {
2f2854
 		"global", JSCLASS_GLOBAL_FLAGS,
2f2854
 		JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
2f2854
-		JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub,
2f2854
+		JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub,
2f2854
+#if JS_VERSION == 186      
2f2854
+		NULL,
2f2854
+#else
2f2854
+		JS_FinalizeStub,
2f2854
+#endif
2f2854
 		NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
2f2854
 };
2f2854
 
2f2854
@@ -117,7 +123,11 @@ public:
2f2854
 	    //JS_SetOptions(this->jsctx, JSOPTION_VAROBJFIX);
2f2854
 	    //JS_SetVersion(this->jsctx, JSVERSION_LATEST);
2f2854
 	    //JS_SetErrorReporter(cx, reportError);
2f2854
+#if JS_VERSION == 186
2f2854
+		if (!(this->jsglb = JS_NewGlobalObject(this->jsctx, &cls, NULL))) goto error;
2f2854
+#else
2f2854
 		if (!(this->jsglb = JS_NewCompartmentAndGlobalObject(this->jsctx, &cls, NULL))) goto error;
2f2854
+#endif
2f2854
 		if (!JS_InitStandardClasses(this->jsctx, this->jsglb))            goto error;
2f2854
 
2f2854
 		// Define Javascript functions
2f2854
-- 
2f2854
1.7.1
2f2854