testing/talos/talos/tests/cpstartup/cpstartup.html
author Masayuki Nakano <masayuki@d-toybox.com>
Sun, 16 Jan 2022 06:21:17 +0000
changeset 604634 9ef0614a59629916c1e182eb8eda055b0b0e8b32
parent 442648 e19cd8da255dd2fedd21c69a99545d4b5f0f1ef3
permissions -rw-r--r--
Bug 1749299 - Make `HTMLEditor::HandleInsertLinefeed()` stop handling it if insertion point cannot have text nodes r=m_kato Ideally, it should not be called when the editor cannot insert new text node. However, the callers are complicated. Therefore, let's check in it for avoiding making the callers more complicated. Fortunately, this is not realistic path for normal web apps. Therefore, the compatibility of the behavior is not matter. That's the reason why this patch does not have a test comparing the result. Differential Revision: https://phabricator.services.mozilla.com/D135826

<html>
<head>
<script>

function init() {
  window.addEventListener("CPStartup:FinalResults", function onResults(event) {
    let results = event.detail;
    tpRecordTime(results, 0, "content-process-startup");
  }, {once: true});

  async function tryPing() {
    let pingPromise = new Promise(resolve => {
      window.addEventListener("CPStartup:Pong", resolve, {once: true});
      dispatchEvent(new CustomEvent("CPStartup:Ping", {bubbles: true}));
    });
    let timeoutPromise = new Promise((resolve, reject) => setTimeout(reject, 500));

    try {
      await Promise.race([pingPromise, timeoutPromise]);
    } catch (e) {
      return tryPing();
    }
    return null;
  }

  let target = document.location.href.replace(/cpstartup.html$/, "target.html");
  tryPing().then(() => {
    dispatchEvent(new CustomEvent("CPStartup:Go", {
      bubbles: true,
      detail: {target},
    }));
  });
}

</script>
</head>

<body onload="init();">
  Hello, Talos!

  <a href="#" id="target" target="_blank">I'll open a new tab</a>
</body>
</html>