IE9“无法从释放的脚本执行代码"调用hasOwnProperty()时 [英] IE9 "Can't execute code from freed script" when calling hasOwnProperty()

查看:96
本文介绍了IE9“无法从释放的脚本执行代码"调用hasOwnProperty()时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是场景:

我有一个容器页面,可以将iFrame换入和换出以显示不同的内容.所有iFrame都来自同一域. https已启用.

I have a container page that swaps iFrames in and out to show different content. All iFrames come from the same domain. https is enabled.

  • 容器页面上有一个名为Flow的对象,其功能为set/getParameter
  • 第一个iFrame s0-welcome创建一个对象,数据并调用Flow.setParameter('data',data);
  • 然后,容器用第二个iFrame s1-transfer替换第一个iFrame.
  • s1-transfer调用Flow.getParameter('data')并将其存储在本地变量s1data

在IE9调试工具控制台中,如果键入s1data,它将显示该对象的所有属性.但是,如果我调用s1data.hasOwnProperty('prop1'),则会收到无法从释放的脚本执行代码"错误.如果我调用Object.prototype.hasOwnProperty.call(s1data,"prop1"),一切正常.

In the IE9 debug tools console, if I type s1data it shows me all the properties of that object. However, if I call s1data.hasOwnProperty('prop1'), I get a "Can't execute code from a freed script" error. If I call Object.prototype.hasOwnProperty.call(s1data, "prop1"), everything works fine.

在我看来,可能有两种可能性:

It looks to me that there can be 2 possibilities:

1)容器页面保留了第一个iFrame的引用,但是当第一个iFrame被释放时,它将丢失一些数据.这似乎不太可能,因为我唯一无法访问的是函数

1) Container page holds on to the reference from the first iFrame, but when the first iFrame gets disposed, it loses some of the data. This seems unlikely since the only thing I can't access is functions

2)有一个安全限制,即使两个iFrame来自同一域,也不允许一个iFrame运行与另一个iFrame相关的代码.

2) There is a security restriction that does not allow one iFrame to run code related to another iFrame even if both iFrames are from the same domain.

有什么想法吗?

推荐答案

只是遇到了类似的问题.对我来说,只需将s1data.hasOwnProperty('prop1')更改为('prop' in s1data)即可消除错误.

Just ran into a similar issue. For me, simply changing s1data.hasOwnProperty('prop1') into ('prop' in s1data) made the error go away.

这篇关于IE9“无法从释放的脚本执行代码"调用hasOwnProperty()时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