Closed Bug 485407 Opened 16 years ago Closed 16 years ago

Assignment to undeclared variable dragAfter

Categories

(Toolkit :: Toolbars and Toolbar Customization, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: philor, Assigned: ehsan.akhgari)

References

()

Details

Attachments

(2 files, 2 obsolete files)

When bug 251627 added tracking whether the window is ltr or rtl to decide which side to drop on, it failed to declare var dragAfter, making it an unintentional global.
And despite the microscopic scrutiny it went through, that seems to have made it into the SeaMonkey fork, too.
It's a temporary fork Phil, so we forked their bugs as well. :P
Attached patch No-brainer :-)Splinter Review
Assignee: nobody → ehsan.akhgari
Status: NEW → ASSIGNED
Attachment #369655 - Flags: review?(gavin.sharp)
In other parts of customizeToolbar.js we use this style: var value = direction == "ltr"? "left" : "right"; This version uses the more compact coding style: var dragAfter = direction == "ltr" ? aEvent.clientX > dropTargetCenter : aEvent.clientX < dropTargetCenter;
Attachment #369668 - Flags: review?(gavin.sharp)
Attachment #369668 - Flags: review?(ehsan.akhgari)
Comment on attachment 369668 [details] [diff] [review] Patch v1.0: consistent code style. What do you think Ehsan?
Comment on attachment 369668 [details] [diff] [review] Patch v1.0: consistent code style. I think this is harder to read and too long of a line :)
Attachment #369668 - Flags: review?(gavin.sharp) → review-
Attachment #369655 - Flags: review?(gavin.sharp) → review+
Attachment #369670 - Flags: superreview?(neil)
Attachment #369670 - Flags: review?(neil)
> I think this is harder to read and too long of a line :) So wrap on multiple lines? var dragAfter = direction == "ltr" ? aEvent.clientX > dropTargetCenter : aEvent.clientX < dropTargetCenter;
Attachment #369670 - Flags: superreview?(neil)
Attachment #369670 - Flags: review?(neil)
Comment on attachment 369670 [details] [diff] [review] Patch v1.0-comm comm-central version. var dragAfter = direction == "ltr" ? aEvent.clientX > dropTargetCenter : aEvent.clientX < dropTargetCenter;
Attachment #369670 - Flags: superreview+
Attachment #369670 - Flags: review+
Is that your entry in the "Make A Simple JavaScript Assignment Easy To Misunderstand" contest? If so, you should probably sneak in use of the comma operator, that always helps obfuscate.
Carrying forward r+/sr+ for suite/comm-central > (From update of attachment 369670 [details] [diff] [review]) > var dragAfter = direction == "ltr" ? aEvent.clientX > dropTargetCenter : > aEvent.clientX < dropTargetCenter; Nit Fixed.
Attachment #369668 - Attachment is obsolete: true
Attachment #369670 - Attachment is obsolete: true
Attachment #369700 - Flags: superreview+
Attachment #369700 - Flags: review+
Attachment #369668 - Flags: review?(ehsan.akhgari)
(In reply to comment #5) > (From update of attachment 369668 [details] [diff] [review]) > What do you think Ehsan? FWIW, I find the use of the conditional test in non-trivial assignments confusing. Indentation can be used to compensate for the problem partly, but I don't get why one would do that in the first place. :-) (And as far as the coding conventions in the file are concerned, I'd file a bug to fix any other such assignments instead of adding more of them...)
Landed on mozilla-central: <http://hg.mozilla.org/mozilla-central/rev/68b8e8a9c0c7>. Keeping open until it's landed on comm-central as well.
Whiteboard: [landed on m-c]
Comment on attachment 369700 [details] [diff] [review] [comm-central checkin-needed] Patch v1.1-comm comm-central version. > Keeping open until it's landed on comm-central as well. I don't have checkin privileges. Setting keywords.
Attachment #369700 - Attachment description: Patch v1.1-comm comm-central version. → [comm-central checkin-needed] Patch v1.1-comm comm-central version.
Keywords: checkin-needed
Whiteboard: [landed on m-c] → [landed on m-c][for c-c checkin]
Pushed to comm-central, changeset 266595448dd8.
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Whiteboard: [landed on m-c][for c-c checkin]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: