author | Marco Bonardo <mbonardo@mozilla.com> |
Fri, 30 Sep 2016 11:42:28 +0200 | |
changeset 316132 | 43c03bc692083131117463df747c15ab82eb3ad7 |
parent 316131 | 3820efc791553122908ff5b2f209d90bc305b527 |
child 316133 | f2181015902f1bd9e533bf6103bbbb9e65d2436e |
push id | 30762 |
push user | philringnalda@gmail.com |
push date | Sat, 01 Oct 2016 21:00:36 +0000 |
treeherder | mozilla-central@d1fd56faaeb9 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | adw |
bugs | 1306466 |
milestone | 52.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
toolkit/components/places/History.jsm | file | annotate | diff | comparison | revisions | |
toolkit/components/places/tests/history/test_insert.js | file | annotate | diff | comparison | revisions |
--- a/toolkit/components/places/History.jsm +++ b/toolkit/components/places/History.jsm @@ -85,16 +85,19 @@ Cu.importGlobalProperties(["URL"]); * Whenever we update or remove numerous pages, it is preferable * to yield time to the main thread every so often to avoid janking. * These constants determine the maximal number of notifications we * may emit before we yield. */ const NOTIFICATION_CHUNK_SIZE = 300; const ONRESULT_CHUNK_SIZE = 300; +// Timers resolution is not always good, it can have a 16ms precision on Win. +const TIMERS_RESOLUTION_SKEW_MS = 16; + /** * Sends a bookmarks notification through the given observers. * * @param observers * array of nsINavBookmarkObserver objects. * @param notification * the notification name. * @param args @@ -495,17 +498,17 @@ function validatePageInfo(pageInfo) { }; if (!isValidTransitionType(visit.transition)) { throw new TypeError(`transition: ${visit.transition} is not a valid transition type`); } if (inVisit.date) { ensureDate(inVisit.date); - if (inVisit.date > Date.now()) { + if (inVisit.date > (Date.now() + TIMERS_RESOLUTION_SKEW_MS)) { throw new TypeError(`date: ${inVisit.date} cannot be a future date`); } visit.date = inVisit.date; } if (inVisit.referrer) { visit.referrer = normalizeToURLOrGUID(inVisit.referrer); }
--- a/toolkit/components/places/tests/history/test_insert.js +++ b/toolkit/components/places/tests/history/test_insert.js @@ -73,17 +73,17 @@ add_task(function* test_insert_error_cas transition: TRANSITION_LINK, date: "a" } ]}), /TypeError: Expected a Date, got a/, "passing a second visit object with an invalid date to History.insert should throw a TypeError" ); let futureDate = new Date(); - futureDate.setDate(futureDate.getDate() + 1); + futureDate.setDate(futureDate.getDate() + 1000); Assert.throws( () => PlacesUtils.history.insert({ url: TEST_URL, visits: [ { transition: TRANSITION_LINK, date: futureDate, }