* Add instrumentation code to doc.write. * @param {!Window} parent * @param {!Window} win
(parent, win)
| 61 | * @param {!Window} win |
| 62 | */ |
| 63 | function instrumentDocWrite(parent, win) { |
| 64 | const doc = win.document; |
| 65 | const {close} = doc; |
| 66 | doc.close = function () { |
| 67 | parent.ampManageWin = function (win) { |
| 68 | manageWin(win); |
| 69 | }; |
| 70 | if (!parent.ampSeen) { |
| 71 | // .call does not work in Safari with document.write. |
| 72 | doc.write('<script>window.parent.ampManageWin(window)</script>'); |
| 73 | } |
| 74 | doc._close = close; |
| 75 | return doc._close(); |
| 76 | }; |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * Add instrumentation code to iframe's srcdoc. |
no test coverage detected