[RFE] XUL iframe onload event

VERIFIED WONTFIX

Status

()

--
enhancement
VERIFIED WONTFIX
18 years ago
10 years ago

People

(Reporter: rvj, Assigned: hyatt)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(4 attachments)

(Reporter)

Description

18 years ago
it appears that no onload event is available for XUL iframe/browser/editor 
elements to tell if a document (htm, xml, gif, etc) has loaded or not.

Is this planned and if not could it be? 

When developing UIs some means of letting XUL scripts know when to begin  
processing is needed.  

As a work around, I have attempted to find a method of notifying XUL from the 
document itself but security seems to prevent even this option.

Apologies if this a duplicate (could nt find in XUL component)

Comment 1

18 years ago
->hyatt
Assignee: trudelle → hyatt

Updated

18 years ago
Severity: normal → enhancement
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: other → All
Hardware: Other → All
Summary: [RFE}xul iframe onload event → [RFE] XUL iframe onload event

Comment 2

18 years ago
Marking NEW.
(Assignee)

Comment 3

18 years ago
You do it using iframElt.addEventListener("load", myFunc, true);
Status: NEW → RESOLVED
Last Resolved: 18 years ago
Resolution: --- → INVALID
(Reporter)

Comment 4

18 years ago
Sorry if I'm missing something obvious but I still cant see whats necessary to 
get the iframe load event to fire (attaching xul)

I've even altered the src assignment until after the eventlisterner is added 
(just in case it arrived beforehand) but still no joy.

Even worse the frame does not load at all- is this a separate bug? Thanks.
(Reporter)

Comment 5

18 years ago
Created attachment 27030 [details]
xul test case for onload

Comment 6

18 years ago
uh, if it isn't loading, why would you expect its load handler to fire?
(Reporter)

Comment 7

18 years ago
ok but that was the last test I tried which seems to show up another bug 
associated with setting the src attribute.

a) should I report it as a separate bug?

modified version of test case with src preset attached

b) can you confirm whether the iframeloaded function fires?
(Reporter)

Comment 8

18 years ago
Created attachment 27099 [details]
simple test case for iframe onload event

Comment 9

18 years ago
There is no (to my knowledge) 'src' _property_ for the iframe binding.

The correct way to set the 'src' attribute is through the DOM 'setAttribute'
method, e.g., 
 document.getElementById('someiframe').setAttribute('src','http://www.w3.org');

However, when I add the load listener (either bubbling or capturing), I am
not getting any event notifications (e.g., neither 'load', nor 'click' comes
through). 
Status: RESOLVED → REOPENED
Resolution: INVALID → ---

Comment 10

18 years ago
... although iframe derives from an html iframe which does have that .src
property for its DOM, but the xul iframe is not picking that up from html.
(Reporter)

Comment 11

18 years ago
thanks - revised test case now works !

ps I guess that if src is preset the load event is not fired (maybe because it 
has already arrived?)
(Reporter)

Comment 12

18 years ago
Created attachment 27104 [details]
working test case (without preset src)
(Reporter)

Comment 13

18 years ago
spoke too soon !

new test case (iframe resized after load event ) results in flashing effect (is 
it continually reloading?)

I know there are a number of onload event bugs pending - is this one of them?

(Reporter)

Comment 14

18 years ago
Created attachment 27109 [details]
flashing effect created after load event fires
(Reporter)

Comment 15

18 years ago
and finally  (today)  ..........

I've noticed that the onload event fires fairly reliably for wan http locations 
however this does not seem to be true of lan based http locations .

FYI After clearing cache memory and disc the onload event will fire when the 
XUL application is started. However when the XUL application is subsequently  
restarted it does not.  (a caching issue?)
(Assignee)

Comment 16

18 years ago
I already have a bug about adding the src property to iframes and browsers.
I don't understand, <iframe> has a src in the guide. 
http://www.mozilla.org/xpfe/xulref/iframe.html
(Assignee)

Comment 18

18 years ago
This bug is bogus.  Events in the content DOM don't bubble across iframes.  Only
in chrome docshells does this sort of bubbling occur (and HTML iframes have a
hack that allows you to put onload right on the iframe).

If you disagree with this behavior, file an RFE on jst@netscape.com to request
that events cross iframe boundaries by default in content.
Status: REOPENED → RESOLVED
Last Resolved: 18 years ago18 years ago
Resolution: --- → WONTFIX

Comment 19

18 years ago
Thanks hyatt. Sorry for not getting back to this yesterday. Marking verified.

(To answer boberp last comment: the xul <iframe> has a 'src' _attribute_
( as in <iframe src="..." >), but does not have a 'src' _property_, (as in
document.getElementById('aFrame').src = "...";)
Status: RESOLVED → VERIFIED
rvj asked me to clarify the last two comments, and I couldn't because I have no 
idea what was being said. What is docshell?

AFAIK, Mozilla doesn't support iframe onload events.

<iframe onload="alert('Blah')"  src="www.excite.com">

The alert will never fire. bug 60173. Although this isn't a dupe because he is 
talking about XUL.

Comment 21

18 years ago
Add this file as 'foop.xul' to your comm.jar package, in the 
/content/navigator/ folder. 

Then enter 
  mozilla -console -chrome chrome://content/navigator/foop.xul




<?xml version="1.0"?> 
<window 
  xmlns:html="http://www.w3.org/TR/REC-html40"
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  onload="loadxul();"
  height="400px"
  width="400px"
  align="vertical" > 

<script>
<![CDATA[

var url = ['http://www.mozilla.org/xpfe/',
	   'http://www.mozilla.org/']; 
var idx = 0;

function iframeloaded() {
  dump("iframeloaded\n");
  idx = ++idx % url.length;
  window.setTimeout('foop()', 2000);
}

function loadxul() {
    dump("loadxul\n");
    document.getElementById("iframe").
              addEventListener("load", iframeloaded, true);
    window.setTimeout('foop()', 2000);
}

function foop() {
    dump('foop : ' + url[idx] + '\n');
    document.getElementById("iframe").setAttribute('src', url[idx]);
}

]]>
</script>

<iframe id="iframe" src="http://www.mozilla.org/" flex="1"/>

</window>

Comment 22

18 years ago
And yes, it appears that jst has not done the stuff for iframe onload for 
html (bug 60173 as noted).

Updated

10 years ago
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: jrgmorrison → xptoolkit.widgets
You need to log in before you can comment on or make changes to this bug.