(win, event)
| 62 | * @param {!Event} event |
| 63 | */ |
| 64 | export function handleCookieOptOutPostMessage(win, event) { |
| 65 | try { |
| 66 | const message = JSON.parse(event.data); |
| 67 | if (message['googMsgType'] === 'gpi-uoo') { |
| 68 | const userOptOut = !!message['userOptOut']; |
| 69 | const clearAdsData = !!message['clearAdsData']; |
| 70 | const domain = getProxySafeDomain(win, win.location.hostname); |
| 71 | setCookie( |
| 72 | win, |
| 73 | '__gpi_opt_out', |
| 74 | userOptOut ? '1' : '0', |
| 75 | // Last valid date for 32-bit browsers; 2038-01-19 |
| 76 | 2147483646 * 1000, |
| 77 | {domain} |
| 78 | ); |
| 79 | if (userOptOut || clearAdsData) { |
| 80 | setCookie(win, '__gads', 'delete', Date.now() - 1000, {domain}); |
| 81 | setCookie(win, '__gpi', 'delete', Date.now() - 1000, {domain}); |
| 82 | } |
| 83 | } |
| 84 | } catch {} |
| 85 | } |
no test coverage detected