- Collect all scripts code, extract all variables as keywords with exception of
- JS keywords
- "clean" window properties from blank iframe window
- EPA_ prefixed variables
- EpaWindow properties
- in rendered script declare all collected variables.
- clone all EpaWindow properties into variables.
For each script code
- temporary clear container window properties to avoid leaking container globals into embed-page scope
- preserve "unclean" window properties
- remove those properties from window
- in try{ section insert code }
- catch(ex){ console.error(ex)} will permit to run following SCRIPTs
- finally{}
- move added to container window properties into EpaWindow ( detect by comparing with reference iframe )
- restore container window properties
- For each onXXX attribute
- in try section set event handler
- in event handler body insert code as in 4-7
|