Our webapp (an online advertising campaign console) supports ad tags that are converted from flash using Swiffy. In our UI, we have a page where you can preview and edit the ad, and some changes cause the preview (an IFRAME) to be reloaded with an updated preview (e.g. if we change the URL passed as the clickTag value to the ad).
The first time we display a Swiffy preview, everything works fine; but on the second and subsequent attempts, we see the following in the browser (Chrome 43.0.2357.130) console:
Uncaught TypeError: Cannot redefine property: __swiffy_override
(anonymous function) @ runtime.js:163
(anonymous function) @ runtime.js:799
It seems that what's going on here is that Swiffy is using Object.defineProperty(Date,"__swiffy_override",{value:Fh})
. According to MDN, unless you specify {configurable: true}
in the third argument, you will get this exception.
We're currently using the version of runtime.js from Google's CDN (https://www.gstatic.com/swiffy/v7.2.0/runtime.js). We could, of course, copy this into our own CDN and edit the javascript, but this has obvious maintainability issues.
Is this something that should be reported back to Google as a bug? (If so, how does one do that?)
Is this a problem other people have run into, and have work-arounds for?
It sounds like you are not actually reloading the contents of the IFRAME when updating the preview, otherwise the error shouldn't occur, Date.__swiffy_override
would not be defined at that point.
If you aren't able to completely reload the content of the IFRAME, are you able to load the Swiffy runtime just once, and create a new swiffy.Stage for each preview update?
Note, I've not tested this, and it may not work in some circumstances (if at all). I'd be especially wary of creating swiffy.Stages with different ActionScript versions for instance. The safe bet would always be to completely reload the IFRAME each time.