aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog15
-rw-r--r--NEWS1
-rw-r--r--plugin/icedteanp/IcedTeaNPPlugin.cc15
-rw-r--r--tests/jnlp_tests/simple/AppletBaseURLTest/resources/AppletBaseURLTest.html48
-rw-r--r--tests/jnlp_tests/simple/AppletBaseURLTest/resources/AppletBaseURLTest.jnlp58
-rw-r--r--tests/jnlp_tests/simple/AppletBaseURLTest/resources/AppletJNLPHrefBaseURLTest.html46
-rw-r--r--tests/jnlp_tests/simple/AppletBaseURLTest/srcs/AppletBaseURL.java64
-rw-r--r--tests/jnlp_tests/simple/AppletBaseURLTest/testcases/AppletBaseURLTest.java87
8 files changed, 320 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 5d25839..8aa04b8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2012-06-11 Danesh Dadachanji <[email protected]>
+
+ PR855: AppletStub getDocumentBase() doesn't return full URL
+ * NEWS: Added PR855 entry.
+ * plugin/icedteanp/IcedTeaNPPlugin.cc (plugin_get_documentbase):
+ Assign documentbase_copy directly to href's value instead of iterating
+ through the segments to remove the file from the path.
+ * tests/jnlp_tests/simple/AppletBaseURLTest/srcs/AppletBaseURL.java:
+ * tests/jnlp_tests/simple/AppletBaseURLTest/testcases/AppletBaseURLTest.java:
+ * tests/jnlp_tests/simple/AppletBaseURLTest/resources/AppletBaseURLTest.html:
+ * tests/jnlp_tests/simple/AppletBaseURLTest/resources/AppletBaseURLTest.jnlp:
+ * tests/jnlp_tests/simple/AppletBaseURLTest/resources/AppletJNLPHrefBaseURLTest.html:
+ New reproducer that checks the URLS that document and codebase
+ point are correct.
+
2012-06-13 Danesh Dadachanji <[email protected]>
Update CheckServices reproducer to handle browser testcase.
diff --git a/NEWS b/NEWS
index a61688a..ab5bc8e 100644
--- a/NEWS
+++ b/NEWS
@@ -19,6 +19,7 @@ New in release 1.3 (2012-XX-XX):
- PR861: Allow loading from non codebase hosts. Allow code to connect to hosting server
- PR518: NPString.utf8characters not guaranteed to be nul-terminated
- PR722: META-INF/ unsigned entries should be ignored in signing
+ - PR855: AppletStub getDocumentBase() doesn't return full URL
* Common
- PR918: java applet windows uses a low resulution black/white icon
diff --git a/plugin/icedteanp/IcedTeaNPPlugin.cc b/plugin/icedteanp/IcedTeaNPPlugin.cc
index d132780..f3d30a4 100644
--- a/plugin/icedteanp/IcedTeaNPPlugin.cc
+++ b/plugin/icedteanp/IcedTeaNPPlugin.cc
@@ -1094,24 +1094,11 @@ plugin_get_documentbase (NPP instance)
href_id, &href);
std::string href_str = IcedTeaPluginUtilities::NPVariantAsString(href);
-
- // Strip everything after the last "/"
- gchar** parts = g_strsplit (href_str.c_str(), "/", -1);
- guint parts_sz = g_strv_length (parts);
-
- std::string location_str;
- for (int i=0; i < parts_sz - 1; i++)
- {
- location_str += parts[i];
- location_str += "/";
- }
-
- documentbase_copy = g_strdup (location_str.c_str());
+ documentbase_copy = g_strdup (href_str.c_str());
// Release references.
browser_functions.releasevariantvalue(&href);
browser_functions.releasevariantvalue(&location);
- g_strfreev(parts);
cleanup_done:
PLUGIN_DEBUG ("plugin_get_documentbase return\n");
PLUGIN_DEBUG("plugin_get_documentbase returning: %s\n", documentbase_copy);
diff --git a/tests/jnlp_tests/simple/AppletBaseURLTest/resources/AppletBaseURLTest.html b/tests/jnlp_tests/simple/AppletBaseURLTest/resources/AppletBaseURLTest.html
new file mode 100644
index 0000000..9cc0fe1
--- /dev/null
+++ b/tests/jnlp_tests/simple/AppletBaseURLTest/resources/AppletBaseURLTest.html
@@ -0,0 +1,48 @@
+<!--
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+IcedTea is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version.
+
+ -->
+<html>
+ <head></head>
+ <body>
+ <applet code="AppletBaseURL.class"
+ archive="AppletBaseURLTest.jar"
+ codebase="."
+ width="800"
+ height="600">
+ </applet>
+ </body>
+</html>
diff --git a/tests/jnlp_tests/simple/AppletBaseURLTest/resources/AppletBaseURLTest.jnlp b/tests/jnlp_tests/simple/AppletBaseURLTest/resources/AppletBaseURLTest.jnlp
new file mode 100644
index 0000000..4902f25
--- /dev/null
+++ b/tests/jnlp_tests/simple/AppletBaseURLTest/resources/AppletBaseURLTest.jnlp
@@ -0,0 +1,58 @@
+<!--
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+IcedTea is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version.
+
+ -->
+<?xml version="1.0" encoding="utf-8"?>
+<jnlp spec="1.0" href="AppletBaseURLTest.jnlp" codebase=".">
+ <information>
+ <title>AppletBaseURL</title>
+ <vendor>IcedTea</vendor>
+ <homepage href="http://icedtea.classpath.org/wiki/IcedTea-Web#Testing_IcedTea-Web"/>
+ <description>AppletBaseURL</description>
+ <offline/>
+ </information>
+ <resources>
+ <j2se version="1.4+"/>
+ <jar href="AppletBaseURLTest.jar"/>
+ </resources>
+ <applet-desc
+ documentBase="."
+ name="AppletBaseURL"
+ main-class="AppletBaseURL"
+ width="100"
+ height="100">
+ </applet-desc>
+</jnlp>
diff --git a/tests/jnlp_tests/simple/AppletBaseURLTest/resources/AppletJNLPHrefBaseURLTest.html b/tests/jnlp_tests/simple/AppletBaseURLTest/resources/AppletJNLPHrefBaseURLTest.html
new file mode 100644
index 0000000..752a767
--- /dev/null
+++ b/tests/jnlp_tests/simple/AppletBaseURLTest/resources/AppletJNLPHrefBaseURLTest.html
@@ -0,0 +1,46 @@
+<!--
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+IcedTea is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version.
+
+-->
+<html>
+ <head></head>
+ <body>
+ <applet code="AppletBaseURL.class" width="800" height="600">
+ <param name="jnlp_href" value="AppletBaseURLTest.jnlp">
+ </applet>
+ </body>
+</html>
+
diff --git a/tests/jnlp_tests/simple/AppletBaseURLTest/srcs/AppletBaseURL.java b/tests/jnlp_tests/simple/AppletBaseURLTest/srcs/AppletBaseURL.java
new file mode 100644
index 0000000..8234e3c
--- /dev/null
+++ b/tests/jnlp_tests/simple/AppletBaseURLTest/srcs/AppletBaseURL.java
@@ -0,0 +1,64 @@
+/* AppletBaseURL.java
+Copyright (C) 2012 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 2.
+
+IcedTea is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING. If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version.
+ */
+
+import java.applet.Applet;
+public class AppletBaseURL extends Applet {
+
+ private class Killer extends Thread {
+
+ public int n = 1000;
+
+ @Override
+ public void run() {
+ try {
+ Thread.sleep(n);
+ System.out.println("Aplet killing himself after " + n + " ms of life");
+ System.exit(0);
+ } catch (Exception ex) {
+ }
+ }
+ }
+ private Killer killer;
+
+ @Override
+ public void init() {
+ System.out.println("Document base is " + getDocumentBase() + " for this applet");
+ System.out.println("Codebase is " + getCodeBase() + " for this applet");
+ killer = new Killer();
+ killer.start();
+ }
+}
diff --git a/tests/jnlp_tests/simple/AppletBaseURLTest/testcases/AppletBaseURLTest.java b/tests/jnlp_tests/simple/AppletBaseURLTest/testcases/AppletBaseURLTest.java
new file mode 100644
index 0000000..8b1d893
--- /dev/null
+++ b/tests/jnlp_tests/simple/AppletBaseURLTest/testcases/AppletBaseURLTest.java
@@ -0,0 +1,87 @@
+/* AppletBaseURLTest.java
+Copyright (C) 2012 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 2.
+
+IcedTea is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING. If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version.
+ */
+
+import net.sourceforge.jnlp.ServerAccess;
+import net.sourceforge.jnlp.ServerAccess.ProcessResult;
+import net.sourceforge.jnlp.annotations.Bug;
+import net.sourceforge.jnlp.annotations.NeedsDisplay;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class AppletBaseURLTest {
+
+ private static ServerAccess server = new ServerAccess();
+
+ private void evaluateApplet(ProcessResult pr, String baseName) {
+ String s8 = "(?s).*Codebase is http://localhost:[0-9]{5}/ for this applet(?s).*";
+ Assert.assertTrue("AppletBaseURL stdout should match" + s8 + " but didn't", pr.stdout.matches(s8));
+ String s9 = "(?s).*Document base is http://localhost:[0-9]{5}/" + baseName + " for this applet(?s).*";
+ Assert.assertTrue("AppletBaseURL stdout should match" + s9 + " but didn't", pr.stdout.matches(s9));
+ String ss = "xception";
+ Assert.assertFalse("AppletBaseURL stderr should not contain" + ss + " but did", pr.stderr.contains(ss));
+ }
+
+ @NeedsDisplay
+ @Test
+ public void AppletWebstartBaseURLTest() throws Exception {
+ ProcessResult pr = server.executeJavaws(null, "/AppletBaseURLTest.jnlp");
+ evaluateApplet(pr, "");
+ Assert.assertFalse(pr.wasTerminated);
+ Assert.assertEquals((Integer) 0, pr.returnValue);
+ }
+
+ @Bug(id="PR855")
+ @NeedsDisplay
+ @Test
+ public void AppletInFirefoxTest() throws Exception {
+ ProcessResult pr = server.executeBrowser("/AppletBaseURLTest.html");
+ pr.process.destroy();
+ evaluateApplet(pr, "AppletBaseURLTest.html");
+ Assert.assertTrue(pr.wasTerminated);
+ }
+
+ @Bug(id="PR855")
+ @NeedsDisplay
+ @Test
+ public void AppletWithJNLPHrefTest() throws Exception {
+ ProcessResult pr = server.executeBrowser("/AppletJNLPHrefBaseURLTest.html");
+ pr.process.destroy();
+ evaluateApplet(pr, "AppletJNLPHrefBaseURLTest.html");
+ Assert.assertTrue(pr.wasTerminated);
+ }
+}