Fix code for determining whether to use defaultView as sandbox scope