90 mins should be plenty. On arrival, you bypass Cdn customs and go to directly to US preclearance for connections (pick up checked bags before entering the customs hall). This is a small section of the main customs hall - wait is usually not too bad.
The PVG flight gets in around 1800, I believe, and there should be a late evening departure for EWR (around 2100). So if you miss your connection, you should still be able to make the last flight