Closed Bug 1195123 Opened 6 years ago Closed 6 years ago

Pull "!" inverting operator out of logic in SVG-image rejection code, to make it clearer that it matches the comment

Categories

(Core :: SVG, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla43
Tracking Status
firefox43 --- fixed

People

(Reporter: dholbert, Assigned: dholbert)

References

Details

Attachments

(1 file)

As noted in bug 693940 comment 37, and bug 693940 comment 39, we've got some code for rejecting SVG images which is the inverse of the comment that describes it.

(The comment describes what's accepted; the code tests for what's rejected.)

This could be made clearer by pulling the "!" out of the code, so that we effectively have:
 if (!(accepted)) {
   reject;

Then it's easier to audit that the code matches the comment.
[er, somehow ended up with an arbitrary component. Sorry; --> SVG]
Component: Audio/Video: Playback → SVG
Attached patch fix v1Splinter Review
So this patch changes:
 if (!A || (!B && !C))
...to:
 if (!(A && (B || C))
...which are be equivalent by the laws of logic and how "!" is applied to a complex expression.
Attachment #8648503 - Flags: review?(longsonr)
Attachment #8648503 - Flags: review?(longsonr) → review+
https://hg.mozilla.org/mozilla-central/rev/1563c2cabdc8
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
You need to log in before you can comment on or make changes to this bug.