I think you can do something simpler like :
```
sandbox.stub(window, "AppPort").returns({postEvent: spy()});
```

It will effectively mock the `AppPort` constructor and get rid of the cumbersome `mozSocial` part.