ction onMsg(evt) {
      if (evt.data !== name) {
        return;
      }
      removeEventListener('message', onMsg);
      resolve();
    });
  });
}

function with_window_by_name(name) {
  let win = window.open(make_post_back_url(name));
  return wait_for_message(name).then(_ => {
    return win;
  });
}

function with_nested_frame(win, url) {
  return new Promise(resolve => {
    let frame = win.document.createElement('iframe');
    frame.addEventListener('load', function onLoad(evt) {
      removeEvent