Gentoo Archives: gentoo-commits

From: "Mike Frysinger (vapier)" <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in net-misc/mediatomb/files: mediatomb-0.12.1-mozjs187.patch
Date: Tue, 02 Oct 2012 07:49:20
Message-Id: 20121002074856.4BB5621600@flycatcher.gentoo.org
1 vapier 12/10/02 07:48:56
2
3 Added: mediatomb-0.12.1-mozjs187.patch
4 Log:
5 Support spidermonkey-1.8.7 #423991 by Ian Stakenvicius.
6
7 (Portage version: 2.2.0_alpha131/cvs/Linux x86_64)
8
9 Revision Changes Path
10 1.1 net-misc/mediatomb/files/mediatomb-0.12.1-mozjs187.patch
11
12 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/mediatomb/files/mediatomb-0.12.1-mozjs187.patch?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/mediatomb/files/mediatomb-0.12.1-mozjs187.patch?rev=1.1&content-type=text/plain
14
15 Index: mediatomb-0.12.1-mozjs187.patch
16 ===================================================================
17 maybe this is correct, maybe it's not. spidermonkey's documentation blows, so
18 who is to say!
19
20 https://bugs.gentoo.org/423991
21
22 --- a/src/scripting/dvd_image_import_script.cc
23 +++ b/src/scripting/dvd_image_import_script.cc
24 @@ -232,8 +232,6 @@ DVDImportScript::DVDImportScript(Ref<Runtime> runtime) : Script(runtime)
25
26 String scriptPath = ConfigManager::getInstance()->getOption(CFG_IMPORT_SCRIPTING_DVD_SCRIPT);
27 load(scriptPath);
28 - root = JS_NewScriptObject(cx, script);
29 - JS_AddNamedRoot(cx, &root, "DVDImportScript");
30 log_info("Loaded %s\n", scriptPath.c_str());
31
32 Ref<Dictionary> mappings =
33 @@ -296,21 +294,4 @@ void DVDImportScript::processDVDObject(Ref<CdsObject> obj)
34 #endif
35 }
36
37 -DVDImportScript::~DVDImportScript()
38 -{
39 -#ifdef JS_THREADSAFE
40 - JS_SetContextThread(cx);
41 - JS_BeginRequest(cx);
42 -#endif
43 -
44 - if (root)
45 - JS_RemoveRoot(cx, &root);
46 -
47 -#ifdef JS_THREADSAFE
48 - JS_EndRequest(cx);
49 - JS_ClearContextThread(cx);
50 -#endif
51 -
52 -}
53 -
54 #endif // HAVE_JS
55 --- a/src/scripting/dvd_image_import_script.h
56 +++ b/src/scripting/dvd_image_import_script.h
57 @@ -41,7 +41,6 @@ class DVDImportScript : public Script
58 {
59 public:
60 DVDImportScript(zmm::Ref<Runtime> runtime);
61 - ~DVDImportScript();
62 /// \brief Adds a DVD object to the database
63 ///
64 /// \param title DVD title number
65 --- a/src/scripting/import_script.cc
66 +++ b/src/scripting/import_script.cc
67 @@ -53,8 +53,6 @@ ImportScript::ImportScript(Ref<Runtime> runtime) : Script(runtime)
68 try
69 {
70 load(scriptPath);
71 - root = JS_NewObject(cx, NULL, script, NULL);
72 - JS_AddNamedObjectRoot(cx, &root, "ImportScript");
73 }
74 catch (Exception ex)
75 {
76 @@ -109,21 +107,4 @@ void ImportScript::processCdsObject(Ref<CdsObject> obj, String rootpath)
77 #endif
78 }
79
80 -ImportScript::~ImportScript()
81 -{
82 -#ifdef JS_THREADSAFE
83 - JS_SetContextThread(cx);
84 - JS_BeginRequest(cx);
85 -#endif
86 -
87 - if (root)
88 - JS_RemoveObjectRoot(cx, &root);
89 -
90 -#ifdef JS_THREADSAFE
91 - JS_EndRequest(cx);
92 - JS_ClearContextThread(cx);
93 -#endif
94 -
95 -}
96 -
97 #endif // HAVE_JS
98 --- a/src/scripting/import_script.h
99 +++ b/src/scripting/import_script.h
100 @@ -41,11 +41,8 @@ class ImportScript : public Script
101 {
102 public:
103 ImportScript(zmm::Ref<Runtime> runtime);
104 - ~ImportScript();
105 void processCdsObject(zmm::Ref<CdsObject> obj, zmm::String rootpath);
106 virtual script_class_t whoami() { return S_IMPORT; }
107 -private:
108 - JSObject *root;
109 };
110
111 #endif // __SCRIPTING_IMPORT_SCRIPT_H__
112 --- a/src/scripting/playlist_parser_script.cc
113 +++ b/src/scripting/playlist_parser_script.cc
114 @@ -93,8 +93,6 @@ PlaylistParserScript::PlaylistParserScript(Ref<Runtime> runtime) : Script(runtim
115
116 String scriptPath = ConfigManager::getInstance()->getOption(CFG_IMPORT_SCRIPTING_PLAYLIST_SCRIPT);
117 load(scriptPath);
118 - root = JS_NewObject(cx, NULL, script, NULL);
119 - JS_AddNamedObjectRoot(cx, &root, "PlaylistScript");
120 }
121 catch (Exception ex)
122 {
123 @@ -236,21 +234,4 @@ void PlaylistParserScript::processPlaylistObject(zmm::Ref<CdsObject> obj, Ref<Ge
124
125 }
126
127 -
128 -PlaylistParserScript::~PlaylistParserScript()
129 -{
130 -#ifdef JS_THREADSAFE
131 - JS_SetContextThread(cx);
132 - JS_BeginRequest(cx);
133 -#endif
134 -
135 - if (root)
136 - JS_RemoveObjectRoot(cx, &root);
137 -
138 -#ifdef JS_THREADSAFE
139 - JS_EndRequest(cx);
140 - JS_ClearContextThread(cx);
141 -#endif
142 -
143 -}
144 #endif // HAVE_JS
145 --- a/src/scripting/playlist_parser_script.h
146 +++ b/src/scripting/playlist_parser_script.h
147 @@ -42,7 +42,6 @@ class PlaylistParserScript : public Script
148 {
149 public:
150 PlaylistParserScript(zmm::Ref<Runtime> runtime);
151 - ~PlaylistParserScript();
152 zmm::String readln();
153 void processPlaylistObject(zmm::Ref<CdsObject> obj, zmm::Ref<GenericTask> task);
154 virtual script_class_t whoami() { return S_PLAYLIST; }
155 @@ -52,7 +51,6 @@ private:
156 int currentObjectID;
157 char *currentLine;
158 zmm::Ref<GenericTask> currentTask;
159 - JSObject *root;
160 };
161
162 #endif // __SCRIPTING_PLAYLIST_PARSER_SCRIPT_H__
163 --- a/src/scripting/script.cc
164 +++ b/src/scripting/script.cc
165 @@ -427,15 +427,10 @@ static JSFunctionSpec js_global_functions[] = {
166 try
167 {
168 common_script = _load(common_scr_path);
169 - common_root = JS_NewObject(cx, NULL, common_script, NULL);
170 - JS_AddNamedObjectRoot(cx, &common_root, "common-script");
171 _execute(common_script);
172 }
173 catch (Exception e)
174 {
175 - if (common_root)
176 - JS_RemoveObjectRoot(cx, &common_root);
177 -
178 log_js("Unable to load %s: %s\n", common_scr_path.c_str(),
179 e.getMessage().c_str());
180 }
181 @@ -459,8 +454,6 @@ Script::~Script()
182 JS_SetContextThread(cx);
183 JS_BeginRequest(cx);
184 #endif
185 - if (common_root)
186 - JS_RemoveObjectRoot(cx, &common_root);
187
188 /*
189 * scripts are unrooted and will be cleaned up by GC
190 @@ -532,12 +532,12 @@ void Script::defineFunctions(JSFunctionSpec *functions)
191 throw _Exception(_("Scripting: JS_DefineFunctions failed"));
192 }
193
194 -JSObject *Script::_load(zmm::String scriptPath)
195 +JSScript *Script::_load(zmm::String scriptPath)
196 {
197 if (glob == NULL)
198 initGlobalObject();
199
200 - JSObject *scr;
201 + JSScript *scr;
202
203 String scriptText = read_text_file(scriptPath);
204
205 @@ -568,7 +568,7 @@ void Script::load(zmm::String scriptPath)
206 }
207
208
209 -void Script::_execute(JSObject *scr)
210 +void Script::_execute(JSScript *scr)
211 {
212 jsval ret_val;
213
214 --- a/src/scripting/script.h
215 +++ b/src/scripting/script.h
216 @@ -66,8 +66,8 @@ public:
217 JSRuntime *rt;
218 JSContext *cx;
219 JSObject *glob;
220 - JSObject *script;
221 - JSObject *common_script;
222 + JSScript *script;
223 + JSScript *common_script;
224
225 public:
226 Script(zmm::Ref<Runtime> runtime);
227 @@ -112,11 +112,9 @@ protected:
228 zmm::Ref<CdsObject> processed;
229
230 private:
231 - JSObject *common_root;
232 -
233 void initGlobalObject();
234 - JSObject *_load(zmm::String scriptPath);
235 - void _execute(JSObject *scr);
236 + JSScript *_load(zmm::String scriptPath);
237 + void _execute(JSScript *scr);
238 zmm::Ref<StringConverter> _p2i;
239 zmm::Ref<StringConverter> _j2i;
240 zmm::Ref<StringConverter> _f2i;
241 --- a/configure.ac
242 +++ b/configure.ac
243 @@ -1036,13 +1036,13 @@
244 ],
245 [
246 unset ac_cv_lib_smjs_JS_NewObject
247 - AC_CHECK_LIB(mozjs185, JS_NewObject,
248 + AC_CHECK_LIB(mozjs187, JS_NewObject,
249 [
250 - MOZLIB=mozjs185
251 - JS_LIBS="-lmozjs185"
252 + MOZLIB=mozjs187
253 + JS_LIBS="-lmozjs187"
254 ],
255 [
256 - unset ac_cv_lib_mozjs185_JS_NewObject
257 + unset ac_cv_lib_mozjs187_JS_NewObject
258 AC_CHECK_LIB(mozjs, JS_NewObject,
259 [
260 MOZLIB=mozjs
261 @@ -1064,11 +1064,11 @@
262 MOZLIB=smjs
263 ],
264 [
265 - unset ac_cv_lib_mozjs185_JS_NewObject
266 - AC_CHECK_LIB(mozjs185, JS_NewObject,
267 + unset ac_cv_lib_mozjs187_JS_NewObject
268 + AC_CHECK_LIB(mozjs187, JS_NewObject,
269 [
270 - JS_LIBS="-L$SEARCH_DIR_LIBS -lmozjs185"
271 - MOZLIB=mozjs185
272 + JS_LIBS="-L$SEARCH_DIR_LIBS -lmozjs187"
273 + MOZLIB=mozjs187
274 ],
275 [
276 LDFLAGS="-L$SEARCH_DIR_LIBS $LDFLAGS_SAVE -lmozjs"