Closed
Bug 691103
Opened 13 years ago
Closed 13 years ago
nsBoxObject::SetPropertyAsSupports cannot recognize nsInterfaceHashtable.Init error
Categories
(Core :: XUL, defect)
Core
XUL
Tracking
()
RESOLVED
FIXED
mozilla13
Tracking | Status | |
---|---|---|
firefox10 | - | --- |
People
(Reporter: m_kato, Assigned: m_kato)
Details
(Whiteboard: [inbound])
Attachments
(1 file)
861 bytes,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
Although nsInterfaceHashtable.Init returns bool, nsBoxObject::SetPropertyAsSupports uses NS_FAILED. NS_FAILED(bool) is always true.
![]() |
||
Comment 1•13 years ago
|
||
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?
Comment 2•13 years ago
|
||
(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
Updated•13 years ago
|
Keywords: regression
![]() |
||
Comment 3•13 years ago
|
||
> 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....
![]() |
||
Comment 4•13 years ago
|
||
I did just verify that bool(true & 0x80000000) is false, and likewise for false. Sorry for the false alarm. :(
Updated•13 years ago
|
Assignee | ||
Comment 5•13 years ago
|
||
Assignee | ||
Updated•13 years ago
|
Attachment #592595 -
Flags: review?(bzbarsky)
![]() |
||
Comment 6•13 years ago
|
||
Comment on attachment 592595 [details] [diff] [review]
fix
r=me
Attachment #592595 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Comment 7•13 years ago
|
||
Whiteboard: [inbound]
Comment 8•13 years ago
|
||
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.
Description
•