Closed Bug 108547 Opened 23 years ago Closed 23 years ago

javascript error in attachment.cgi - using bad DOM Style code

Categories

(Bugzilla :: Attachments & Requests, defect, P2)

2.15
defect

Tracking

()

RESOLVED FIXED
Bugzilla 2.16

People

(Reporter: timeless, Assigned: caillon)

References

()

Details

Attachments

(1 file, 1 obsolete file)

Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.5+) Gecko/20011105

Error: small.style.getProperty is not a function
Source File: http://bugzilla.mozilla.org/attachment.cgi?id=56564&action=edit
Line: 212

this build is generally borked, i'm not sure what caused this. oh wait, sure i
am :-)

feel free to dupe.
it's all jkeiser's fault!
Assignee: rods → jkeiser
Um.  Are new bugs just getting assigned to me by default now or something? :)

First, that attachment doesn't even have JavaScript in it--wrong attachment #?

Second, my patch modified a couple of GetProperty methods in *frames*, but I
didn't touch style in the least.  And form control content doesn't have any
getProperty() method to begin with ...

I really have no idea who this goes to though, esp. since I can't see the
testcase :)
Okeee...  the page in question has:

 var small = document.getElementById('smallCommentFrame');
 if ( small.style.getProperty('display') == 'none' )

Too bad that .style gives you a CSSStyleDeclaration and that has no
getProperty() method, just a getPropertyValue().  Over to bugzilla -- this is a
bug in the bugzilla JS pure and simple.
Assignee: jkeiser → myk
Component: HTML Form Controls → Creating/Changing Bugs
Product: Browser → Bugzilla
QA Contact: madhur → matty
Version: other → 2.10
CCing the javascript experts on the Bugzilla team.

I do know the page in question has been completely redone in CVS since the last
time bugzilla.mozilla.org updated, but I don't know if that affected the javascript.
Oh oh oh!  Sorry timeless, I didn't realize I was supposed to be looking at the
actual attachment.cgi page, I was looking at the patch :)
Well, that rewrite may have affected the JS but this error does not occur on
Linux 2001103012 ... so it may be a combo of the two.
what I meant by the page being redone is that the javascript in question may not
even be there anymore on the current version (bugzilla.mozilla.org is not
running the current version until this coming Wednesday night)
OK.  

STEPS TO REPRODUCE:

1) Load an attachment page
2) Submit the form

The onsubmit() handler should fire and cause those errors.  If it does not, it's
a  bug.  If it did not fire prior to jkeiser's checkin.... well... :)

jkeiser, did you actually submit the form when testing?
Taking.
Assignee: myk → caillon
Blocks: 98307
OS: Windows 98 → All
Priority: -- → P2
Hardware: PC → All
Summary: javascript error → javascript error in attachment.cgi - using bad DOM Style code
Target Milestone: --- → Bugzilla 2.16
Version: 2.10 → 2.15
The attached patch gets rid of the bad style.(get|set)Property(foo) and replaces
it with style.foo code plus a minor cleanup.
Status: NEW → ASSIGNED
Keywords: patch, review
Comment on attachment 56606 [details] [diff] [review]
Patch to fix

>   function hideElementById(id)
>   {
>     var elm = document.getElementById(id);
>-    if (!elm) return;
>-
>-    elm.style.setProperty('display', 'none', '');
>+    if (elm) {
>+      elm.style.display = 'none';
>+    }
remove this:
>+    return;
>   }

>   function showElementById(id, val)
>   {
>     var elm = document.getElementById(id);
>-    if (!elm) return;
>-
>-    if (!val) val = 'inline';
>-    elm.style.setProperty('display', val, '');
>+    if (elm) {
>+      if (!val) val = 'inline';
>+      elm.style.display = val;
>+    }
remove this:
>+    return;
>   }

r=timeless w/ those removed
Attachment #56606 - Flags: review-
Comment on attachment 56689 [details] [diff] [review]
Patch v2

This patch removes the two returns and timeless said:

r=timeless w/ those removed
Attachment #56689 - Flags: review+
Attachment #56606 - Attachment is obsolete: true
Comment on attachment 56689 [details] [diff] [review]
Patch v2

r=kiko good work c.
Attachment #56689 - Flags: review+
Checking in template/default/attachment/edit.atml;
/cvsroot/mozilla/webtools/bugzilla/template/default/attachment/edit.atml,v  <--
 edit.atml
new revision: 1.5; previous revision: 1.4
done
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Component: Creating/Changing Bugs → attachment and request management
QA Contact: matty_is_a_geek → default-qa
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: