findBundleHost(addonParent, addonPkgInfo) {
    let curr = addonParent;

    while (curr) {
      if (curr === this.project) {
        return curr;
      }

      if (isLazyEngine(curr)) {
        // if we're building a lazy engine in isolation, prefer that the bundle host is
        // the project, not the lazy engine addon instance
        if (curr.parent === this.project && curr._packageInfo === this.project._packageInfo) {
          return this.project;
        }

        return curr;
      }

      curr = curr.parent;
    }

    // the following should not be able to happen given that Projects are always
    // bundle hosts, but just in case, throw an error if we didn't find one.
    throw new Error(`Addon at path\n  ${addonPkgInfo.realPath}\n has 'allowCachingPerBundle' but has no bundleHost`);
  }
Given a parent object of a potential addon (another addon or the project),
go up the 'parent' chain to find the potential addon's bundle host object
(i.e. lazy engine or project.) Because Projects are always bundle hosts,
this should always pass, but we'll throw if somehow it doesn't work.

@method findBundleHost
@param {Project|Addon} addonParent the direct parent object of a (potential or real) addon.
@param {PackageInfo} addonPkgInfo the PackageInfo for an addon being instantiated. This is only
used for information if an error is going to be thrown.
@return {Object} the object in the 'parent' chain that is a bundle host.
@throws {Error} if there is not bundle host