The top that you have is from a CJ7. You can tell that by 2 ways from a YJ top.
1. The side widows in your top are flat glass, and a YJ has a taller window that has a curve in the top of it.
2. The area behind your window doesn't have the vent in it, like a YJ does.
As for your question about the YJ back glass fitting, NO...the YJ rear window is taller, my rear window is only about 1/2" down from the rear roof light. If it wasn't below zero here right now, I would get you a proper measurement, but I can tell you that I purchased a CJ rear hatch cause mine had the t-handle rusted beyond repair, and it was about 2 inches short or working.
'87 YJ, 4.2L built and bored, 8" of lift, 8.8 rear, AX15/NP 231J, Tom Woods drive shafts, Flat fenders, 12,000LB winch, Custom bumpers, Rattle can paint job. Never completed...