MCPcopy Create free account
hub / github.com/ampproject/amphtml / createServedIframe

Function createServedIframe

testing/iframe.js:334–353  ·  view source on GitHub ↗
(src)

Source from the content-addressed store, hash-verified

332}
333
334export function createServedIframe(src) {
335 return new Promise(function (resolve, reject) {
336 const iframe = document.createElement('iframe');
337 iframe.name = 'test_' + iframeCount++;
338 iframe.src = src;
339 iframe.onload = function () {
340 const win = iframe.contentWindow;
341 win.__AMP_TEST_IFRAME = true;
342 win.__AMP_TEST = true;
343 installRuntimeServices(win);
344 resolve({
345 win,
346 doc: win.document,
347 iframe,
348 });
349 };
350 iframe.onerror = reject;
351 document.body.appendChild(iframe);
352 });
353}
354
355const IFRAME_STUB_URL =
356 '//ads.localhost:8081/test/fixtures/served/iframe-stub.html#';

Callers

nothing calls this directly

Calls 2

installRuntimeServicesFunction · 0.90
resolveFunction · 0.50

Tested by

no test coverage detected