Fix #2131: document.validate() returns a promise