Closed Bug 1366371 Opened 2 years ago Closed 2 years ago

size_t threshold = -1 seems suspicious

Categories

(Core :: Layout, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla56
Tracking Status
firefox56 --- fixed

People

(Reporter: mstange, Assigned: tschneider)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

I didn't catch this in my review in bug 1243846, but I noticed it reading the code again now:

http://searchfox.org/mozilla-central/rev/24c443a440104dabd9447608bd41b8766e8fc2f5/dom/base/DOMIntersectionObserver.cpp#410

We declare the threshold variable as a size_t (which is unsigned), and then later pass it to UpdateIntersectionObservation which takes an int32_t.

If we have no intersection, we will pass -1 here. I think this works, but we should really use a signed type for this variable.
Blocks: 1381574
Priority: -- → P3
Use int32_t for intersection threshold.
Attachment #8889261 - Flags: review?(mstange)
Attachment #8889261 - Flags: review?(mstange) → review+
Pushed by tschneider@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/173b2aadfbab
Use signed integer for intersection threshold. r=mstange
https://hg.mozilla.org/mozilla-central/rev/173b2aadfbab
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
Assignee: nobody → tschneider
You need to log in before you can comment on or make changes to this bug.