( opt_configCallback, opt_allowed3pTypes, opt_allowedEmbeddingOrigins )
| 150 | * that are allowed to embed this frame. |
| 151 | */ |
| 152 | export function draw3p( |
| 153 | opt_configCallback, |
| 154 | opt_allowed3pTypes, |
| 155 | opt_allowedEmbeddingOrigins |
| 156 | ) { |
| 157 | try { |
| 158 | const location = getLocation(); |
| 159 | |
| 160 | ensureFramed(window); |
| 161 | validateParentOrigin(window, location); |
| 162 | validateAllowedTypes(window, getEmbedType(), opt_allowed3pTypes); |
| 163 | if (opt_allowedEmbeddingOrigins) { |
| 164 | validateAllowedEmbeddingOrigins(window, opt_allowedEmbeddingOrigins); |
| 165 | } |
| 166 | window.context = new IntegrationAmpContext(window); |
| 167 | manageWin(window); |
| 168 | installEmbedStateListener(); |
| 169 | |
| 170 | // Ugly type annotation is due to Event.prototype.data being denylisted |
| 171 | // and the compiler not being able to discern otherwise |
| 172 | // TODO(alanorozco): Do this more elegantly once old impl is cleaned up. |
| 173 | draw3pInternal( |
| 174 | window, |
| 175 | /** @type {!IntegrationAmpContext} */ (window.context).data || {}, |
| 176 | opt_configCallback |
| 177 | ); |
| 178 | |
| 179 | window.context.bootstrapLoaded(); |
| 180 | } catch (e) { |
| 181 | if (window.context && window.context.report3pError) { |
| 182 | // window.context has initiated yet |
| 183 | if (e.message && isUserErrorMessage(e.message)) { |
| 184 | // report user error to parent window |
| 185 | window.context.report3pError(e); |
| 186 | } |
| 187 | } |
| 188 | |
| 189 | const c = window.context || {mode: {test: false}}; |
| 190 | if (!c.mode.test) { |
| 191 | lightweightErrorReport(e, c.canary); |
| 192 | throw e; |
| 193 | } |
| 194 | } |
| 195 | } |
| 196 | |
| 197 | /** |
| 198 | * Throws if the current frame's parent origin is not equal to |
nothing calls this directly
no test coverage detected