I've seen instructions on the cans of spray foam saying not to use it inside electrical boxes. So it's definitely not "listed for the purpose"...