Closed Bug 691103 Opened 13 years ago Closed 13 years ago

nsBoxObject::SetPropertyAsSupports cannot recognize nsInterfaceHashtable.Init error

Categories

(Core :: XUL, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla13
Tracking Status
firefox10 - ---

People

(Reporter: m_kato, Assigned: m_kato)

Details

(Whiteboard: [inbound])

Attachments

(1 file)

Although nsInterfaceHashtable.Init returns bool, nsBoxObject::SetPropertyAsSupports uses NS_FAILED. NS_FAILED(bool) is always true.
So this used to always test false, and now always tests true? That's really bad... Michael, could we write some sort of static analysis to catch other cases like this?
Blocks: 675553
Keywords: regression
(In reply to Boris Zbarsky (:bz) from comment #1) > So this used to always test false, and now always tests true? > As far as I can tell, this always tested false, and will continue to test false. The underlying implementation (nsTHashtable) returns true for success and false for failure, so the switch to bool cannot change anything as far as I can tell. > That's really bad... > > Michael, could we write some sort of static analysis to catch other cases > like this? MSVC actually tells us if we're trying to test bits in a bool which cannot be anything but a zero.
No longer blocks: 675553
Keywords: regression
> As far as I can tell, this always tested false, and will continue to test false Ok, then there's no real issue. Comment 0 was implying that NS_FAILED(bool) would be true for some reason, so I assumed there was something about the C++ treatment of bool that I was missing....
I did just verify that bool(true & 0x80000000) is false, and likewise for false. Sorry for the false alarm. :(
Attached patch fixSplinter Review
Attachment #592595 - Flags: review?(bzbarsky)
Attachment #592595 - Flags: review?(bzbarsky) → review+
Assignee: nobody → m_kato
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla13
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: