Closed Bug 120727 Opened 23 years ago Closed 21 years ago

LiveConnect (JavaScript from Java) fails with some URL-types

Categories

(Core Graveyard :: Java: OJI, defect)

x86
Windows NT
defect
Not set
major

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: hans, Assigned: joshua.xia)

Details

(Whiteboard: close)

Hi,

I've encountered a problem with executing JavaScript statements from within 
Java applets.  It only occurs when the URL of the page in which the applet is 
embedded starts with "http://".  If the same page is accessed directly from the 
local hard-drive, using the "file://" URL prefix, then it works perfectly.  The 
following illustrates the problem:

(NB: Sorry if it's too detailed - I tried to be thorough)

1. Create a file containing the following HTML code:

   <html>
   <body>
   <form name=myForm>
   <input type=text name=myText value="TEST FAILED">
   </form>
   <applet code=TestApplet.class codebase=. width=0 height=0 mayscript=true>
   </applet>
   </body>
   </html>


2. Create a file called TestApplet.java containing the following Java code:

   public class TestApplet extends java.applet.Applet
   {
     public void init()
     {
       String statement = "document.myForm.myText.value='TEST PASSED';";
       netscape.javascript.JSObject.getWindow(super).eval(statement);
     }
   }


3. Compile TestApplet.java and copy the class file into the same
   directory as the HTML file.


4. Access the page from Netscape 6.1 (or greater?) using a URL of
   the form "file://...".  When the applet is loading you should
   see the text in the text-field change from "TEST FAILED" to 
   "TEST PASSED".  So this works.


5. Now place the HTML and Java class file in a directory on a web-server.
   I used an Apache server on my LAN but I don't suppose that would make 
   any difference.

6. Access the page using a URL of the form "http://...".  Now you should
   observe that the text in the text-field does NOT change.  This is
   wrong, isn't it.  It should change to "TEST PASSED".
Further investigation has revealed that it may have to do with the presence or
absence of a port-number in URL being accessed.  I have placed the test-page
described in the initial bug report on web-server that you can access.  If you
type the URL without a port-number then the test is passed.  If, however, you
enter a port-number (ie. 80 in this case) then it doesn't work.  Please try it:

This one works:
  http://www.psionix.biz/TestApplet.html

This one doesn't:
  http://www.psionix.biz:80/TestApplet.html

Hope this helps.
Reporter, what Mozilla build are you testing? Please always include the buildID
with your reports. I'm setting this bug status from Unconfirmed to New.
Status: UNCONFIRMED → NEW
Ever confirmed: true
QA Contact: pmac → petersen
reassign to me
Assignee: joe.chou → joshua.xia
WFM on Linux(RH8.0)/Windows2000 mozilla1.2 with JRE1.4.1_01.
Both http:// or http://...:80 works fine.
Reporter:
Please try latest JRE and latest mozilla.
Whiteboard: close
->wfm
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → WORKSFORME
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.