The name Jesus was independently revealed to both Mary and Joseph. If you read through Isaiah 7:14 you would expect His name to be Immanuel. But . . . first the angel appeared to Mary and told her she would bear the Savior of the world and told her to call Him Jesus. Then Joseph found out that she was pregnant and did not believe her. Only then did an angel appear to him in a dream and tell him to call the baby Jesus.
The name "Jesus" was revealed to both Mary and Joseph, to each one of them independently. This is one example of God’s Word being corroborated by matching dreams, visions, or revelations. (See also Paul & Ananias in Acts 9 and Peter & Cornelius in Acts 10.) This is important in confirming Mary's truthfulness and that the dream Joseph had really was from God.