javascript: iframe_element.src = href remain NULL




DOM: Core & HTML
14 years ago
9 years ago


(Reporter: Gary, Assigned: jst)



Firefox Tracking Flags

(Not tracked)




(1 attachment)

1.05 KB, patch
Christopher Aillon (sabbatical, not receiving bugmail)
: review+
Details | Diff | Splinter Review


14 years ago
User-Agent:       Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) Opera 7.21  [en]
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5) Gecko/20031007 Firebird/0.7

An iframe element's SRC cannot be set through javascript.

Reproducible: Always

Steps to Reproduce:
1. Click on a row in the files table
2. Servers page slide out

Actual Results:  
Empty iframe, which is set to a URL.

Expected Results: should be loaded inside iframe, instead of 
iframe_element.src remaining NULL.

The javascript triggered onClick below:

function servOC(i, href, nColor) {
  var trObj = (document.getElementById) ? document.getElementById('ihtr' + i) : 
eval("document.all['ihtr" + i + "']");
  var nameObj = (document.getElementById) ? document.getElementById('name' + i) 
: eval("document.all['name" + i + "']");
  var ifObj = (document.getElementById) ? document.getElementById('ihif' + i) : 
eval("document.all['ihif" + i + "']");
  if (trObj != null) {
    if ("none") {"";"#ECECD9";
      if (ifObj.src == "") ifObj.src = href;
      smoothHeight('ihif' + i, 0, 210, 42, 'o');
    else {;
      smoothHeight('ihif' + i, 210, 0, 42, 'ihtr' + i);

Someone reported this problem exists for Mozilla 1.5 as well, so it's likely a 
new bug introduced to the DOM model recently. I've tested the javascript in 
earlier versions of both Mozilla and Firebird and this problem did not happen 
>      if (ifObj.src == "") ifObj.src = href;

That test fails.  When the src attribute us not set, we return null for the src
property and |null == ""| is false). Just testing (!ifObj.src) should work for
you, I think.

caillon, we return null because of your review comments in bug 212277... I
suspect we may want to revert it to returning empty string if it breaks too many
things.  jst, thoughts?
Assignee: events → general
Component: DOM Events → DOM Core
OS: Windows XP → All
Hardware: PC → All

Comment 3

14 years ago
Interesting, it works. ^.^

But please do keep some level of backward compatibility, as all browsers, 
including Mozilla previously, did not return false on assessing (ifObj.src == 
we want to make a call one way or the other here by 1.6, in my opinion.... 
Assigning to jst to get an executive decision handed down, hopefully...
Assignee: general → jst

Comment 5

14 years ago
Created attachment 136018 [details] [diff] [review]
Make iframe.src default to ""

For compatibility's sake, revert back to returning "" for no URI attribute.


14 years ago
Attachment #136018 - Flags: superreview?(bz-vacation)
Attachment #136018 - Flags: review?(caillon)
Attachment #136018 - Flags: review?(caillon) → review+
Comment on attachment 136018 [details] [diff] [review]
Make iframe.src default to ""


Could this please be approved for 1.6b?  We don't really want to break this.
Attachment #136018 - Flags: superreview?(bz-vacation)
Attachment #136018 - Flags: superreview+
Attachment #136018 - Flags: approval1.6b?
Attachment #136018 - Flags: approval1.6b? → approval1.6b+

Comment 7

14 years ago
Last Resolved: 14 years ago
Resolution: --- → FIXED


9 years ago
Component: DOM: Core → DOM: Core & HTML
QA Contact: ian → general
You need to log in before you can comment on or make changes to this bug.