Closed Bug 1502312 Opened 6 years ago Closed 6 years ago

PlacesUtils.validatePageInfo isn't setting requiredIf for url/guid properly.

Categories

(Toolkit :: Places, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla65
Tracking Status
firefox65 --- fixed

People

(Reporter: standard8, Assigned: standard8)

References

(Blocks 1 open bug)

Details

(Whiteboard: [fxsearch])

Attachments

(1 file)

In PlacesUtils.validatePageInfo we currently have:

```
  validatePageInfo(pageInfo, validateVisits = true) {
    return this.validateItemProperties("PageInfo", PAGEINFO_VALIDATORS, pageInfo,
      { url: { requiredIf: b => { typeof b.guid != "string"; } },
        guid: { requiredIf: b => { typeof b.url != "string"; } },
        visits: { requiredIf: b => validateVisits  },
      });
  },
```

I just realised this is wrong, as the curly braces around the typeof mean that it is treated as a function body, and hence would require a return statement to return the value. So they'd never be set as required.
Pushed by mbanner@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/f2ea2c762c5d
PlacesUtils.validatePageInfo isn't setting requiredIf for url/guid properly. r=mak
https://hg.mozilla.org/mozilla-central/rev/f2ea2c762c5d
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla65
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: