cloneContext_(context) {
    /**
     * @param {?shaka.dash.DashParser.InheritanceFrame} frame
     * @return {?shaka.dash.DashParser.InheritanceFrame}
     */
    const cloneFrame = (frame) => {
      if (!frame) {
        return null;
      }
      const clone = shaka.util.ObjectUtils.shallowCloneObject(frame);
      clone.segmentBase = null;
      clone.segmentList = null;
      clone.segmentTemplate = shaka.util.TXml.cloneNode(clone.segmentTemplate);
      clone.producerReferenceTime = null;
      return clone;
    };
    const contextClone = shaka.util.ObjectUtils.shallowCloneObject(context);
    contextClone.period = cloneFrame(contextClone.period);
    contextClone.adaptationSet = cloneFrame(contextClone.adaptationSet);
    contextClone.representation = cloneFrame(contextClone.representation);

    if (contextClone.periodInfo) {
      contextClone.periodInfo =
        shaka.util.ObjectUtils.shallowCloneObject(contextClone.periodInfo);
      contextClone.periodInfo.node = null;
    }

    return contextClone;
  }
Clone context and remove xml document references.

@param {!shaka.dash.DashParser.Context} context
@return {!shaka.dash.DashParser.Context}
@private