author Alex Gaynor <>
Mon, 27 Nov 2017 14:37:34 -0600
changeset 403385 bcc0a91dd43feae18d4bf04d7db3d146035aa416
parent 395024 59adfaf5e09f4592e64635462ad36253b301af82
permissions -rw-r--r--
Bug 1407693 - Part 2 - when a child process crashes, write extra annotation data to a pre-opened file descriptor instead of creating a new file; r=gsvelto,rbarker This removes the need for the content process to have permissions to create new files on macOS, allowing more aggressive sandboxing. MozReview-Commit-ID: 8agL5jwxDSL

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at

import sys

def main(header, propFile):
  mappings = {}

  with open(propFile, 'r') as f:
    for line in f:
      line = line.strip()
      if not line.startswith('#'):
        parts = line.split("=", 1)
        if len(parts) == 2 and len(parts[0]) > 0:
          mappings[parts[0].strip()] = parts[1].strip()
  keys = mappings.keys()

  header.write("// This is a generated file. Please do not edit.\n")
  header.write("// Please edit the corresponding .properties file instead.\n")

  entries = ['{ "%s", %s }'
             % (key, mappings[key].replace('-', '_').upper() + '_ENCODING') for key in keys]
  header.write(',\n'.join(entries) + '\n')