简体   繁体   中英

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

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM