Closed
Bug 442244
Opened 16 years ago
Closed 16 years ago
Incorrect relative path used in iframe when using documet.write to write content to iframe
Categories
(Core :: General, defect, P1)
Tracking
()
RESOLVED
DUPLICATE
of bug 445004
People
(Reporter: fraser.macdonald, Unassigned)
References
Details
(Keywords: regression, testcase)
Attachments
(1 file)
3.34 KB,
application/octet-stream
|
Details |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1a1pre) Gecko/2008062703 Minefield/3.1a1pre Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1a1pre) Gecko/2008062703 Minefield/3.1a1pre When using an html page to open a second html page, located in a sub directory, within which an iframe is created and html content written using document.write. The relative paths within the iframe are based on the first page not the second. This only appears to be an issue in Firefox 3.x. In the Firefox 2.x versions tested the path is correctly relative to the document root of the second page this is consistent with other browsers. Reproducible: Always Steps to Reproduce: 1. Create an html file that opens a second file located in a sub directory // add script to the head to open the second file <script> function doStart(url) { var f = "toolbar=no, menubar=no, location=no, status=no, scrollbars=yes, resizable=yes, width=800, height=600, left=100, top=100"; win = window.open(url, "myWindow", f); } </script> // call scrip using a link like the following in the pages html <a href="#" onclick="doStart('./content/target.html');">Start<a> 2. Within the second file, located in my example a sub directory called "conetnt" create an iframe and write content to the iframe: // add script to the head to inject the iframe and its content <script> function inject(code, container) { if (!container) container = window.document; if (container.body.insertAdjacentHTML) { container.body.insertAdjacentHTML("beforeEnd", code); } else { var r = container.createRange(); r.setStartBefore(container.body); container.body.appendChild(r.createContextualFragment( code )); } } </script> // add script to html to perform the inject and write content to the iframe inject( '<iframe id="f1" name="f1" src="#" frameborder="1" scrolling="no" tabIndex="10000" style="position: absolute; left: 10px; top: 100px; width: 400px; height: 400px;"></iframe>', window.document ); scode = "<html><head><style>body{font-family:sans-serif;}</style></head><body><img src='images/image.gif' /><br /><br /><script>document.write('Path = ' + window.location.pathname);<\/script></body></html>"; _frame = window.frames[ "f1" ]; _frame.document.open(); _frame.document.write(scode); _frame.document.close(); 3. Add an "images" directory within the "content" directory and add an image (to test the path) I have used "image.gif" in this example 4. Open the first page in Firefox 3.x and click on the "Start" link 5. When the Second page opens the iframe contains a broken link and and outputs an invalid path Actual Results: When the second page draws, the iframe contains a broken image link and the path output refers to the first page not the second. Expected Results: The image should be displayed and the path should refer to the second page.
Reporter | ||
Comment 1•16 years ago
|
||
Comment 2•16 years ago
|
||
Regression range is http://bonsai.mozilla.org/cvsquery.cgi?module=PhoenixTinderbox&date=explicit&mindate=1206193800&maxdate=1206205379 -> Bug 402983.
Blocks: 402983
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: regression,
testcase
Product: Firefox → Core
QA Contact: general → general
Version: unspecified → Trunk
Flags: wanted1.9.1+
Flags: wanted1.9.0.x+
Priority: -- → P1
Comment 3•16 years ago
|
||
I ended up fixing this in bug 445004...
Updated•16 years ago
|
Flags: wanted1.9.1+
Flags: wanted1.9.0.x+
You need to log in
before you can comment on or make changes to this bug.
Description
•