“Great Stuff” in junction boxes

I just bought a new house, and in the electrical outlets in one of the rooms someone has filled in the airspace with what seems to be “Great Stuff”. I’m assuming this is an unnecessary fire hazzard and has to go?
Or is this a fairly standard way of sealing up a drafty 1940’s house?
Any advice appreciated, thanks in advance.
Replies
Do you mean that they filled the inside of the box with foam? If so -- and I've seen that too in a rental -- you have to get rid of it. If it's outside sealing between the box and the rest of the wall, that's a good thing.
-- J.S.
Inside the junction boxes, of course. Thanks for the reply, apparenlty I have work to do...