Guest User

nashorn-fix.patch

a guest
Mar 23rd, 2017
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 17.90 KB | None | 0 0
  1. # HG changeset patch
  2. # User Jiri Vanek <[email protected]>
  3. # Date 1481889053 -3600
  4. # Node ID 2461eeea269fc5ac25ad0fe4e1290af663ba9a3d
  5. # Parent  d5801f6cc5b35ce3f9ab0a550b77feecb271eb59
  6. Nashorn made accessible to javaws applications
  7.  
  8. * NEWS: mentioned PR3263
  9. * launcher/launchers.in: added nashorn to BOOT_CLASSPATH
  10. * tests/reproducers/signed/jsengineSigned/: reproducer of behavior
  11. * tests/reproducers/simple/jsengine/: for completeness, added signed reproducer of behavior
  12.  
  13. diff -r d5801f6cc5b3 -r 2461eeea269f launcher/launchers.in
  14. --- a/launcher/launchers.in Mon Nov 21 14:23:11 2016 +0100
  15. +++ b/launcher/launchers.in Fri Dec 16 12:50:53 2016 +0100
  16. @@ -1,5 +1,6 @@
  17.  #!/bin/bash
  18.  
  19. +NASHORN=lib/ext/nashorn.jar
  20.  JAVA=@JAVA@
  21.  LAUNCHER_BOOTCLASSPATH=@LAUNCHER_BOOTCLASSPATH@
  22.  LAUNCHER_FLAGS=-Xms8m
  23. @@ -28,9 +29,12 @@
  24.    if [ -e  "$CUSTOM_JRE" -a -e "$CUSTOM_JRE/bin/java" ] ; then
  25.      JAVA=$CUSTOM_JRE/bin/java
  26.      CP=$CUSTOM_JRE/lib/rt.jar:$CUSTOM_JRE/lib/jfxrt.jar
  27. +    LAUNCHER_BOOTCLASSPATH=$LAUNCHER_BOOTCLASSPATH:$CUSTOM_JRE/$NASHORN
  28.    else
  29.      echo "Your custom JRE $CUSTOM_JRE read from deployment.properties under key $PROPERTY_NAME as $CUSTOM_JRE is not valid. Using default ($JAVA, $CP) in attempt to start. Please fix this."
  30.    fi
  31. +else
  32. +  LAUNCHER_BOOTCLASSPATH="$LAUNCHER_BOOTCLASSPATH:@JRE@/$NASHORN"
  33.  fi;
  34.  
  35.  JDK9="NO"
  36. diff -r d5801f6cc5b3 -r 2461eeea269f tests/reproducers/signed/jsengineSigned/resources/jsengineSigned.jnlp
  37. --- /dev/null   Thu Jan 01 00:00:00 1970 +0000
  38. +++ b/tests/reproducers/signed/jsengineSigned/resources/jsengineSigned.jnlp Fri Dec 16 12:50:53 2016 +0100
  39. @@ -0,0 +1,56 @@
  40. +<!--
  41. +
  42. +This file is part of IcedTea.
  43. +
  44. +IcedTea is free software; you can redistribute it and/or modify
  45. +it under the terms of the GNU General Public License as published by
  46. +the Free Software Foundation; either version 2, or (at your option)
  47. +any later version.
  48. +
  49. +IcedTea is distributed in the hope that it will be useful, but
  50. +WITHOUT ANY WARRANTY; without even the implied warranty of
  51. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  52. +General Public License for more details.
  53. +
  54. +You should have received a copy of the GNU General Public License
  55. +along with IcedTea; see the file COPYING.  If not, write to the
  56. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  57. +02110-1301 USA.
  58. +
  59. +Linking this library statically or dynamically with other modules is
  60. +making a combined work based on this library.  Thus, the terms and
  61. +conditions of the GNU General Public License cover the whole
  62. +combination.
  63. +
  64. +As a special exception, the copyright holders of this library give you
  65. +permission to link this library with independent modules to produce an
  66. +executable, regardless of the license terms of these independent
  67. +modules, and to copy and distribute the resulting executable under
  68. +terms of your choice, provided that you also meet, for each linked
  69. +independent module, the terms and conditions of the license of that
  70. +module.  An independent module is a module which is not derived from
  71. +or based on this library.  If you modify this library, you may extend
  72. +this exception to your version of the library, but you are not
  73. +obligated to do so.  If you do not wish to do so, delete this
  74. +exception statement from your version.
  75. +
  76. + -->
  77. +<?xml version="1.0" encoding="utf-8"?>
  78. +<jnlp spec="1.0" href="jsengineSigned.jnlp" codebase=".">
  79. +  <information>
  80. +    <title>jsengineSigned</title>
  81. +    <vendor>IcedTea</vendor>
  82. +    <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/>
  83. +    <description>jsengineSigned</description>
  84. +    <offline/>
  85. +  </information>
  86. +  <security>
  87. +      <all-permissions/>
  88. +  </security>
  89. +  <resources>
  90. +    <j2se version="1.4+"/>
  91. +    <jar href="jsengineSigned.jar"/>
  92. +  </resources>
  93. +  <application-desc main-class="jsengineSigned">
  94. +  </application-desc>
  95. +</jnlp>
  96. diff -r d5801f6cc5b3 -r 2461eeea269f tests/reproducers/signed/jsengineSigned/srcs/jsengineSigned.java
  97. --- /dev/null   Thu Jan 01 00:00:00 1970 +0000
  98. +++ b/tests/reproducers/signed/jsengineSigned/srcs/jsengineSigned.java  Fri Dec 16 12:50:53 2016 +0100
  99. @@ -0,0 +1,56 @@
  100. +/* jsengineSigned.java
  101. +Copyright (C) 2011 Red Hat, Inc.
  102. +
  103. +This file is part of IcedTea.
  104. +
  105. +IcedTea is free software; you can redistribute it and/or
  106. +modify it under the terms of the GNU General Public License as published by
  107. +the Free Software Foundation, version 2.
  108. +
  109. +IcedTea is distributed in the hope that it will be useful,
  110. +but WITHOUT ANY WARRANTY; without even the implied warranty of
  111. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  112. +General Public License for more details.
  113. +
  114. +You should have received a copy of the GNU General Public License
  115. +along with IcedTea; see the file COPYING.  If not, write to
  116. +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  117. +02110-1301 USA.
  118. +
  119. +Linking this library statically or dynamically with other modules is
  120. +making a combined work based on this library.  Thus, the terms and
  121. +conditions of the GNU General Public License cover the whole
  122. +combination.
  123. +
  124. +As a special exception, the copyright holders of this library give you
  125. +permission to link this library with independent modules to produce an
  126. +executable, regardless of the license terms of these independent
  127. +modules, and to copy and distribute the resulting executable under
  128. +terms of your choice, provided that you also meet, for each linked
  129. +independent module, the terms and conditions of the license of that
  130. +module.  An independent module is a module which is not derived from
  131. +or based on this library.  If you modify this library, you may extend
  132. +this exception to your version of the library, but you are not
  133. +obligated to do so.  If you do not wish to do so, delete this
  134. +exception statement from your version.
  135. + */
  136. +
  137. +
  138. +import javax.script.ScriptEngine;
  139. +import javax.script.ScriptEngineManager;
  140. +
  141. +public class jsengineSigned{
  142. +    
  143. +    private  static final ScriptEngine engine1 = new ScriptEngineManager().getEngineByName("JavaScript");
  144. +    private  static final ScriptEngine engine2 = new ScriptEngineManager(jsengineSigned.class.getClassLoader()).getEngineByName("JavaScript");
  145. +    private  static final ScriptEngine engine3 = new ScriptEngineManager(null).getEngineByName("JavaScript");
  146. +
  147. +    public static void main(String[] args){
  148. +        System.out.println("starting");
  149. +        System.out.println("A-"+engine1+"-Z");
  150. +        System.out.println("B-"+engine2+"-Y");
  151. +        System.out.println("C-"+engine3+"-X");
  152. +        System.out.println("finished");
  153. +
  154. +    }
  155. +}
  156. diff -r d5801f6cc5b3 -r 2461eeea269f tests/reproducers/signed/jsengineSigned/testcases/jsengineSignedTest.java
  157. --- /dev/null   Thu Jan 01 00:00:00 1970 +0000
  158. +++ b/tests/reproducers/signed/jsengineSigned/testcases/jsengineSignedTest.java Fri Dec 16 12:50:53 2016 +0100
  159. @@ -0,0 +1,61 @@
  160. +/* jsengineSignedTest.java
  161. + Copyright (C) 2011 Red Hat, Inc.
  162. +
  163. + This file is part of IcedTea.
  164. +
  165. + IcedTea is free software; you can redistribute it and/or
  166. + modify it under the terms of the GNU General Public License as published by
  167. + the Free Software Foundation, version 2.
  168. +
  169. + IcedTea is distributed in the hope that it will be useful,
  170. + but WITHOUT ANY WARRANTY; without even the implied warranty of
  171. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  172. + General Public License for more details.
  173. +
  174. + You should have received a copy of the GNU General Public License
  175. + along with IcedTea; see the file COPYING.  If not, write to
  176. + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  177. + 02110-1301 USA.
  178. +
  179. + Linking this library statically or dynamically with other modules is
  180. + making a combined work based on this library.  Thus, the terms and
  181. + conditions of the GNU General Public License cover the whole
  182. + combination.
  183. +
  184. + As a special exception, the copyright holders of this library give you
  185. + permission to link this library with independent modules to produce an
  186. + executable, regardless of the license terms of these independent
  187. + modules, and to copy and distribute the resulting executable under
  188. + terms of your choice, provided that you also meet, for each linked
  189. + independent module, the terms and conditions of the license of that
  190. + module.  An independent module is a module which is not derived from
  191. + or based on this library.  If you modify this library, you may extend
  192. + this exception to your version of the library, but you are not
  193. + obligated to do so.  If you do not wish to do so, delete this
  194. + exception statement from your version.
  195. + */
  196. +
  197. +import net.sourceforge.jnlp.ProcessResult;
  198. +import net.sourceforge.jnlp.ServerAccess;
  199. +import org.junit.Assert;
  200. +
  201. +import org.junit.Test;
  202. +
  203. +public class jsengineSignedTest {
  204. +
  205. +    private static final ServerAccess server = new ServerAccess();
  206. +    
  207. +    @Test
  208. +    public void jsengineSignedTestcase1() throws Exception {
  209. +        String originalResourceName = "jsengineSigned.jnlp";
  210. +        ProcessResult pr = server.executeJavawsHeadless(null, "/" + originalResourceName);
  211. +        //ServerAccess.logOutputReprint(pr.stderr);
  212. +        //ServerAccess.logOutputReprint(pr.stdout);
  213. +        Assert.assertTrue(pr.stdout.matches("(?s).*starting.*"));
  214. +        Assert.assertTrue(pr.stdout.matches("(?s)(?i).*A-.*nashorn.*-Z.*") || pr.stdout.matches("(?s)(?i).*A-.*rhino.*-Z.*"));
  215. +        Assert.assertTrue(pr.stdout.matches("(?s)(?i).*B-.*nashorn.*-Y.*") || pr.stdout.matches("(?s)(?i).*B-.*rhino.*-Y.*"));
  216. +        Assert.assertTrue(pr.stdout.matches("(?s)(?i).*C-.*nashorn.*-X.*") || pr.stdout.matches("(?s)(?i).*C-.*rhino.*-X.*"));
  217. +        Assert.assertTrue(pr.stdout.matches("(?s).*finished.*"));
  218. +    }
  219. +}
  220. +
  221. diff -r d5801f6cc5b3 -r 2461eeea269f tests/reproducers/simple/jsengine/resources/jsengine.jnlp
  222. --- /dev/null   Thu Jan 01 00:00:00 1970 +0000
  223. +++ b/tests/reproducers/simple/jsengine/resources/jsengine.jnlp Fri Dec 16 12:50:53 2016 +0100
  224. @@ -0,0 +1,53 @@
  225. +<!--
  226. +
  227. +This file is part of IcedTea.
  228. +
  229. +IcedTea is free software; you can redistribute it and/or modify
  230. +it under the terms of the GNU General Public License as published by
  231. +the Free Software Foundation; either version 2, or (at your option)
  232. +any later version.
  233. +
  234. +IcedTea is distributed in the hope that it will be useful, but
  235. +WITHOUT ANY WARRANTY; without even the implied warranty of
  236. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  237. +General Public License for more details.
  238. +
  239. +You should have received a copy of the GNU General Public License
  240. +along with IcedTea; see the file COPYING.  If not, write to the
  241. +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  242. +02110-1301 USA.
  243. +
  244. +Linking this library statically or dynamically with other modules is
  245. +making a combined work based on this library.  Thus, the terms and
  246. +conditions of the GNU General Public License cover the whole
  247. +combination.
  248. +
  249. +As a special exception, the copyright holders of this library give you
  250. +permission to link this library with independent modules to produce an
  251. +executable, regardless of the license terms of these independent
  252. +modules, and to copy and distribute the resulting executable under
  253. +terms of your choice, provided that you also meet, for each linked
  254. +independent module, the terms and conditions of the license of that
  255. +module.  An independent module is a module which is not derived from
  256. +or based on this library.  If you modify this library, you may extend
  257. +this exception to your version of the library, but you are not
  258. +obligated to do so.  If you do not wish to do so, delete this
  259. +exception statement from your version.
  260. +
  261. + -->
  262. +<?xml version="1.0" encoding="utf-8"?>
  263. +<jnlp spec="1.0" href="jsengine.jnlp" codebase=".">
  264. +  <information>
  265. +    <title>jsengine</title>
  266. +    <vendor>IcedTea</vendor>
  267. +    <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/>
  268. +    <description>jsengine</description>
  269. +    <offline/>
  270. +  </information>
  271. +  <resources>
  272. +    <j2se version="1.4+"/>
  273. +    <jar href="jsengine.jar"/>
  274. +  </resources>
  275. +  <application-desc main-class="jsengine">
  276. +  </application-desc>
  277. +</jnlp>
  278. diff -r d5801f6cc5b3 -r 2461eeea269f tests/reproducers/simple/jsengine/srcs/jsengine.java
  279. --- /dev/null   Thu Jan 01 00:00:00 1970 +0000
  280. +++ b/tests/reproducers/simple/jsengine/srcs/jsengine.java  Fri Dec 16 12:50:53 2016 +0100
  281. @@ -0,0 +1,56 @@
  282. +/* jsengine.java
  283. +Copyright (C) 2011 Red Hat, Inc.
  284. +
  285. +This file is part of IcedTea.
  286. +
  287. +IcedTea is free software; you can redistribute it and/or
  288. +modify it under the terms of the GNU General Public License as published by
  289. +the Free Software Foundation, version 2.
  290. +
  291. +IcedTea is distributed in the hope that it will be useful,
  292. +but WITHOUT ANY WARRANTY; without even the implied warranty of
  293. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  294. +General Public License for more details.
  295. +
  296. +You should have received a copy of the GNU General Public License
  297. +along with IcedTea; see the file COPYING.  If not, write to
  298. +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  299. +02110-1301 USA.
  300. +
  301. +Linking this library statically or dynamically with other modules is
  302. +making a combined work based on this library.  Thus, the terms and
  303. +conditions of the GNU General Public License cover the whole
  304. +combination.
  305. +
  306. +As a special exception, the copyright holders of this library give you
  307. +permission to link this library with independent modules to produce an
  308. +executable, regardless of the license terms of these independent
  309. +modules, and to copy and distribute the resulting executable under
  310. +terms of your choice, provided that you also meet, for each linked
  311. +independent module, the terms and conditions of the license of that
  312. +module.  An independent module is a module which is not derived from
  313. +or based on this library.  If you modify this library, you may extend
  314. +this exception to your version of the library, but you are not
  315. +obligated to do so.  If you do not wish to do so, delete this
  316. +exception statement from your version.
  317. + */
  318. +
  319. +
  320. +import javax.script.ScriptEngine;
  321. +import javax.script.ScriptEngineManager;
  322. +
  323. +public class jsengine{
  324. +    
  325. +    private  static final ScriptEngine engine1 = new ScriptEngineManager().getEngineByName("JavaScript");
  326. +    private  static final ScriptEngine engine2 = new ScriptEngineManager(jsengine.class.getClassLoader()).getEngineByName("JavaScript");
  327. +    private  static final ScriptEngine engine3 = new ScriptEngineManager(null).getEngineByName("JavaScript");
  328. +
  329. +    public static void main(String[] args){
  330. +        System.out.println("starting");
  331. +        System.out.println("A-"+engine1+"-Z");
  332. +        System.out.println("B-"+engine2+"-Y");
  333. +        System.out.println("C-"+engine3+"-X");
  334. +        System.out.println("finished");
  335. +
  336. +    }
  337. +}
  338. diff -r d5801f6cc5b3 -r 2461eeea269f tests/reproducers/simple/jsengine/testcases/jsengineTest.java
  339. --- /dev/null   Thu Jan 01 00:00:00 1970 +0000
  340. +++ b/tests/reproducers/simple/jsengine/testcases/jsengineTest.java Fri Dec 16 12:50:53 2016 +0100
  341. @@ -0,0 +1,63 @@
  342. +/* jsengineTest.java
  343. + Copyright (C) 2011 Red Hat, Inc.
  344. +
  345. + This file is part of IcedTea.
  346. +
  347. + IcedTea is free software; you can redistribute it and/or
  348. + modify it under the terms of the GNU General Public License as published by
  349. + the Free Software Foundation, version 2.
  350. +
  351. + IcedTea is distributed in the hope that it will be useful,
  352. + but WITHOUT ANY WARRANTY; without even the implied warranty of
  353. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  354. + General Public License for more details.
  355. +
  356. + You should have received a copy of the GNU General Public License
  357. + along with IcedTea; see the file COPYING.  If not, write to
  358. + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  359. + 02110-1301 USA.
  360. +
  361. + Linking this library statically or dynamically with other modules is
  362. + making a combined work based on this library.  Thus, the terms and
  363. + conditions of the GNU General Public License cover the whole
  364. + combination.
  365. +
  366. + As a special exception, the copyright holders of this library give you
  367. + permission to link this library with independent modules to produce an
  368. + executable, regardless of the license terms of these independent
  369. + modules, and to copy and distribute the resulting executable under
  370. + terms of your choice, provided that you also meet, for each linked
  371. + independent module, the terms and conditions of the license of that
  372. + module.  An independent module is a module which is not derived from
  373. + or based on this library.  If you modify this library, you may extend
  374. + this exception to your version of the library, but you are not
  375. + obligated to do so.  If you do not wish to do so, delete this
  376. + exception statement from your version.
  377. + */
  378. +
  379. +import net.sourceforge.jnlp.ProcessResult;
  380. +import net.sourceforge.jnlp.ServerAccess;
  381. +import net.sourceforge.jnlp.annotations.Bug;
  382. +import org.junit.Assert;
  383. +
  384. +import org.junit.Test;
  385. +
  386. +public class jsengineTest {
  387. +
  388. +    private static final ServerAccess server = new ServerAccess();
  389. +    
  390. +    @Test
  391. +    @Bug(id="PR3263")
  392. +    public void jsengineTestcase1() throws Exception {
  393. +        String originalResourceName = "jsengine.jnlp";
  394. +        ProcessResult pr = server.executeJavawsHeadless(null, "/" + originalResourceName);
  395. +        //ServerAccess.logOutputReprint(pr.stderr);
  396. +        //ServerAccess.logOutputReprint(pr.stdout);
  397. +        Assert.assertTrue(pr.stdout.matches("(?s).*starting.*"));
  398. +        Assert.assertTrue(pr.stdout.matches("(?s)(?i).*A-.*nashorn.*-Z.*") || pr.stdout.matches("(?s)(?i).*A-.*rhino.*-Z.*"));
  399. +        Assert.assertTrue(pr.stdout.matches("(?s)(?i).*B-.*nashorn.*-Y.*") || pr.stdout.matches("(?s)(?i).*B-.*rhino.*-Y.*"));
  400. +        Assert.assertTrue(pr.stdout.matches("(?s)(?i).*C-.*nashorn.*-X.*") || pr.stdout.matches("(?s)(?i).*C-.*rhino.*-X.*"));
  401. +        Assert.assertTrue(pr.stdout.matches("(?s).*finished.*"));
  402. +    }
  403. +}
  404. +
Advertisement
Add Comment
Please, Sign In to add comment