async _retrieveMapFromScript(driver, script) {
    if (!script.sourceMapURL) {
      throw new Error('precondition failed: event.sourceMapURL should exist');
    }

    // `sourceMapURL` is simply the URL found in either a magic comment or an x-sourcemap header.
    // It has not been resolved to a base url.
    const isSourceMapADataUri = script.sourceMapURL.startsWith('data:');
    const scriptUrl = script.name;
    const rawSourceMapUrl = isSourceMapADataUri ?
        script.sourceMapURL :
        this._resolveUrl(script.sourceMapURL, script.name);

    if (!rawSourceMapUrl) {
      return {
        scriptId: script.scriptId,
        scriptUrl,
        errorMessage: `Could not resolve map url: ${script.sourceMapURL}`,
      };
    }

    // sourceMapUrl isn't included in the the artifact if it was a data URL.
    const sourceMapUrl = isSourceMapADataUri ? undefined : rawSourceMapUrl;

    try {
      const map = isSourceMapADataUri ?
          this.parseSourceMapFromDataUrl(rawSourceMapUrl) :
          await this.fetchSourceMap(driver, rawSourceMapUrl);

      if (typeof map.version !== 'number') throw new Error('Map has no numeric `version` field');
      if (!Array.isArray(map.sources)) throw new Error('Map has no `sources` list');
      if (typeof map.mappings !== 'string') throw new Error('Map has no `mappings` field');

      if (map.sections) {
        map.sections = map.sections.filter(section => section.map);
      }
      return {
        scriptId: script.scriptId,
        scriptUrl,
        sourceMapUrl,
        map,
      };
    } catch (err) {
      return {
        scriptId: script.scriptId,
        scriptUrl,
        sourceMapUrl,
        errorMessage: err.toString(),
      };
    }
  }
@param {LH.Gatherer.Driver} driver
@param {LH.Artifacts.Script} script
@return {Promise<LH.Artifacts.SourceMap>}