MDL-55283 javascript: Check dir is readable before traversing them