add window.Buffer and tests