Re: [rfc][icedtea-web] PR1271, Handle 'javascript:' urls, with tests
Jacob Wisor
gitne at excite.co.jp
Tue Aug 6 14:26:28 PDT 2013
Hello!
My usual nit picks:
> + static private void installDummyJavascriptProtocolHandler() {
> + try {
> + Field handlersField = URL.class.getDeclaredField("handlers");
> + handlersField.setAccessible(true);
> +
> + @SuppressWarnings("unchecked")
> + Hashtable<String, URLStreamHandler> handlers = (Hashtable<String,URLStreamHandler>)handlersField.get(null);
You can make the compiler happy by checking the return value with the instanceof operator. ;)
> +
> + // Place an arbitrary handler, we only need the URL construction to not error-out
> + handlers.put("javascript", new sun.net.www.protocol.http.Handler());
> + } catch (Exception e) {
Uhh ahh, there are good reasons not to do this :)
> + PluginDebug.debug("Unable to install 'javascript:' URL protocol handler!");
> + }
> + }
Regards,
Jacob
"Adam Domurad"<adomurad at xxxxxxxxxx> wrote:
> This fixes this bug
> http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=1271
>
> Note the test case sometimes fails if the fix from '[rfc][icedtea-web]
> Fix NPE on Applet launch due to missing AppletStub' is not applied.
>
> ChangeLog:
>
> 2013-XX-XX Adam Domurad <adomurad at redhat.com>
> * plugin/icedteanp/java/sun/applet/PluginAppletViewer.java:
> Evaluate
> javascript when it shows up in a 'showDocument' call.
> * plugin/icedteanp/java/sun/applet/PluginMain.java: Install
> arbitrary
> 'javascript:' protocol handler.
> *
> tests/rproducers/simple/JavascriptURLProtocol/resources/JavascriptProtocol.html:
> Tests if javascript is run from a test applet using showDocument.
> *
> tests/reproducers/simple/JavascriptURLProtocol/resources/JavascriptProtocol.js:
> Same.
> *
> tests/reproducers/simple/JavascriptURLProtocol/srcs/JavascriptProtocol.java:
> Same.
> *
> tests/reproducers/simple/JavascriptURLProtocol/testcases/JavascriptProtocolTest.java:
> Same.
>
> Cheers,
> -Adam
>
>
More information about the distro-pkg-dev
mailing list