Introduce ARIAProperties.json5

ARIAProperties.json5 represents the certain rules captured in the ARIA spec.
This change also uses it to generate the list of ARIA attribute name constants,
and to generate the ARIA autocompletion configuration for devtools.

Also adds pyjson5 as a third_party library.

Change-Id: I622e590196be667ed97288a73d040856380f3bf9
Reviewed-on: https://chromium-review.googlesource.com/737397
Commit-Queue: Alice Boxhall <aboxhall@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Reviewed-by: Dominic Mazzoni <dmazzoni@chromium.org>
Reviewed-by: Joel Einbinder <einbinder@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#560222}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: a39ce6e61cd170b5b549f119f3b6f7a08253cba9
diff --git a/scripts/build/generate_aria.py b/scripts/build/generate_aria.py
new file mode 100644
index 0000000..52cd165
--- /dev/null
+++ b/scripts/build/generate_aria.py
@@ -0,0 +1,25 @@
+# Copyright 2018 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import json
+import os
+import os.path
+import sys
+
+PYJSON5_DIR = os.path.join(os.path.dirname(__file__),
+                           '..', '..', '..', '..', '..', 'pyjson5', 'src')
+sys.path.append(PYJSON5_DIR)
+
+import json5  # pylint: disable=import-error
+
+
+def properties_from_file(file_name):
+    with open(os.path.abspath(file_name)) as json5_file:
+        properties = json5.loads(json5_file.read())
+        return properties
+
+
+ARIA_PROPERTIES = properties_from_file(sys.argv[1])
+with open(sys.argv[2], "w") as f:
+    f.write("Accessibility.ARIAMetadata._config = %s;" % json.dumps(ARIA_PROPERTIES))
diff --git a/scripts/check_gn.js b/scripts/check_gn.js
index 2df36ad..7b01271 100644
--- a/scripts/check_gn.js
+++ b/scripts/check_gn.js
@@ -71,7 +71,7 @@
  */
 function checkAllDevToolsFiles() {
   const errors = [];
-  const excludedFiles = ['InspectorBackendCommands.js', 'SupportedCSSProperties.js'];
+  const excludedFiles = ['InspectorBackendCommands.js', 'SupportedCSSProperties.js', 'ARIAProperties.js'];
   const gnVariable = 'all_devtools_files';
   const lines = selectGNLines(`${gnVariable} = [`, ']');
   if (!lines.length) {
diff --git a/scripts/hosted_mode/server.js b/scripts/hosted_mode/server.js
index 4303c26..ed95b9f 100644
--- a/scripts/hosted_mode/server.js
+++ b/scripts/hosted_mode/server.js
@@ -77,6 +77,7 @@
   '/front_end/SupportedCSSProperties.js': cloudURL.bind(null, 'SupportedCSSProperties.js'),
   '/front_end/InspectorBackendCommands.js': cloudURL.bind(null, 'InspectorBackendCommands.js'),
   '/favicon.ico': () => 'https://chrome-devtools-frontend.appspot.com/favicon.ico'
+  '/front_end/accessibility/ARIAProperties.js': cloudURL.bind(null, 'accessibility/ARIAProperties.js'),
 };
 
 function cloudURL(path, commitHash) {