Closed Bug 294674 Opened 19 years ago Closed 3 years ago

Copy/cut/paste in iframe with base href and designMode="on" corrupts "img src" and "a href" addresses

Categories

(Firefox :: General, defect)

x86
Windows XP
defect
Not set
major

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: soren, Unassigned)

References

()

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4

We use Midas/designMode="on" and iframes to implement a web content editor.

Unfortunately, copy/cut/paste within the designMode="on" iframe ignores the
iframe's "base href" and uses the iframe's document location instead. The result
is that the image and link addresses in the cut/copied/pasted content are
changed/corrupted.

Importance: This is a major problem for Mozilla's/Firefox's use in web content
management systems etc. with Midas/designMode-based web content editors. Users
risk breaking the edited content (unless they manually repair the corrupted
image/link addresses after using copy/cut/paste - a cumbersome and error prone
process).

Reproducible: every time (including testing a number of different
Midas/designMode-based web content editor products from different vendors).


Reproducible: Always

Steps to Reproduce:
Test case files:
/image1.png
/image2.png
/test/image3.png
/test/editor/image4.png
/test/editor/test.html
/test/editor/test.iframe.html

1) Open the "http://editor.hardcoreinternet.co.uk/test/editor/test.html" web
page in the web browser.
Four images are display correctly in the editable "content" iframe. The image
and link addresses are correctly resolved relative to the iframe's "base href"
as they should be.

2) Select the "View HTML" button to view the HTML code from the "content" iframe.
The HTML code is:
<a href="image1.png"><img src="image1.png"></a>
<a href="/image2.png"><img src="/image2.png"></a>
<a href="/test/image3.png"><img src="/test/image3.png"></a>
<a href="/test/editor/image4.png"><img src="/test/editor/image4.png"></a>

3) Focus the "content" iframe with the four images and select all the content
(i.e. using CTRL+A).

4) Copy or cut all the content (i.e. using CTRL+C or CTRL+X)

5) Paste the content back into the "content" iframe (i.e. using CTRL+V)
Only two of the four images are now displayed and the two other images are "broken".

6) Select the "View HTML" button to view the HTML code from the "content" iframe.

Actual Results:  
The HTML code is now:
<a href="../../image1.png"><img src="../../image1.png"></a>
<a href="../../image2.png"><img src="../../image2.png"></a>
<a href="../image3.png"><img src="../image3.png"></a>
<a href="image4.png"><img src="image4.png"></a>

The "a href" and "img src" addresses have been changed to be relative to the
iframe's document location instead of being relative to the iframe's "base
href". All eight image/link addresses are wrong (although two of the images are
still displayed). The web browser still tries to resolve the image and link
addresses relative to the iframe's "base href" as they should be, but the image
and link addresses in the content are now relative to the iframe's document
location.


Expected Results:  
Solution: Copy/cut/paste should not modify the image and link addresses.

The HTML code should still be:
<a href="image1.png"><img src="image1.png"></a>
<a href="/image2.png"><img src="/image2.png"></a>
<a href="/test/image3.png"><img src="/test/image3.png"></a>
<a href="/test/editor/image4.png"><img src="/test/editor/image4.png"></a>
I have seen exactly this problems several times with Firefox. It forces me to
have our users not use Mozilla based editors. This is a critical bug.
The Kupu editor is affected by this bug as well. The testcase in the URL
reliably reproduces the problem in firefox for me.
Because of Bug 290740 this problem also affects absolute URLs when they are
moved around. The move causes them to be changed to relative, and this bug then
means they get broken.
Two years later this bug is still around in Firefox 2.0.0.4. Please, do take care of it.
(In reply to comment #4)
> Two years later this bug is still around in Firefox 2.0.0.4. Please, do take
> care of it.
> 

That is the biggest problem with OpenSource software, because everyone contributes  no one wants to takle the hard bits. Someone needs to fix this, its a stupid bug.
This bug impacts SamePlace, preventing me from copying out of the chat window. Also breaks pasting linked text into a chat. 
Blocks: 424615
Test case is 404.

Marking this as Resolved > Incomplete since the last real activity on this issue was 14 years ago (reported for Windows XP) and it might not be relevant anymore.
Feel free to re-open it if it's not the case and the issue is still relevant.

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.