Closed Bug 308185 Opened 19 years ago Closed 7 years ago

XmlHttpRequest uses incorrect Url, when relative Url is given to open() method.

Categories

(Core :: XML, defect)

1.7 Branch
x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: flashfm, Unassigned)

References

Details

Attachments

(3 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU; rv:1.7.10) Gecko/20050717 Firefox/1.0.6
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU; rv:1.7.10) Gecko/20050717 Firefox/1.0.6

When i use XMLHttpRequest class in function, that called from child iframe with
source like "Default.aspx/test/1.html" and pass relative Url to open() method of
XMLHttpRequest object, it consider that base url is "Default.aspx/test/" but not
"/". I suppose that it is error, because invocation of top's function cannot
depend on iframe source.

Reproducible: Always

Steps to Reproduce:
1.Create ASP.NET web-application with one serverside executed file Default.aspx.
It's contents, for example, must be:
<%@ Page language="c#" AutoEventWireup="false"%>
<% Response.Write("<a href='javascript: top.doIt();'>Do It</a>"); %> 

2. Create file index.html in folder of this web-application. Let it's contents are:

<html>
<body>
<script language="javascript" type="text/javascript">
var xmlhttp;
function doIt()
{
  xmlhttp = new XMLHttpRequest();
  xmlhttp.open("GET", "readme.txt", true);
  xmlhttp.onreadystatechange = function() {
    if (xmlhttp.readyState==4)
      alert('Response: ' + xmlhttp.responseText);
  }
  xmlhttp.send(null);
}
</script>
<iframe src="Default.aspx/test/2.html"></iframe>
</body>
</html>

3. Create text file readme.txt with one string in it: "You'll not see this text
in Firefox"

4. Compile your application and load in filefox page
"http://localhost/%YOUR_WEBAPP_NAME%/index.html" and than click to "Do It" link.

Actual Results:  
Message box with message: "Response: <a href='javascript: top.doIt();'>Do It</a>"

Expected Results:  
Message box with message: "Response: You'll not see this text in Firefox"
Attached file Readme.txt file
Assignee: nobody → xml
Component: General → XML
Product: Firefox → Core
QA Contact: general → ashshbhatt
Version: unspecified → 1.7 Branch
This is by-design, actually.  The problem is telling where the string comes from. Is it coming from the function you called or from the caller?  The base URI should be different in those cases for optimal behavior.

I have to ask.  What does IE do?
Flags: blocking1.9a1?
Flags: blocking1.9a1? → blocking1.9-
jonas says this is an IE compat bug and that he's going to fix it.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Whiteboard: [wanted-1.9]
Flags: wanted1.9+
Whiteboard: [wanted-1.9]
Assignee: xml → nobody
QA Contact: ashshbhatt → xml
This hasn't been a compat problem for a long time, if ever (and the standard settled on our behavior).
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: