Closed Bug 55730 Opened 24 years ago Closed 23 years ago

document.write to popup window fails.

Categories

(Core :: DOM: HTML Parser, defect, P3)

x86
Windows NT
defect

Tracking

()

RESOLVED INVALID

People

(Reporter: david.valentine, Assigned: harishd)

References

()

Details

Attachments

(1 file)

[code part of commercial applicaiton in large use. www.esri.con/arcims/ ]

1) go to url, put in 'sanfrancisco' as map service.
2) hit send request
3) hit showmap.
4) window pops up blank.

this is the function.

 function showMap(returnString) {
		//This function will display the resulting map in a separate
		//window.  The URL must be extracted from the response.  A
		//sample URL is http://zephyr/output/crayola_i_ZEPHYR46010821.jpg.
		
			var theForm = document.forms[0];
			theResponse=theForm.response.value;
			//alert(theResponse);
			theURLstart=theResponse.indexOf("http://")
			theURLend=theResponse.indexOf('"',theURLstart);
			theURL=theResponse.substring(theURLstart,theURLend)
			//alert(theURL);

			var Win1;
			Win1 = open("","Window1","width=800, height=600, scrollbars=yes,resizable=yes");
			Win1.document.open();
			Win1.document.write("<html><head><title>A Map</title></head><body leftmargin=0
topmargin=0 bgcolor='white'>");
			Win1.document.write("<IMG SRC='" + theURL + "' BORDER=0 ALT='The Map'>");
			Win1.document.write("</body></html>");
			Win1.document.close();
			Win1.focus();
			Win1 = null;

		}
Summary: docuement.write to popup window fails. → document.write to popup window fails.
Maybe if the link to the image was actually working, the image might be displayed?

Do you have an example, other than 'sanfrancisco,' where it actually displays an
image?
Can you simplify the url into a testcase?
I don't think the problem with the document.write (this was a problem and was
fixed in build 2000100520 [ See Bug 53683 ])
As far as I can see the problem is before the showMap function, and may be
connected with the contents of the Response text area.

dwv - is this still broken on newer builds?  if it's working now, you were 
probably hitting bug 55275 (which is now fixed).
The given URL has this HTML:

<!-- frames -->
<FRAMESET  ROWS="*,100">
    <FRAME NAME="MapFrame"  SRC="test.htm"     etc. >
    <FRAME NAME="PostFrame" SRC="jsForm.htm"   etc. >
</FRAMESET>



When I follow the steps to reproduce, I am getting the following error 
in the JavaScript console:


Error:        thePostForm has no properties
Source File:  http://redlands.alexandria.ucsb.edu/website/sendarcxml/test.htm
Line:         37


Line 37 is inside this function: 


function sendXML() {
  // get set the form values from this page
  var theForm = document.forms[0];
          // the MapService
  var theService = theForm.Service.value;
  if (theService!="catalog") serviceVar = theService;
  var theURL = "http://" + hostName + esrimapBlurb + theService;
          // send to QueryServer?
  if (theForm.useQuery.checked) theURL = theURL + "&CustomService=Query";  
          // send to GeocodeServer?
  if (theForm.useGeocode.checked) theURL = theURL + "&CustomService=Geocode";  
          // the request
  var theRequest = theForm.request.value;
  // get the Post Form and set values, then submit to server
  var thePostForm = parent.PostFrame.document.forms[0];
                          // set parameters for the Servlet Connector
                          //alert(theURL);
  thePostForm.action=theURL + "&Form=True&Encode=True";
  thePostForm.ArcXMLRequest.value=theRequest;
  thePostForm.HeaderFile.value = headerFilePath;
  thePostForm.FooterFile.value = footerFilePath;
  // submit to Application Server
  thePostForm.submit();
}



So it looks like some sort of timing issue in building and accessing
the DOM object tree. We expect to be able to access this from JavaScript:


      var thePostForm = parent.PostFrame.document.forms[0];


but we are not able to. Reassigning to Parser for further triage -


For convenience, here are the URLs for the two frames above:

      http://redlands.alexandria.ucsb.edu/website/sendarcxml/test.htm
      http://redlands.alexandria.ucsb.edu/website/sendarcxml/jsForm.htm



