IE9 “Can't execute code from freed script” when calling hasOwnProperty()

試著忘記壹切 提交于 2019-12-11 10:48:28

问题


Here is the scenario:

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.

  • The container page has an object called Flow, with functions set/getParameter
  • The first iFrame, s0-welcome, creates an object, data, and calls Flow.setParameter('data', data);
  • The container then replaces the first iFrame with a second iFrame, s1-transfer.
  • The s1-transfer calls Flow.getParameter('data') and stores it in a local variable s1data

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) 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) 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.

Any thoughts?


回答1:


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



来源:https://stackoverflow.com/questions/8317725/ie9-cant-execute-code-from-freed-script-when-calling-hasownproperty

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!