function getCommonLandings()

in common_landings.js [120:185]


function getCommonLandings() {
  let pushlog_link_promises = [];

  // Nightly
  let nightlyPushlogLink = getPushlogLink("nightly");
  if (nightlyPushlogLink) {
    pushlog_link_promises.push(nightlyPushlogLink);
  }

  // Beta
  let betaFirstAffected = document.getElementById("beta_first_affected").value;
  if (betaFirstAffected) {
    let betaStartBuildElem = document.getElementById("beta_builds");
    let betaStartBuild = subtractFromBetaBuild(
      betaFirstAffected,
      dropdownBuildToVal(
        betaStartBuildElem.options[betaStartBuildElem.selectedIndex].value
      )
    );
    let betaPushlogLink =
      "https://hg.mozilla.org/releases/mozilla-beta/pushloghtml?fromchange=" +
      betaBuildToTag(betaStartBuild) +
      "&tochange=" +
      betaBuildToTag(betaFirstAffected);

    let betaPushlogLinkElem = document.getElementById("beta_pushloglink");
    betaPushlogLinkElem.textContent = betaPushlogLinkElem.href = betaPushlogLink;
    pushlog_link_promises.push(Promise.resolve(betaPushlogLink));
  }

  return Promise.all(
    pushlog_link_promises.map((link_promise) =>
      link_promise.then((link) =>
        fetch(link)
          .then((response) => response.text())
          .then((html) => {
            let bugs = [];

            let result;
            let re = /Bug ([0-9]+)/gi;
            while ((result = re.exec(html)) !== null) {
              bugs.push(result[1]);
            }

            return bugs;
          })
      )
    )
  )
    .then((arrays) => {
      if (arrays.length === 0) {
        return [];
      }

      return arrays[0].filter((elem) => {
        let is_everywhere = true;

        for (let array of arrays.slice(1)) {
          is_everywhere &= array.includes(elem);
        }

        return is_everywhere;
      });
    })
    .then((bugs) => new Set(bugs));
}