And here is the HTML from jsForm.htm:



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>
<HEAD>
        <TITLE>Default Form</TITLE>
        <!-- Title must match header.htm's title -->
        <SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">

          function passXML() {
                  // Esrimap connector writes necessary lines here
          }               
        

</SCRIPT>
</HEAD>

<BODY BGCOLOR="Black" onload="passXML()">
  <FORM ACTION="" METHOD="POST" name="theForm">
          <!--- <input type="Hidden" name="Form" value="True"> --->
          <INPUT TYPE="Hidden" NAME="ArcXMLRequest" 
                               VALUE="">                 
          <INPUT TYPE="Hidden" NAME="JavaScriptFunction"                                 
                               VALUE="parent.MapFrame.processXML">
          <INPUT TYPE="Hidden" NAME="HeaderFile"                                
                               VALUE="c:/ArcIMS/Website/sendArcXML/header.htm">
          <INPUT TYPE="Hidden" NAME="FooterFile"                                
                               VALUE="c:/ArcIMS/Website/sendArcXML/footer.htm">
          <INPUT TYPE="Hidden" NAME="FormExists" 
                               VALUE="Yes">
        
  </FORM>
</BODY>
</HTML>
Assignee: rogerl → harishd
Status: UNCONFIRMED → NEW
Component: Javascript Engine → Parser
Ever confirmed: true
QA Contact: pschwartau → janc
2000102120:
I assumed that since when I hit view page source  and it showed
html--body-/body-/html that it was a bug in the document write. But the image
display works with a different service (world_image).

Really a bug that 'view source' for the window that has been dynamically
modified is not correctly shown. Assigning as works for me, should a new bug be
filed for the view source problem?
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → WORKSFORME
QA Contact: janc → bsharma
updated qa contact.
The image is not visible for 'sanfrancisco', then tried 'world_image' or 
'worldimage', the image is still not displayed.
I am reopening the bug, please let me know if there is other way i can verify 
the bug.
Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
When I enter a value and click 'Send Request' I get:

Error: 503
Location: /servlet/com.esri.esrimap.Esrimap

in the bottom frame.
Http 503 is 'Service Unavailable'.
I presume this is what you'll get if you use a diferent browser.
Let's see if the evangelism folks can help us with the HTTP 503 problem. 

CCing Arun.
Status: REOPENED → ASSIGNED
Phil: Could you please deduce a reduced testcase for the problem?  Thanx.
Attached file HTML testcase
Remember, the given URL had this HTML:

<FRAMESET  ROWS="*,100">
    <FRAME NAME="MapFrame"  SRC="test.htm"     etc. >
    <FRAME NAME="PostFrame" SRC="jsForm.htm"   etc. >
</FRAMESET>

The testcase above consists of just the test.htm frame, with 
debugging alertboxes added. I also populate the Response
textarea with a (quoted) URL to a mozilla.org gif file. 
The double quotes that surround the URL are important; see below.

Load the testcase in Mozilla, and then click on the "Show Map" button.
You will see the mozilla gif load just fine into the popup window.
If you erase the left double quote from the Response textarea and 
try again, it again works perfectly. However, if you erase the 
right double-quote, the popup window comes up blank.

The debugging alerts make it clear why. The showMap() function is 
looking for a double-quote character as the terminator of the 
URL string inside the Response textarea. The text of the showMap() 
function is printed in the original bug report above.

In my opinion, we can close this bug. There must have been something
wrong with either the URL to the map, or the way it was formatted
in the Response textarea. We can see that if we follow the code
instructions at this site, Mozilla brings up the image just fine.
Sorry for the lack of reply. Didn't realize this was still open, and in crisis 
mode (new machines, db that's on it's last leg, and interviewing for a 
new sysadmin, and recently noticed the beta version of the map server 
on the machine expired).
Fixed is a good resolution. Works fine with functioning services. Source 
works fine. Moz knows there's an image to be fetched.
Based on Phil's comment marking the bug invalid.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago23 years ago
Resolution: --- → INVALID
QA Contact: bsharma → moied
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: