* @param {!Window} win * @param {string} src * @param {boolean=} noReferrer * @param {string=} attributionSrc * @param {(Element|./service/ampdoc-impl.AmpDoc)=} opt_elementOrAmpDoc Whether services are provided by an * element. * @return {!Image}
( win, src, noReferrer = false, attributionSrc, opt_elementOrAmpDoc )
| 91 | * @return {!Image} |
| 92 | */ |
| 93 | function createImagePixel( |
| 94 | win, |
| 95 | src, |
| 96 | noReferrer = false, |
| 97 | attributionSrc, |
| 98 | opt_elementOrAmpDoc |
| 99 | ) { |
| 100 | const Image = WindowInterface.getImage(win); |
| 101 | const image = new Image(); |
| 102 | if (noReferrer) { |
| 103 | image.referrerPolicy = 'no-referrer'; |
| 104 | } |
| 105 | |
| 106 | let attributionReportingStatus = |
| 107 | AttributionReportingStatus.ATTRIBUTION_DATA_UNSPECIFIED; |
| 108 | if (attributionSrc != null) { |
| 109 | if (isAttributionReportingAllowed(win.document)) { |
| 110 | attributionReportingStatus = |
| 111 | AttributionReportingStatus.ATTRIBUTION_DATA_PRESENT_AND_POLICY_ENABLED; |
| 112 | const substituteVariables = |
| 113 | getAttributionReportingStatusUrlVariableRewriter( |
| 114 | win, |
| 115 | attributionReportingStatus, |
| 116 | opt_elementOrAmpDoc |
| 117 | ); |
| 118 | attributionSrc = substituteVariables(attributionSrc); |
| 119 | image.attributionSrc = attributionSrc; |
| 120 | } else { |
| 121 | attributionReportingStatus = |
| 122 | AttributionReportingStatus.ATTRIBUTION_DATA_PRESENT; |
| 123 | } |
| 124 | } |
| 125 | const substituteVariables = getAttributionReportingStatusUrlVariableRewriter( |
| 126 | win, |
| 127 | attributionReportingStatus, |
| 128 | opt_elementOrAmpDoc |
| 129 | ); |
| 130 | src = substituteVariables(src); |
| 131 | image.src = src; |
| 132 | return image; |
| 133 | } |
| 134 | |
| 135 | /** |
| 136 | * Check if element attribute "referrerPolicy" is supported by the browser. |
no test coverage detected