I think the normal is is to put a 2x4 on the sides and top of the window opening and foam to that so the window gets full support nailed to the top and sides.
When doing the sill pan we quit doing the top of the opening so any leak from above will go to the window and around and out the bottom.