Is that guaranteed to give the current buffer on the selected frame?

you're asking me? :)

I don't know, till now it worked fine!