* Blackhole the legacy popups since they should never be used for anything. * @param {!Window} win
(win)
| 214 | * @param {!Window} win |
| 215 | */ |
| 216 | function blockSyncPopups(win) { |
| 217 | let count = 0; |
| 218 | /** |
| 219 | * Checks for security error. |
| 220 | */ |
| 221 | function maybeThrow() { |
| 222 | // Prevent deep recursion. |
| 223 | if (count++ > 2) { |
| 224 | throw new Error('security error'); |
| 225 | } |
| 226 | } |
| 227 | try { |
| 228 | win.alert = maybeThrow; |
| 229 | win.prompt = function () { |
| 230 | maybeThrow(); |
| 231 | return ''; |
| 232 | }; |
| 233 | win.confirm = function () { |
| 234 | maybeThrow(); |
| 235 | return false; |
| 236 | }; |
| 237 | } catch (e) { |
| 238 | console./*OK*/ error(e.message, e.stack); |
| 239 | } |
| 240 | } |
| 241 | |
| 242 | /** |
| 243 | * Calculates the minimum time that a timeout should have right now. |
no test coverage detected