menu.push({
      id: "properties-view-context-menu-copy",
      label: L10N.getStr("netmonitor.context.copy"),
      accesskey: L10N.getStr("netmonitor.context.copy.accesskey"),
      click: () => this.copySelected(member),
    });

    menu.push({
      id: "properties-view-context-menu-copyall",
      label: L10N.getStr("netmonitor.context.copyAll"),
      accesskey: L10N.getStr("netmonitor.context.copyAll.accesskey"),
      click: () => this.copyAll(object),
    });

    showMenu(menu, {
      screenX: event.screenX,
      screenY: event.screenY,
    });
  }

  copyAll(data) {
    try {
      copyString(JSON.stringify(data));
    } catch (error) {}
  }

  copySelected({ object, hasChildren }) {
    if (hasChildren) {
      // If has children, copy the data as JSON
      try {
        copyString(JSON.stringify({ [object.name]: object.value }));
      } catch (error) {}
    } else {
      // Copy the data as key-value format
      copyString(`${object.name}: ${object.value}`);
    }
  }
}

module.exports = PropertiesViewContextMenu;
PK