Last Comment Bug 224952 - javascript: iframe_element.src = href remain NULL
: javascript: iframe_element.src = href remain NULL
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: DOM: Core & HTML (show other bugs)
: Trunk
: All All
: -- normal (vote)
: ---
Assigned To: Johnny Stenback (:jst, jst@mozilla.com)
:
:
Mentors:
http://isohunt.com/files.php?ihq=linu...
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2003-11-06 19:20 PST by Gary
Modified: 2008-07-31 02:38 PDT (History)
3 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Make iframe.src default to "" (1.05 KB, patch)
2003-11-20 16:15 PST, Johnny Stenback (:jst, jst@mozilla.com)
caillon: review+
bzbarsky: superreview+
dbaron: approval1.6b+
Details | Diff | Splinter Review

Description Gary 2003-11-06 19:20:32 PST
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:  
http://isohunt.com/servers.php 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 (trObj.style.display=="none") {
      trObj.style.display="";
      nameObj.style.background="#ECECD9";
      if (ifObj.src == "") ifObj.src = href;
      smoothHeight('ihif' + i, 0, 210, 42, 'o');
    }
    else {
      nameObj.style.background=nColor;
      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 
before.
Comment 1 Boris Zbarsky [:bz] (still a bit busy) 2003-11-06 20:44:44 PST
>      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?
Comment 2 Boris Zbarsky [:bz] (still a bit busy) 2003-11-06 23:56:54 PST
.
Comment 3 Gary 2003-11-16 13:36:33 PST
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 == 
"").
Comment 4 Boris Zbarsky [:bz] (still a bit busy) 2003-11-16 13:44:57 PST
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...
Comment 5 Johnny Stenback (:jst, jst@mozilla.com) 2003-11-20 16:15:23 PST
Created attachment 136018 [details] [diff] [review]
Make iframe.src default to ""

For compatibility's sake, revert back to returning "" for no URI attribute.
Comment 6 Boris Zbarsky [:bz] (still a bit busy) 2003-11-20 16:33:59 PST
Comment on attachment 136018 [details] [diff] [review]
Make iframe.src default to ""

sr=bzbarsky

Could this please be approved for 1.6b?  We don't really want to break this.
Comment 7 Johnny Stenback (:jst, jst@mozilla.com) 2003-11-20 17:00:18 PST
Fixed.

Note You need to log in before you can comment on or make changes to this bug.