Closed Bug 290366 Opened 20 years ago Closed 19 years ago

JavaScript error in productmenu.js from editflagtypes.cgi and request.cgi when only one product defined

Categories

(Bugzilla :: Bugzilla-General, defect)

2.19
defect
Not set
trivial

Tracking

()

RESOLVED FIXED
Bugzilla 2.22

People

(Reporter: myk, Assigned: wicked)

Details

Attachments

(1 file)

A fresh Bugzilla tip install generates the following error in the JavaScript
console if I go to editflagtypes.cgi and click "Create Flag Type for Bugs":

Error: b has no properties
Source File: http://localhost/bztipb/productmenu.js
Line: 112
Assignee: general → wicked
Looks like this error occurs when only one product is defined. It also affects
request.cgi under same condition. Culprit is line 249 of productmenu.js that
assumes there are atleast two items in the array. I don't think we should end up
there when there is only one array item. Note that the updateSelect function in
js/productform.js seems to work so ultimate solution would be to fix bug 258647.
Severity: normal → trivial
Status: NEW → ASSIGNED
OS: Linux → All
Hardware: PC → All
Summary: JavaScript error in productmenu.js from editflagtypes.cgi on fresh Bugzilla install → JavaScript error in productmenu.js from editflagtypes.cgi and request.cgi when only one product defined
Target Milestone: --- → Bugzilla 2.22
Attached patch Simple fix, V1Splinter Review
This patch fixes the reported problem and similar problem when there are no
products defined. This results in error "a has no properties" on same line. I
tested this with zero products, one product, one product with one or more
components and two products with different amount of components.
Attachment #189787 - Flags: review?(myk)
Comment on attachment 189787 [details] [diff] [review]
Simple fix, V1

Looks good, r=myk
Attachment #189787 - Flags: review?(myk) → review+
Flags: approval+
Checking in productmenu.js;
/cvsroot/mozilla/webtools/bugzilla/productmenu.js,v  <--  productmenu.js
new revision: 1.3; previous revision: 1.2
done
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: