Listener('load', onLoad);
      resolve(frame);
    });
    frame.src = url;
    win.document.body.appendChild(frame);
  });
}

function delay(win, delay) {
  return new Promise(resolve => {
    win.setTimeout(_ => {
      resolve(win);
    }, delay);
  });
}

function navigate_by_name(win, name) {
  win.location = make_post_back_url(name);
  return wait_for_message(name).then(_ => {
    return win;
  });
}

function go_back(win) {
  return new Promise(resolve => {
    win.onpagehide = e => resolve(win);
  