[rfc][icedtea-web] Reproducer for: Ignore invalid .jar files in applets

Jiri Vanek jvanek at redhat.com
Mon Jun 4 01:42:22 PDT 2012


On 06/01/2012 04:45 PM, Adam Domurad wrote:
> Here's is a reproducer for the previous patch (which still needs a
> reviewer btw).
Thanx a lot for test! Few hint inline.

>
> ChangeLog:
> 2012-06-01  Adam Domurad<adomurad at redhat.com>
>
> 	*
> tests/jnlp_tests/simple/AppletReadsInvalidJar/resources/AppletReadsInvalidJar.html:
> 	*
> tests/jnlp_tests/simple/AppletReadsInvalidJar/resources/AppletReadsInvalidJar.jnlp:
> 	* tests/jnlp_tests/simple/AppletReadsInvalidJar/srcs/Valid.java:
> 	*
> tests/jnlp_tests/simple/AppletReadsInvalidJar/testcases/AppletReadsInvalidJarTests.java:
> 	Reproducer for checking behaviour of existing but invalid (corrupt,
> 	etc) jar files in .jnlp files (should fail) and applet tags (should be
> 	ignored)

It is not clear whether the test should fail, or the test should pass with failure of application. See below for more comments on this topic.
>
> On Mon, 2012-05-28 at 16:23 -0400, Adam Domurad wrote:

...snip...

> +exception statement from your version.
> + */
> +public class Valid extends Applet {
> +    @Override
> +    public void init() {
> +        System.out.println("Program Executed Correctly.");
> +    }
> +}

You do not need to create such a simple application each time, but you can reuse one of the existing. But for this case we can probably live with new one (depends on you)

> diff --git a/tests/jnlp_tests/simple/AppletReadsInvalidJar/testcases/AppletReadsInvalidJarTests.java b/tests/jnlp_tests/simple/AppletReadsInvalidJar/testcases/AppletReadsInvalidJarTests.java
> new file mode 100644

...snip...

> +
> +    /*This SHOULD NOT execute the applet!*/
> +    @Test
> +    public void AppletJNLPTest() throws Exception {
> +        long previous_timeout = ServerAccess.PROCESS_TIMEOUT;
> +        /*This test should be short, so set to 2 seconds*/
> +        ServerAccess.PROCESS_TIMEOUT = 2 * 1000;
> +
> +        ServerAccess.ProcessResult pr = server.executeJavawsHeadless("/AppletReadsInvalidJar.jnlp");
> +
> +        String s0 = "Program Executed Correctly.";
> +        Assert.assertTrue("AppletTakesLastParam stdout should NOT contain " + s0 + ", but did (applet should not have ran!).", !pr.stdout.contains(s0));
> +
> +        ServerAccess.PROCESS_TIMEOUT = previous_timeout;
> +    }

In this case you are launching applet in javaws. It will not launch application. Is this time outing necessary?  If the applet in javaws is not laoded at all, then
javaws should be terminated or not?
Also there is small complex  - applets should be launched _without_ hedaless, but if exception is launched in not-headless mode, then dialog-window keeps hanging n the air.

If timeout is really necessary (killer thread is not enough I guess)  then the restore of original one must be in finally block.
Although to check the type of exception can be very handy.

Last comment here - the issue is never going to be fixed (applet by jnlp) correct? In case that it should be fixed n some future, then this test should be failing (@KnownToFail)



> +
> +    /*This SHOULD execute the applet!*/
> +    @Test
> +    public void AppletInFirefoxTest() throws Exception {
> +        ServerAccess.ProcessResult pr = server.executeBrowser("/AppletReadsInvalidJar.html");
> +
> +        String s0 = "Program Executed Correctly.";
> +        Assert.assertTrue("AppletTakesLastParam stdout should contain " + s0 + " but did not.", pr.stdout.contains(s0));
> +    }
> +}

Tahnx for test again!

J.




More information about the distro-pkg-dev mailing list