If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

except for first use of midas in session, setting designMode=on loses iframe contents and calls onload again

RESOLVED WORKSFORME

Status

()

Core
Editor
RESOLVED WORKSFORME
15 years ago
12 years ago

People

(Reporter: Jesse Ruderman, Assigned: Kathleen Brade)

Tracking

({testcase})

Trunk
x86
Windows XP
testcase
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: midas)

Attachments

(3 attachments)

(Reporter)

Description

15 years ago
Setting designMode to "on" sometimes causes the iframe's onload to be called
again.  With the testcase, it is called again if and only if it's not the first
time you've loaded the testcase with the Mozilla instance.

I don't know whether it's correct for onload to be called again or not, but
sometimes calling it again can't be right.
(Reporter)

Comment 1

15 years ago
Created attachment 117163 [details]
testcase: setting designMode causes iframe's onload to be called again (except on first use of midas in session)
(Reporter)

Comment 2

15 years ago
Meant to assign to Brade.
Assignee: jfrancis → brade
(Reporter)

Updated

15 years ago
Attachment #117163 - Attachment description: testcase → testcase: setting designMode causes iframe's onload to be called again (except on first use of midas in session)
(Reporter)

Comment 3

15 years ago
I just realized that my original problem, which I thought was a separate bug,
has the same conditions as this bug.  Updating summary.  About to attach a
testcase for my original problem.
Summary: setting designMode *sometimes* causes iframe's onload to be called again → except for first use of midas in session, setting designMode=on loses iframe contents and calls onload again
(Reporter)

Comment 4

15 years ago
Created attachment 117167 [details]
testcase: setting designMode loses iframe contents (except on first use of midas in session)
(Reporter)

Comment 5

15 years ago
I'm using Mozilla build 03/13:08 on Windows XP, but I first ran into this bug
using an older build.

My workaround is to set m.contentDocument.body.innerHTML twice in my code: just
before setting designMode="on" (for the first-use-in-session case), and in a
function set as the second onload handler for the iframe just after setting
designMode="on" (for the other case).  There's probably a simpler and more
obvious workaround, or someone else would have already reported this bug.
(Assignee)

Updated

15 years ago
Whiteboard: midas

Comment 6

15 years ago
What you've done doesn't work at on IE either. I'm don't think you should be
setting document.designMode to on in the onload of the iframe.
(Reporter)

Comment 7

15 years ago
When should I be setting document.designMode?  In the onload of the iframe's
contents, right?

* I can't do it in the onload of the iframe's contents because of bug 197305
(can't use data: URLs with Midas).

* Why is the onload of the iframe not the same as the onload of the iframe's
contents?

Comment 8

15 years ago
In the examples I have looked at, document.designMode is set in the iframe in
the onload of the parent of the iframe. That seems to be pretty common.

That way you guarantee that the iframe has been instantiated completely.

Comment 9

15 years ago
I'm having this problem too.

Also, when I load a page that already has some content into the iframe, set its
designmode to "on" and then refresh, the page becomes empty. Then, when I press
the "back" button, the original contents of the iframe's src page reappears,
editable, but all chenges i made were lost.

Comment 10

15 years ago
I find its best to attach the onload event to the contentWindow of the iframe,
this can only be done after the iframe has been added to the document -
otherwise you get no properties error.
  document.body.appendChild(iframe1);
  iframe1.contentWindow.onload = function() {
    var doc = this.document;
    try {
      doc.designMode = "on";
    } catch (e) {
    };
  }; 

If you then wish to set some content you must put a delay timer in before doing
so - see bug <a href="http://bugzilla.mozilla.org/show_bug.cgi?id=206654">206654</a>

Comment 11

14 years ago
*** Bug 238944 has been marked as a duplicate of this bug. ***

Updated

14 years ago
Keywords: testcase
I think this is fixed now. I don't see the bug anymore in a 2005-02-24 build. I
think this was fixed with the fix for bug 209020.
Depends on: 209020
(Reporter)

Comment 13

13 years ago
I still see this bug using
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b2) Gecko/20050225
Firefox/1.0+

Comment 14

12 years ago
Both testcases works fine for me, using build 20050621 on win xp. First testcase
shows one onload call in the status bar, and the second testcase does not loose
the initial value when designmode is set to on

Comment 15

12 years ago
Created attachment 187017 [details]
testcase: setting designMode causes iframe's onload to be called again (except on first use of midas in session) not using window.status

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b2) Gecko/20050619
Firefox/1.0+

window.status doesn't seem to working on the build I'm using, so I'm posting a
test case that doesn't use it.

Comment 16

12 years ago
All test cases WFM.  Probably fixed when bug 209020 and bug 283897 were fixed.

Comment 17

12 years ago
WFM too: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b2)
Gecko/20050703 Firefox/1.0+

Please reopen if you can reproduce with a nightly build
Status: NEW → RESOLVED
Last Resolved: 12 years ago
Resolution: --- → WORKSFORME
(Reporter)

Comment 18

12 years ago
WFM Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b4) Gecko/20050718
Firefox/1.0+

No difference between first load and subsequent loads.
You need to log in before you can comment on or make changes to this bug.