diff --git a/python3.patch b/python3.patch index 565cc965b69965b1000dff8bd7fd3a79d9a1e0a9..078f8b392362638e25b562c2293ed2ba761a938c 100644 --- a/python3.patch +++ b/python3.patch @@ -1,5 +1,5 @@ diff --git a/configure.pri b/configure.pri -index 8705ad93f..3977c959e 100644 +index e072961f0..8d639a99d 100644 --- a/configure.pri +++ b/configure.pri @@ -7,20 +7,7 @@ QTWEBENGINE_SOURCE_TREE = $$PWD @@ -24,45 +24,52 @@ index 8705ad93f..3977c959e 100644 } defineTest(qtConfTest_detectJumboBuild) { -@@ -52,10 +39,10 @@ defineTest(qtConfReport_jumboBuild) { +@@ -52,22 +39,22 @@ defineTest(qtConfReport_jumboBuild) { qtConfReportPadded($${1}, $$mergeLimit) } -defineTest(qtConfTest_detectPython2) { - python = $$qtConfFindInPath("python2$$EXE_SUFFIX") -+defineTest(qtConfTest_detectPython3) { ++defineTest(qtConfTest_detectPython) { + python = $$qtConfFindInPath("python3$$EXE_SUFFIX") isEmpty(python) { - qtLog("'python2$$EXE_SUFFIX' not found in PATH. Checking for 'python$$EXE_SUFFIX'.") -+ qtLog("'python3$$EXE_SUFFIX' not found in PATH. Checking for 'python$$EXE_SUFFIX'.") - python = $$qtConfFindInPath("python$$EXE_SUFFIX") +- python = $$qtConfFindInPath("python$$EXE_SUFFIX") ++ qtLog("'python3$$EXE_SUFFIX' not found in PATH. Checking for 'python3$$EXE_SUFFIX'.") ++ python = $$qtConfFindInPath("python3$$EXE_SUFFIX") } isEmpty(python) { -@@ -67,7 +54,7 @@ defineTest(qtConfTest_detectPython2) { +- qtLog("'python$$EXE_SUFFIX' not found in PATH. Giving up.") ++ qtLog("'python3$$EXE_SUFFIX' not found in PATH. Giving up.") + return(false) + } + !isPythonVersionSupported($$python) { +- qtLog("A suitable Python 2 executable could not be located.") ++ qtLog("A suitable Python executable could not be located.") return(false) } - # Make tests.python2.location available in configure.json. -+ # Make tests.python3.location available in configure.json. ++ # Make tests.python.location available in configure.json. $${1}.location = $$clean_path($$python) export($${1}.location) $${1}.cache += location diff --git a/mkspecs/features/functions.prf b/mkspecs/features/functions.prf -index 2750d7071..908e6dcd4 100644 +index 7f630588a..2d2eb2d01 100644 --- a/mkspecs/features/functions.prf +++ b/mkspecs/features/functions.prf -@@ -39,11 +39,11 @@ defineReplace(which) { +@@ -44,11 +44,11 @@ defineReplace(which) { # Returns the unquoted path to the python executable. defineReplace(pythonPath) { - isEmpty(QMAKE_PYTHON2) { -+ isEmpty(QMAKE_PYTHON3) { ++ isEmpty(QMAKE_PYTHON) { # Fallback for building QtWebEngine with Qt < 5.8 - QMAKE_PYTHON2 = python -+ QMAKE_PYTHON3 = python ++ QMAKE_PYTHON = python3 } - return($$QMAKE_PYTHON2) -+ return($$QMAKE_PYTHON3) ++ return($$QMAKE_PYTHON) } # Returns the python executable for use with shell / make targets. @@ -1578,16 +1585,6 @@ index f24bcde02..64a6503d6 100755 if __name__ == '__main__': -diff --git a/src/3rdparty/chromium/build/android/gyp/create_r_java.py b/src/3rdparty/chromium/build/android/gyp/create_r_java.py -index 6c55a06fd..2d5ffae04 100755 ---- a/src/3rdparty/chromium/build/android/gyp/create_r_java.py -+++ b/src/3rdparty/chromium/build/android/gyp/create_r_java.py -@@ -1,4 +1,4 @@ --#!/usr/bin/env python2 -+#!/usr/bin/env python3 - # Copyright 2020 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. diff --git a/src/3rdparty/chromium/build/android/gyp/dex.py b/src/3rdparty/chromium/build/android/gyp/dex.py index 905c44d9d..37e87c605 100755 --- a/src/3rdparty/chromium/build/android/gyp/dex.py @@ -1873,7 +1870,7 @@ index 2830d25c9..d004adc48 100644 import difflib import hashlib diff --git a/src/3rdparty/chromium/build/android/gyp/util/parallel.py b/src/3rdparty/chromium/build/android/gyp/util/parallel.py -index 082ad9722..c26875a71 100644 +index 082ad9722..a6caf04a2 100644 --- a/src/3rdparty/chromium/build/android/gyp/util/parallel.py +++ b/src/3rdparty/chromium/build/android/gyp/util/parallel.py @@ -205,7 +205,7 @@ def BulkForkAndCall(func, arg_tuples, **kwargs): @@ -1881,7 +1878,7 @@ index 082ad9722..c26875a71 100644 wrapped_func = _FuncWrapper(func) try: - for result in pool.imap(wrapped_func, xrange(len(arg_tuples))): -+ for result in pool.imap(wrapped_func, range(len(arg_tuples))): ++ for result in pool.imap(wrapped_func, list(range(len(arg_tuples)))): _CheckForException(result) yield result finally: @@ -4567,7 +4564,7 @@ index 5fbab3392..983a6c33c 100755 import argparse import os diff --git a/src/3rdparty/chromium/build/android/test_runner.py b/src/3rdparty/chromium/build/android/test_runner.py -index d15488194..3c9b96769 100755 +index d15488194..0a7242de3 100755 --- a/src/3rdparty/chromium/build/android/test_runner.py +++ b/src/3rdparty/chromium/build/android/test_runner.py @@ -694,7 +694,7 @@ def AddMonkeyTestOptions(parser): @@ -4593,7 +4590,7 @@ index d15488194..3c9b96769 100755 with json_writer(), logcats_uploader, env, test_instance, test_run: - repetitions = (xrange(args.repeat + 1) if args.repeat >= 0 -+ repetitions = (range(args.repeat + 1) if args.repeat >= 0 ++ repetitions = (list(range(args.repeat + 1)) if args.repeat >= 0 else itertools.count()) result_counts = collections.defaultdict( lambda: collections.defaultdict(int)) @@ -5072,28 +5069,6 @@ index b45aa0de4..b992f78b1 100644 import subprocess import sys -diff --git a/src/3rdparty/chromium/build/config/python.gni b/src/3rdparty/chromium/build/config/python.gni -index 63f6dddc8..59183f00d 100644 ---- a/src/3rdparty/chromium/build/config/python.gni -+++ b/src/3rdparty/chromium/build/config/python.gni -@@ -64,7 +64,7 @@ template("python_library") { - } - - # This is a wrapper around action() that ensures that the script is --# run under a Python2 executable, even if the main script_executable is -+# run under a Python3 executable, even if the main script_executable is - # Python3. - # - # It supports all of action()'s arguments. -@@ -104,7 +104,7 @@ template("python2_action") { - } - - # This is a wrapper around action() that ensures that the script is --# run under a Python2 executable, even if the main script_executable is -+# run under a Python3 executable, even if the main script_executable is - # Python3. - # - # It supports all of action()'s arguments. diff --git a/src/3rdparty/chromium/build/copy_test_data_ios.py b/src/3rdparty/chromium/build/copy_test_data_ios.py index cd23fb29b..8d2a6ec97 100755 --- a/src/3rdparty/chromium/build/copy_test_data_ios.py @@ -5294,7 +5269,7 @@ index 6b3916ccb..595d2c63b 100644 def _AddTargetSpecificationArgs(arg_parser): diff --git a/src/3rdparty/chromium/build/fuchsia/deploy_to_amber_repo.py b/src/3rdparty/chromium/build/fuchsia/deploy_to_amber_repo.py -index 02dcf25f3..34fbca9d8 100755 +index 02dcf25f3..824a8f08e 100755 --- a/src/3rdparty/chromium/build/fuchsia/deploy_to_amber_repo.py +++ b/src/3rdparty/chromium/build/fuchsia/deploy_to_amber_repo.py @@ -7,7 +7,7 @@ @@ -5306,6 +5281,15 @@ index 02dcf25f3..34fbca9d8 100755 import argparse import os import sys +@@ -55,7 +55,7 @@ def main(): + fuchsia_out_dir = os.path.expanduser(args.fuchsia_out_dir.pop()) + repo = amber_repo.ExternalAmberRepo( + os.path.join(fuchsia_out_dir, 'amber-files')) +- print('Installing packages and symbols in Amber repo %s...' % repo.GetPath()) ++ print(('Installing packages and symbols in Amber repo %s...' % repo.GetPath())) + + for package in args.package: + repo.PublishPackage(package) diff --git a/src/3rdparty/chromium/build/fuchsia/device_target.py b/src/3rdparty/chromium/build/fuchsia/device_target.py index 135770cd7..c3c8189cd 100644 --- a/src/3rdparty/chromium/build/fuchsia/device_target.py @@ -5509,10 +5493,10 @@ index ed2cca3bf..cfa302bd3 100644 FAR = common.GetHostToolPathFromPlatform('far') diff --git a/src/3rdparty/chromium/build/fuchsia/runner_exceptions.py b/src/3rdparty/chromium/build/fuchsia/runner_exceptions.py -index 03f872e45..59841f6e0 100644 +index 03f872e45..dd236a440 100644 --- a/src/3rdparty/chromium/build/fuchsia/runner_exceptions.py +++ b/src/3rdparty/chromium/build/fuchsia/runner_exceptions.py -@@ -15,7 +15,7 @@ import subprocess +@@ -15,13 +15,13 @@ import subprocess import sys import traceback @@ -5521,6 +5505,22 @@ index 03f872e45..59841f6e0 100644 def _PrintException(value, trace): """Prints stack trace and error message for the current exception.""" + + traceback.print_tb(trace) +- print(str(value)) ++ print((str(value))) + + + def IsStdoutBlocking(): +@@ -68,7 +68,7 @@ def HandleExceptionAndReturnExitCode(): + return 72 + elif type is subprocess.CalledProcessError: + if os.path.basename(value.cmd[0]) == 'scp': +- print('Error: scp operation failed - %s' % str(value)) ++ print(('Error: scp operation failed - %s' % str(value))) + return 81 + if os.path.basename(value.cmd[0]) == 'qemu-img': + print('Error: qemu-img fuchsia image generation failed.') diff --git a/src/3rdparty/chromium/build/fuchsia/runner_logs.py b/src/3rdparty/chromium/build/fuchsia/runner_logs.py index 20ab6b227..4b94ae8a2 100644 --- a/src/3rdparty/chromium/build/fuchsia/runner_logs.py @@ -5646,6 +5646,19 @@ index a32ab9937..e5ef7c1ff 100755 import sys +diff --git a/src/3rdparty/chromium/build/get_symlink_targets.py b/src/3rdparty/chromium/build/get_symlink_targets.py +index 3285ff1d9..28bd07e8d 100755 +--- a/src/3rdparty/chromium/build/get_symlink_targets.py ++++ b/src/3rdparty/chromium/build/get_symlink_targets.py +@@ -19,7 +19,7 @@ def main(): + target = os.readlink(link_name) + if not os.path.isabs(target): + target = os.path.join(os.path.dirname(link_name), target) +- print(os.path.realpath(target)) ++ print((os.path.realpath(target))) + return 0 + + diff --git a/src/3rdparty/chromium/build/gn_helpers.py b/src/3rdparty/chromium/build/gn_helpers.py index 825865868..3f82dac1a 100644 --- a/src/3rdparty/chromium/build/gn_helpers.py @@ -6078,12 +6091,12 @@ index 00507af37..0a172828a 100755 import argparse import os diff --git a/src/3rdparty/chromium/build/print_python_deps.py b/src/3rdparty/chromium/build/print_python_deps.py -index fd29c0972..aa5fdcbf9 100755 +index fd29c0972..51a3eb733 100755 --- a/src/3rdparty/chromium/build/print_python_deps.py +++ b/src/3rdparty/chromium/build/print_python_deps.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2.7 -+#!/usr/bin/python ++#!/usr/bin/python3 # Copyright 2016 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. @@ -6096,20 +6109,12 @@ index fd29c0972..aa5fdcbf9 100755 if m and hasattr(m, '__file__')) src_paths = set() -@@ -80,7 +80,6 @@ def _GetTargetPythonVersion(module): - if shebang.startswith('#!'): - # Examples: - # '#!/usr/bin/python' -- # '#!/usr/bin/python2.7' - # '#!/usr/bin/python3' - # '#!/usr/bin/env python3' - # '#!/usr/bin/env vpython' -@@ -152,7 +151,7 @@ def main(): +@@ -152,7 +152,7 @@ def main(): # Trybots run with vpython as default Python, but with a different config # from //.vpython. To make the is_vpython test work, and to match the behavior - # of dev machines, the shebang line must be run with python2.7. -+ # of dev machines, the shebang line must be run with python3. ++ # of dev machines, the shebang line must be run with python. # # E.g. $HOME/.vpython-root/dd50d3/bin/python # E.g. /b/s/w/ir/cache/vpython/ab5c79/bin/python @@ -6590,38 +6595,6 @@ index a415b1f53..1d6f05980 100644 conn.request('HEAD', parsed.path) response = conn.getresponse() except (socket.gaierror, socket.error): -diff --git a/src/3rdparty/chromium/build/util/python2_action.py b/src/3rdparty/chromium/build/util/python2_action.py -index a62d065ce..0353c88a8 100644 ---- a/src/3rdparty/chromium/build/util/python2_action.py -+++ b/src/3rdparty/chromium/build/util/python2_action.py -@@ -1,22 +1,22 @@ - # Copyright 2020 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. --"""Script for ensuring that a python action runs under Python2, not Python3.""" -+"""Script for ensuring that a python action runs under Python3, not Python3.""" - - import subprocess - import sys - - if sys.version_info.major == 2: -- # If we get here, we're already Python2, so just re-execute the -+ # If we get here, we're already Python3, so just re-execute the - # command without the wrapper. - exe = sys.executable - elif sys.executable.endswith('.exe'): - # If we get here, we're a Python3 executable likely running on -- # Windows, so look for the Python2 wrapper in depot_tools. -+ # Windows, so look for the Python3 wrapper in depot_tools. - exe = 'python.bat' - else: - # If we get here, we are a Python3 executable. Hope that we can find -- # a `python2.7` in path somewhere. -- exe = 'python2.7' -+ # a `python3` in path somewhere. -+ exe = 'python3' - - sys.exit(subprocess.call([exe] + sys.argv[1:])) diff --git a/src/3rdparty/chromium/build/util/version.py b/src/3rdparty/chromium/build/util/version.py index 4f440c4ee..68d4892a8 100755 --- a/src/3rdparty/chromium/build/util/version.py @@ -7428,14 +7401,16 @@ index 055131e62..6678ba2bb 100644 input_api.AffectedFiles()[0].LocalPath()))) ] diff --git a/src/3rdparty/chromium/chrome/browser/resources/vr/assets/push_assets_component.py b/src/3rdparty/chromium/chrome/browser/resources/vr/assets/push_assets_component.py -index b47f275ad..db8c7abb9 100755 +index b47f275ad..22935c1ba 100755 --- a/src/3rdparty/chromium/chrome/browser/resources/vr/assets/push_assets_component.py +++ b/src/3rdparty/chromium/chrome/browser/resources/vr/assets/push_assets_component.py -@@ -35,7 +35,7 @@ class TempDir(): +@@ -34,8 +34,8 @@ class TempDir(): + def PrintInfo(header, items): - print('\n%s' % header) +- print('\n%s' % header) - print ' ', '\n '.join(items) ++ print(('\n%s' % header)) + print(' ', '\n '.join(items)) @@ -7452,15 +7427,9 @@ index b47f275ad..db8c7abb9 100755 return subprocess.call(command, cwd=temp_dir) diff --git a/src/3rdparty/chromium/components/assist_ranker/print_example_preprocessor_config.py b/src/3rdparty/chromium/components/assist_ranker/print_example_preprocessor_config.py -index 5e35a0f1a..581ec7360 100755 +index 5e35a0f1a..92f66565f 100755 --- a/src/3rdparty/chromium/components/assist_ranker/print_example_preprocessor_config.py +++ b/src/3rdparty/chromium/components/assist_ranker/print_example_preprocessor_config.py -@@ -1,4 +1,4 @@ --#!/usr/bin/env python2 -+#!/usr/bin/env python3 - - # Copyright 2018 The Chromium Authors. All rights reserved. - # Use of this source code is governed by a BSD-style license that can be @@ -61,31 +61,31 @@ def PrintExamplePreprocessorConfig(pb_file): # Indent description by a tab and wrap text. max_len = 80 - 8 # Leave at least 8 columns for tab width. @@ -7515,7 +7484,7 @@ index 853b5b924..72fed7492 100644 if '$ref' in json: diff --git a/src/3rdparty/chromium/components/certificate_transparency/tools/make_ct_known_logs_list.py b/src/3rdparty/chromium/components/certificate_transparency/tools/make_ct_known_logs_list.py -index f1563dbe4..1a25c1e75 100755 +index f1563dbe4..d89bf94aa 100755 --- a/src/3rdparty/chromium/components/certificate_transparency/tools/make_ct_known_logs_list.py +++ b/src/3rdparty/chromium/components/certificate_transparency/tools/make_ct_known_logs_list.py @@ -83,7 +83,7 @@ def _get_log_ids_for_operator(logs_by_operator, operator_name): @@ -7536,6 +7505,15 @@ index f1563dbe4..1a25c1e75 100755 return list(log.get("state"))[0] not in ("pending", "rejected") +@@ -193,7 +193,7 @@ def generate_cpp_file(input_file, f): + + def main(): + if len(sys.argv) != 3: +- print("usage: %s in_loglist_json out_header" % sys.argv[0]) ++ print(("usage: %s in_loglist_json out_header" % sys.argv[0])) + return 1 + with open(sys.argv[1], "r") as infile, open(sys.argv[2], "w") as outfile: + generate_cpp_file(infile, outfile) diff --git a/src/3rdparty/chromium/components/certificate_transparency/tools/make_ct_known_logs_list_unittest.py b/src/3rdparty/chromium/components/certificate_transparency/tools/make_ct_known_logs_list_unittest.py index db94cf4f3..c2c5e833d 100755 --- a/src/3rdparty/chromium/components/certificate_transparency/tools/make_ct_known_logs_list_unittest.py @@ -7734,19 +7712,22 @@ index cf2e8b483..0828ac39d 100755 import ast import json diff --git a/src/3rdparty/chromium/components/feed/core/v2/tools/protoc_util.py b/src/3rdparty/chromium/components/feed/core/v2/tools/protoc_util.py -index 2d2ce70da..a86d9583f 100755 +index 2d2ce70da..723d0587c 100755 --- a/src/3rdparty/chromium/components/feed/core/v2/tools/protoc_util.py +++ b/src/3rdparty/chromium/components/feed/core/v2/tools/protoc_util.py -@@ -9,6 +9,7 @@ - import glob - import os - import subprocess -+import sys - - _protoc_path = None - +@@ -65,8 +65,8 @@ def protoc_path(root_dir): + glob.glob(os.path.join(root_dir, "out") + "/*/protoc")) + list( + glob.glob(os.path.join(root_dir, "out") + "/*/*/protoc")) + if not len(protoc_list): +- print("Can't find a suitable build output directory", +- "(it should have protoc)") ++ print(("Can't find a suitable build output directory", ++ "(it should have protoc)")) + sys.exit(1) + _protoc_path = protoc_list[0] + return _protoc_path diff --git a/src/3rdparty/chromium/components/feed/core/v2/tools/stream_dump.py b/src/3rdparty/chromium/components/feed/core/v2/tools/stream_dump.py -index c6a0040bb..ce2eab6bc 100755 +index c6a0040bb..b528d0662 100755 --- a/src/3rdparty/chromium/components/feed/core/v2/tools/stream_dump.py +++ b/src/3rdparty/chromium/components/feed/core/v2/tools/stream_dump.py @@ -18,7 +18,7 @@ import argparse @@ -7758,6 +7739,15 @@ index c6a0040bb..ce2eab6bc 100755 import re import subprocess import sys +@@ -90,7 +90,7 @@ def dump(): + with open(join(DUMP_DIR, 'entry{:03d}.textproto'.format(i)), + 'w') as f: + f.write(extract_db_entry(k, v)) +- print('Finished dumping to', DUMP_DIR) ++ print(('Finished dumping to', DUMP_DIR)) + db.close() + + diff --git a/src/3rdparty/chromium/components/feed/core/v2/tools/textpb_to_binarypb.py b/src/3rdparty/chromium/components/feed/core/v2/tools/textpb_to_binarypb.py index ef07d256c..856a15a91 100755 --- a/src/3rdparty/chromium/components/feed/core/v2/tools/textpb_to_binarypb.py @@ -7772,7 +7762,7 @@ index ef07d256c..856a15a91 100755 import sys import urllib.parse diff --git a/src/3rdparty/chromium/components/feed/tools/content_dump.py b/src/3rdparty/chromium/components/feed/tools/content_dump.py -index 91d5cdee0..6dd33b51a 100755 +index 91d5cdee0..eed71a336 100755 --- a/src/3rdparty/chromium/components/feed/tools/content_dump.py +++ b/src/3rdparty/chromium/components/feed/tools/content_dump.py @@ -18,7 +18,7 @@ import argparse @@ -7784,6 +7774,24 @@ index 91d5cdee0..6dd33b51a 100755 import re import subprocess import sys +@@ -96,7 +96,7 @@ def proto_message_from_db_key(key): + return 'search.now.feed.client.StreamSharedState' + if key.startswith('FEATURE::') or key.startswith('FSM::'): + return 'search.now.feed.client.StreamPayload' +- print("Unknown Key kind", key) ++ print(("Unknown Key kind", key)) + sys.exit(1) + + +@@ -131,7 +131,7 @@ def dump(): + f.write(k) + with open(join(DUMP_DIR, 'entry{:03d}.textproto'.format(i)), 'w') as f: + f.write(extract_db_entry(k, v)) +- print('Finished dumping to', DUMP_DIR) ++ print(('Finished dumping to', DUMP_DIR)) + db.close() + + diff --git a/src/3rdparty/chromium/components/feed/tools/mockserver_textpb_to_binary.py b/src/3rdparty/chromium/components/feed/tools/mockserver_textpb_to_binary.py index b6d75745b..e0b02396b 100755 --- a/src/3rdparty/chromium/components/feed/tools/mockserver_textpb_to_binary.py @@ -7798,17 +7806,20 @@ index b6d75745b..e0b02396b 100755 from absl import app diff --git a/src/3rdparty/chromium/components/feed/tools/protoc_util.py b/src/3rdparty/chromium/components/feed/tools/protoc_util.py -index 0ff20f2c0..fa7bba00b 100755 +index 0ff20f2c0..d83e930b6 100755 --- a/src/3rdparty/chromium/components/feed/tools/protoc_util.py +++ b/src/3rdparty/chromium/components/feed/tools/protoc_util.py -@@ -9,6 +9,7 @@ - import glob - import os - import subprocess -+import sys - - _protoc_path = None - +@@ -58,8 +58,8 @@ def protoc_path(root_dir): + glob.glob(os.path.join(root_dir, "out") + "/*/protoc")) + list( + glob.glob(os.path.join(root_dir, "out") + "/*/*/protoc")) + if not len(protoc_list): +- print("Can't find a suitable build output directory", +- "(it should have protoc)") ++ print(("Can't find a suitable build output directory", ++ "(it should have protoc)")) + sys.exit(1) + _protoc_path = protoc_list[0] + return _protoc_path diff --git a/src/3rdparty/chromium/components/ntp_snippets/remote/fetch.py b/src/3rdparty/chromium/components/ntp_snippets/remote/fetch.py index d5624c050..c9833fdf5 100755 --- a/src/3rdparty/chromium/components/ntp_snippets/remote/fetch.py @@ -7823,18 +7834,10 @@ index d5624c050..c9833fdf5 100755 import argparse import base64 diff --git a/src/3rdparty/chromium/components/resources/protobufs/binary_proto_generator.py b/src/3rdparty/chromium/components/resources/protobufs/binary_proto_generator.py -index 7422ead96..fcf10080a 100755 +index 7422ead96..1bf58cfed 100755 --- a/src/3rdparty/chromium/components/resources/protobufs/binary_proto_generator.py +++ b/src/3rdparty/chromium/components/resources/protobufs/binary_proto_generator.py -@@ -8,6 +8,7 @@ - - """ - -+from __future__ import print_function - import abc - import imp - import optparse -@@ -196,12 +197,12 @@ class BinaryProtoGenerator: +@@ -196,12 +196,12 @@ class BinaryProtoGenerator: self._ImportProtoModules(opts.path) if not self.VerifyArgs(opts): @@ -7847,8 +7850,8 @@ index 7422ead96..fcf10080a 100755 except Exception as e: - print "ERROR: Failed to render binary version of %s:\n %s\n%s" % ( - opts.infile, str(e), traceback.format_exc()) -+ print("ERROR: Failed to render binary version of %s:\n %s\n%s" % ( -+ opts.infile, str(e), traceback.format_exc())) ++ print("ERROR: Failed to render binary version of %s:\n %s\n%s" % ++ (opts.infile, str(e), traceback.format_exc())) return 1 diff --git a/src/3rdparty/chromium/components/resources/ssl/ssl_error_assistant/push_proto.py b/src/3rdparty/chromium/components/resources/ssl/ssl_error_assistant/push_proto.py index d2d3824d1..2634d844c 100755 @@ -8091,18 +8094,15 @@ index 41c92623b..b5f99bb25 100755 diff --git a/src/3rdparty/chromium/docs/enterprise/extension_query_py2.py b/src/3rdparty/chromium/docs/enterprise/extension_query_py2.py -index 597a5647a..e9f4f8b2c 100755 +index 597a5647a..a93e975d6 100755 --- a/src/3rdparty/chromium/docs/enterprise/extension_query_py2.py +++ b/src/3rdparty/chromium/docs/enterprise/extension_query_py2.py -@@ -2,9 +2,9 @@ - # Copyright 2020 The Chromium Authors. All rights reserved. - # Use of this source code is governed by a BSD-style license that can be +@@ -4,7 +4,7 @@ # found in the LICENSE file. --"""Transform CBCM Takeout API Data (Python2).""" -+"""Transform CBCM Takeout API Data (Python3).""" -+ + """Transform CBCM Takeout API Data (Python2).""" -from __future__ import print_function ++ import argparse import csv @@ -8259,7 +8259,7 @@ index 8e528f2ad..ec583fdc9 100755 + print('GOOGLE_CLIENT_ID_REMOTING_IDENTITY_API=%s' %GetClientID( + 'REMOTING_IDENTITY_API')) diff --git a/src/3rdparty/chromium/gpu/command_buffer/build_cmd_buffer_lib.py b/src/3rdparty/chromium/gpu/command_buffer/build_cmd_buffer_lib.py -index 2538596fb..38e9bebea 100644 +index 2538596fb..e722d89ec 100644 --- a/src/3rdparty/chromium/gpu/command_buffer/build_cmd_buffer_lib.py +++ b/src/3rdparty/chromium/gpu/command_buffer/build_cmd_buffer_lib.py @@ -682,7 +682,7 @@ def _Namespace(): @@ -8276,7 +8276,7 @@ index 2538596fb..38e9bebea 100644 # By default trace only at the highest level 3. trace_level = int(self.GetInfo('trace_level', default = 3)) - if trace_level not in xrange(0, 4): -+ if trace_level not in range(0, 4): ++ if trace_level not in list(range(0, 4)): raise KeyError("Unhandled trace_level: %d" % trace_level) cmd_flags = ('CMD_FLAG_SET_TRACE_LEVEL(%d)' % trace_level) @@ -8490,7 +8490,7 @@ index b6713168a..7d4c1da96 100644 if '$ref' in json: diff --git a/src/3rdparty/chromium/infra/config/lint-luci-milo.py b/src/3rdparty/chromium/infra/config/lint-luci-milo.py -index a91c6f3e6..4bb51b935 100755 +index a91c6f3e6..24d211c7c 100755 --- a/src/3rdparty/chromium/infra/config/lint-luci-milo.py +++ b/src/3rdparty/chromium/infra/config/lint-luci-milo.py @@ -43,12 +43,12 @@ def compare_builders(name, main_builders, sub_builders): @@ -8498,9 +8498,10 @@ index a91c6f3e6..4bb51b935 100755 if main_desc != sub_desc: - print ('bot lists different between main waterfall ' + -+ print('bot lists different between main waterfall ' + - 'and stand-alone %s waterfall:' % name) +- 'and stand-alone %s waterfall:' % name) - print '\n'.join(difflib.unified_diff(main_desc, sub_desc, ++ print(('bot lists different between main waterfall ' + ++ 'and stand-alone %s waterfall:' % name)) + print('\n'.join(difflib.unified_diff(main_desc, sub_desc, fromfile='main', tofile=name, - lineterm='')) @@ -8927,10 +8928,10 @@ index be8985ced..747047db9 100755 import optparse import re diff --git a/src/3rdparty/chromium/mojo/public/tools/bindings/gen_data_files_list.py b/src/3rdparty/chromium/mojo/public/tools/bindings/gen_data_files_list.py -index 79c9e50ef..84c452925 100644 +index 79c9e50ef..4701b8394 100644 --- a/src/3rdparty/chromium/mojo/public/tools/bindings/gen_data_files_list.py +++ b/src/3rdparty/chromium/mojo/public/tools/bindings/gen_data_files_list.py -@@ -12,13 +12,13 @@ pattern that is passed in. Only files which match the regex +@@ -12,13 +12,12 @@ pattern that is passed in. Only files which match the regex will be written to the list. """ @@ -8942,23 +8943,22 @@ index 79c9e50ef..84c452925 100644 import sys -from cStringIO import StringIO -+from io import StringIO from optparse import OptionParser sys.path.insert( -@@ -41,12 +41,8 @@ def main(): +@@ -41,12 +40,9 @@ def main(): pattern = re.compile(options.pattern) files = [f for f in os.listdir(options.directory) if pattern.match(f)] - stream = StringIO() - for f in files: - print(f, file=stream) -- -- WriteFile(stream.getvalue(), options.output) -- stream.close() + contents = '\n'.join(f for f in files) + '\n' + WriteFile(contents, options.output) +- WriteFile(stream.getvalue(), options.output) +- stream.close() + if __name__ == '__main__': sys.exit(main()) diff --git a/src/3rdparty/chromium/mojo/public/tools/bindings/generators/cpp_tracing_support.py b/src/3rdparty/chromium/mojo/public/tools/bindings/generators/cpp_tracing_support.py @@ -9002,10 +9002,21 @@ index d73b3f483..95feb718f 100644 return True return False diff --git a/src/3rdparty/chromium/mojo/public/tools/bindings/generators/mojom_java_generator.py b/src/3rdparty/chromium/mojo/public/tools/bindings/generators/mojom_java_generator.py -index 96b2fdfae..bd75c80eb 100644 +index 96b2fdfae..4a2037870 100644 --- a/src/3rdparty/chromium/mojo/public/tools/bindings/generators/mojom_java_generator.py +++ b/src/3rdparty/chromium/mojo/public/tools/bindings/generators/mojom_java_generator.py -@@ -142,7 +142,7 @@ def GetInterfaceResponseName(method): +@@ -25,6 +25,10 @@ sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, + 'build', 'android', 'gyp')) + from util import build_utils + ++# TODO(crbug.com/1174969): Remove this once Python2 is obsoleted. ++if sys.version_info.major != 2: ++ str = str ++ long = int + + GENERATOR_PREFIX = 'java' + +@@ -142,7 +146,7 @@ def GetInterfaceResponseName(method): return UpperCamelCase(method.name + '_Response') def ParseStringAttribute(attribute): @@ -9014,7 +9025,7 @@ index 96b2fdfae..bd75c80eb 100644 return attribute def GetJavaTrueFalse(value): -@@ -331,7 +331,7 @@ def ExpressionToText(context, token, kind_spec=''): +@@ -331,7 +335,7 @@ def ExpressionToText(context, token, kind_spec=''): return _TranslateNamedValue(token) if kind_spec.startswith('i') or kind_spec.startswith('u'): number = ast.literal_eval(token.lstrip('+ ')) @@ -9023,7 +9034,7 @@ index 96b2fdfae..bd75c80eb 100644 raise ValueError('got unexpected type %r for int literal %r' % ( type(number), token)) # If the literal is too large to fit a signed long, convert it to the -@@ -416,8 +416,7 @@ def TempDir(): +@@ -416,8 +420,7 @@ def TempDir(): def EnumCoversContinuousRange(kind): if not kind.fields: return False @@ -9096,7 +9107,7 @@ index e8588c675..6da272bdc 100755 template_expander.PrecompileTemplates(generator_modules, args.output_dir) return 0 diff --git a/src/3rdparty/chromium/mojo/public/tools/bindings/mojom_types_downgrader.py b/src/3rdparty/chromium/mojo/public/tools/bindings/mojom_types_downgrader.py -index 15f0e3bac..271d5d9ea 100755 +index 15f0e3bac..a9d257d4f 100755 --- a/src/3rdparty/chromium/mojo/public/tools/bindings/mojom_types_downgrader.py +++ b/src/3rdparty/chromium/mojo/public/tools/bindings/mojom_types_downgrader.py @@ -25,13 +25,13 @@ _MOJO_REPLACEMENTS = { @@ -9115,6 +9126,15 @@ index 15f0e3bac..271d5d9ea 100755 if match_object.group(0).startswith(match): return repl.format(match_object.group(index)) +@@ -99,7 +99,7 @@ def DowngradePath(src_path, output_dir=None): + elif os.path.isfile(src_path): + DowngradeFile(src_path, output_dir) + else: +- print(">>> {} not pointing to a valid file or directory".format(src_path)) ++ print((">>> {} not pointing to a valid file or directory".format(src_path))) + sys.exit(1) + + diff --git a/src/3rdparty/chromium/mojo/public/tools/bindings/validate_typemap_config.py b/src/3rdparty/chromium/mojo/public/tools/bindings/validate_typemap_config.py index f1783d59b..823282ba0 100755 --- a/src/3rdparty/chromium/mojo/public/tools/bindings/validate_typemap_config.py @@ -9427,7 +9447,7 @@ index e8fd4936c..c59b9de2f 100644 e.exception.__str__(), 'Associated interface requires \'x:TestStruct\' to be an interface.') diff --git a/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/generate/template_expander.py b/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/generate/template_expander.py -index 7a3005602..59dc85b84 100644 +index 7a3005602..cf5366474 100644 --- a/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/generate/template_expander.py +++ b/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/generate/template_expander.py @@ -67,7 +67,7 @@ def UseJinjaForImportedTemplate(func): @@ -9439,6 +9459,22 @@ index 7a3005602..59dc85b84 100644 generator = module.Generator(None) jinja_env = jinja2.Environment( loader=jinja2.FileSystemLoader([ +@@ -75,9 +75,9 @@ def PrecompileTemplates(generator_modules, output_dir): + os.path.dirname(module.__file__), generator.GetTemplatePrefix()) + ])) + jinja_env.filters.update(generator.GetFilters()) +- jinja_env.compile_templates( +- os.path.join(output_dir, "%s.zip" % generator.GetTemplatePrefix()), +- extensions=["tmpl"], +- zip="stored", +- py_compile=True, +- ignore_errors=False) ++ jinja_env.compile_templates(os.path.join( ++ output_dir, "%s.zip" % generator.GetTemplatePrefix()), ++ extensions=["tmpl"], ++ zip="stored", ++ py_compile=sys.version_info.major < 3, ++ ignore_errors=False) diff --git a/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/generate/translate.py b/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/generate/translate.py index 68c1843e7..2fe80d221 100644 --- a/src/3rdparty/chromium/mojo/public/tools/mojom/mojom/generate/translate.py @@ -10815,7 +10851,7 @@ index 65db4dc9c..4f8ca519b 100644 raise AssertionError( 'Given the old mojom:\n\n %s\n\nand the new mojom:\n\n %s\n\n' diff --git a/src/3rdparty/chromium/net/android/tools/proxy_test_cases.py b/src/3rdparty/chromium/net/android/tools/proxy_test_cases.py -index ab93f6783..f656162ca 100755 +index ab93f6783..1656d7976 100755 --- a/src/3rdparty/chromium/net/android/tools/proxy_test_cases.py +++ b/src/3rdparty/chromium/net/android/tools/proxy_test_cases.py @@ -285,25 +285,25 @@ class GenerateCPlusPlus: @@ -10823,7 +10859,7 @@ index ab93f6783..f656162ca 100755 def Generate(self): for test_case in test_cases: - print ("TEST_F(ProxyConfigServiceAndroidTest, %s) {" % test_case["name"]) -+ print("TEST_F(ProxyConfigServiceAndroidTest, %s) {" % test_case["name"]) ++ print(("TEST_F(ProxyConfigServiceAndroidTest, %s) {" % test_case["name"])) if "description" in test_case: self._GenerateDescription(test_case["description"]); self._GenerateConfiguration(test_case["properties"]) @@ -10967,15 +11003,9 @@ index 815fa9ca4..3f1c47694 100755 outfile.write(struct.pack(' FALLBACK_EXPECTED_MAC_SI_COUNT: - print('Expected <= %d static initializers in %s, but found %d' % +- print('Expected <= %d static initializers in %s, but found %d' % ++ print(('Expected <= %d static initializers in %s, but found %d' % (FALLBACK_EXPECTED_MAC_SI_COUNT, chromium_framework_executable, +- si_count)) ++ si_count))) + ret = 1 + show_mod_init_func = os.path.join(mac_tools_path, + 'show_mod_init_func.py') @@ -134,14 +134,14 @@ def main_mac(src_dir): if os.path.exists(framework_unstripped_name): args.append(framework_unstripped_name) @@ -13114,9 +13166,14 @@ index 76ab89628..54021e3c7 100755 return ret -@@ -178,8 +178,8 @@ def main_linux(src_dir, is_chromeos): - print('Error: file "%s" is not expected to have static initializers in' - ' binary "%s"') % (f, binary_name) +@@ -175,11 +175,11 @@ def main_linux(src_dir, is_chromeos): + for f in files_with_si: + if f not in allowlist[binary_name]: + ret = 1 +- print('Error: file "%s" is not expected to have static initializers in' +- ' binary "%s"') % (f, binary_name) ++ print(('Error: file "%s" is not expected to have static initializers in' ++ ' binary "%s"') % (f, binary_name)) - print '\n# Static initializers in %s:' % binary_name - print stdout @@ -13212,7 +13269,7 @@ index 6aa9b8a28..618f35b1e 100755 results[k] = v[0] else: diff --git a/src/3rdparty/chromium/testing/scripts/run_performance_tests.py b/src/3rdparty/chromium/testing/scripts/run_performance_tests.py -index 15696cbac..45c99c27e 100755 +index 15696cbac..f78b1e237 100755 --- a/src/3rdparty/chromium/testing/scripts/run_performance_tests.py +++ b/src/3rdparty/chromium/testing/scripts/run_performance_tests.py @@ -160,7 +160,7 @@ class OutputFilePaths(object): @@ -13224,6 +13281,28 @@ index 15696cbac..45c99c27e 100755 def IsWindows(): +@@ -295,8 +295,8 @@ def execute_gtest_perf_test(command_generator, output_paths, use_xvfb=False): + return_code = test_env.run_command_output_to_handle( + command, handle, env=env) + except OSError as e: +- print('Command to run gtest perf test %s failed with an OSError: %s' % +- (output_paths.name, e)) ++ print(('Command to run gtest perf test %s failed with an OSError: %s' % ++ (output_paths.name, e))) + return_code = 1 + if (not os.path.exists(output_paths.perf_results) and + os.path.exists(output_paths.logs)): +@@ -319,8 +319,8 @@ def execute_gtest_perf_test(command_generator, output_paths, use_xvfb=False): + # pylint: enable=no-name-in-module + gtest_json_converter.ConvertGtestJsonFile(output_paths.perf_results) + else: +- print('ERROR: gtest perf test %s did not generate perf output' % +- output_paths.name) ++ print(('ERROR: gtest perf test %s did not generate perf output' % ++ output_paths.name)) + return_code = 1 + write_simple_test_results(return_code, output_paths.test_results, + output_paths.name) @@ -460,7 +460,7 @@ def execute_telemetry_benchmark( except Exception: print ('The following exception may have prevented the code from ' @@ -13233,16 +13312,36 @@ index 15696cbac..45c99c27e 100755 finally: # Add ignore_errors=True because otherwise rmtree may fail due to leaky # processes of tests are still holding opened handles to files under -@@ -475,7 +475,7 @@ def execute_telemetry_benchmark( +@@ -475,8 +475,8 @@ def execute_telemetry_benchmark( # TODO(crbug.com/1019139): Make 111 be the exit code that means # "no stories were run.". if return_code in (111, -1, 255): - print ('Exit code %s indicates that no stories were run, so we are marking ' -+ print('Exit code %s indicates that no stories were run, so we are marking ' - 'this as a success.' % return_code) +- 'this as a success.' % return_code) ++ print(('Exit code %s indicates that no stories were run, so we are marking ' ++ 'this as a success.' % return_code)) return 0 if return_code: -@@ -620,7 +620,7 @@ def main(sys_args): + return return_code +@@ -564,7 +564,7 @@ def main(sys_args): + if not benchmark_name: + benchmark_name = options.executable + output_paths = OutputFilePaths(isolated_out_dir, benchmark_name).SetUp() +- print('\n### {folder} ###'.format(folder=benchmark_name)) ++ print(('\n### {folder} ###'.format(folder=benchmark_name))) + overall_return_code = execute_gtest_perf_test( + command_generator, output_paths, options.xvfb) + test_results_files.append(output_paths.test_results) +@@ -577,7 +577,7 @@ def main(sys_args): + output_paths = OutputFilePaths(isolated_out_dir, benchmark).SetUp() + command_generator = TelemetryCommandGenerator( + benchmark, options) +- print('\n### {folder} ###'.format(folder=benchmark)) ++ print(('\n### {folder} ###'.format(folder=benchmark))) + return_code = execute_telemetry_benchmark( + command_generator, output_paths, options.xvfb) + overall_return_code = return_code or overall_return_code +@@ -620,14 +620,14 @@ def main(sys_args): if 'benchmarks' in shard_configuration: benchmarks_and_configs = shard_configuration['benchmarks'] for (benchmark, story_selection_config @@ -13251,6 +13350,25 @@ index 15696cbac..45c99c27e 100755 # Need to run the benchmark on both latest browser and reference # build. output_paths = OutputFilePaths(isolated_out_dir, benchmark).SetUp() + command_generator = TelemetryCommandGenerator( + benchmark, options, + story_selection_config=story_selection_config) +- print('\n### {folder} ###'.format(folder=benchmark)) ++ print(('\n### {folder} ###'.format(folder=benchmark))) + return_code = execute_telemetry_benchmark( + command_generator, output_paths, options.xvfb) + overall_return_code = return_code or overall_return_code +@@ -640,8 +640,8 @@ def main(sys_args): + benchmark, options, + story_selection_config=story_selection_config, + is_reference=True) +- print('\n### {folder} ###'.format( +- folder=reference_benchmark_foldername)) ++ print(('\n### {folder} ###'.format( ++ folder=reference_benchmark_foldername))) + # We intentionally ignore the return code and test results of the + # reference build. + execute_telemetry_benchmark( @@ -650,7 +650,7 @@ def main(sys_args): if 'executables' in shard_configuration: names_and_configs = shard_configuration['executables'] @@ -13260,6 +13378,15 @@ index 15696cbac..45c99c27e 100755 additional_flags = [] if 'arguments' in configuration: additional_flags = configuration['arguments'] +@@ -658,7 +658,7 @@ def main(sys_args): + options, override_executable=configuration['path'], + additional_flags=additional_flags, ignore_shard_env_vars=True) + output_paths = OutputFilePaths(isolated_out_dir, name).SetUp() +- print('\n### {folder} ###'.format(folder=name)) ++ print(('\n### {folder} ###'.format(folder=name))) + return_code = execute_gtest_perf_test( + command_generator, output_paths, options.xvfb) + overall_return_code = return_code or overall_return_code diff --git a/src/3rdparty/chromium/testing/scripts/run_rendering_benchmark_with_gated_performance.py b/src/3rdparty/chromium/testing/scripts/run_rendering_benchmark_with_gated_performance.py index 0721aeb9f..7bcb6c97b 100755 --- a/src/3rdparty/chromium/testing/scripts/run_rendering_benchmark_with_gated_performance.py @@ -14475,19 +14602,43 @@ index d3d48f099..f2d68cb33 100644 """ -diff --git a/src/3rdparty/chromium/third_party/SPIRV-Tools/src/kokoro/windows-msvc-2015-release-bazel/build.bat b/src/3rdparty/chromium/third_party/SPIRV-Tools/src/kokoro/windows-msvc-2015-release-bazel/build.bat -index ddb4f540d..4e5d1f4bf 100644 ---- a/src/3rdparty/chromium/third_party/SPIRV-Tools/src/kokoro/windows-msvc-2015-release-bazel/build.bat -+++ b/src/3rdparty/chromium/third_party/SPIRV-Tools/src/kokoro/windows-msvc-2015-release-bazel/build.bat -@@ -37,7 +37,7 @@ call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64 - set BAZEL_VS=C:\Program Files (x86)\Microsoft Visual Studio 14.0 - set BAZEL_VC=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC - set BAZEL_SH=c:\tools\msys64\usr\bin\bash.exe --set BAZEL_PYTHON=c:\tools\python2\python.exe -+set BAZEL_PYTHON=c:\tools\python3\python.exe - - :: ######################################### - :: Start building. +diff --git a/src/3rdparty/chromium/third_party/SPIRV-Tools/src/utils/check_copyright.py b/src/3rdparty/chromium/third_party/SPIRV-Tools/src/utils/check_copyright.py +index 39d27cb7d..487294e75 100755 +--- a/src/3rdparty/chromium/third_party/SPIRV-Tools/src/utils/check_copyright.py ++++ b/src/3rdparty/chromium/third_party/SPIRV-Tools/src/utils/check_copyright.py +@@ -212,8 +212,8 @@ def main(): + + if args.author: + if args.author not in AUTHORS: +- print('error: --update argument must be in the AUTHORS list in ' +- 'check_copyright.py: {}'.format(AUTHORS)) ++ print(('error: --update argument must be in the AUTHORS list in ' ++ 'check_copyright.py: {}'.format(AUTHORS))) + sys.exit(1) + for pair in glob_comment_pairs: + insert_copyright(args.author, *pair) +diff --git a/src/3rdparty/chromium/third_party/SPIRV-Tools/src/utils/check_symbol_exports.py b/src/3rdparty/chromium/third_party/SPIRV-Tools/src/utils/check_symbol_exports.py +index bcd77da68..d3f944442 100755 +--- a/src/3rdparty/chromium/third_party/SPIRV-Tools/src/utils/check_symbol_exports.py ++++ b/src/3rdparty/chromium/third_party/SPIRV-Tools/src/utils/check_symbol_exports.py +@@ -71,7 +71,7 @@ def check_library(library): + seen.add(symbol) + #print("look at '{}'".format(symbol)) + if not (symbol_allowlist_pattern.match(symbol) or symbol_ok_pattern.match(symbol)): +- print('{}: error: Unescaped exported symbol: {}'.format(PROG, symbol)) ++ print(('{}: error: Unescaped exported symbol: {}'.format(PROG, symbol))) + result = 1 + return result + +@@ -83,7 +83,7 @@ def main(): + args = parser.parse_args() + + if not os.path.isfile(args.library): +- print('{}: error: {} does not exist'.format(PROG, args.library)) ++ print(('{}: error: {} does not exist'.format(PROG, args.library))) + sys.exit(1) + + if os.name == 'posix': diff --git a/src/3rdparty/chromium/third_party/SPIRV-Tools/src/utils/generate_grammar_tables.py b/src/3rdparty/chromium/third_party/SPIRV-Tools/src/utils/generate_grammar_tables.py index 2a6773369..830328bf4 100755 --- a/src/3rdparty/chromium/third_party/SPIRV-Tools/src/utils/generate_grammar_tables.py @@ -14527,24 +14678,38 @@ index 2a6773369..830328bf4 100755 table_entries = [' {{{}, ARRAY_SIZE({}), {}}}'.format(*e) for e in table_entries] +diff --git a/src/3rdparty/chromium/third_party/SPIRV-Tools/src/utils/generate_vim_syntax.py b/src/3rdparty/chromium/third_party/SPIRV-Tools/src/utils/generate_vim_syntax.py +index da7e99ba7..7e2f49a28 100755 +--- a/src/3rdparty/chromium/third_party/SPIRV-Tools/src/utils/generate_vim_syntax.py ++++ b/src/3rdparty/chromium/third_party/SPIRV-Tools/src/utils/generate_vim_syntax.py +@@ -123,12 +123,12 @@ SPEC_CONSTANT_OP_OPCODES = """ + + def EmitAsStatement(name): + """Emits the given name as a statement token""" +- print('syn keyword spvasmStatement', name) ++ print(('syn keyword spvasmStatement', name)) + + + def EmitAsEnumerant(name): + """Emits the given name as an named operand token""" +- print('syn keyword spvasmConstant', name) ++ print(('syn keyword spvasmConstant', name)) + + + def main(): diff --git a/src/3rdparty/chromium/third_party/SPIRV-Tools/src/utils/update_build_version.py b/src/3rdparty/chromium/third_party/SPIRV-Tools/src/utils/update_build_version.py -index 321de74bd..8184191a2 100755 +index 321de74bd..0c1f83ff7 100755 --- a/src/3rdparty/chromium/third_party/SPIRV-Tools/src/utils/update_build_version.py +++ b/src/3rdparty/chromium/third_party/SPIRV-Tools/src/utils/update_build_version.py -@@ -101,11 +101,11 @@ def describe(directory): - Runs 'git describe', or alternately 'git rev-parse HEAD', in directory. If - successful, returns the output; otherwise returns 'unknown hash, '.""" - try: -- # decode() is needed here for Python3 compatibility. In Python2, -+ # decode() is needed here for Python3 compatibility. In Python3, - # str and bytes are the same type, but not in Python3. - # Popen.communicate() returns a bytes instance, which needs to be - # decoded into text data first in Python3. And this decode() won't -- # hurt Python2. -+ # hurt Python3. - return command_output(['git', 'describe'], directory).rstrip().decode() - except: - try: +@@ -125,7 +125,7 @@ def describe(directory): + + def main(): + if len(sys.argv) != 3: +- print('usage: {} '.format(sys.argv[0])) ++ print(('usage: {} '.format(sys.argv[0]))) + sys.exit(1) + + output_file = sys.argv[2] diff --git a/src/3rdparty/chromium/third_party/abseil-cpp/absl/abseil.podspec.gen.py b/src/3rdparty/chromium/third_party/abseil-cpp/absl/abseil.podspec.gen.py index 6aefb794d..6e155e754 100755 --- a/src/3rdparty/chromium/third_party/abseil-cpp/absl/abseil.podspec.gen.py @@ -14558,6 +14723,19 @@ index 6aefb794d..6e155e754 100755 with open(args.output, "wt") as f: write_podspec(f, rules, vars(args)) +diff --git a/src/3rdparty/chromium/third_party/angle/PRESUBMIT.py b/src/3rdparty/chromium/third_party/angle/PRESUBMIT.py +index e7ac94e13..cc9d9086c 100644 +--- a/src/3rdparty/chromium/third_party/angle/PRESUBMIT.py ++++ b/src/3rdparty/chromium/third_party/angle/PRESUBMIT.py +@@ -240,7 +240,7 @@ def _CheckCodeGeneration(input_api, output_api): + cmd = [input_api.python_executable, code_gen_path, '--verify-no-dirty'] + test_cmd = input_api.Command(name=cmd_name, cmd=cmd, kwargs={}, message=Msg) + if input_api.verbose: +- print('Running ' + cmd_name) ++ print(('Running ' + cmd_name)) + return input_api.RunTests([test_cmd]) + + diff --git a/src/3rdparty/chromium/third_party/angle/scripts/apply_clang_format_on_all_sources.py b/src/3rdparty/chromium/third_party/angle/scripts/apply_clang_format_on_all_sources.py index 779ef91e8..8cc06f113 100755 --- a/src/3rdparty/chromium/third_party/angle/scripts/apply_clang_format_on_all_sources.py @@ -14571,26 +14749,10 @@ index 779ef91e8..8cc06f113 100755 import os import sys -diff --git a/src/3rdparty/chromium/third_party/angle/scripts/bmp_to_nv12.py b/src/3rdparty/chromium/third_party/angle/scripts/bmp_to_nv12.py -index 10491658b..d1c2f6f2c 100755 ---- a/src/3rdparty/chromium/third_party/angle/scripts/bmp_to_nv12.py -+++ b/src/3rdparty/chromium/third_party/angle/scripts/bmp_to_nv12.py -@@ -1,4 +1,4 @@ --#!/usr/bin/python2 -+#!/usr/bin/python3 - # - # Copyright 2016 The ANGLE Project Authors. All rights reserved. - # Use of this source code is governed by a BSD-style license that can be diff --git a/src/3rdparty/chromium/third_party/angle/scripts/bootstrap.py b/src/3rdparty/chromium/third_party/angle/scripts/bootstrap.py -index c505ffaff..5683d1fc8 100755 +index c505ffaff..3ce5f340a 100755 --- a/src/3rdparty/chromium/third_party/angle/scripts/bootstrap.py +++ b/src/3rdparty/chromium/third_party/angle/scripts/bootstrap.py -@@ -1,4 +1,4 @@ --#!/usr/bin/python2 -+#!/usr/bin/python3 - - # Copyright 2015 Google Inc. All rights reserved. - # Use of this source code is governed by a BSD-style license that can be @@ -18,11 +18,11 @@ def main(): try: rc = subprocess.call(gclient_cmd, shell=True) @@ -14614,31 +14776,11 @@ index c505ffaff..5683d1fc8 100755 if __name__ == '__main__': -diff --git a/src/3rdparty/chromium/third_party/angle/scripts/export_targets.py b/src/3rdparty/chromium/third_party/angle/scripts/export_targets.py -index bfea05db7..fe509f255 100755 ---- a/src/3rdparty/chromium/third_party/angle/scripts/export_targets.py -+++ b/src/3rdparty/chromium/third_party/angle/scripts/export_targets.py -@@ -2,8 +2,8 @@ - assert __name__ == '__main__' - - ''' --To update ANGLE in Gecko, use Windows with git-bash, and setup depot_tools, python2, and --python3. Because depot_tools expects `python` to be `python2` (shame!), python2 must come -+To update ANGLE in Gecko, use Windows with git-bash, and setup depot_tools, python3, and -+python3. Because depot_tools expects `python` to be `python3` (shame!), python3 must come - before python3 in your path. - - Upstream: https://chromium.googlesource.com/angle/angle diff --git a/src/3rdparty/chromium/third_party/angle/scripts/file_exists.py b/src/3rdparty/chromium/third_party/angle/scripts/file_exists.py -index 976bf546c..a3529174d 100644 +index 976bf546c..91856eace 100644 --- a/src/3rdparty/chromium/third_party/angle/scripts/file_exists.py +++ b/src/3rdparty/chromium/third_party/angle/scripts/file_exists.py -@@ -1,11 +1,11 @@ --#!/usr/bin/python2 -+#!/usr/bin/python3 - # Copyright 2019 The ANGLE Project Authors. All rights reserved. - # Use of this source code is governed by a BSD-style license that can be - # found in the LICENSE file. +@@ -5,7 +5,7 @@ # # Simple helper for use in 'gn' files to check if a file exists. @@ -14647,6 +14789,19 @@ index 976bf546c..a3529174d 100644 import os, shutil, sys +diff --git a/src/3rdparty/chromium/third_party/angle/scripts/gen_angle_gn_info_json.py b/src/3rdparty/chromium/third_party/angle/scripts/gen_angle_gn_info_json.py +index 983cd7ed1..8b6ec822c 100755 +--- a/src/3rdparty/chromium/third_party/angle/scripts/gen_angle_gn_info_json.py ++++ b/src/3rdparty/chromium/third_party/angle/scripts/gen_angle_gn_info_json.py +@@ -108,7 +108,7 @@ def main(): + fh.write(json.dumps(desc, indent=4, sort_keys=True)) + fh.close() + +- print("Output written to: %s" % args.output) ++ print(("Output written to: %s" % args.output)) + + + if __name__ == '__main__': diff --git a/src/3rdparty/chromium/third_party/angle/scripts/gen_gl_enum_utils.py b/src/3rdparty/chromium/third_party/angle/scripts/gen_gl_enum_utils.py index 0d614f577..6ce05c57c 100755 --- a/src/3rdparty/chromium/third_party/angle/scripts/gen_gl_enum_utils.py @@ -14727,8 +14882,24 @@ index 43e821de8..ef8584d00 100644 with open(out_file_name_gl, 'w') as out_file: output_cpp = template_cpp.format( +diff --git a/src/3rdparty/chromium/third_party/angle/scripts/gen_vk_gl_cts_build.py b/src/3rdparty/chromium/third_party/angle/scripts/gen_vk_gl_cts_build.py +index 6adda4c44..e3d99a273 100644 +--- a/src/3rdparty/chromium/third_party/angle/scripts/gen_vk_gl_cts_build.py ++++ b/src/3rdparty/chromium/third_party/angle/scripts/gen_vk_gl_cts_build.py +@@ -119,9 +119,9 @@ def main(): + outputs = [dataGniFilename, buildGnPath] + + if sys.argv[1] == 'inputs': +- print(','.join(inputs)) ++ print((','.join(inputs))) + elif sys.argv[1] == 'outputs': +- print(','.join(outputs)) ++ print((','.join(outputs))) + else: + print('Invalid script parameters') + return 1 diff --git a/src/3rdparty/chromium/third_party/angle/scripts/generate_android_bp.py b/src/3rdparty/chromium/third_party/angle/scripts/generate_android_bp.py -index f7853c175..a00a5cb1d 100644 +index f7853c175..16dfe284c 100644 --- a/src/3rdparty/chromium/third_party/angle/scripts/generate_android_bp.py +++ b/src/3rdparty/chromium/third_party/angle/scripts/generate_android_bp.py @@ -42,7 +42,7 @@ def has_child_values(value): @@ -14802,16 +14973,19 @@ index f7853c175..a00a5cb1d 100644 output = outputs_remap[output] bp_outputs.append(output) +@@ -567,7 +567,7 @@ def main(): + for (blueprint_type, blueprint_data) in blueprint_targets: + write_blueprint(output, blueprint_type, blueprint_data) + +- print('\n'.join(output)) ++ print(('\n'.join(output))) + + + if __name__ == '__main__': diff --git a/src/3rdparty/chromium/third_party/angle/scripts/generate_entry_points.py b/src/3rdparty/chromium/third_party/angle/scripts/generate_entry_points.py -index 5bd82ab35..0f4db41c7 100755 +index 5bd82ab35..8c4faccb1 100755 --- a/src/3rdparty/chromium/third_party/angle/scripts/generate_entry_points.py +++ b/src/3rdparty/chromium/third_party/angle/scripts/generate_entry_points.py -@@ -1,4 +1,4 @@ --#!/usr/bin/python2 -+#!/usr/bin/python3 - # - # Copyright 2017 The ANGLE Project Authors. All rights reserved. - # Use of this source code is governed by a BSD-style license that can be @@ -738,7 +738,7 @@ def make_param(param_type, param_name): def just_the_type_packed(param, entry): @@ -14893,15 +15067,9 @@ index 5bd82ab35..0f4db41c7 100755 # Detect and filter duplicate extensions. diff --git a/src/3rdparty/chromium/third_party/angle/scripts/generate_loader.py b/src/3rdparty/chromium/third_party/angle/scripts/generate_loader.py -index 216b5cf3d..1bb0bfe01 100755 +index 216b5cf3d..87f05a5fb 100755 --- a/src/3rdparty/chromium/third_party/angle/scripts/generate_loader.py +++ b/src/3rdparty/chromium/third_party/angle/scripts/generate_loader.py -@@ -1,4 +1,4 @@ --#!/usr/bin/python2 -+#!/usr/bin/python3 - # - # Copyright 2018 The ANGLE Project Authors. All rights reserved. - # Use of this source code is governed by a BSD-style license that can be @@ -290,9 +290,9 @@ def main(): ] @@ -14915,15 +15083,26 @@ index 216b5cf3d..1bb0bfe01 100755 print('Invalid script parameters') return 1 diff --git a/src/3rdparty/chromium/third_party/angle/scripts/generate_new_renderer.py b/src/3rdparty/chromium/third_party/angle/scripts/generate_new_renderer.py -index 9b26c5ee6..13e772dd0 100755 +index 9b26c5ee6..b5a7cffa6 100755 --- a/src/3rdparty/chromium/third_party/angle/scripts/generate_new_renderer.py +++ b/src/3rdparty/chromium/third_party/angle/scripts/generate_new_renderer.py -@@ -1,4 +1,4 @@ --#!/usr/bin/python2 -+#!/usr/bin/python3 - # - # Copyright 2015 The ANGLE Project Authors. All rights reserved. - # Use of this source code is governed by a BSD-style license that can be +@@ -18,7 +18,7 @@ + import os, sys, re, string, datetime + + if len(sys.argv) < 3: +- print('Usage: ' + sys.argv[0] + ' ') ++ print(('Usage: ' + sys.argv[0] + ' ')) + sys.exit(1) + + renderer_name = sys.argv[1] +@@ -283,5 +283,5 @@ for impl_class in impl_classes: + print("Generated files:") + for impl_class in impl_classes: + path = "libANGLE/renderer/" + renderer_name + "/" + impl_class + renderer_suffix +- print('\'' + path + ".cpp\',") +- print('\'' + path + ".h\',") ++ print(('\'' + path + ".cpp\',")) ++ print(('\'' + path + ".h\',")) diff --git a/src/3rdparty/chromium/third_party/angle/scripts/generate_stats.py b/src/3rdparty/chromium/third_party/angle/scripts/generate_stats.py index 8924b7e05..528931a8a 100755 --- a/src/3rdparty/chromium/third_party/angle/scripts/generate_stats.py @@ -14999,35 +15178,71 @@ index 8924b7e05..528931a8a 100755 body=append_values_request_body, range=header_range, diff --git a/src/3rdparty/chromium/third_party/angle/scripts/msvs_projects.py b/src/3rdparty/chromium/third_party/angle/scripts/msvs_projects.py -index f24a95216..4248fc79b 100755 +index f24a95216..f0be3418d 100755 --- a/src/3rdparty/chromium/third_party/angle/scripts/msvs_projects.py +++ b/src/3rdparty/chromium/third_party/angle/scripts/msvs_projects.py -@@ -1,4 +1,4 @@ --#!/usr/bin/python2 -+#!/usr/bin/python3 - # - # Copyright 2017 The ANGLE Project Authors. All rights reserved. - # Use of this source code is governed by a BSD-style license that can be +@@ -26,7 +26,7 @@ out_dir = 'out' + # Generate the VS solutions for any valid directory. + def generate_projects(dirname): + args = ['gn.bat', 'gen', dirname, '--ide=' + target_ide, '--sln=' + solution_name] +- print('Running "' + ' '.join(args) + '"') ++ print(('Running "' + ' '.join(args) + '"')) + subprocess.call(args) + + +@@ -38,5 +38,5 @@ for potential_dir in os.listdir(out_dir): + + # Run the helper utility that merges the projects. + args = ['python', os.path.join('build', 'win', 'gn_meta_sln.py')] +-print('Running "' + ' '.join(args) + '"') ++print(('Running "' + ' '.join(args) + '"')) + subprocess.call(args) diff --git a/src/3rdparty/chromium/third_party/angle/scripts/perf_test_runner.py b/src/3rdparty/chromium/third_party/angle/scripts/perf_test_runner.py -index 989ffcfe5..4737db77e 100755 +index 989ffcfe5..f0b15d489 100755 --- a/src/3rdparty/chromium/third_party/angle/scripts/perf_test_runner.py +++ b/src/3rdparty/chromium/third_party/angle/scripts/perf_test_runner.py -@@ -1,4 +1,4 @@ --#!/usr/bin/python2 -+#!/usr/bin/python3 - # - # Copyright 2015 The ANGLE Project Authors. All rights reserved. - # Use of this source code is governed by a BSD-style license that can be +@@ -89,7 +89,7 @@ for path in perftests_paths: + perftests_path = newest_binary + + if perftests_path == None or not os.path.exists(perftests_path): +- print('Cannot find Release %s!' % binary_name) ++ print(('Cannot find Release %s!' % binary_name)) + sys.exit(1) + + if sys.platform == 'win32': +@@ -100,8 +100,8 @@ else: + if len(sys.argv) >= 2: + test_name = sys.argv[1] + +-print('Using test executable: ' + perftests_path) +-print('Test name: ' + test_name) ++print(('Using test executable: ' + perftests_path)) ++print(('Test name: ' + test_name)) + + + def get_results(metric, extra_args=[]): +@@ -122,7 +122,7 @@ def get_results(metric, extra_args=[]): + pattern = r'\.' + metric + r':.*= ([0-9.]+)' + m = re.findall(pattern, output) + if not m: +- print("Did not find the metric '%s' in the test output:" % metric) ++ print(("Did not find the metric '%s' in the test output:" % metric)) + print(output) + sys.exit(1) + +@@ -131,7 +131,7 @@ def get_results(metric, extra_args=[]): + + # Calibrate the number of steps + steps = get_results("steps", ["--calibration"])[0] +-print("running with %d steps." % steps) ++print(("running with %d steps." % steps)) + + # Loop 'max_experiments' times, running the tests. + for experiment in range(max_experiments): diff --git a/src/3rdparty/chromium/third_party/angle/scripts/registry_xml.py b/src/3rdparty/chromium/third_party/angle/scripts/registry_xml.py -index e596e8ae7..0ba279eaa 100644 +index e596e8ae7..6436722b9 100644 --- a/src/3rdparty/chromium/third_party/angle/scripts/registry_xml.py +++ b/src/3rdparty/chromium/third_party/angle/scripts/registry_xml.py -@@ -1,4 +1,4 @@ --#!/usr/bin/python2 -+#!/usr/bin/python3 - # - # Copyright 2018 The ANGLE Project Authors. All rights reserved. - # Use of this source code is governed by a BSD-style license that can be @@ -216,7 +216,7 @@ class GLCommandNames: def get_all_commands(self): cmd_names = [] @@ -15047,15 +15262,18 @@ index e596e8ae7..0ba279eaa 100644 # Detect and filter duplicate extensions. dupes = [] diff --git a/src/3rdparty/chromium/third_party/angle/scripts/remove_files.py b/src/3rdparty/chromium/third_party/angle/scripts/remove_files.py -index f52a1a816..6e7883b9e 100755 +index f52a1a816..30f56be4f 100755 --- a/src/3rdparty/chromium/third_party/angle/scripts/remove_files.py +++ b/src/3rdparty/chromium/third_party/angle/scripts/remove_files.py -@@ -1,4 +1,4 @@ --#!/usr/bin/python2 -+#!/usr/bin/python3 - # - # Copyright 2019 The ANGLE Project Authors. All rights reserved. - # Use of this source code is governed by a BSD-style license that can be +@@ -14,7 +14,7 @@ import os + import sys + + if len(sys.argv) < 3: +- print("Usage: " + sys.argv[0] + " ") ++ print(("Usage: " + sys.argv[0] + " ")) + + stamp_file = sys.argv[1] + diff --git a/src/3rdparty/chromium/third_party/angle/scripts/roll_chromium_deps.py b/src/3rdparty/chromium/third_party/angle/scripts/roll_chromium_deps.py index d377894c5..8c28000ab 100755 --- a/src/3rdparty/chromium/third_party/angle/scripts/roll_chromium_deps.py @@ -15115,30 +15333,51 @@ index d377894c5..8c28000ab 100755 continue diff --git a/src/3rdparty/chromium/third_party/angle/scripts/run_code_generation.py b/src/3rdparty/chromium/third_party/angle/scripts/run_code_generation.py -index 9477a9d39..a4ea98f8a 100755 +index 9477a9d39..ac8808184 100755 --- a/src/3rdparty/chromium/third_party/angle/scripts/run_code_generation.py +++ b/src/3rdparty/chromium/third_party/angle/scripts/run_code_generation.py -@@ -1,4 +1,4 @@ --#!/usr/bin/python2 -+#!/usr/bin/python3 - # - # Copyright 2017 The ANGLE Project Authors. All rights reserved. - # Use of this source code is governed by a BSD-style license that can be -@@ -157,12 +157,12 @@ def any_hash_dirty(name, filenames, new_hashes, old_hashes): +@@ -145,26 +145,26 @@ def any_hash_dirty(name, filenames, new_hashes, old_hashes): + + for fname in filenames: + if not os.path.isfile(fname): +- print('File not found: "%s". Code gen dirty for %s' % (fname, name)) ++ print(('File not found: "%s". Code gen dirty for %s' % (fname, name))) + found_dirty_hash = True + else: + new_hashes[fname] = md5(fname) + if (not fname in old_hashes) or (old_hashes[fname] != new_hashes[fname]): +- print('Hash for "%s" dirty for %s generator.' % (fname, name)) ++ print(('Hash for "%s" dirty for %s generator.' % (fname, name))) + found_dirty_hash = True + return found_dirty_hash + def any_old_hash_missing(all_new_hashes, all_old_hashes): result = False - for file, old_hashes in all_old_hashes.iteritems(): + for file, old_hashes in all_old_hashes.items(): if file not in all_new_hashes: - print('"%s" does not exist. Code gen dirty.' % file) +- print('"%s" does not exist. Code gen dirty.' % file) ++ print(('"%s" does not exist. Code gen dirty.' % file)) result = True else: - for name, _ in old_hashes.iteritems(): + for name, _ in old_hashes.items(): if name not in all_new_hashes[file]: - print('Hash for %s is missing from "%s". Code gen is dirty.' % (name, file)) +- print('Hash for %s is missing from "%s". Code gen is dirty.' % (name, file)) ++ print(('Hash for %s is missing from "%s". Code gen is dirty.' % (name, file))) result = True + return result + +@@ -172,7 +172,7 @@ def any_old_hash_missing(all_new_hashes, all_old_hashes): + def update_output_hashes(script, outputs, new_hashes): + for output in outputs: + if not os.path.isfile(output): +- print('Output is missing from %s: %s' % (script, output)) ++ print(('Output is missing from %s: %s' % (script, output))) + sys.exit(1) + new_hashes[output] = md5(output) + @@ -197,7 +197,7 @@ def main(): if len(sys.argv) > 1 and sys.argv[1] == '--verify-no-dirty': verify_only = True @@ -15148,6 +15387,15 @@ index 9477a9d39..a4ea98f8a 100755 info = auto_script(script) fname = get_hash_file_name(name) filenames = info['inputs'] + info['outputs'] + [script] +@@ -211,7 +211,7 @@ def main(): + # Set the CWD to the script directory. + os.chdir(get_child_script_dirname(script)) + +- print('Running ' + name + ' code generator') ++ print(('Running ' + name + ' code generator')) + + f = open(os.path.basename(script), "r") + if subprocess.call([get_executable_name(f.readline()), @@ -236,14 +236,14 @@ def main(): sys.exit(1) @@ -15166,25 +15414,53 @@ index 9477a9d39..a4ea98f8a 100755 json.dump( new_hashes, diff --git a/src/3rdparty/chromium/third_party/angle/scripts/trigger.py b/src/3rdparty/chromium/third_party/angle/scripts/trigger.py -index e8b0e5461..7c1fdaf56 100755 +index e8b0e5461..57a20c57a 100755 --- a/src/3rdparty/chromium/third_party/angle/scripts/trigger.py +++ b/src/3rdparty/chromium/third_party/angle/scripts/trigger.py -@@ -1,4 +1,4 @@ --#!/usr/bin/python2 -+#!/usr/bin/python3 - # - # Copyright 2019 The ANGLE Project Authors. All rights reserved. - # Use of this source code is governed by a BSD-style license that can be +@@ -49,7 +49,7 @@ def main(): + with open(isolated_file, 'rb') as f: + sha = hashlib.sha1(f.read()).hexdigest() + +- print('Got an isolated SHA of %s' % sha) ++ print(('Got an isolated SHA of %s' % sha)) + swarming_script_path = os.path.join('tools', 'luci-go', 'swarming') + + swarming_args = [ +@@ -78,7 +78,7 @@ def main(): + if unknown: + shard_args += ["--"] + unknown + +- print(' '.join(shard_args)) ++ print((' '.join(shard_args))) + subprocess.call(shard_args) + return 0 + diff --git a/src/3rdparty/chromium/third_party/angle/scripts/update_canary_angle.py b/src/3rdparty/chromium/third_party/angle/scripts/update_canary_angle.py -index 5df46cc5f..28110631d 100755 +index 5df46cc5f..50cbd936b 100755 --- a/src/3rdparty/chromium/third_party/angle/scripts/update_canary_angle.py +++ b/src/3rdparty/chromium/third_party/angle/scripts/update_canary_angle.py -@@ -1,4 +1,4 @@ --#!/usr/bin/python2 -+#!/usr/bin/python3 - # - # Copyright 2016 The ANGLE Project Authors. All rights reserved. - # Use of this source code is governed by a BSD-style license that can be +@@ -51,7 +51,7 @@ sorted_chrome_bins = sorted( + + dest_folder = os.path.join(chrome_folder, sorted_chrome_bins[0]) + +-print('Copying DLLs from ' + source_folder + ' to ' + dest_folder + '.') ++print(('Copying DLLs from ' + source_folder + ' to ' + dest_folder + '.')) + + for dll in ['libGLESv2.dll', 'libEGL.dll']: + src = os.path.join(source_folder, dll) +diff --git a/src/3rdparty/chromium/third_party/angle/src/commit_id.py b/src/3rdparty/chromium/third_party/angle/src/commit_id.py +index 1042b9c20..0498c482d 100755 +--- a/src/3rdparty/chromium/third_party/angle/src/commit_id.py ++++ b/src/3rdparty/chromium/third_party/angle/src/commit_id.py +@@ -42,7 +42,7 @@ if operation == 'check': + sys.exit(0) + elif operation == 'position': + if git_dir_exists: +- print(get_commit_position(cwd)) ++ print((get_commit_position(cwd))) + else: + print("0") + sys.exit(0) diff --git a/src/3rdparty/chromium/third_party/angle/src/common/Float16ToFloat32.py b/src/3rdparty/chromium/third_party/angle/src/common/Float16ToFloat32.py index 592da65e7..a79e6154a 100644 --- a/src/3rdparty/chromium/third_party/angle/src/common/Float16ToFloat32.py @@ -15295,10 +15571,20 @@ index faa87e698..8d6fad128 100644 print('Invalid script parameters') return 1 diff --git a/src/3rdparty/chromium/third_party/angle/src/compiler/generate_parser_tools.py b/src/3rdparty/chromium/third_party/angle/src/compiler/generate_parser_tools.py -index 0990e26d6..0a0257f3e 100644 +index 0990e26d6..a4e30c349 100644 --- a/src/3rdparty/chromium/third_party/angle/src/compiler/generate_parser_tools.py +++ b/src/3rdparty/chromium/third_party/angle/src/compiler/generate_parser_tools.py -@@ -148,12 +148,12 @@ def generate_parser(basename, generate_header): +@@ -140,20 +140,20 @@ def generate_parser(basename, generate_header): + if current_file.endswith('.pyc'): + current_file = current_file[:-1] + inputs += [current_file] +- print(','.join(inputs)) ++ print((','.join(inputs))) + if sys.argv[1] == 'outputs': +- print(','.join(get_output_files(basename, generate_header))) ++ print((','.join(get_output_files(basename, generate_header)))) + return 0 + # Call flex and bison to generate the lexer and parser. flex_result = run_flex(basename) if flex_result != 0: @@ -15593,7 +15879,7 @@ index a35606846..0a37e0695 100644 for internal_format in combos: internal_format_cases += " case " + internal_format + ":\n" diff --git a/src/3rdparty/chromium/third_party/angle/src/libANGLE/gen_overlay_fonts.py b/src/3rdparty/chromium/third_party/angle/src/libANGLE/gen_overlay_fonts.py -index 22a99de3f..6f0fd4d5d 100644 +index 22a99de3f..4562eb691 100644 --- a/src/3rdparty/chromium/third_party/angle/src/libANGLE/gen_overlay_fonts.py +++ b/src/3rdparty/chromium/third_party/angle/src/libANGLE/gen_overlay_fonts.py @@ -28,7 +28,7 @@ out_file_cpp = 'Overlay_font_autogen.cpp' @@ -15623,8 +15909,17 @@ index 22a99de3f..6f0fd4d5d 100644 return GetFontLayerPixel({font_image}, x, y); """ +@@ -148,7 +148,7 @@ def main(): + # print(font_file) + return + if len(sys.argv) == 2 and sys.argv[1] == 'outputs': +- print(','.join([out_file_cpp, out_file_h])) ++ print((','.join([out_file_cpp, out_file_h]))) + return + + font_defs = [('large', 36), ('medium', 23), ('small', 14)] diff --git a/src/3rdparty/chromium/third_party/angle/src/libANGLE/gen_overlay_widgets.py b/src/3rdparty/chromium/third_party/angle/src/libANGLE/gen_overlay_widgets.py -index f374dc8e3..6b1959905 100644 +index f374dc8e3..1f3393cbf 100644 --- a/src/3rdparty/chromium/third_party/angle/src/libANGLE/gen_overlay_widgets.py +++ b/src/3rdparty/chromium/third_party/angle/src/libANGLE/gen_overlay_widgets.py @@ -18,7 +18,7 @@ OUT_HEADER_FILE_NAME = 'Overlay_autogen.h' @@ -15672,6 +15967,15 @@ index f374dc8e3..6b1959905 100644 is_left = coord >= 0 return coord, is_left +@@ -321,7 +321,7 @@ def main(): + OUT_SOURCE_FILE_NAME, + OUT_HEADER_FILE_NAME, + ] +- print(','.join(outputs)) ++ print((','.join(outputs))) + return + + with open(IN_JSON_FILE_NAME) as fin: diff --git a/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/angle_format.py b/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/angle_format.py index 88e3236f0..97f2222b2 100644 --- a/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/angle_format.py @@ -15704,15 +16008,9 @@ index 88e3236f0..97f2222b2 100644 def get_channels(format_id): diff --git a/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/d3d/d3d11/gen_blit11helper.py b/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/d3d/d3d11/gen_blit11helper.py -index 4be6a253a..722aeb318 100644 +index 4be6a253a..492925f09 100644 --- a/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/d3d/d3d11/gen_blit11helper.py +++ b/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/d3d/d3d11/gen_blit11helper.py -@@ -1,4 +1,4 @@ --#!/usr/bin/python2 -+#!/usr/bin/python3 - # - # Copyright 2018 The ANGLE Project Authors. All rights reserved. - # Use of this source code is governed by a BSD-style license that can be @@ -322,9 +322,9 @@ def main(): outputs = ['Blit11Helper_autogen.inc', 'd3d11_blit_shaders_autogen.gni'] @@ -15868,7 +16166,7 @@ index 0342726c9..0eb6e43fe 100644 else: component_cases += undefined_case(dxgi_format) diff --git a/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/gen_dxgi_support_tables.py b/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/gen_dxgi_support_tables.py -index 96287b14e..c805836e8 100644 +index 96287b14e..99e87a9e4 100644 --- a/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/gen_dxgi_support_tables.py +++ b/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/gen_dxgi_support_tables.py @@ -183,7 +183,7 @@ def do_format(format_data): @@ -15889,6 +16187,15 @@ index 96287b14e..c805836e8 100644 d3d_flag = [json_flag_to_d3d[json_flag]] +@@ -235,7 +235,7 @@ def do_format(format_data): + fl_9_3_check.update(d3d_flag) + fl_10_0_check_11_0_supported.update(d3d_flag) + else: +- print("Data specification error: " + support) ++ print(("Data specification error: " + support)) + sys.exit(1) + + for feature_level in ['9_3', '10_0', '10_1', '11_0', '11_1']: @@ -306,9 +306,9 @@ def main(): outputs = ['dxgi_support_table_autogen.cpp'] @@ -15962,7 +16269,7 @@ index e0667befd..2d6460371 100755 print('Invalid script parameters') return 1 diff --git a/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/gl/generate_gl_dispatch_table.py b/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/gl/generate_gl_dispatch_table.py -index 455d437da..e30c793d5 100644 +index 455d437da..c2a404d13 100644 --- a/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/gl/generate_gl_dispatch_table.py +++ b/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/gl/generate_gl_dispatch_table.py @@ -260,9 +260,9 @@ def main(): @@ -15986,6 +16293,31 @@ index 455d437da..e30c793d5 100644 for entry_point_no_prefix in entry_points: entry_point = "gl" + entry_point_no_prefix +@@ -347,18 +347,18 @@ def main(): + if not gl_required: + gl_required = reqs + elif entry_point in core_removed_eps: +- print('Upgrade ' + entry_point + ' to ' + str(reqs) + ' instead of ' + +- str(gl_required)) ++ print(('Upgrade ' + entry_point + ' to ' + str(reqs) + ' instead of ' + ++ str(gl_required))) + gl_required = reqs + else: +- print('Keep ' + entry_point + ' at ' + str(gl_required) + +- ' instead of ' + str(reqs)) ++ print(('Keep ' + entry_point + ' at ' + str(gl_required) + ++ ' instead of ' + str(reqs))) + elif api == 'gles2': + if not gles2_required: + gles2_required = reqs + else: +- print("Duplicate for " + entry_point + ": " + str(reqs) + " and " + +- str(gles2_required)) ++ print(("Duplicate for " + entry_point + ": " + str(reqs) + " and " + ++ str(gles2_required))) + else: + raise Exception('Bad api type: ' + api) + @@ -397,7 +397,7 @@ def main(): raise Exception('Entry point ' + entry_point + ' not found in the xml.') @@ -16043,9 +16375,40 @@ index 2b4e3d3dc..af3f4d889 100644 print('Invalid script parameters') return 1 diff --git a/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/metal/shaders/gen_mtl_internal_shaders.py b/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/metal/shaders/gen_mtl_internal_shaders.py -index 40fc73fcc..123872191 100644 +index 40fc73fcc..5502f76fa 100644 --- a/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/metal/shaders/gen_mtl_internal_shaders.py +++ b/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/metal/shaders/gen_mtl_internal_shaders.py +@@ -93,10 +93,10 @@ def store_metallib_as_byte_array_and_include(variable_name, copyright_comments, + # src_files: metal source files + def gen_precompiled_shaders(mac_version, ios_version, variable_name, additional_flags, src_files, + copyright_comments): +- print('Generating default shaders with flags=\'{0}\' ...'.format(additional_flags)) ++ print(('Generating default shaders with flags=\'{0}\' ...'.format(additional_flags))) + + # Mac version's compilation +- print('Compiling macos {0} version of default shaders ...'.format(mac_version)) ++ print(('Compiling macos {0} version of default shaders ...'.format(mac_version))) + + mac_metallib = 'compiled/{0}.mac.metallib'.format(variable_name) + +@@ -110,7 +110,7 @@ def gen_precompiled_shaders(mac_version, ios_version, variable_name, additional_ + file=mac_metallib, object_files=object_files)) + + # iOS device version's compilation +- print('Compiling ios {0} version of default shaders ...'.format(ios_version)) ++ print(('Compiling ios {0} version of default shaders ...'.format(ios_version))) + + ios_metallib = 'compiled/{0}.ios.metallib'.format(variable_name) + +@@ -124,7 +124,7 @@ def gen_precompiled_shaders(mac_version, ios_version, variable_name, additional_ + file=ios_metallib, object_files=object_files)) + + # iOS simulator version's compilation +- print('Compiling ios {0} simulator version of default shaders ...'.format(ios_version)) ++ print(('Compiling ios {0} simulator version of default shaders ...'.format(ios_version))) + + ios_sim_metallib = 'compiled/{0}.ios_sim.metallib'.format(variable_name) + @@ -224,9 +224,9 @@ def main(): ] + os_specific_autogen_files @@ -16106,7 +16469,7 @@ index 476130422..c3a74c091 100644 output_cpp = template_table_autogen_cpp.format( diff --git a/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/vulkan/gen_vk_internal_shaders.py b/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/vulkan/gen_vk_internal_shaders.py -index b9b54f6ac..82148161f 100644 +index b9b54f6ac..d8c175cf2 100644 --- a/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/vulkan/gen_vk_internal_shaders.py +++ b/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/vulkan/gen_vk_internal_shaders.py @@ -28,7 +28,7 @@ is_windows = platform.system() == 'Windows' @@ -16154,6 +16517,15 @@ index b9b54f6ac..82148161f 100644 if key == "Description": continue elif key == "Flags": +@@ -419,7 +419,7 @@ class CompileQueue: + if description: + print(description) + if out and out.strip(): +- print(out.strip()) ++ print((out.strip())) + if err and err.strip(): + print(err) + if returncode != 0: @@ -468,11 +468,11 @@ class CompileQueue: # [ name, arg1, ..., argN ]. In that case, name is option[0] and option[1:] are extra arguments # that need to be passed to glslang_validator for this variation. @@ -16168,6 +16540,24 @@ index b9b54f6ac..82148161f 100644 def compile_variation(glslang_path, compile_queue, shader_file, shader_basename, flags, enums, +@@ -705,7 +705,7 @@ def main(): + input_shaders_variations = [ + variations for variations in input_shaders_variations if variations is not None + ] +- print(",".join(input_shaders + input_shaders_variations + glslang_binary_hashes)) ++ print((",".join(input_shaders + input_shaders_variations + glslang_binary_hashes))) + return 0 + + # STEP 1: Call glslang to generate the internal shaders into small .inc files. +@@ -752,7 +752,7 @@ def main(): + outputs = output_shaders + [out_file_cpp, out_file_h] + + if print_outputs: +- print(','.join(outputs)) ++ print((','.join(outputs))) + return 0 + + compile_queue.finish() diff --git a/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/vulkan/gen_vk_mandatory_format_support_table.py b/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/vulkan/gen_vk_mandatory_format_support_table.py index da1cf4778..da2102f1a 100644 --- a/src/3rdparty/chromium/third_party/angle/src/libANGLE/renderer/vulkan/gen_vk_mandatory_format_support_table.py @@ -16184,19 +16574,29 @@ index da1cf4778..da2102f1a 100644 else: print('Invalid script parameters') return 1 -diff --git a/src/3rdparty/chromium/third_party/angle/third_party/rapidjson/src/bin/jsonschema/bin/jsonschema_suite b/src/3rdparty/chromium/third_party/angle/third_party/rapidjson/src/bin/jsonschema/bin/jsonschema_suite -index 96108c86b..2f6faa20a 100755 ---- a/src/3rdparty/chromium/third_party/angle/third_party/rapidjson/src/bin/jsonschema/bin/jsonschema_suite -+++ b/src/3rdparty/chromium/third_party/angle/third_party/rapidjson/src/bin/jsonschema/bin/jsonschema_suite -@@ -10,7 +10,7 @@ except ImportError: - The argparse library could not be imported. jsonschema_suite requires - either Python 2.7 or for you to install argparse. You can do so by - running `pip install argparse`, `easy_install argparse` or by -- downloading argparse and running `python2.6 setup.py install`. -+ downloading argparse and running `python3.6 setup.py install`. - - See https://pypi.python.org/pypi/argparse for details. - """.strip("\n"))) +diff --git a/src/3rdparty/chromium/third_party/angle/third_party/vulkan-headers/src/.cmake-format.py b/src/3rdparty/chromium/third_party/angle/third_party/vulkan-headers/src/.cmake-format.py +index 07d2f99d6..4165b0b25 100644 +--- a/src/3rdparty/chromium/third_party/angle/third_party/vulkan-headers/src/.cmake-format.py ++++ b/src/3rdparty/chromium/third_party/angle/third_party/vulkan-headers/src/.cmake-format.py +@@ -21,14 +21,14 @@ separate_fn_name_with_space = False + dangle_parens = False + + # What character to use for bulleted lists +-bullet_char = u'*' ++bullet_char = '*' + + # What character to use as punctuation after numerals in an enumerated list +-enum_char = u'.' ++enum_char = '.' + + # What style line endings to use in the output. +-line_ending = u'unix' ++line_ending = 'unix' + + # Format command names consistently as 'lower' or 'upper' case +-command_case = u'lower' ++command_case = 'lower' + diff --git a/src/3rdparty/chromium/third_party/angle/third_party/vulkan-headers/src/registry/cgenerator.py b/src/3rdparty/chromium/third_party/angle/third_party/vulkan-headers/src/registry/cgenerator.py index 11d54683b..72e63a204 100644 --- a/src/3rdparty/chromium/third_party/angle/third_party/vulkan-headers/src/registry/cgenerator.py @@ -16294,8 +16694,80 @@ index c63804b11..e74939bd5 100755 extName = ei.name include = False +diff --git a/src/3rdparty/chromium/third_party/angle/third_party/vulkan-loader/src/.cmake-format.py b/src/3rdparty/chromium/third_party/angle/third_party/vulkan-loader/src/.cmake-format.py +index 07d2f99d6..4165b0b25 100644 +--- a/src/3rdparty/chromium/third_party/angle/third_party/vulkan-loader/src/.cmake-format.py ++++ b/src/3rdparty/chromium/third_party/angle/third_party/vulkan-loader/src/.cmake-format.py +@@ -21,14 +21,14 @@ separate_fn_name_with_space = False + dangle_parens = False + + # What character to use for bulleted lists +-bullet_char = u'*' ++bullet_char = '*' + + # What character to use as punctuation after numerals in an enumerated list +-enum_char = u'.' ++enum_char = '.' + + # What style line endings to use in the output. +-line_ending = u'unix' ++line_ending = 'unix' + + # Format command names consistently as 'lower' or 'upper' case +-command_case = u'lower' ++command_case = 'lower' + +diff --git a/src/3rdparty/chromium/third_party/angle/third_party/vulkan-loader/src/scripts/generate_source.py b/src/3rdparty/chromium/third_party/angle/third_party/vulkan-loader/src/scripts/generate_source.py +index 712747b83..419b883c0 100755 +--- a/src/3rdparty/chromium/third_party/angle/third_party/vulkan-loader/src/scripts/generate_source.py ++++ b/src/3rdparty/chromium/third_party/angle/third_party/vulkan-loader/src/scripts/generate_source.py +@@ -61,14 +61,14 @@ def main(argv): + + # run each code generator + for cmd in gen_cmds: +- print(' '.join(cmd)) ++ print((' '.join(cmd))) + try: + subprocess.check_call([sys.executable] + cmd, + # ignore generator output, vk_validation_stats.py is especially noisy + stdout=subprocess.DEVNULL, + cwd=gen_dir) + except Exception as e: +- print('ERROR:', str(e)) ++ print(('ERROR:', str(e))) + return 1 + + # optional post-generation steps +@@ -79,15 +79,15 @@ def main(argv): + files_match = True + for filename in sorted((temp_files | repo_files) - set(verify_exclude)): + if filename not in repo_files: +- print('ERROR: Missing repo file', filename) ++ print(('ERROR: Missing repo file', filename)) + files_match = False + elif filename not in temp_files: +- print('ERROR: Missing generator for', filename) ++ print(('ERROR: Missing generator for', filename)) + files_match = False + elif not filecmp.cmp(os.path.join(temp_dir, filename), + os.path.join(repo_dir, filename), + shallow=False): +- print('ERROR: Repo files do not match generator output for', filename) ++ print(('ERROR: Repo files do not match generator output for', filename)) + files_match = False + + # return code for test scripts +@@ -103,7 +103,7 @@ def main(argv): + repo_filename = os.path.join(repo_dir, filename) + if not os.path.exists(repo_filename) or \ + not filecmp.cmp(temp_filename, repo_filename, shallow=False): +- print('update', repo_filename) ++ print(('update', repo_filename)) + shutil.copyfile(temp_filename, repo_filename) + + return 0 diff --git a/src/3rdparty/chromium/third_party/angle/third_party/vulkan-loader/src/scripts/loader_genvk.py b/src/3rdparty/chromium/third_party/angle/third_party/vulkan-loader/src/scripts/loader_genvk.py -index 7c8185880..638709a22 100644 +index 7c8185880..82bcc8755 100644 --- a/src/3rdparty/chromium/third_party/angle/third_party/vulkan-loader/src/scripts/loader_genvk.py +++ b/src/3rdparty/chromium/third_party/angle/third_party/vulkan-loader/src/scripts/loader_genvk.py @@ -256,7 +256,7 @@ def genTarget(args): @@ -16307,24 +16779,15 @@ index 7c8185880..638709a22 100644 createGenerator = genOpts[args.target][0] options = genOpts[args.target][1] -@@ -277,7 +277,7 @@ def genTarget(args): - return (gen, options) - else: - write('No generator options for unknown target:', args.target, file=sys.stderr) -- return none -+ return None - - # -feature name - # -extension name -@@ -357,7 +357,7 @@ if __name__ == '__main__': - from dispatch_table_helper_generator import DispatchTableHelperOutputGenerator, DispatchTableHelperOutputGeneratorOptions - from helper_file_generator import HelperFileOutputGenerator, HelperFileOutputGeneratorOptions - from loader_extension_generator import LoaderExtensionOutputGenerator, LoaderExtensionGeneratorOptions -- # Temporary workaround for vkconventions python2 compatibility -+ # Temporary workaround for vkconventions python3 compatibility - import abc; abc.ABC = abc.ABCMeta('ABC', (object,), {}) - from vkconventions import VulkanConventions +@@ -343,7 +343,7 @@ if __name__ == '__main__': + # default scripts path to be same as registry + if not args.scripts: + args.scripts = os.path.dirname(args.registry) +- print(args.scripts) ++ print((args.scripts)) + scripts_dir = os.path.dirname(os.path.abspath(__file__)) + registry_dir = os.path.join(scripts_dir, args.scripts) diff --git a/src/3rdparty/chromium/third_party/angle/third_party/vulkan-loader/src/scripts/update_deps.py b/src/3rdparty/chromium/third_party/angle/third_party/vulkan-loader/src/scripts/update_deps.py index ea21c9fba..e82dcc877 100755 --- a/src/3rdparty/chromium/third_party/angle/third_party/vulkan-loader/src/scripts/update_deps.py @@ -16338,6 +16801,29 @@ index ea21c9fba..e82dcc877 100755 import argparse import json +diff --git a/src/3rdparty/chromium/third_party/angle/third_party/vulkan-tools/src/.cmake-format.py b/src/3rdparty/chromium/third_party/angle/third_party/vulkan-tools/src/.cmake-format.py +index 07d2f99d6..4165b0b25 100644 +--- a/src/3rdparty/chromium/third_party/angle/third_party/vulkan-tools/src/.cmake-format.py ++++ b/src/3rdparty/chromium/third_party/angle/third_party/vulkan-tools/src/.cmake-format.py +@@ -21,14 +21,14 @@ separate_fn_name_with_space = False + dangle_parens = False + + # What character to use for bulleted lists +-bullet_char = u'*' ++bullet_char = '*' + + # What character to use as punctuation after numerals in an enumerated list +-enum_char = u'.' ++enum_char = '.' + + # What style line endings to use in the output. +-line_ending = u'unix' ++line_ending = 'unix' + + # Format command names consistently as 'lower' or 'upper' case +-command_case = u'lower' ++command_case = 'lower' + diff --git a/src/3rdparty/chromium/third_party/angle/third_party/vulkan-tools/src/build-gn/generate_vulkan_layers_json.py b/src/3rdparty/chromium/third_party/angle/third_party/vulkan-tools/src/build-gn/generate_vulkan_layers_json.py index 93d105b62..27f2294cf 100755 --- a/src/3rdparty/chromium/third_party/angle/third_party/vulkan-tools/src/build-gn/generate_vulkan_layers_json.py @@ -16351,8 +16837,40 @@ index 93d105b62..27f2294cf 100755 import argparse import glob +diff --git a/src/3rdparty/chromium/third_party/angle/third_party/vulkan-tools/src/scripts/determine_vs_version.py b/src/3rdparty/chromium/third_party/angle/third_party/vulkan-tools/src/scripts/determine_vs_version.py +index 7982bf717..d34610dd5 100755 +--- a/src/3rdparty/chromium/third_party/angle/third_party/vulkan-tools/src/scripts/determine_vs_version.py ++++ b/src/3rdparty/chromium/third_party/angle/third_party/vulkan-tools/src/scripts/determine_vs_version.py +@@ -74,7 +74,7 @@ if __name__ == '__main__': + # fail if the program above tries to use it. + if foundExeName == None: + print('00 0000') +- print('Executable ' + exeName + ' not found in PATH!') ++ print(('Executable ' + exeName + ' not found in PATH!')) + else: + proc = subprocess.Popen([exeName, arguments], stdout=subprocess.PIPE) + sysCallOut = proc.stdout.readline().decode('iso-8859-1').rstrip() +@@ -116,4 +116,4 @@ if __name__ == '__main__': + year = determine_year(version) + + # Output the string we need for Cmake to properly build for this version +- print(str(version) + ' ' + str(year)) ++ print((str(version) + ' ' + str(year))) +diff --git a/src/3rdparty/chromium/third_party/angle/third_party/vulkan-tools/src/scripts/fetch_glslangvalidator.py b/src/3rdparty/chromium/third_party/angle/third_party/vulkan-tools/src/scripts/fetch_glslangvalidator.py +index 936def893..0b0db9126 100755 +--- a/src/3rdparty/chromium/third_party/angle/third_party/vulkan-tools/src/scripts/fetch_glslangvalidator.py ++++ b/src/3rdparty/chromium/third_party/angle/third_party/vulkan-tools/src/scripts/fetch_glslangvalidator.py +@@ -56,7 +56,7 @@ if __name__ == '__main__': + + if os.path.isdir(GLSLANG_DIR): + if os.path.exists(GLSLANG_VALIDATOR_FULL_PATH): +- print(" Using glslangValidator at %s" % GLSLANG_VALIDATOR_PATH) ++ print((" Using glslangValidator at %s" % GLSLANG_VALIDATOR_PATH)) + sys.exit() + else: + os.makedirs(GLSLANG_DIR) diff --git a/src/3rdparty/chromium/third_party/angle/third_party/vulkan-tools/src/scripts/generate_source.py b/src/3rdparty/chromium/third_party/angle/third_party/vulkan-tools/src/scripts/generate_source.py -index a2002aae1..8e93f6364 100755 +index a2002aae1..c2c952659 100755 --- a/src/3rdparty/chromium/third_party/angle/third_party/vulkan-tools/src/scripts/generate_source.py +++ b/src/3rdparty/chromium/third_party/angle/third_party/vulkan-tools/src/scripts/generate_source.py @@ -53,11 +53,11 @@ def main(argv): @@ -16369,7 +16887,24 @@ index a2002aae1..8e93f6364 100755 for filename in filenames: if args.verify or args.incremental: output_path = os.path.join(temp_dir, path) -@@ -82,17 +82,17 @@ def main(argv): +@@ -67,7 +67,7 @@ def main(argv): + cmd = [common_codegen.repo_relative(os.path.join('scripts','kvt_genvk.py')), + '-registry', os.path.abspath(os.path.join(args.registry, 'vk.xml')), + '-quiet', '-directory', output_path, filename] +- print(' '.join(cmd)) ++ print((' '.join(cmd))) + try: + if args.verify or args.incremental: + subprocess.check_call([sys.executable] + cmd, cwd=temp_dir) +@@ -75,35 +75,35 @@ def main(argv): + subprocess.check_call([sys.executable] + cmd, cwd=repo_dir) + + except Exception as e: +- print('ERROR:', str(e)) ++ print(('ERROR:', str(e))) + return 1 + + # optional post-generation steps if args.verify: # compare contents of temp dir and repo temp_files = {} @@ -16389,8 +16924,22 @@ index a2002aae1..8e93f6364 100755 + for path in list(files_to_gen.keys()): for filename in sorted((temp_files[path] | repo_files[path])): if filename not in repo_files[path]: - print('ERROR: Missing repo file', filename) -@@ -114,7 +114,7 @@ def main(argv): +- print('ERROR: Missing repo file', filename) ++ print(('ERROR: Missing repo file', filename)) + files_match = False + elif filename not in temp_files[path]: +- print('ERROR: Missing generator for', filename) ++ print(('ERROR: Missing generator for', filename)) + files_match = False + elif not filecmp.cmp(os.path.join(temp_dir, path, filename), + os.path.join(repo_dir, path, filename), + shallow=False): +- print('ERROR: Repo files do not match generator output for', filename) ++ print(('ERROR: Repo files do not match generator output for', filename)) + files_match = False + + # return code for test scripts +@@ -114,13 +114,13 @@ def main(argv): elif args.incremental: # copy missing or differing files from temp directory to repo @@ -16399,8 +16948,15 @@ index a2002aae1..8e93f6364 100755 for filename in os.listdir(os.path.join(temp_dir,path)): temp_filename = os.path.join(temp_dir, path, filename) repo_filename = os.path.join(repo_dir, path, filename) + if not os.path.exists(repo_filename) or \ + not filecmp.cmp(temp_filename, repo_filename, shallow=False): +- print('update', repo_filename) ++ print(('update', repo_filename)) + shutil.copyfile(temp_filename, repo_filename) + + return 0 diff --git a/src/3rdparty/chromium/third_party/angle/third_party/vulkan-tools/src/scripts/kvt_genvk.py b/src/3rdparty/chromium/third_party/angle/third_party/vulkan-tools/src/scripts/kvt_genvk.py -index 8cd3e1beb..3a9f5aa55 100644 +index 8cd3e1beb..31a546e74 100644 --- a/src/3rdparty/chromium/third_party/angle/third_party/vulkan-tools/src/scripts/kvt_genvk.py +++ b/src/3rdparty/chromium/third_party/angle/third_party/vulkan-tools/src/scripts/kvt_genvk.py @@ -248,7 +248,7 @@ def genTarget(args): @@ -16412,15 +16968,6 @@ index 8cd3e1beb..3a9f5aa55 100644 createGenerator = genOpts[args.target][0] options = genOpts[args.target][1] -@@ -351,7 +351,7 @@ if __name__ == '__main__': - from mock_icd_generator import MockICDGeneratorOptions, MockICDOutputGenerator - from vulkan_tools_helper_file_generator import HelperFileOutputGenerator, HelperFileOutputGeneratorOptions - from vulkaninfo_generator import VulkanInfoGenerator, VulkanInfoGeneratorOptions -- # Temporary workaround for vkconventions python2 compatibility -+ # Temporary workaround for vkconventions python3 compatibility - import abc - abc.ABC = abc.ABCMeta('ABC', (object,), {}) - from vkconventions import VulkanConventions diff --git a/src/3rdparty/chromium/third_party/angle/third_party/vulkan-tools/src/scripts/mock_icd_generator.py b/src/3rdparty/chromium/third_party/angle/third_party/vulkan-tools/src/scripts/mock_icd_generator.py index 30f396c3c..e8281be45 100644 --- a/src/3rdparty/chromium/third_party/angle/third_party/vulkan-tools/src/scripts/mock_icd_generator.py @@ -16587,36 +17134,38 @@ index 61e8651be..10ae74b33 100644 if k == self.name: if e.guard is not None: self.guard = e.guard -diff --git a/src/3rdparty/chromium/third_party/angle/tools/angle_tools.py b/src/3rdparty/chromium/third_party/angle/tools/angle_tools.py -index f4d14c4ca..857d0b282 100644 ---- a/src/3rdparty/chromium/third_party/angle/tools/angle_tools.py -+++ b/src/3rdparty/chromium/third_party/angle/tools/angle_tools.py -@@ -1,4 +1,4 @@ --#!/usr/bin/python2 -+#!/usr/bin/python3 - # - # Copyright 2019 The ANGLE Project Authors. All rights reserved. - # Use of this source code is governed by a BSD-style license that can be diff --git a/src/3rdparty/chromium/third_party/angle/tools/flex-bison/update_flex_bison_binaries.py b/src/3rdparty/chromium/third_party/angle/tools/flex-bison/update_flex_bison_binaries.py -index 99c002b04..dd95d473b 100755 +index 99c002b04..154daae0d 100755 --- a/src/3rdparty/chromium/third_party/angle/tools/flex-bison/update_flex_bison_binaries.py +++ b/src/3rdparty/chromium/third_party/angle/tools/flex-bison/update_flex_bison_binaries.py -@@ -1,4 +1,4 @@ --#!/usr/bin/python2 -+#!/usr/bin/python3 - # - # Copyright 2019 The ANGLE Project Authors. All rights reserved. - # Use of this source code is governed by a BSD-style license that can be +@@ -52,9 +52,9 @@ def main(): + print('Suggested commit message (please indicate flex/bison versions):') + print('----------------------------') + print('') +- print('Update flex and bison binaries for %s.' % platform.system()) ++ print(('Update flex and bison binaries for %s.' % platform.system())) + print('') +- print('These binaries were updated using %s.' % os.path.basename(__file__)) ++ print(('These binaries were updated using %s.' % os.path.basename(__file__))) + print('Please see instructions in tools/flex-bison/README.md.') + print('') + print('flex is at version TODO.') diff --git a/src/3rdparty/chromium/third_party/angle/tools/glslang/update_glslang_binary.py b/src/3rdparty/chromium/third_party/angle/tools/glslang/update_glslang_binary.py -index 1e2bb5256..99cb2a0cb 100755 +index 1e2bb5256..778ff9db5 100755 --- a/src/3rdparty/chromium/third_party/angle/tools/glslang/update_glslang_binary.py +++ b/src/3rdparty/chromium/third_party/angle/tools/glslang/update_glslang_binary.py -@@ -1,4 +1,4 @@ --#!/usr/bin/python2 -+#!/usr/bin/python3 - # - # Copyright 2019 The ANGLE Project Authors. All rights reserved. - # Use of this source code is governed by a BSD-style license that can be +@@ -80,9 +80,9 @@ def main(): + print('Suggested commit message:') + print('----------------------------') + print('') +- print('Update glslang_validator binary for %s.' % platform.system()) ++ print(('Update glslang_validator binary for %s.' % platform.system())) + print('') +- print('This binary was updated using %s.' % os.path.basename(__file__)) ++ print(('This binary was updated using %s.' % os.path.basename(__file__))) + print('Please see instructions in tools/glslang/README.md.') + print('') + print('Bug: None') diff --git a/src/3rdparty/chromium/third_party/blink/PRESUBMIT_test.py b/src/3rdparty/chromium/third_party/blink/PRESUBMIT_test.py index bd74f2cf6..fc50ffa00 100755 --- a/src/3rdparty/chromium/third_party/blink/PRESUBMIT_test.py @@ -16672,6 +17221,19 @@ index bd74f2cf6..fc50ffa00 100755 errors[0].message, r'^[^:]+:\d+ uses disallowed identifier .+$') +diff --git a/src/3rdparty/chromium/third_party/blink/renderer/bindings/PRESUBMIT.py b/src/3rdparty/chromium/third_party/blink/renderer/bindings/PRESUBMIT.py +index 2d690d1e1..fe2674bd9 100644 +--- a/src/3rdparty/chromium/third_party/blink/renderer/bindings/PRESUBMIT.py ++++ b/src/3rdparty/chromium/third_party/blink/renderer/bindings/PRESUBMIT.py +@@ -65,7 +65,7 @@ def _RunBindingsTests(input_api, output_api): + test_cmd = input_api.Command( + name=cmd_name, cmd=cmd, kwargs={}, message=message_type) + if input_api.verbose: +- print('Running ' + cmd_name) ++ print(('Running ' + cmd_name)) + return input_api.RunTests([test_cmd]) + + diff --git a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/aggregate_generated_bindings.py b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/aggregate_generated_bindings.py index 4a4cb9f57..e069b78e5 100755 --- a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/aggregate_generated_bindings.py @@ -16730,7 +17292,7 @@ index 4a6df5130..8b51f23a4 100644 operation_entries=[]) (install_interface_template_decl, install_interface_template_def, diff --git a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/code_node.py b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/code_node.py -index 52972fefe..68e7f52d0 100644 +index 52972fefe..b59965733 100644 --- a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/code_node.py +++ b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/code_node.py @@ -316,7 +316,7 @@ class CodeNode(object): @@ -16794,7 +17356,7 @@ index 52972fefe..68e7f52d0 100644 - self_index = iter(scope_chains).next().index(self) - scope_chains = map( - lambda scope_chain: scope_chain[self_index + 1:], scope_chains) -+ self_index = iter(scope_chains).__next__().index(self) ++ self_index = next(iter(scope_chains)).index(self) + scope_chains = [scope_chain[self_index + 1:] for scope_chain in scope_chains] scope_to_likeliness = {} for scope_chain in scope_chains: @@ -16939,7 +17501,7 @@ index 9760f9637..82d7bd88f 100644 if value is None: value = NonRenderable(attr) diff --git a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_expr.py b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_expr.py -index a229a6c71..cbd1fee36 100644 +index a229a6c71..d42310856 100644 --- a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_expr.py +++ b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_expr.py @@ -109,7 +109,7 @@ def expr_and(terms): @@ -16947,7 +17509,7 @@ index a229a6c71..cbd1fee36 100644 if any(term.is_always_false for term in terms): return _Expr(False) - terms = filter(lambda x: not x.is_always_true, terms) -+ terms = [x for x in terms if not x.is_always_true] ++ terms = list([x for x in terms if not x.is_always_true]) if not terms: return _Expr(True) if len(terms) == 1: @@ -16956,7 +17518,7 @@ index a229a6c71..cbd1fee36 100644 if any(term.is_always_true for term in terms): return _Expr(True) - terms = filter(lambda x: not x.is_always_false, terms) -+ terms = [x for x in terms if not x.is_always_false] ++ terms = list([x for x in terms if not x.is_always_false]) if not terms: return _Expr(False) if len(terms) == 1: @@ -16980,7 +17542,7 @@ index a229a6c71..cbd1fee36 100644 secure_context_term = expr_or( [_Expr("${is_in_secure_context}"), expr_not(expr_and(terms))]) -@@ -269,16 +267,15 @@ def expr_from_exposure(exposure, +@@ -269,16 +267,16 @@ def expr_from_exposure(exposure, # [RuntimeEnabled] if exposure.runtime_enabled_features: feature_enabled_terms.extend( @@ -16993,18 +17555,20 @@ index a229a6c71..cbd1fee36 100644 if exposure.context_enabled_features: - terms = map( - lambda feature: _Expr( -+ terms = [_Expr( - "${{context_feature_settings}}->is{}Enabled()".format( +- "${{context_feature_settings}}->is{}Enabled()".format( - feature)), exposure.context_enabled_features) -+ feature)) for feature in exposure.context_enabled_features] ++ terms = list( ++ [_Expr( ++ "${{context_feature_settings}}->is{}Enabled()".format( ++ feature)) for feature in exposure.context_enabled_features]) context_enabled_terms.append( expr_and([_Expr("${context_feature_settings}"), expr_or(terms)])) diff --git a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_format.py b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_format.py -index 87d26eec3..9758e3651 100644 +index 87d26eec3..f3e9d3824 100644 --- a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_format.py +++ b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_format.py -@@ -23,13 +23,13 @@ class _TemplateFormatter(string.Formatter): +@@ -23,7 +23,7 @@ class _TemplateFormatter(string.Formatter): self._template_formatter_indexing_count_ = 0 def get_value(self, key, args, kwargs): @@ -17013,13 +17577,6 @@ index 87d26eec3..9758e3651 100644 return args[key] assert isinstance(key, str) if not key: - # Prior to Python 3.1, when a positional argument specifier is - # omitted, |format_string="{}"| produces |key=""|. Should be -- # removed once Python2 gets retired. -+ # removed once Python3 gets retired. - index = self._template_formatter_indexing_count_ - self._template_formatter_indexing_count_ += 1 - return args[index] diff --git a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_utils.py b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_utils.py index 2bcc4fed4..e72282aa6 100644 --- a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/codegen_utils.py @@ -17044,7 +17601,7 @@ index b39f01004..4d6820229 100644 return func_decl, func_def diff --git a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/interface.py b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/interface.py -index 10ff30656..630a4319f 100644 +index 10ff30656..fe63d8c7e 100644 --- a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/interface.py +++ b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/interface.py @@ -561,8 +561,7 @@ def _make_reflect_process_keyword_state(cg_context): @@ -17075,17 +17632,19 @@ index 10ff30656..630a4319f 100644 arg_count_def = F("const int arg_count = std::min(${info}.Length(), {});", max_arg_size) -@@ -1196,8 +1195,7 @@ def make_overload_dispatcher(cg_context): +@@ -1196,8 +1195,9 @@ def make_overload_dispatcher(cg_context): did_use_break = did_use_break or can_fail conditional = expr_or( - map(lambda item: expr_from_exposure(item.function_like.exposure), - items)) -+ [expr_from_exposure(item.function_like.exposure) for item in items]) ++ list( ++ [expr_from_exposure(item.function_like.exposure ++ ) for item in items])) if not conditional.is_always_true: node = CxxUnlikelyIfNode(cond=conditional, body=node) -@@ -1807,7 +1805,7 @@ EventListener* event_handler = JSEventHandler::CreateOrNull( +@@ -1807,7 +1807,7 @@ EventListener* event_handler = JSEventHandler::CreateOrNull( def optimize_element_cereactions_reflect(): has_cereactions = False has_reflect = False @@ -17094,7 +17653,7 @@ index 10ff30656..630a4319f 100644 if key == "CEReactions": has_cereactions = True elif key == "Reflect": -@@ -4642,7 +4640,7 @@ class _PropEntryConstructorGroup(_PropEntryBase): +@@ -4642,7 +4642,7 @@ class _PropEntryConstructorGroup(_PropEntryBase): def __init__(self, is_context_dependent, exposure_conditional, world, constructor_group, ctor_callback_name, ctor_func_length): assert isinstance(ctor_callback_name, str) @@ -17103,7 +17662,7 @@ index 10ff30656..630a4319f 100644 _PropEntryBase.__init__(self, is_context_dependent, exposure_conditional, world, constructor_group) -@@ -4670,7 +4668,7 @@ class _PropEntryOperationGroup(_PropEntryBase): +@@ -4670,7 +4670,7 @@ class _PropEntryOperationGroup(_PropEntryBase): op_func_length, no_alloc_direct_callback_name=None): assert isinstance(op_callback_name, str) @@ -17112,7 +17671,7 @@ index 10ff30656..630a4319f 100644 _PropEntryBase.__init__(self, is_context_dependent, exposure_conditional, world, operation_group) -@@ -4952,7 +4950,7 @@ def make_property_entries_and_callback_defs(cg_context, attribute_entries, +@@ -4952,7 +4952,7 @@ def make_property_entries_and_callback_defs(cg_context, attribute_entries, iterate(collectionlike.attributes, process_attribute) iterate( @@ -17121,7 +17680,7 @@ index 10ff30656..630a4319f 100644 process_operation_group) return callback_def_nodes -@@ -4968,8 +4966,8 @@ def _make_install_prototype_object(cg_context): +@@ -4968,8 +4968,8 @@ def _make_install_prototype_object(cg_context): unscopables = [] is_unscopable = lambda member: "Unscopable" in member.extended_attributes @@ -17132,14 +17691,15 @@ index 10ff30656..630a4319f 100644 if unscopables: nodes.extend([ TextNode("""\ -@@ -5175,13 +5173,10 @@ def make_install_interface_template(cg_context, function_name, class_name, api_c +@@ -5175,13 +5175,11 @@ def make_install_interface_template(cg_context, function_name, class_name, api_c ]) if class_like.identifier == "CSSStyleDeclaration": - css_properties = filter( - lambda attr: "CSSProperty" in attr.extended_attributes, - class_like.attributes) -+ css_properties = [attr for attr in class_like.attributes if "CSSProperty" in attr.extended_attributes] ++ css_properties = list( ++ [attr for attr in class_like.attributes if "CSSProperty" in attr.extended_attributes]) if css_properties: prop_name_list = "".join( - map(lambda attr: "\"{}\", ".format(attr.identifier), @@ -17148,7 +17708,7 @@ index 10ff30656..630a4319f 100644 body.append( T("""\ // CSSStyleDeclaration-specific settings -@@ -5530,7 +5525,7 @@ ${instance_object} = ${v8_context}->Global()->GetPrototype().As();\ +@@ -5530,7 +5528,7 @@ ${instance_object} = ${v8_context}->Global()->GetPrototype().As();\ TextNode(installer_call_text), ])) body.append(EmptyNode()) @@ -17157,27 +17717,27 @@ index 10ff30656..630a4319f 100644 body.append( CxxUnlikelyIfNode( cond=conditional, -@@ -5567,8 +5562,7 @@ ${instance_object} = ${v8_context}->Global()->GetPrototype().As();\ +@@ -5567,8 +5565,7 @@ ${instance_object} = ${v8_context}->Global()->GetPrototype().As();\ "V8DOMConfiguration::InstallConstants(${isolate}, " "${interface_template}, ${prototype_template}, " "kConstantCallbackTable, base::size(kConstantCallbackTable));") - constant_callback_entries = filter(lambda entry: entry.const_callback_name, - constant_entries) -+ constant_callback_entries = [entry for entry in constant_entries if entry.const_callback_name] ++ constant_callback_entries = list([entry for entry in constant_entries if entry.const_callback_name]) install_properties(table_name, constant_callback_entries, _make_constant_callback_registration_table, installer_call_text) -@@ -5584,8 +5578,7 @@ ${instance_object} = ${v8_context}->Global()->GetPrototype().As();\ +@@ -5584,8 +5581,7 @@ ${instance_object} = ${v8_context}->Global()->GetPrototype().As();\ "V8DOMConfiguration::InstallConstants(${isolate}, " "${interface_template}, ${prototype_template}, " "kConstantValueTable, base::size(kConstantValueTable));") - constant_value_entries = filter( - lambda entry: not entry.const_callback_name, constant_entries) -+ constant_value_entries = [entry for entry in constant_entries if not entry.const_callback_name] ++ constant_value_entries = list([entry for entry in constant_entries if not entry.const_callback_name]) install_properties(table_name, constant_value_entries, _make_constant_value_registration_table, installer_call_text) -@@ -5617,12 +5610,10 @@ ${instance_object} = ${v8_context}->Global()->GetPrototype().As();\ +@@ -5617,12 +5613,10 @@ ${instance_object} = ${v8_context}->Global()->GetPrototype().As();\ "${instance_template}, ${prototype_template}, " "${interface_template}, ${signature}, " "kOperationTable, base::size(kOperationTable));") @@ -17192,7 +17752,7 @@ index 10ff30656..630a4319f 100644 install_properties(table_name, entries, _make_operation_registration_table, installer_call_text) -@@ -5661,7 +5652,7 @@ def make_indexed_and_named_property_callbacks_and_install_node(cg_context): +@@ -5661,7 +5655,7 @@ def make_indexed_and_named_property_callbacks_and_install_node(cg_context): def most_derived_interface(*interfaces): key = lambda interface: len(interface.inclusive_inherited_interfaces) @@ -17201,7 +17761,7 @@ index 10ff30656..630a4319f 100644 cg_context = cg_context.make_copy( v8_callback_type=CodeGenContext.V8_OTHER_CALLBACK) -@@ -5699,7 +5690,7 @@ def make_indexed_and_named_property_callbacks_and_install_node(cg_context): +@@ -5699,7 +5693,7 @@ def make_indexed_and_named_property_callbacks_and_install_node(cg_context): flags.append("v8::PropertyHandlerFlags::kHasNoSideEffect") property_handler_flags = ( "static_cast({})".format(" | ".join( @@ -17210,28 +17770,31 @@ index 10ff30656..630a4319f 100644 pattern = """\ // Named interceptors {{ -@@ -6336,8 +6327,7 @@ def make_v8_context_snapshot_api(cg_context, component, attribute_entries, +@@ -6336,8 +6330,8 @@ def make_v8_context_snapshot_api(cg_context, component, attribute_entries, assert isinstance(component, web_idl.Component) derived_interfaces = cg_context.interface.deriveds - derived_names = map(lambda interface: interface.identifier, - derived_interfaces) -+ derived_names = [interface.identifier for interface in derived_interfaces] ++ derived_names = list( ++ [interface.identifier for interface in derived_interfaces]) derived_names.append(cg_context.interface.identifier) if not ("Window" in derived_names or "HTMLDocument" in derived_names): return None, None -@@ -6411,9 +6401,7 @@ def _make_v8_context_snapshot_get_reference_table_function( +@@ -6411,9 +6405,9 @@ def _make_v8_context_snapshot_get_reference_table_function( collect_callbacks(named_properties_object_callback_defs) collect_callbacks(cross_origin_property_callback_defs) - entry_nodes = map( - lambda name: TextNode("reinterpret_cast({}),".format(name)), - filter(None, callback_names)) -+ entry_nodes = [TextNode("reinterpret_cast({}),".format(name)) for name in [_f for _f in callback_names if _f]] ++ entry_nodes = list( ++ [TextNode("reinterpret_cast({}),".format(name ++ )) for name in [_f for _f in callback_names if _f]]) table_node = ListNode([ TextNode("using namespace ${class_name}Callbacks;"), TextNode("static const intptr_t kReferenceTable[] = {"), -@@ -6451,10 +6439,10 @@ def _make_v8_context_snapshot_install_props_per_context_function( +@@ -6451,10 +6445,11 @@ def _make_v8_context_snapshot_install_props_per_context_function( class_name=None, prop_install_mode=PropInstallMode.V8_CONTEXT_SNAPSHOT, trampoline_var_name=None, @@ -17241,12 +17804,13 @@ index 10ff30656..630a4319f 100644 - operation_entries=filter(selector, operation_entries)) + attribute_entries=list(filter(selector, attribute_entries)), + constant_entries=list(filter(selector, constant_entries)), -+ exposed_construct_entries=list(filter(selector, exposed_construct_entries)), ++ exposed_construct_entries=list( ++ filter(selector, exposed_construct_entries)), + operation_entries=list(filter(selector, operation_entries))) return func_decl, func_def -@@ -6810,11 +6798,11 @@ def generate_interface(interface_identifier): +@@ -6810,11 +6805,11 @@ def generate_interface(interface_identifier): class_name=impl_class_name, prop_install_mode=PropInstallMode.UNCONDITIONAL, trampoline_var_name=tp_install_unconditional_props, @@ -17257,13 +17821,13 @@ index 10ff30656..630a4319f 100644 - operation_entries=filter(is_unconditional, operation_entries)) + attribute_entries=list(filter(is_unconditional, attribute_entries)), + constant_entries=list(filter(is_unconditional, constant_entries)), -+ exposed_construct_entries=list(filter(is_unconditional, -+ exposed_construct_entries)), ++ exposed_construct_entries=list( ++ filter(is_unconditional, exposed_construct_entries)), + operation_entries=list(filter(is_unconditional, operation_entries))) (install_context_independent_props_decl, install_context_independent_props_def, install_context_independent_props_trampoline) = make_install_properties( -@@ -6823,11 +6811,11 @@ def generate_interface(interface_identifier): +@@ -6823,11 +6818,14 @@ def generate_interface(interface_identifier): class_name=impl_class_name, prop_install_mode=PropInstallMode.CONTEXT_INDEPENDENT, trampoline_var_name=tp_install_context_independent_props, @@ -17272,15 +17836,18 @@ index 10ff30656..630a4319f 100644 - exposed_construct_entries=filter(is_context_independent, - exposed_construct_entries), - operation_entries=filter(is_context_independent, operation_entries)) -+ attribute_entries=list(filter(is_context_independent, attribute_entries)), -+ constant_entries=list(filter(is_context_independent, constant_entries)), -+ exposed_construct_entries=list(filter(is_context_independent, -+ exposed_construct_entries)), -+ operation_entries=list(filter(is_context_independent, operation_entries))) ++ attribute_entries=list( ++ filter(is_context_independent, attribute_entries)), ++ constant_entries=list(filter(is_context_independent, ++ constant_entries)), ++ exposed_construct_entries=list( ++ filter(is_context_independent, exposed_construct_entries)), ++ operation_entries=list( ++ filter(is_context_independent, operation_entries))) (install_context_dependent_props_decl, install_context_dependent_props_def, install_context_dependent_props_trampoline) = make_install_properties( cg_context, -@@ -6835,11 +6823,11 @@ def generate_interface(interface_identifier): +@@ -6835,11 +6833,13 @@ def generate_interface(interface_identifier): class_name=impl_class_name, prop_install_mode=PropInstallMode.CONTEXT_DEPENDENT, trampoline_var_name=tp_install_context_dependent_props, @@ -17289,11 +17856,13 @@ index 10ff30656..630a4319f 100644 - exposed_construct_entries=filter(is_context_dependent, - exposed_construct_entries), - operation_entries=filter(is_context_dependent, operation_entries)) -+ attribute_entries=list(filter(is_context_dependent, attribute_entries)), ++ attribute_entries=list(filter(is_context_dependent, ++ attribute_entries)), + constant_entries=list(filter(is_context_dependent, constant_entries)), -+ exposed_construct_entries=list(filter(is_context_dependent, -+ exposed_construct_entries)), -+ operation_entries=list(filter(is_context_dependent, operation_entries))) ++ exposed_construct_entries=list( ++ filter(is_context_dependent, exposed_construct_entries)), ++ operation_entries=list(filter(is_context_dependent, ++ operation_entries))) (install_interface_template_decl, install_interface_template_def, install_interface_template_trampoline) = make_install_interface_template( cg_context, @@ -17368,10 +17937,10 @@ index dc3493cc3..017d3d47b 100644 exit_code = proc.wait() diff --git a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/task_queue.py b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/task_queue.py -index 0d8f4c0f3..2ede0d334 100644 +index 0d8f4c0f3..e666a9b66 100644 --- a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/task_queue.py +++ b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/task_queue.py -@@ -2,9 +2,11 @@ +@@ -2,6 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -17379,11 +17948,7 @@ index 0d8f4c0f3..2ede0d334 100644 import multiprocessing from .package_initializer import package_initializer -+from functools import reduce - - - class TaskQueue(object): -@@ -76,7 +78,7 @@ class TaskQueue(object): +@@ -76,7 +77,7 @@ class TaskQueue(object): if not report_progress: return @@ -17392,7 +17957,7 @@ index 0d8f4c0f3..2ede0d334 100644 lambda count, worker_task: count + bool(worker_task.ready()), self._worker_tasks, 0) report_progress(len(self._worker_tasks), done_count) -@@ -85,4 +87,4 @@ class TaskQueue(object): +@@ -85,4 +86,4 @@ class TaskQueue(object): def _task_queue_run_tasks(tasks): for task in tasks: func, args, kwargs = task @@ -17425,7 +17990,7 @@ index 0361deed5..3c4b0acbe 100644 import os.path import sys diff --git a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/code_generator.py b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/code_generator.py -index e8280be72..826928594 100644 +index e8280be72..204950ba6 100644 --- a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/code_generator.py +++ b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/code_generator.py @@ -5,7 +5,7 @@ @@ -17467,17 +18032,14 @@ index e8280be72..826928594 100644 def initialize_jinja_env(cache_dir): jinja_env = jinja2.Environment( loader=jinja2.FileSystemLoader(TEMPLATES_DIR), -@@ -113,7 +122,9 @@ def initialize_jinja_env(cache_dir): - 'runtime_enabled_function': - v8_utilities.runtime_enabled_function, - 'secure_context': -- secure_context_if -+ secure_context_if, -+ 'stringifykeygroupby': -+ do_stringify_key_group_by +@@ -117,6 +126,7 @@ def initialize_jinja_env(cache_dir): }) jinja_env.filters.update(constant_filters()) jinja_env.filters.update(method_filters()) ++ jinja_env.filters["stringifykeygroupby"] = do_stringify_key_group_by + return jinja_env + + diff --git a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/code_generator_v8.py b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/code_generator_v8.py index f296d486a..ebb0a4435 100644 --- a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/code_generator_v8.py @@ -17755,7 +18317,7 @@ index ae06acc48..7ade03e56 100755 def __init__(self, output_directory, diff --git a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/idl_definitions.py b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/idl_definitions.py -index 14e6e9d3f..e44097d2f 100644 +index 14e6e9d3f..2b8ef132f 100644 --- a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/idl_definitions.py +++ b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/idl_definitions.py @@ -77,13 +77,12 @@ SPECIAL_KEYWORD_LIST = ['GETTER', 'SETTER', 'DELETER'] @@ -17807,7 +18369,7 @@ index 14e6e9d3f..e44097d2f 100644 raise ValueError('Unrecognized node class: %s' % child_class) - if len(filter(None, [self.iterable, self.maplike, self.setlike])) > 1: -+ if len([_f for _f in [self.iterable, self.maplike, self.setlike] if _f]) > 1: ++ if len(list([_f for _f in [self.iterable, self.maplike, self.setlike] if _f])) > 1: raise ValueError( 'Interface can only have one of iterable<>, maplike<> and setlike<>.' ) @@ -17851,15 +18413,17 @@ index 14e6e9d3f..e44097d2f 100644 converted["ConstructorCallWith"] = value elif name == "RaisesException": diff --git a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/idl_reader.py b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/idl_reader.py -index 8d72865a6..111bcf285 100644 +index 8d72865a6..b80eebdcd 100644 --- a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/idl_reader.py +++ b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/idl_reader.py -@@ -56,7 +56,7 @@ def validate_blink_idl_definitions(idl_filename, idl_file_basename, +@@ -55,8 +55,8 @@ def validate_blink_idl_definitions(idl_filename, idl_file_basename, + definitions. There is no filename convention in this case. - Otherwise, an IDL file is invalid. """ - targets = ( +- targets = ( - definitions.interfaces.values() + definitions.dictionaries.values()) -+ list(definitions.interfaces.values()) + list(definitions.dictionaries.values())) ++ targets = (list(definitions.interfaces.values()) + ++ list(definitions.dictionaries.values())) number_of_targets = len(targets) if number_of_targets > 1: raise Exception( @@ -17984,7 +18548,7 @@ index 309de6954..acb8448b6 100644 method for method in methods if method['name'] in overloaded_method_names diff --git a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/utilities.py b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/utilities.py -index e1677ee7b..5584b8a50 100644 +index e1677ee7b..270137a39 100644 --- a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/utilities.py +++ b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/utilities.py @@ -13,7 +13,7 @@ import subprocess @@ -17996,18 +18560,19 @@ index e1677ee7b..5584b8a50 100644 else: import pickle -@@ -196,8 +196,8 @@ class ComponentInfoProviderModules(ComponentInfoProvider): +@@ -196,8 +196,9 @@ class ComponentInfoProviderModules(ComponentInfoProvider): @property def callback_functions(self): - return dict(self._component_info_core['callback_functions'].items() + - self._component_info_modules['callback_functions'].items()) -+ return dict(list(self._component_info_core['callback_functions'].items()) + -+ list(self._component_info_modules['callback_functions'].items())) ++ return dict( ++ list(self._component_info_core['callback_functions'].items()) + ++ list(self._component_info_modules['callback_functions'].items())) @property def specifier_for_export(self): -@@ -209,8 +209,8 @@ class ComponentInfoProviderModules(ComponentInfoProvider): +@@ -209,8 +210,8 @@ class ComponentInfoProviderModules(ComponentInfoProvider): def load_interfaces_info_overall_pickle(info_dir): @@ -18018,7 +18583,7 @@ index e1677ee7b..5584b8a50 100644 return pickle.load(interface_info_file) -@@ -219,7 +219,7 @@ def merge_dict_recursively(target, diff): +@@ -219,7 +220,7 @@ def merge_dict_recursively(target, diff): |target| will be updated with |diff|. Part of |diff| may be re-used in |target|. """ @@ -18027,7 +18592,7 @@ index e1677ee7b..5584b8a50 100644 if key not in target: target[key] = value elif type(value) == dict: -@@ -236,23 +236,20 @@ def merge_dict_recursively(target, diff): +@@ -236,23 +237,20 @@ def merge_dict_recursively(target, diff): def create_component_info_provider_core(info_dir): interfaces_info = load_interfaces_info_overall_pickle(info_dir) @@ -18058,7 +18623,7 @@ index e1677ee7b..5584b8a50 100644 component_info_modules = pickle.load(component_info_file) return ComponentInfoProviderModules(interfaces_info, component_info_core, component_info_modules) -@@ -356,7 +353,7 @@ def write_pickle_file(pickle_filename, data): +@@ -356,7 +354,7 @@ def write_pickle_file(pickle_filename, data): pickle_filename = abs(pickle_filename) # If |data| is same with the file content, we skip updating. if os.path.isfile(pickle_filename): @@ -18067,7 +18632,7 @@ index e1677ee7b..5584b8a50 100644 try: if pickle.load(pickle_file) == data: return -@@ -445,7 +442,7 @@ def get_interface_extended_attributes_from_idl(file_contents): +@@ -445,7 +443,7 @@ def get_interface_extended_attributes_from_idl(file_contents): if parences < 0 or square_brackets < 0: raise ValueError('You have more close braces than open braces.') if parences == 0 and square_brackets == 0: @@ -18140,7 +18705,7 @@ index a43260414..a85b03abe 100644 # We can’t do a single loop through all methods or simply sort them, because # a method may be listed in multiple steps of the resolution algorithm, and diff --git a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/v8_methods.py b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/v8_methods.py -index 5f1f89a3d..8d5135c9e 100644 +index 5f1f89a3d..7c88c0da0 100644 --- a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/v8_methods.py +++ b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/v8_methods.py @@ -46,6 +46,10 @@ import v8_types @@ -18149,7 +18714,7 @@ index 5f1f89a3d..8d5135c9e 100644 +# TODO: Remove this once Python2 is obsoleted. +if sys.version_info.major != 2: -+ basestring = str ++ str = str + def method_is_visible(method, interface_is_partial): @@ -18177,41 +18742,27 @@ index 2ecd69233..fcfc48371 100644 def __init__(self, exposures=None): diff --git a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/callback_interface.py b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/callback_interface.py -index 13fb7c706..8e0106aeb 100644 +index 13fb7c706..927733229 100644 --- a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/callback_interface.py +++ b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/callback_interface.py -@@ -93,8 +93,7 @@ class CallbackInterface(UserDefinedType, WithExtendedAttributes, +@@ -91,11 +91,12 @@ class CallbackInterface(UserDefinedType, WithExtendedAttributes, + for operation_ir in ir.operations + ]) self._operation_groups = tuple([ - OperationGroup( - operation_group_ir, +- OperationGroup( +- operation_group_ir, - filter(lambda x: x.identifier == operation_group_ir.identifier, - self._operations), -+ [x for x in self._operations if x.identifier == operation_group_ir.identifier], - owner=self) for operation_group_ir in ir.operation_groups +- owner=self) for operation_group_ir in ir.operation_groups ++ OperationGroup(operation_group_ir, ++ list( ++ [x for x in self._operations if x.identifier == operation_group_ir ++ .identifier]), ++ owner=self) ++ for operation_group_ir in ir.operation_groups ]) -diff --git a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/composition_parts.py b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/composition_parts.py -index 5e8de8940..c45680ba0 100644 ---- a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/composition_parts.py -+++ b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/composition_parts.py -@@ -249,7 +249,7 @@ class WithOwnerMixin(object): - def __init__(self, owner_mixin=None): - if isinstance(owner_mixin, WithOwnerMixin): - owner_mixin = owner_mixin._owner_mixin -- # In Python2, we need to avoid circular imports. -+ # In Python3, we need to avoid circular imports. - from .reference import RefById - assert owner_mixin is None or isinstance(owner_mixin, RefById) - -@@ -264,7 +264,7 @@ class WithOwnerMixin(object): - return self._owner_mixin.target_object if self._owner_mixin else None - - def set_owner_mixin(self, mixin): -- # In Python2, we need to avoid circular imports. -+ # In Python3, we need to avoid circular imports. - from .reference import RefById - assert isinstance(mixin, RefById) - assert self._owner_mixin is None + @property diff --git a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/database.py b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/database.py index c92cf48eb..5b53bed87 100644 --- a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/database.py @@ -18299,20 +18850,21 @@ index 19e3327a8..bfa7dbd34 100644 import pickle diff --git a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/function_like.py b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/function_like.py -index 648c70d80..2ff709fe8 100644 +index 648c70d80..0d0b07cbe 100644 --- a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/function_like.py +++ b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/function_like.py -@@ -71,8 +71,7 @@ class FunctionLike(WithIdentifier): +@@ -71,8 +71,8 @@ class FunctionLike(WithIdentifier): def num_of_required_arguments(self): """Returns the number of required arguments.""" return len( - filter(lambda arg: not (arg.is_optional or arg.is_variadic), - self.arguments)) -+ [arg for arg in self.arguments if not (arg.is_optional or arg.is_variadic)]) ++ list( ++ [arg for arg in self.arguments if not (arg.is_optional or arg.is_variadic)])) class OverloadGroup(WithIdentifier): -@@ -164,7 +163,7 @@ class OverloadGroup(WithIdentifier): +@@ -164,21 +164,20 @@ class OverloadGroup(WithIdentifier): Returns the minimum number of required arguments of overloaded functions. """ @@ -18321,12 +18873,12 @@ index 648c70d80..2ff709fe8 100644 def effective_overload_set(self, argument_count=None): """ -@@ -172,13 +171,13 @@ class OverloadGroup(WithIdentifier): + Returns the effective overload set. https://heycam.github.io/webidl/#compute-the-effective-overload-set """ - assert argument_count is None or isinstance(argument_count, +- assert argument_count is None or isinstance(argument_count, - (int, long)) -+ int) ++ assert argument_count is None or isinstance(argument_count, int) N = argument_count S = [] @@ -18343,8 +18895,8 @@ index 648c70d80..2ff709fe8 100644 OverloadGroup.EffectiveOverloadItem( - X, map(lambda arg: arg.idl_type, X.arguments), - map(lambda arg: arg.optionality, X.arguments))) -+ X, [arg.idl_type for arg in X.arguments], -+ [arg.optionality for arg in X.arguments])) ++ X, list([arg.idl_type for arg in X.arguments]), ++ list([arg.optionality for arg in X.arguments]))) if X.is_variadic: - for i in xrange(n, max(maxarg, N)): @@ -18352,8 +18904,8 @@ index 648c70d80..2ff709fe8 100644 - o = map(lambda arg: arg.optionality, X.arguments) - for _ in xrange(n, i + 1): + for i in range(n, max(maxarg, N)): -+ t = [arg.idl_type for arg in X.arguments] -+ o = [arg.optionality for arg in X.arguments] ++ t = list([arg.idl_type for arg in X.arguments]) ++ o = list([arg.optionality for arg in X.arguments]) + for _ in range(n, i + 1): t.append(X.arguments[-1].idl_type) o.append(X.arguments[-1].optionality) @@ -18362,8 +18914,8 @@ index 648c70d80..2ff709fe8 100644 - t = map(lambda arg: arg.idl_type, X.arguments) - o = map(lambda arg: arg.optionality, X.arguments) - for i in xrange(n - 1, -1, -1): -+ t = [arg.idl_type for arg in X.arguments] -+ o = [arg.optionality for arg in X.arguments] ++ t = list([arg.idl_type for arg in X.arguments]) ++ o = list([arg.optionality for arg in X.arguments]) + for i in range(n - 1, -1, -1): if X.arguments[i].optionality == IdlType.Optionality.REQUIRED: break @@ -18378,7 +18930,7 @@ index 648c70d80..2ff709fe8 100644 # the two types. if OverloadGroup.are_distinguishable_types( diff --git a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/idl_compiler.py b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/idl_compiler.py -index c5ee2bd8a..ae45d5d97 100644 +index c5ee2bd8a..72df9e2cf 100644 --- a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/idl_compiler.py +++ b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/idl_compiler.py @@ -149,8 +149,8 @@ class IdlCompiler(object): @@ -18437,38 +18989,39 @@ index c5ee2bd8a..ae45d5d97 100644 new_interface = make_copy(old_interface) self._ir_map.add(new_interface) inheritance_chain = create_inheritance_chain( -@@ -422,9 +422,7 @@ class IdlCompiler(object): +@@ -422,9 +422,8 @@ class IdlCompiler(object): assert not new_interface.deriveds derived_set = identifier_to_derived_set.get( new_interface.identifier, set()) - new_interface.deriveds = map( - lambda id_: self._ref_to_idl_def_factory.create(id_), - sorted(derived_set)) -+ new_interface.deriveds = [self._ref_to_idl_def_factory.create(id_) for id_ in sorted(derived_set)] ++ new_interface.deriveds = list( ++ [self._ref_to_idl_def_factory.create(id_) for id_ in sorted(derived_set)]) def _supplement_missing_html_constructor_operation(self): # Temporary mitigation of misuse of [HTMLConstructor] -@@ -553,7 +551,7 @@ class IdlCompiler(object): +@@ -553,7 +552,7 @@ class IdlCompiler(object): self._ir_map.add(new_ir) for group in new_ir.iter_all_overload_groups(): - exposures = map(lambda overload: overload.exposure, group) -+ exposures = [overload.exposure for overload in group] ++ exposures = list([overload.exposure for overload in group]) # [Exposed] if any(not exposure.global_names_and_features -@@ -653,8 +651,8 @@ class IdlCompiler(object): +@@ -653,8 +652,8 @@ class IdlCompiler(object): constructs = set() for global_name in global_names: constructs.update(exposed_map.get(global_name, [])) - new_ir.exposed_constructs = map( - self._ref_to_idl_def_factory.create, sorted(constructs)) -+ new_ir.exposed_constructs = list(map( -+ self._ref_to_idl_def_factory.create, sorted(constructs))) ++ new_ir.exposed_constructs = list( ++ map(self._ref_to_idl_def_factory.create, sorted(constructs))) assert not new_ir.legacy_window_aliases if new_ir.identifier != 'Window': -@@ -771,13 +769,13 @@ class IdlCompiler(object): +@@ -771,13 +770,13 @@ class IdlCompiler(object): grouped_typedefs = {} # {unique key: list of typedefs to the union} all_typedefs = self._db.find_by_kind(DatabaseBody.Kind.TYPEDEF) @@ -18485,7 +19038,7 @@ index c5ee2bd8a..ae45d5d97 100644 DatabaseBody.Kind.UNION, Union( diff --git a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/idl_type.py b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/idl_type.py -index 1d7ae8026..3a6dea2ea 100644 +index 1d7ae8026..be498e410 100644 --- a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/idl_type.py +++ b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/idl_type.py @@ -265,14 +265,14 @@ class IdlType(WithExtendedAttributes, WithDebugInfo): @@ -18505,15 +19058,6 @@ index 1d7ae8026..3a6dea2ea 100644 if value is None: switches[arg] = default -@@ -1214,7 +1214,7 @@ class UnionType(IdlType): - return self._union_definition_object - - def set_union_definition_object(self, union_definition_object): -- # In Python2, we need to avoid circular imports. -+ # In Python3, we need to avoid circular imports. - from .union import Union - assert isinstance(union_definition_object, Union) - assert self._union_definition_object is None diff --git a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/idl_type_test.py b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/idl_type_test.py index b3d097a74..4efae30be 100644 --- a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/idl_type_test.py @@ -18528,36 +19072,39 @@ index b3d097a74..4efae30be 100644 short_type = factory.simple_type('short') diff --git a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/interface.py b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/interface.py -index 65d24e529..063afb8a4 100644 +index 65d24e529..d6a379a50 100644 --- a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/interface.py +++ b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/interface.py -@@ -180,8 +180,7 @@ class Interface(UserDefinedType, WithExtendedAttributes, WithCodeGeneratorInfo, +@@ -180,8 +180,8 @@ class Interface(UserDefinedType, WithExtendedAttributes, WithCodeGeneratorInfo, self._constructor_groups = tuple([ ConstructorGroup( group_ir, - filter(lambda x: x.identifier == group_ir.identifier, - self._constructors), -+ [x for x in self._constructors if x.identifier == group_ir.identifier], ++ list( ++ [x for x in self._constructors if x.identifier == group_ir.identifier]), owner=self) for group_ir in ir.constructor_groups ]) assert len(self._constructor_groups) <= 1 -@@ -192,8 +191,7 @@ class Interface(UserDefinedType, WithExtendedAttributes, WithCodeGeneratorInfo, +@@ -192,8 +192,8 @@ class Interface(UserDefinedType, WithExtendedAttributes, WithCodeGeneratorInfo, self._named_constructor_groups = tuple([ ConstructorGroup( group_ir, - filter(lambda x: x.identifier == group_ir.identifier, - self._named_constructors), -+ [x for x in self._named_constructors if x.identifier == group_ir.identifier], ++ list( ++ [x for x in self._named_constructors if x.identifier == group_ir.identifier]), owner=self) for group_ir in ir.named_constructor_groups ]) self._operations = tuple([ -@@ -203,22 +201,18 @@ class Interface(UserDefinedType, WithExtendedAttributes, WithCodeGeneratorInfo, +@@ -203,22 +203,21 @@ class Interface(UserDefinedType, WithExtendedAttributes, WithCodeGeneratorInfo, self._operation_groups = tuple([ OperationGroup( group_ir, - filter(lambda x: x.identifier == group_ir.identifier, - self._operations), -+ [x for x in self._operations if x.identifier == group_ir.identifier], ++ list( ++ [x for x in self._operations if x.identifier == group_ir.identifier]), owner=self) for group_ir in ir.operation_groups ]) self._exposed_constructs = tuple(ir.exposed_constructs) @@ -18566,28 +19113,31 @@ index 65d24e529..063afb8a4 100644 - indexed_and_named_property_operations = filter( - lambda x: x.is_indexed_or_named_property_operation, - self._operations) -+ indexed_and_named_property_operations = [x for x in self._operations if x.is_indexed_or_named_property_operation] ++ indexed_and_named_property_operations = list( ++ [x for x in self._operations if x.is_indexed_or_named_property_operation]) if indexed_and_named_property_operations: self._indexed_and_named_properties = IndexedAndNamedProperties( indexed_and_named_property_operations, owner=self) self._stringifier = None - stringifier_operation_irs = filter(lambda x: x.is_stringifier, - ir.operations) -+ stringifier_operation_irs = [x for x in ir.operations if x.is_stringifier] ++ stringifier_operation_irs = list( ++ [x for x in ir.operations if x.is_stringifier]) if stringifier_operation_irs: assert len(stringifier_operation_irs) == 1 op_ir = make_copy(stringifier_operation_irs[0]) -@@ -231,8 +225,7 @@ class Interface(UserDefinedType, WithExtendedAttributes, WithCodeGeneratorInfo, +@@ -231,8 +230,8 @@ class Interface(UserDefinedType, WithExtendedAttributes, WithCodeGeneratorInfo, attribute = None if operation.stringifier_attribute: attr_id = operation.stringifier_attribute - attributes = filter(lambda x: x.identifier == attr_id, - self._attributes) -+ attributes = [x for x in self._attributes if x.identifier == attr_id] ++ attributes = list( ++ [x for x in self._attributes if x.identifier == attr_id]) assert len(attributes) == 1 attribute = attributes[0] self._stringifier = Stringifier(operation, attribute, owner=self) -@@ -254,7 +247,7 @@ class Interface(UserDefinedType, WithExtendedAttributes, WithCodeGeneratorInfo, +@@ -254,7 +253,7 @@ class Interface(UserDefinedType, WithExtendedAttributes, WithCodeGeneratorInfo, @property def deriveds(self): """Returns the list of the derived interfaces.""" @@ -18596,7 +19146,7 @@ index 65d24e529..063afb8a4 100644 @property def inclusive_inherited_interfaces(self): -@@ -346,7 +339,7 @@ class Interface(UserDefinedType, WithExtendedAttributes, WithCodeGeneratorInfo, +@@ -346,7 +345,7 @@ class Interface(UserDefinedType, WithExtendedAttributes, WithCodeGeneratorInfo, Returns a list of the constructs that are exposed on this global object. """ return tuple( @@ -18605,59 +19155,65 @@ index 65d24e529..063afb8a4 100644 @property def legacy_window_aliases(self): -@@ -578,8 +571,7 @@ class Iterable(WithDebugInfo): +@@ -578,8 +577,8 @@ class Iterable(WithDebugInfo): self._operation_groups = tuple([ OperationGroup( group_ir, - filter(lambda x: x.identifier == group_ir.identifier, - self._operations), -+ [x for x in self._operations if x.identifier == group_ir.identifier], ++ list( ++ [x for x in self._operations if x.identifier == group_ir.identifier]), owner=owner) for group_ir in ir.operation_groups ]) -@@ -666,8 +658,7 @@ class Maplike(WithDebugInfo): +@@ -666,8 +665,8 @@ class Maplike(WithDebugInfo): self._operation_groups = tuple([ OperationGroup( group_ir, - filter(lambda x: x.identifier == group_ir.identifier, - self._operations), -+ [x for x in self._operations if x.identifier == group_ir.identifier], ++ list( ++ [x for x in self._operations if x.identifier == group_ir.identifier]), owner=owner) for group_ir in ir.operation_groups ]) -@@ -755,8 +746,7 @@ class Setlike(WithDebugInfo): +@@ -755,8 +754,8 @@ class Setlike(WithDebugInfo): self._operation_groups = tuple([ OperationGroup( group_ir, - filter(lambda x: x.identifier == group_ir.identifier, - self._operations), -+ [x for x in self._operations if x.identifier == group_ir.identifier], ++ list( ++ [x for x in self._operations if x.identifier == group_ir.identifier]), owner=owner) for group_ir in ir.operation_groups ]) diff --git a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/ir_builder.py b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/ir_builder.py -index e9aeff4ab..1d21148e2 100644 +index e9aeff4ab..1f3d2b93c 100644 --- a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/ir_builder.py +++ b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/ir_builder.py -@@ -2,6 +2,7 @@ +@@ -2,6 +2,8 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import sys ++ from .argument import Argument from .ast_group import AstGroup from .attribute import Attribute -@@ -29,6 +30,9 @@ from .namespace import Namespace - from .operation import Operation +@@ -30,6 +32,11 @@ from .operation import Operation from .typedef import Typedef + +# TODO: Remove this once Python2 is obsoleted. +if sys.version_info.major != 2: + long = int - ++ ++ def load_and_register_idl_definitions(filepaths, register_ir, create_ref_to_idl_def, idl_type_factory): -@@ -120,7 +124,7 @@ class _IRBuilder(object): + """ +@@ -120,7 +127,7 @@ class _IRBuilder(object): for child in child_nodes ] if stringifier_members: @@ -18666,7 +19222,7 @@ index e9aeff4ab..1d21148e2 100644 attributes = [] constants = [] constructors = [] -@@ -160,7 +164,7 @@ class _IRBuilder(object): +@@ -160,7 +167,7 @@ class _IRBuilder(object): child_nodes = list(node.GetChildren()) extended_attributes = self._take_extended_attributes(child_nodes) @@ -18675,7 +19231,7 @@ index e9aeff4ab..1d21148e2 100644 attributes = [] constants = [] operations = [] -@@ -302,7 +306,7 @@ class _IRBuilder(object): +@@ -302,7 +309,7 @@ class _IRBuilder(object): child_nodes = list(node.GetChildren()) inherited = self._take_inheritance(child_nodes) extended_attributes = self._take_extended_attributes(child_nodes) @@ -18684,7 +19240,7 @@ index e9aeff4ab..1d21148e2 100644 return Dictionary.IR( identifier=Identifier(node.GetName()), -@@ -336,7 +340,7 @@ class _IRBuilder(object): +@@ -336,7 +343,7 @@ class _IRBuilder(object): child_nodes = list(node.GetChildren()) extended_attributes = self._take_extended_attributes(child_nodes) @@ -18693,27 +19249,29 @@ index e9aeff4ab..1d21148e2 100644 constants = [] operations = [] for member in members: -@@ -456,8 +460,8 @@ class _IRBuilder(object): +@@ -456,8 +463,8 @@ class _IRBuilder(object): assert len(child_nodes) == 1 child = child_nodes[0] if child.GetClass() == 'Arguments': - arguments = map(build_extattr_argument, - child.GetChildren()) -+ arguments = list(map(build_extattr_argument, -+ child.GetChildren())) ++ arguments = list( ++ map(build_extattr_argument, child.GetChildren())) elif child.GetClass() == 'Call': assert len(child.GetChildren()) == 1 grand_child = child.GetChildren()[0] -@@ -486,7 +490,7 @@ class _IRBuilder(object): +@@ -486,7 +493,9 @@ class _IRBuilder(object): assert node.GetClass() == 'ExtAttributes' return ExtendedAttributes( - filter(None, map(build_extended_attribute, node.GetChildren()))) -+ [_f for _f in map(build_extended_attribute, node.GetChildren()) if _f]) ++ list( ++ [_f for _f in map(build_extended_attribute, ++ node.GetChildren()) if _f])) def _build_inheritance(self, node): assert node.GetClass() == 'Inherit' -@@ -506,7 +510,7 @@ class _IRBuilder(object): +@@ -506,7 +515,7 @@ class _IRBuilder(object): def _build_iterable(self, node): assert node.GetClass() == 'Iterable' @@ -18722,7 +19280,7 @@ index e9aeff4ab..1d21148e2 100644 assert len(types) == 1 or len(types) == 2 if len(types) == 1: # value iterator key_type, value_type = (None, types[0]) -@@ -548,7 +552,7 @@ class _IRBuilder(object): +@@ -548,7 +557,7 @@ class _IRBuilder(object): elif type_token == 'integer': idl_type = factory.simple_type(name='long', debug_info=debug_info) assert isinstance(value_token, str) @@ -18731,7 +19289,7 @@ index e9aeff4ab..1d21148e2 100644 literal = value_token elif type_token == 'float': idl_type = factory.simple_type( -@@ -584,7 +588,7 @@ class _IRBuilder(object): +@@ -584,7 +593,7 @@ class _IRBuilder(object): def _build_maplike(self, node, interface_identifier): assert node.GetClass() == 'Maplike' assert isinstance(interface_identifier, Identifier) @@ -18740,7 +19298,7 @@ index e9aeff4ab..1d21148e2 100644 assert len(types) == 2 key_type, value_type = types is_readonly = bool(node.GetProperty('READONLY')) -@@ -676,7 +680,7 @@ class _IRBuilder(object): +@@ -676,7 +685,7 @@ class _IRBuilder(object): def _build_setlike(self, node, interface_identifier): assert node.GetClass() == 'Setlike' assert isinstance(interface_identifier, Identifier) @@ -18749,7 +19307,7 @@ index e9aeff4ab..1d21148e2 100644 assert len(types) == 1 value_type = types[0] is_readonly = bool(node.GetProperty('READONLY')) -@@ -838,7 +842,7 @@ class _IRBuilder(object): +@@ -838,7 +847,7 @@ class _IRBuilder(object): def build_union_type(node, extended_attributes): return self._idl_type_factory.union_type( @@ -18758,7 +19316,7 @@ index e9aeff4ab..1d21148e2 100644 is_optional=is_optional, extended_attributes=extended_attributes, debug_info=self._build_debug_info(node)) -@@ -993,7 +997,7 @@ class _IRBuilder(object): +@@ -993,7 +1002,7 @@ class _IRBuilder(object): return ExtendedAttributes([ ExtendedAttribute(key=key, values=values) @@ -18790,23 +19348,23 @@ index 918065232..05222a6f3 100644 return accumulated else: diff --git a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/make_copy.py b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/make_copy.py -index a7a2b11f3..d2145ee27 100644 +index a7a2b11f3..54ca4bd0e 100644 --- a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/make_copy.py +++ b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/make_copy.py -@@ -2,6 +2,13 @@ - # Use of this source code is governed by a BSD-style license that can be +@@ -3,6 +3,13 @@ # found in the LICENSE file. + +import sys + +# TODO: Remove this once Python2 is obsoleted. +if sys.version_info.major != 2: + long = int -+ basestring = str ++ str = str + - def make_copy(obj, memo=None): """ + Creates a copy of the given object, which should be an IR or part of IR. @@ -16,7 +23,7 @@ def make_copy(obj, memo=None): memo = dict() @@ -18837,19 +19395,27 @@ index a7a2b11f3..d2145ee27 100644 return copy diff --git a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/namespace.py b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/namespace.py -index eeabef97c..682c7c33d 100644 +index eeabef97c..4e6891eed 100644 --- a/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/namespace.py +++ b/src/3rdparty/chromium/third_party/blink/renderer/bindings/scripts/web_idl/namespace.py -@@ -109,8 +109,7 @@ class Namespace(UserDefinedType, WithExtendedAttributes, WithCodeGeneratorInfo, +@@ -107,11 +107,12 @@ class Namespace(UserDefinedType, WithExtendedAttributes, WithCodeGeneratorInfo, + for operation_ir in ir.operations + ]) self._operation_groups = tuple([ - OperationGroup( - operation_group_ir, +- OperationGroup( +- operation_group_ir, - filter(lambda x: x.identifier == operation_group_ir.identifier, - self._operations), -+ [x for x in self._operations if x.identifier == operation_group_ir.identifier], - owner=self) for operation_group_ir in ir.operation_groups +- owner=self) for operation_group_ir in ir.operation_groups ++ OperationGroup(operation_group_ir, ++ list( ++ [x for x in self._operations if x.identifier == operation_group_ir ++ .identifier]), ++ owner=self) ++ for operation_group_ir in ir.operation_groups ]) + @property diff --git a/src/3rdparty/chromium/third_party/blink/renderer/bindings/templates/dictionary_v8.cc.tmpl b/src/3rdparty/chromium/third_party/blink/renderer/bindings/templates/dictionary_v8.cc.tmpl index 0add9c45a..dc910f6d2 100644 --- a/src/3rdparty/chromium/third_party/blink/renderer/bindings/templates/dictionary_v8.cc.tmpl @@ -18983,7 +19549,7 @@ index ef5c5f57b..239c45fce 100755 self._outputs = { 'cssom_types.cc': self.generate_types, diff --git a/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/core/css/make_style_shorthands.py b/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/core/css/make_style_shorthands.py -index 1799cd5a1..2a700120d 100755 +index 1799cd5a1..f3f9569e9 100755 --- a/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/core/css/make_style_shorthands.py +++ b/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/core/css/make_style_shorthands.py @@ -71,7 +71,7 @@ class Expansion(object): @@ -18995,17 +19561,18 @@ index 1799cd5a1..2a700120d 100755 @property def index(self): -@@ -87,8 +87,7 @@ class Expansion(object): +@@ -87,8 +87,8 @@ class Expansion(object): def create_expansions(longhands): flags = collect_runtime_flags(longhands) - expansions = map(lambda mask: Expansion(longhands, flags, mask), - range(1 << len(flags))) -+ expansions = [Expansion(longhands, flags, mask) for mask in range(1 << len(flags))] ++ expansions = list( ++ [Expansion(longhands, flags, mask) for mask in range(1 << len(flags))]) assert len(expansions) > 0 # We generate 2^N expansions for N flags, so enforce some limit. assert len(flags) <= 4, 'Too many runtime flags for a single shorthand' -@@ -114,19 +113,17 @@ class StylePropertyShorthandWriter(json5_generator.Writer): +@@ -114,19 +114,18 @@ class StylePropertyShorthandWriter(json5_generator.Writer): self._longhand_dictionary = defaultdict(list) for property_ in json5_properties.shorthands: @@ -19017,12 +19584,13 @@ index 1799cd5a1..2a700120d 100755 - longhands = map( - lambda name: json5_properties.properties_by_name[name], - property_['longhands']) -+ property_['longhand_enum_keys'] = list(map(enum_key_for_css_property, -+ property_['longhands'])) -+ property_['longhand_property_ids'] = list(map(id_for_css_property, -+ property_['longhands'])) ++ property_['longhand_enum_keys'] = list( ++ map(enum_key_for_css_property, property_['longhands'])) ++ property_['longhand_property_ids'] = list( ++ map(id_for_css_property, property_['longhands'])) + -+ longhands = [json5_properties.properties_by_name[name] for name in property_['longhands']] ++ longhands = list( ++ [json5_properties.properties_by_name[name] for name in property_['longhands']]) property_['expansions'] = create_expansions(longhands) for longhand_enum_key in property_['longhand_enum_keys']: self._longhand_dictionary[longhand_enum_key].append(property_) @@ -19184,10 +19752,10 @@ index eb93ee502..1117a9def 100755 def test_assertion_for_non_in_files(self): in_files = ['some_sample_file.json'] diff --git a/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/in_generator.py b/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/in_generator.py -index e46740a2e..9ffd950c1 100644 +index e46740a2e..110fa0f9b 100644 --- a/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/in_generator.py +++ b/src/3rdparty/chromium/third_party/blink/renderer/build/scripts/in_generator.py -@@ -26,16 +26,20 @@ +@@ -26,16 +26,21 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @@ -19200,17 +19768,17 @@ index e46740a2e..9ffd950c1 100644 import shutil +import sys import optparse -- + from in_file import InFile +# TODO: Remove this once Python2 is obsoleted. +if sys.version_info.major != 2: -+ basestring = str ++ str = str + ######################################################### # This is now deprecated - use json5_generator.py instead -@@ -61,7 +65,7 @@ class GenericWriter(object): +@@ -61,7 +66,7 @@ class GenericWriter(object): output_file.write(contents) def write_files(self, output_dir): @@ -19219,7 +19787,7 @@ index e46740a2e..9ffd950c1 100644 self._write_file_if_changed(output_dir, generator(), file_name) def set_gperf_path(self, gperf_path): -@@ -78,7 +82,7 @@ class Writer(GenericWriter): +@@ -78,7 +83,7 @@ class Writer(GenericWriter): def __init__(self, in_files): super(Writer, self).__init__(in_files) @@ -19767,6 +20335,28 @@ index d9b834f27..bc7d76a75 100644 + test_file_path)) + if __name__ == '__main__': +diff --git a/src/3rdparty/chromium/third_party/blink/renderer/modules/bluetooth/testing/clusterfuzz/setup.py b/src/3rdparty/chromium/third_party/blink/renderer/modules/bluetooth/testing/clusterfuzz/setup.py +index 3819febdb..f204a20da 100644 +--- a/src/3rdparty/chromium/third_party/blink/renderer/modules/bluetooth/testing/clusterfuzz/setup.py ++++ b/src/3rdparty/chromium/third_party/blink/renderer/modules/bluetooth/testing/clusterfuzz/setup.py +@@ -59,7 +59,7 @@ def RetrieveResources(): + + # Copy necessary files. + for r in RESOURCES: +- print('Copying: ' + os.path.abspath(os.path.join(current_path, r))) ++ print(('Copying: ' + os.path.abspath(os.path.join(current_path, r)))) + shutil.copy(os.path.join(current_path, r), resources_path) + + return resources_path +@@ -112,7 +112,7 @@ def main(): + format='bztar', + root_dir=os.path.join(current_path, os.pardir), + base_dir='clusterfuzz') +- print('File written to: ' + compressed_file_path + '.tar.bz2') ++ print(('File written to: ' + compressed_file_path + '.tar.bz2')) + + if __name__ == '__main__': diff --git a/src/3rdparty/chromium/third_party/blink/renderer/modules/bluetooth/testing/clusterfuzz/test_case_fuzzer.py b/src/3rdparty/chromium/third_party/blink/renderer/modules/bluetooth/testing/clusterfuzz/test_case_fuzzer.py index 8e6bb1471..e2669fb9a 100644 @@ -19782,7 +20372,7 @@ index 8e6bb1471..e2669fb9a 100644 token = random.choice(TOKENS) diff --git a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/bindings/bindings_tests.py b/src/3rdparty/chromium/third_party/blink/tools/blinkpy/bindings/bindings_tests.py -index ca0bbd220..b99b3fdb6 100644 +index ca0bbd220..661890a97 100644 --- a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/bindings/bindings_tests.py +++ b/src/3rdparty/chromium/third_party/blink/tools/blinkpy/bindings/bindings_tests.py @@ -136,7 +136,7 @@ def generate_interface_dependencies(runtime_enabled_features): @@ -19841,6 +20431,18 @@ index ca0bbd220..b99b3fdb6 100644 return True def identical_output_files(output_files): +@@ -281,9 +281,9 @@ def bindings_tests(output_directory, verbose, suppress_diff): + if relpath not in generated_files: + excess_files.append(relpath) + if excess_files: +- print('Excess reference files! ' ++ print(('Excess reference files! ' + '(probably cruft from renaming or deleting):\n' + +- '\n'.join(excess_files)) ++ '\n'.join(excess_files))) + return False + return True + @@ -379,11 +379,11 @@ def bindings_tests(output_directory, verbose, suppress_diff): if passed: @@ -20996,19 +21598,6 @@ index 51987ed65..06967d9b5 100644 hex_equivalent = '\xC5\xAA\x6E\xC4\xAD\x63\xC5\x8D\x64\x65\xCC\xBD' try: text_path = tempfile.mktemp(prefix='tree_unittest_') -diff --git a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/common/system/log_utils.py b/src/3rdparty/chromium/third_party/blink/tools/blinkpy/common/system/log_utils.py -index 6d3896155..d166876e3 100644 ---- a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/common/system/log_utils.py -+++ b/src/3rdparty/chromium/third_party/blink/tools/blinkpy/common/system/log_utils.py -@@ -99,7 +99,7 @@ def configure_logging(logging_level=None, - # - # Traceback (most recent call last): - # File "/System/Library/Frameworks/Python.framework/Versions/2.6/... -- # lib/python2.6/logging/__init__.py", line 761, in emit -+ # lib/python3.6/logging/__init__.py", line 761, in emit - # self.stream.write(fs % msg.encode(self.stream.encoding)) - # LookupError: unknown encoding: unknown - if logging_level is None: diff --git a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/common/system/output_capture.py b/src/3rdparty/chromium/third_party/blink/tools/blinkpy/common/system/output_capture.py index 4dfbf0137..3bf0a12c1 100644 --- a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/common/system/output_capture.py @@ -21275,7 +21864,7 @@ index 33392a543..18c32d249 100644 + unified_diff('a\xac\u1234\u20ac\U00008000', 'act', 'exp.txt', 'act.txt') diff --git a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py b/src/3rdparty/chromium/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py -index fe8b5e5d6..639e180f7 100755 +index fe8b5e5d6..db5fa63d7 100755 --- a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py +++ b/src/3rdparty/chromium/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py @@ -1366,11 +1366,11 @@ def main(): @@ -21285,26 +21874,14 @@ index fe8b5e5d6..639e180f7 100755 - print '%s uses disallowed identifiers:' % path + print('%s uses disallowed identifiers:' % path) for i in disallowed_identifiers: - print(i.line, i.identifier, i.advice) +- print(i.line, i.identifier, i.advice) ++ print((i.line, i.identifier, i.advice)) except IOError as e: - print 'could not open %s: %s' % (path, e) + print('could not open %s: %s' % (path, e)) if __name__ == '__main__': -diff --git a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/style/checker.py b/src/3rdparty/chromium/third_party/blink/tools/blinkpy/style/checker.py -index 8d1d82c79..51cc90696 100644 ---- a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/style/checker.py -+++ b/src/3rdparty/chromium/third_party/blink/tools/blinkpy/style/checker.py -@@ -325,7 +325,7 @@ def configure_logging(stream, logger=None, is_verbose=False): - # - # Traceback (most recent call last): - # File "/System/Library/Frameworks/Python.framework/Versions/2.6/... -- # lib/python2.6/logging/__init__.py", line 761, in emit -+ # lib/python3.6/logging/__init__.py", line 761, in emit - # self.stream.write(fs % msg.encode(self.stream.encoding)) - # LookupError: unknown encoding: unknown - if logger is None: diff --git a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/style/checker_unittest.py b/src/3rdparty/chromium/third_party/blink/tools/blinkpy/style/checker_unittest.py index fc987c919..549f35fb6 100644 --- a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/style/checker_unittest.py @@ -21519,7 +22096,7 @@ index 434f6dcc3..56011d8d7 100644 _log.debug('Found %s new or modified lines in: %s', len(line_numbers), path) diff --git a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/pep8.py b/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/pep8.py -index f605f189f..b22c5311b 100755 +index f605f189f..a8c41f4ba 100755 --- a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/pep8.py +++ b/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/pep8.py @@ -44,7 +44,7 @@ W warnings @@ -21540,6 +22117,44 @@ index f605f189f..b22c5311b 100755 DEFAULT_EXCLUDE = '.svn,CVS,.bzr,.hg,.git,__pycache__' DEFAULT_IGNORE = 'E123,E226,E24' +@@ -425,7 +425,7 @@ def continued_indentation(logical_line, tokens, indent_level, hang_closing, + # for each depth, memorize the visual indent column + indent = [last_indent[1]] + if verbose >= 3: +- print(">>> " + tokens[0][4].rstrip()) ++ print((">>> " + tokens[0][4].rstrip())) + + for token_type, text, start, end, line in tokens: + +@@ -438,7 +438,7 @@ def continued_indentation(logical_line, tokens, indent_level, hang_closing, + # this is the beginning of a continuation line. + last_indent = start + if verbose >= 3: +- print("... " + line.rstrip()) ++ print(("... " + line.rstrip())) + + # record the initial indent. + rel_indent[row] = expand_indent(line) - indent_level +@@ -506,7 +506,7 @@ def continued_indentation(logical_line, tokens, indent_level, hang_closing, + indent[depth] = start[1] + indent_chances[start[1]] = True + if verbose >= 4: +- print("bracket depth %s indent to %s" % (depth, start[1])) ++ print(("bracket depth %s indent to %s" % (depth, start[1]))) + # deal with implicit string concatenation + elif (token_type in (tokenize.STRING, tokenize.COMMENT) or + text in ('u', 'ur', 'b', 'br')): +@@ -528,8 +528,8 @@ def continued_indentation(logical_line, tokens, indent_level, hang_closing, + open_rows[depth].append(row) + parens[row] += 1 + if verbose >= 4: +- print("bracket depth %s seen, col %s, visual min = %s" % +- (depth, start[1], indent[depth])) ++ print(("bracket depth %s seen, col %s, visual min = %s" % ++ (depth, start[1], indent[depth]))) + elif text in ')]}' and depth > 0: + # parent indents should not be more than this one + prev_indent = indent.pop() or last_indent[1] @@ -1122,14 +1122,14 @@ def parse_udiff(diff, patterns=None, parent='.'): if line[:3] == '@@ ': hunk_match = HUNK_REGEX.match(line) @@ -21557,6 +22172,99 @@ index f605f189f..b22c5311b 100755 if rows and filename_match(path, patterns)]) +@@ -1331,10 +1331,10 @@ class Checker(object): + if self.blank_before < self.blank_lines: + self.blank_before = self.blank_lines + if self.verbose >= 2: +- print(self.logical_line[:80].rstrip()) ++ print((self.logical_line[:80].rstrip())) + for name, check, argument_names in self._logical_checks: + if self.verbose >= 4: +- print(' ' + name) ++ print((' ' + name)) + for offset, text in self.run_check(check, argument_names) or (): + if not isinstance(offset, tuple): + for token_offset, pos in mapping: +@@ -1425,8 +1425,8 @@ class Checker(object): + pos = '[%s:%s]' % (token[2][1] or '', token[3][1]) + else: + pos = 'l.%s' % token[3][0] +- print('l.%s\t%s\t%s\t%r' % +- (token[2][0], pos, tokenize.tok_name[token[0]], text)) ++ print(('l.%s\t%s\t%s\t%r' % ++ (token[2][0], pos, tokenize.tok_name[token[0]], text))) + if token_type == tokenize.OP: + if text in '([{': + parens += 1 +@@ -1507,7 +1507,7 @@ class BaseReport(object): + if code in self.expected: + return + if self.print_filename and not self.file_errors: +- print(self.filename) ++ print((self.filename)) + self.file_errors += 1 + self.total_errors += 1 + return code +@@ -1539,12 +1539,12 @@ class BaseReport(object): + + def print_benchmark(self): + """Print benchmark numbers.""" +- print('%-7.2f %s' % (self.elapsed, 'seconds elapsed')) ++ print(('%-7.2f %s' % (self.elapsed, 'seconds elapsed'))) + if self.elapsed: + for key in self._benchmark_keys: +- print('%-7d %s per second (%d total)' % ++ print(('%-7d %s per second (%d total)' % + (self.counters[key] / self.elapsed, key, +- self.counters[key])) ++ self.counters[key]))) + + + class FileReport(BaseReport): +@@ -1582,20 +1582,20 @@ class StandardReport(BaseReport): + """Print the result and return the overall count for this file.""" + self._deferred_print.sort() + for line_number, offset, code, text, doc in self._deferred_print: +- print(self._fmt % { ++ print((self._fmt % { + 'path': self.filename, + 'row': self.line_offset + line_number, 'col': offset + 1, + 'code': code, 'text': text, +- }) ++ })) + if self._show_source: + if line_number > len(self.lines): + line = '' + else: + line = self.lines[line_number - 1] +- print(line.rstrip()) +- print(re.sub(r'\S', ' ', line[:offset]) + '^') ++ print((line.rstrip())) ++ print((re.sub(r'\S', ' ', line[:offset]) + '^')) + if self._show_pep8 and doc: +- print(' ' + doc.strip()) ++ print((' ' + doc.strip())) + return self.file_errors + + +@@ -1678,7 +1678,7 @@ class StyleGuide(object): + def input_file(self, filename, lines=None, expected=None, line_offset=0): + """Run all checks on a Python source file.""" + if self.options.verbose: +- print('checking %s' % filename) ++ print(('checking %s' % filename)) + fchecker = self.checker_class( + filename, lines=lines, options=self.options) + return fchecker.check_all(expected=expected, line_offset=line_offset) +@@ -1694,7 +1694,7 @@ class StyleGuide(object): + runner = self.runner + for root, dirs, files in os.walk(dirname): + if verbose: +- print('directory ' + root) ++ print(('directory ' + root)) + counters['directories'] += 1 + for subdir in sorted(dirs): + if self.excluded(subdir, root): @@ -1740,7 +1740,7 @@ class StyleGuide(object): starts with argument_name and which contain selected tests. """ @@ -21566,6 +22274,50 @@ index f605f189f..b22c5311b 100755 (codes, args) = attrs if any(not (code and self.ignore_code(code)) for code in codes): checks.append((check.__name__, check, args)) +@@ -1814,7 +1814,7 @@ def read_config(options, args, arglist, parser): + user_conf = options.config + if user_conf and os.path.isfile(user_conf): + if options.verbose: +- print('user configuration: %s' % user_conf) ++ print(('user configuration: %s' % user_conf)) + config.read(user_conf) + + local_dir = os.curdir +@@ -1823,7 +1823,7 @@ def read_config(options, args, arglist, parser): + if config.read([os.path.join(parent, fn) for fn in PROJECT_CONFIG]): + local_dir = parent + if options.verbose: +- print('local configuration: in %s' % parent) ++ print(('local configuration: in %s' % parent)) + break + (parent, tail) = os.path.split(parent) + +@@ -1838,10 +1838,10 @@ def read_config(options, args, arglist, parser): + # Second, parse the configuration + for opt in config.options(pep8_section): + if opt.replace('_', '-') not in parser.config_options: +- print(" unknown option '%s' ignored" % opt) ++ print((" unknown option '%s' ignored" % opt)) + continue + if options.verbose > 1: +- print(" %s = %s" % (opt, config.get(pep8_section, opt))) ++ print((" %s = %s" % (opt, config.get(pep8_section, opt)))) + normalized_opt = opt.replace('-', '_') + opt_type = option_list[normalized_opt] + if opt_type in ('int', 'count'): +diff --git a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/PRESUBMIT.py b/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/PRESUBMIT.py +index 302b3fb3e..4396d963e 100644 +--- a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/PRESUBMIT.py ++++ b/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/PRESUBMIT.py +@@ -23,7 +23,7 @@ def _TestWPTLint(input_api, output_api): + message=output_api.PresubmitError + ) + if input_api.verbose: +- print('Running ' + abspath_to_test) ++ print(('Running ' + abspath_to_test)) + return input_api.RunTests([command]) + + diff --git a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/update_certs.py b/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/update_certs.py index 1a9dc17ed..8eb7a2c9d 100755 --- a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/update_certs.py @@ -21958,11 +22710,30 @@ index 6e90ac054..8b64e633f 100644 script_metadata = self.script_metadata assert script_metadata is not None for (key, value) in script_metadata: +diff --git a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/testpaths.py b/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/testpaths.py +index 2197792cd..66ae1fe51 100644 +--- a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/testpaths.py ++++ b/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/testpaths.py +@@ -100,12 +100,12 @@ def get_paths(**kwargs): + def write_output(path_id_map, as_json): + # type: (Dict[Text, List[Text]], bool) -> None + if as_json: +- print(json.dumps(path_id_map)) ++ print((json.dumps(path_id_map))) + else: + for path, test_ids in sorted(iteritems(path_id_map)): + print(path) + for test_id in sorted(test_ids): +- print(" " + test_id) ++ print((" " + test_id)) + + + def run(**kwargs): diff --git a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/typedata.py b/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/typedata.py -index 01bb82705..dd17aab27 100644 +index 01bb82705..43ec4526d 100644 --- a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/typedata.py +++ b/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/typedata.py -@@ -193,11 +193,11 @@ class TypeData(TypeDataType): +@@ -193,11 +193,10 @@ class TypeData(TypeDataType): return count @@ -21972,19 +22743,9 @@ index 01bb82705..dd17aab27 100644 return bool(self._data) or bool(self._json_data) - __bool__ = __nonzero__ -+ __nonzero__ = __bool__ def __contains__(self, key): # type: (Any) -> bool -@@ -260,7 +260,7 @@ class TypeData(TypeDataType): - """ key function to sort lists with None values. - - Python3 is more strict typewise. Comparing None and str for example is valid -- in python2 but throws an exception in python3. -+ in python3 but throws an exception in python3. - """ - if element and not element[0]: - return ("", element[1]) diff --git a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/utils.py b/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/utils.py index 36c1a9831..ed9d26441 100644 --- a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/manifest/utils.py @@ -23283,6 +24044,28 @@ index 7483be27d..5de27201c 100644 from genshi.core import QName from genshi.core import START, END, XML_NAMESPACE, DOCTYPE, TEXT +diff --git a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/third_party/html5lib/parse.py b/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/third_party/html5lib/parse.py +index e6806b460..aa4880736 100755 +--- a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/third_party/html5lib/parse.py ++++ b/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/third_party/html5lib/parse.py +@@ -101,7 +101,7 @@ def run(parseMethod, f, encoding, scripting): + + def printOutput(parser, document, opts): + if opts.encoding: +- print("Encoding:", parser.tokenizer.stream.charEncoding) ++ print(("Encoding:", parser.tokenizer.stream.charEncoding)) + + for item in parser.log: + print(item) +@@ -120,7 +120,7 @@ def printOutput(parser, document, opts): + if not hasattr(document, '__getitem__'): + document = [document] + for fragment in document: +- print(parser.tree.testSerializer(fragment)) ++ print((parser.tree.testSerializer(fragment))) + elif opts.html: + kwargs = {} + for opt in serializer.HTMLSerializer.options: diff --git a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/third_party/hyperframe/hyperframe/frame.py b/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/third_party/hyperframe/hyperframe/frame.py index 5294768a2..90bfe4549 100644 --- a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/third_party/hyperframe/hyperframe/frame.py @@ -23297,7 +24080,7 @@ index 5294768a2..90bfe4549 100644 def parse_body(self, data): body_len = 0 diff --git a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/third_party/six/six.py b/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/third_party/six/six.py -index 83f69783d..2ce396486 100644 +index 83f69783d..7005f103f 100644 --- a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/third_party/six/six.py +++ b/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/third_party/six/six.py @@ -20,7 +20,7 @@ @@ -23324,6 +24107,24 @@ index 83f69783d..2ce396486 100644 binary_type = str if sys.platform.startswith("java"): +@@ -242,7 +242,7 @@ _moved_attributes = [ + MovedAttribute("getcwd", "os", "os", "getcwdu", "getcwd"), + MovedAttribute("getcwdb", "os", "os", "getcwd", "getcwdb"), + MovedAttribute("getoutput", "commands", "subprocess"), +- MovedAttribute("range", "__builtin__", "builtins", "xrange", "range"), ++ MovedAttribute("range", "__builtin__", "builtins", "range", "range"), + MovedAttribute("reload_module", "__builtin__", "importlib" if PY34 else "imp", "reload"), + MovedAttribute("reduce", "__builtin__", "functools"), + MovedAttribute("shlex_quote", "pipes", "shlex", "quote"), +@@ -250,7 +250,7 @@ _moved_attributes = [ + MovedAttribute("UserDict", "UserDict", "collections"), + MovedAttribute("UserList", "UserList", "collections"), + MovedAttribute("UserString", "UserString", "collections"), +- MovedAttribute("xrange", "__builtin__", "builtins", "xrange", "range"), ++ MovedAttribute("range", "__builtin__", "builtins", "range", "range"), + MovedAttribute("zip", "itertools", "builtins", "izip", "zip"), + MovedAttribute("zip_longest", "itertools", "itertools", "izip_longest", "zip_longest"), + MovedModule("builtins", "__builtin__"), @@ -529,7 +529,7 @@ try: advance_iterator = next except NameError: @@ -23442,7 +24243,7 @@ index d21d697c8..93c990069 100644 import codecs diff --git a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/third_party/webencodings/webencodings/mklabels.py b/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/third_party/webencodings/webencodings/mklabels.py -index 295dc928b..cc1cf2e87 100644 +index 295dc928b..029f2117b 100644 --- a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/third_party/webencodings/webencodings/mklabels.py +++ b/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/third_party/webencodings/webencodings/mklabels.py @@ -12,7 +12,7 @@ @@ -23454,6 +24255,12 @@ index 295dc928b..cc1cf2e87 100644 except ImportError: from urllib.request import urlopen +@@ -56,4 +56,4 @@ LABELS = { + + + if __name__ == '__main__': +- print(generate('http://encoding.spec.whatwg.org/encodings.json')) ++ print((generate('http://encoding.spec.whatwg.org/encodings.json'))) diff --git a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/third_party/webencodings/webencodings/tests.py b/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/third_party/webencodings/webencodings/tests.py index e12c10d03..0c367905a 100644 --- a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/third_party/webencodings/webencodings/tests.py @@ -23481,7 +24288,7 @@ index d16e32602..45037bb49 100644 import codecs diff --git a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/browser.py b/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/browser.py -index 35f60d162..0097214cb 100644 +index 35f60d162..a38fefcb4 100644 --- a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/browser.py +++ b/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/browser.py @@ -47,9 +47,7 @@ def get_taskcluster_artifact(index, path): @@ -23512,6 +24319,47 @@ index 35f60d162..0097214cb 100644 def __init__(self, logger): super(ChromeAndroidBase, self).__init__(logger) +@@ -1114,11 +1111,11 @@ class EdgeChromium(Browser): + if os.path.isfile(edgedriver_path): + # remove read-only attribute + os.chmod(edgedriver_path, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) # 0777 +- print("Delete %s file" % edgedriver_path) ++ print(("Delete %s file" % edgedriver_path)) + os.remove(edgedriver_path) + driver_notes_path = os.path.join(dest, "Driver_notes") + if os.path.isdir(driver_notes_path): +- print("Delete %s folder" % driver_notes_path) ++ print(("Delete %s folder" % driver_notes_path)) + rmtree(driver_notes_path) + + self.logger.info("Downloading MSEdgeDriver from %s" % url) +diff --git a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/create.py b/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/create.py +index 696609a68..e54a36ce1 100644 +--- a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/create.py ++++ b/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/create.py +@@ -63,11 +63,11 @@ def run(_venv, **kwargs): + kwargs["reftest"] = True + + if ".." in path: +- print("""Test path %s is not under wpt root.""" % path) ++ print(("""Test path %s is not under wpt root.""" % path)) + return 1 + + if ref_path and ".." in ref_path: +- print("""Reference path %s is not under wpt root""" % ref_path) ++ print(("""Reference path %s is not under wpt root""" % ref_path)) + return 1 + + +@@ -125,7 +125,7 @@ def run(_venv, **kwargs): + path = "%s %s" % (path, ref_path) + proc = subprocess.Popen("%s %s" % (editor, path), shell=True) + else: +- print("Created test %s" % path) ++ print(("Created test %s" % path)) + + if proc: + proc.wait() diff --git a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/install.py b/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/install.py index 817702254..2ae2c62d8 100644 --- a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/install.py @@ -23588,9 +24436,18 @@ index bd85612e2..c88cdac2c 100644 return if date < cutoff_date: diff --git a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/testfiles.py b/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/testfiles.py -index 7f966a625..9315ac032 100644 +index 7f966a625..1c6e660b5 100644 --- a/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/testfiles.py +++ b/src/3rdparty/chromium/third_party/blink/tools/blinkpy/third_party/wpt/wpt/tools/wpt/testfiles.py +@@ -45,7 +45,7 @@ logger = logging.getLogger() + + def display_branch_point(): + # type: () -> None +- print(branch_point()) ++ print((branch_point())) + + + def branch_point(): @@ -124,17 +124,17 @@ def branch_point(): def compile_ignore_rule(rule): @@ -27628,6 +28485,32 @@ index 50dee2a98..028c6b6b2 100755 buf.write("""/* Copyright (c) 2020, Google Inc. * * Permission to use, copy, modify, and/or distribute this software for any +diff --git a/src/3rdparty/chromium/third_party/boringssl/src/third_party/googletest/scripts/fuse_gtest_files.py b/src/3rdparty/chromium/third_party/boringssl/src/third_party/googletest/scripts/fuse_gtest_files.py +index d0dd464fe..fe1c80cff 100755 +--- a/src/3rdparty/chromium/third_party/boringssl/src/third_party/googletest/scripts/fuse_gtest_files.py ++++ b/src/3rdparty/chromium/third_party/boringssl/src/third_party/googletest/scripts/fuse_gtest_files.py +@@ -93,8 +93,8 @@ def VerifyFileExists(directory, relative_path): + """ + + if not os.path.isfile(os.path.join(directory, relative_path)): +- print('ERROR: Cannot find %s in directory %s.' % (relative_path, +- directory)) ++ print(('ERROR: Cannot find %s in directory %s.' % (relative_path, ++ directory))) + print('Please either specify a valid project root directory ' + 'or omit it on the command line.') + sys.exit(1) +@@ -122,8 +122,8 @@ def VerifyOutputFile(output_dir, relative_path): + # TODO(wan@google.com): The following user-interaction doesn't + # work with automated processes. We should provide a way for the + # Makefile to force overwriting the files. +- print('%s already exists in directory %s - overwrite it? (y/N) ' % +- (relative_path, output_dir)) ++ print(('%s already exists in directory %s - overwrite it? (y/N) ' % ++ (relative_path, output_dir))) + answer = sys.stdin.readline().strip() + if answer not in ['y', 'Y']: + print('ABORTED.') diff --git a/src/3rdparty/chromium/third_party/boringssl/src/third_party/googletest/scripts/gen_gtest_pred_impl.py b/src/3rdparty/chromium/third_party/boringssl/src/third_party/googletest/scripts/gen_gtest_pred_impl.py index b43efdf41..1c5fea776 100755 --- a/src/3rdparty/chromium/third_party/boringssl/src/third_party/googletest/scripts/gen_gtest_pred_impl.py @@ -27669,7 +28552,7 @@ index b43efdf41..1c5fea776 100755 n = int(sys.argv[1]) diff --git a/src/3rdparty/chromium/third_party/boringssl/src/third_party/googletest/scripts/pump.py b/src/3rdparty/chromium/third_party/boringssl/src/third_party/googletest/scripts/pump.py -index 5efb653c2..3f98065d8 100755 +index 5efb653c2..d2a7247b1 100755 --- a/src/3rdparty/chromium/third_party/boringssl/src/third_party/googletest/scripts/pump.py +++ b/src/3rdparty/chromium/third_party/boringssl/src/third_party/googletest/scripts/pump.py @@ -246,7 +246,7 @@ def ParseToken(lines, pos, regex, token_type): @@ -27681,15 +28564,17 @@ index 5efb653c2..3f98065d8 100755 sys.exit(1) -@@ -273,7 +273,7 @@ def SkipUntil(lines, pos, regex, token_type): +@@ -273,8 +273,8 @@ def SkipUntil(lines, pos, regex, token_type): if m: return pos + m.start() else: - print ('ERROR: %s expected on line %s after column %s.' % -+ print('ERROR: %s expected on line %s after column %s.' % - (token_type, pos.line + 1, pos.column)) +- (token_type, pos.line + 1, pos.column)) ++ print(('ERROR: %s expected on line %s after column %s.' % ++ (token_type, pos.line + 1, pos.column))) sys.exit(1) + @@ -453,8 +453,8 @@ def PushFront(a_list, elem): def PopToken(a_list, token_type=None): token = PopFront(a_list) @@ -27701,7 +28586,7 @@ index 5efb653c2..3f98065d8 100755 sys.exit(1) return token -@@ -616,15 +616,15 @@ class Env: +@@ -616,16 +616,16 @@ class Env: if identifier == var: return value @@ -27715,12 +28600,14 @@ index 5efb653c2..3f98065d8 100755 - except Exception, e: - print 'ERROR: caught exception %s: %s' % (e.__class__.__name__, e) - print ('ERROR: failed to evaluate meta expression %s at %s' % +- (exp.python_exp, exp.token.start)) + except Exception as e: + print('ERROR: caught exception %s: %s' % (e.__class__.__name__, e)) -+ print('ERROR: failed to evaluate meta expression %s at %s' % - (exp.python_exp, exp.token.start)) ++ print(('ERROR: failed to evaluate meta expression %s at %s' % ++ (exp.python_exp, exp.token.start))) sys.exit(1) return result + @@ -634,7 +634,7 @@ class Env: if identifier == var: return (lower, upper) @@ -27787,7 +28674,7 @@ index 1291347f6..06ba0ffec 100755 new_text = self.search_for_re.sub(self.replace_with, text) file(versioned_file, 'w').write(new_text) diff --git a/src/3rdparty/chromium/third_party/boringssl/src/third_party/googletest/scripts/upload.py b/src/3rdparty/chromium/third_party/boringssl/src/third_party/googletest/scripts/upload.py -index c852e4c91..981a692bc 100755 +index c852e4c91..625f85abd 100755 --- a/src/3rdparty/chromium/third_party/boringssl/src/third_party/googletest/scripts/upload.py +++ b/src/3rdparty/chromium/third_party/boringssl/src/third_party/googletest/scripts/upload.py @@ -31,7 +31,7 @@ against by using the '--rev' option. @@ -28055,8 +28942,9 @@ index c852e4c91..981a692bc 100755 type = "current" if len(content) > MAX_UPLOAD_SIZE: - print ("Not uploading the %s file for %s because it's too large." % -+ print("Not uploading the %s file for %s because it's too large." % - (type, filename)) +- (type, filename)) ++ print(("Not uploading the %s file for %s because it's too large." % ++ (type, filename))) file_too_large = True content = "" checksum = md5.new(content).hexdigest() @@ -28101,15 +28989,17 @@ index c852e4c91..981a692bc 100755 query, fragment)) logging.info("Guessed base = %s", base) return base -@@ -1187,7 +1187,7 @@ def UploadSeparatePatches(issue, rpc_server, patchset, data, options): +@@ -1187,8 +1187,8 @@ def UploadSeparatePatches(issue, rpc_server, patchset, data, options): rv = [] for patch in patches: if len(patch[1]) > MAX_UPLOAD_SIZE: - print ("Not uploading the patch for " + patch[0] + -+ print("Not uploading the patch for " + patch[0] + - " because the file is too large.") +- " because the file is too large.") ++ print(("Not uploading the patch for " + patch[0] + ++ " because the file is too large.")) continue form_fields = [("filename", patch[0])] + if not options.download_base: @@ -1196,7 +1196,7 @@ def UploadSeparatePatches(issue, rpc_server, patchset, data, options): files = [("data", "data.diff", patch[1])] ctype, body = EncodeMultipartFormData(form_fields, files) @@ -28659,15 +29549,9 @@ index bd3d9f056..1e96ab52b 100644 if actual_hrefs != expected_hrefs: error_text = ( diff --git a/src/3rdparty/chromium/third_party/catapult/catapult_build/perfbot_stats/chrome_perf_stats.py b/src/3rdparty/chromium/third_party/catapult/catapult_build/perfbot_stats/chrome_perf_stats.py -index e98fddfd3..59e31834f 100755 +index e98fddfd3..38ee79c8c 100755 --- a/src/3rdparty/chromium/third_party/catapult/catapult_build/perfbot_stats/chrome_perf_stats.py +++ b/src/3rdparty/chromium/third_party/catapult/catapult_build/perfbot_stats/chrome_perf_stats.py -@@ -1,4 +1,4 @@ --#!/usr/bin/env python2.7 -+#!/usr/bin/env python3 - # Copyright 2015 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. @@ -18,8 +18,8 @@ import calendar import datetime import json @@ -28760,26 +29644,10 @@ index e98fddfd3..59e31834f 100755 results = json.load(response) _UpdateSuccessRatesWithResult( success_rates, results, date_dict_str, builder) -diff --git a/src/3rdparty/chromium/third_party/catapult/catapult_build/perfbot_stats/chrome_perf_stats_unittest.py b/src/3rdparty/chromium/third_party/catapult/catapult_build/perfbot_stats/chrome_perf_stats_unittest.py -index bb72bf190..80a405657 100644 ---- a/src/3rdparty/chromium/third_party/catapult/catapult_build/perfbot_stats/chrome_perf_stats_unittest.py -+++ b/src/3rdparty/chromium/third_party/catapult/catapult_build/perfbot_stats/chrome_perf_stats_unittest.py -@@ -1,4 +1,4 @@ --#!/usr/bin/env python2.7 -+#!/usr/bin/env python3 - # Copyright 2015 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. diff --git a/src/3rdparty/chromium/third_party/catapult/catapult_build/perfbot_stats/chrome_perf_step_timings.py b/src/3rdparty/chromium/third_party/catapult/catapult_build/perfbot_stats/chrome_perf_step_timings.py -index 30558abd1..1384862c8 100755 +index 30558abd1..174f5ca32 100755 --- a/src/3rdparty/chromium/third_party/catapult/catapult_build/perfbot_stats/chrome_perf_step_timings.py +++ b/src/3rdparty/chromium/third_party/catapult/catapult_build/perfbot_stats/chrome_perf_step_timings.py -@@ -1,4 +1,4 @@ --#!/usr/bin/env python2.7 -+#!/usr/bin/env python3 - # Copyright 2015 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. @@ -17,8 +17,8 @@ import csv import datetime import json @@ -28876,7 +29744,7 @@ index d3286a8fd..b30bc3cde 100644 sys.exit(exit_code) diff --git a/src/3rdparty/chromium/third_party/catapult/common/bin/update_chrome_reference_binaries.py b/src/3rdparty/chromium/third_party/catapult/common/bin/update_chrome_reference_binaries.py -index 86a1d7fe9..5a9c4195e 100755 +index 86a1d7fe9..a39e72284 100755 --- a/src/3rdparty/chromium/third_party/catapult/common/bin/update_chrome_reference_binaries.py +++ b/src/3rdparty/chromium/third_party/catapult/common/bin/update_chrome_reference_binaries.py @@ -20,7 +20,7 @@ import shutil @@ -28897,15 +29765,19 @@ index 86a1d7fe9..5a9c4195e 100755 return [l.split(',') for l in lines] -@@ -263,7 +263,7 @@ def _ResolveChromiumRemotePath(channel, platform, version_info): +@@ -263,10 +263,10 @@ def _ResolveChromiumRemotePath(channel, platform, version_info): closest_snapshot = _FindClosestChromiumSnapshot( branch_base_position, build_dir) if closest_snapshot != branch_base_position: - print ('Channel %s corresponds to commit position ' % channel + -+ print('Channel %s corresponds to commit position ' % channel + ++ print(('Channel %s corresponds to commit position ' % channel + '%d on %s, ' % (branch_base_position, platform) + 'but closest chromium snapshot available on ' + - '%s is %d' % (_CHROMIUM_GS_BUCKET, closest_snapshot)) +- '%s is %d' % (_CHROMIUM_GS_BUCKET, closest_snapshot)) ++ '%s is %d' % (_CHROMIUM_GS_BUCKET, closest_snapshot))) + return RemotePath(bucket=_CHROMIUM_GS_BUCKET, + path = ('%s/%s/%s' % (build_dir, closest_snapshot, + platform_info.chromium_info.zip_name))) @@ -348,11 +348,11 @@ def _RemoveKeystoneFromBuild(location): def _NeedsUpdate(config, binary, channel, platform, version_info): @@ -30064,13 +30936,10 @@ index 493176e65..15ce2e6a1 100644 import symbol import token diff --git a/src/3rdparty/chromium/third_party/catapult/common/py_utils/py_utils/refactor/offset_token.py b/src/3rdparty/chromium/third_party/catapult/common/py_utils/py_utils/refactor/offset_token.py -index deca08587..2cd695900 100644 +index deca08587..907d945eb 100644 --- a/src/3rdparty/chromium/third_party/catapult/common/py_utils/py_utils/refactor/offset_token.py +++ b/src/3rdparty/chromium/third_party/catapult/common/py_utils/py_utils/refactor/offset_token.py -@@ -1,11 +1,11 @@ --# Lint as: python2, python3 -+# Lint as: python3, python3 - # Copyright 2015 The Chromium Authors. All rights reserved. +@@ -3,9 +3,9 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -30326,7 +31195,7 @@ index 7e225f595..4efe00d9d 100644 - self.assertRaises(StopIteration, gen.next) + self.assertRaises(StopIteration, gen.__next__) diff --git a/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/py_vulcanize/generate.py b/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/py_vulcanize/generate.py -index 8af373102..53b1347d0 100644 +index 8af373102..8fa0ecb2a 100644 --- a/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/py_vulcanize/generate.py +++ b/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/py_vulcanize/generate.py @@ -2,9 +2,9 @@ @@ -30342,28 +31211,8 @@ index 8af373102..53b1347d0 100644 import os import subprocess -@@ -165,8 +165,8 @@ def GenerateJSToFile(f, - sln = '.'.join(parts[:2]) - - # Output -- print(('%i\t%s\t%s\t%s\t%s' % -- (len(js), min_js_size, module.name, tln, sln))) -+ print('%i\t%s\t%s\t%s\t%s' % -+ (len(js), min_js_size, module.name, tln, sln)) - sys.stdout.flush() - - -@@ -208,7 +208,7 @@ def _MinifyCSS(css_text): - stdin=subprocess.PIPE, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) -- res = p.communicate(input=css_text) -+ res = p.communicate(input=css_text.encode()) - errorcode = p.wait() - if errorcode != 0: - sys.stderr.write('rCSSmin exited with error code %d' % errorcode) diff --git a/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/py_vulcanize/html_module_unittest.py b/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/py_vulcanize/html_module_unittest.py -index e8438f4db..fbce2c726 100644 +index e8438f4db..882510d4e 100644 --- a/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/py_vulcanize/html_module_unittest.py +++ b/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/py_vulcanize/html_module_unittest.py @@ -2,9 +2,9 @@ @@ -30379,15 +31228,6 @@ index e8438f4db..fbce2c726 100644 import os import unittest -@@ -56,7 +56,7 @@ class FakeLoader(object): - return None - - # Sort by length. Longest match wins. -- candidate_paths.sort(lambda x, y: len(x) - len(y)) -+ candidate_paths.sort(key=lambda x: len(x), reverse=True) - longest_candidate = candidate_paths[-1] - - return ResourceWithFakeContents( @@ -91,8 +91,8 @@ class ParseTests(unittest.TestCase): '/tmp/a/b/', is_component=False, @@ -30786,19 +31626,6 @@ index 7a169882d..f090e4f29 100644 import collections import os -diff --git a/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/py_vulcanize/resource_loader.py b/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/py_vulcanize/resource_loader.py -index 015adaa66..8d1356124 100644 ---- a/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/py_vulcanize/resource_loader.py -+++ b/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/py_vulcanize/resource_loader.py -@@ -59,7 +59,7 @@ class ResourceLoader(object): - return None - - # Sort by length. Longest match wins. -- candidate_paths.sort(lambda x, y: len(x) - len(y)) -+ candidate_paths.sort(key=lambda x: len(x), reverse=True) - longest_candidate = candidate_paths[-1] - return resource_module.Resource(longest_candidate, absolute_path, binary) - diff --git a/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/py_vulcanize/resource_unittest.py b/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/py_vulcanize/resource_unittest.py index 4da23556f..3f0dedae3 100644 --- a/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/py_vulcanize/resource_unittest.py @@ -31342,7 +32169,7 @@ index 5c05fac6e..813d4b1e8 100644 """ Safe config parser """ def _interpolate(self, section, option, rawval, vars): diff --git a/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rcssmin/_setup/py3/shell.py b/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rcssmin/_setup/py3/shell.py -index 91f2ebc5b..7641691e2 100644 +index 91f2ebc5b..b925efe34 100644 --- a/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rcssmin/_setup/py3/shell.py +++ b/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rcssmin/_setup/py3/shell.py @@ -48,7 +48,7 @@ class SignalError(ExitError): @@ -31354,23 +32181,29 @@ index 91f2ebc5b..7641691e2 100644 if key.startswith('SIG') and not key.startswith('SIG_'): if val == signal: self.signalstr = key[3:] +@@ -255,7 +255,7 @@ def spawn(*argv, **kwargs): + + echo = kwargs.get('echo') + if echo: +- print(' '.join(argv)) ++ print((' '.join(argv))) + filepipe = kwargs.get('filepipe') + if filepipe: + return _filepipespawn( diff --git a/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rcssmin/bench/cssmin.py b/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rcssmin/bench/cssmin.py -index cbfbf8d49..3eae15818 100644 +index cbfbf8d49..6b374a1ef 100644 --- a/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rcssmin/bench/cssmin.py +++ b/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rcssmin/bench/cssmin.py -@@ -24,10 +24,7 @@ - +@@ -25,7 +25,7 @@ """ --try: + try: - from StringIO import StringIO # The pure-Python StringIO supports unicode. --except ImportError: -- from io import StringIO -+from io import StringIO ++ from io import StringIO # The pure-Python StringIO supports unicode. + except ImportError: + from io import StringIO import re - - -@@ -129,7 +126,7 @@ def normalize_rgb_colors_to_hex(css): +@@ -129,7 +129,7 @@ def normalize_rgb_colors_to_hex(css): regex = re.compile(r"rgb\s*\(\s*([0-9,\s]+)\s*\)") match = regex.search(css) while match: @@ -31380,9 +32213,33 @@ index cbfbf8d49..3eae15818 100644 css = css.replace(match.group(), hexcolor) match = regex.search(css) diff --git a/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rcssmin/bench/main.py b/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rcssmin/bench/main.py -index 078150629..dcf93794d 100644 +index 078150629..e9be5fc9a 100644 --- a/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rcssmin/bench/main.py +++ b/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rcssmin/bench/main.py +@@ -64,9 +64,9 @@ class cssmins(object): + p_03__rcssmin = _p_03__rcssmin() + except ImportError: + import_notes.append("_rcssmin (C-Port) not available") +- print(import_notes[-1]) ++ print((import_notes[-1])) + +-print("Python Release: %s" % ".".join(map(str, _sys.version_info[:3]))) ++print(("Python Release: %s" % ".".join(map(str, _sys.version_info[:3])))) + print("") + + +@@ -103,9 +103,9 @@ def bench(filenames, count): + if not filenames: + raise RuntimeError("Missing files to benchmark") + try: +- xrange ++ range + except NameError: +- xrange = range ++ range = range + try: + cmp + except NameError: @@ -113,7 +113,7 @@ def bench(filenames, count): ports = [item for item in dir(cssmins) if item.startswith('p_')] @@ -31486,19 +32343,6 @@ index 939e11d59..e8b1dfc50 100644 _sys.exit(0) elif key == '-p': plain = str(value) -diff --git a/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rcssmin/docs/BENCHMARKS b/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rcssmin/docs/BENCHMARKS -index 9a49e9b51..6a2afe175 100644 ---- a/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rcssmin/docs/BENCHMARKS -+++ b/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rcssmin/docs/BENCHMARKS -@@ -43,7 +43,7 @@ Benchmarking 'bench/wikipedia.min.css'... (49.4 KiB) - Timing _rcssmin ... ( 49.4 KiB =) 0.25 ms (factor: 526.94, 99.55) - - --$ python2.7 -OO bench/main.py bench/*.css -+$ python3 -OO bench/main.py bench/*.css - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Python Release: 2.7.7 - diff --git a/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rjsmin/_setup/py2/__init__.py b/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rjsmin/_setup/py2/__init__.py index 9582ecc10..6139d510a 100644 --- a/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rjsmin/_setup/py2/__init__.py @@ -31927,7 +32771,7 @@ index 5c05fac6e..813d4b1e8 100644 """ Safe config parser """ def _interpolate(self, section, option, rawval, vars): diff --git a/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rjsmin/_setup/py3/shell.py b/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rjsmin/_setup/py3/shell.py -index 91f2ebc5b..7641691e2 100644 +index 91f2ebc5b..b925efe34 100644 --- a/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rjsmin/_setup/py3/shell.py +++ b/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rjsmin/_setup/py3/shell.py @@ -48,7 +48,7 @@ class SignalError(ExitError): @@ -31939,27 +32783,34 @@ index 91f2ebc5b..7641691e2 100644 if key.startswith('SIG') and not key.startswith('SIG_'): if val == signal: self.signalstr = key[3:] +@@ -255,7 +255,7 @@ def spawn(*argv, **kwargs): + + echo = kwargs.get('echo') + if echo: +- print(' '.join(argv)) ++ print((' '.join(argv))) + filepipe = kwargs.get('filepipe') + if filepipe: + return _filepipespawn( diff --git a/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rjsmin/bench/jsmin.py b/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rjsmin/bench/jsmin.py -index b1f7dd7e6..6ec9b119a 100644 +index b1f7dd7e6..80eb5c328 100644 --- a/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rjsmin/bench/jsmin.py +++ b/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rjsmin/bench/jsmin.py -@@ -31,13 +31,7 @@ - # */ +@@ -32,10 +32,10 @@ # imports adjusted for speed (cStringIO) and python 3 (io) -- nd --try: + try: - from cStringIO import StringIO --except ImportError: -- try: ++ from io import StringIO + except ImportError: + try: - from StringIO import StringIO -- except ImportError: -- from io import StringIO -+from io import StringIO - ++ from io import StringIO + except ImportError: + from io import StringIO - def jsmin(js): diff --git a/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rjsmin/bench/jsmin_2_0_9.py b/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rjsmin/bench/jsmin_2_0_9.py -index 23bed6082..7415a2af3 100644 +index 23bed6082..7cf9c0d51 100644 --- a/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rjsmin/bench/jsmin_2_0_9.py +++ b/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rjsmin/bench/jsmin_2_0_9.py @@ -29,9 +29,9 @@ is_3 = sys.version_info >= (3, 0) @@ -31981,9 +32832,8 @@ index 23bed6082..7415a2af3 100644 - if cStringIO and not isinstance(js, unicode): + if cStringIO and not isinstance(js, str): # strings can use cStringIO for a 3x performance -- # improvement, but unicode (in python2) cannot + # improvement, but unicode (in python2) cannot - klass = cStringIO.StringIO -+ # improvement, but unicode (in python3) cannot + klass = io.StringIO else: - klass = StringIO.StringIO @@ -31992,9 +32842,43 @@ index 23bed6082..7415a2af3 100644 klass = io.StringIO ins = klass(js) diff --git a/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rjsmin/bench/main.py b/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rjsmin/bench/main.py -index c43810594..0632ee6b9 100644 +index c43810594..f434b073d 100644 --- a/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rjsmin/bench/main.py +++ b/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rjsmin/bench/main.py +@@ -53,18 +53,18 @@ class jsmins(object): + import_notes.append( + "jsmin_2_0_9 available for python 2.4 and later..." + ) +- print(import_notes[-1]) ++ print((import_notes[-1])) + + import rjsmin as p_05_rjsmin + try: + import _rjsmin as p_06__rjsmin + except ImportError: + import_notes.append("_rjsmin (C-Port) not available") +- print(import_notes[-1]) ++ print((import_notes[-1])) + jsmins.p_05_rjsmin.jsmin = jsmins.p_05_rjsmin._make_jsmin( + python_only=True + ) +-print("Python Release: %s" % ".".join(map(str, _sys.version_info[:3]))) ++print(("Python Release: %s" % ".".join(map(str, _sys.version_info[:3])))) + print("") + + +@@ -101,9 +101,9 @@ def bench(filenames, count): + if not filenames: + raise RuntimeError("Missing files to benchmark") + try: +- xrange ++ range + except NameError: +- xrange = range ++ range = range + try: + cmp + except NameError: @@ -111,7 +111,7 @@ def bench(filenames, count): ports = [item for item in dir(jsmins) if item.startswith('p_')] @@ -32098,23 +32982,22 @@ index e91c3d073..df436ea96 100644 _sys.exit(0) elif key == '-p': plain = str(value) -diff --git a/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rjsmin/docs/BENCHMARKS b/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rjsmin/docs/BENCHMARKS -index 00fbc90f3..02cb28f07 100644 ---- a/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rjsmin/docs/BENCHMARKS -+++ b/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rjsmin/docs/BENCHMARKS -@@ -121,7 +121,7 @@ Benchmarking 'bench/markermanager.js'... (28.6 KiB) - Timing _rjsmin ... ( 11.6 KiB =) 0.06 ms (factor: 592.11, 236.04, 80.03) - - --$ python2.7 -OO bench/main.py bench/*.js -+$ python3 -OO bench/main.py bench/*.js - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Python Release: 2.7.10 - diff --git a/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rjsmin/rjsmin.py b/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rjsmin/rjsmin.py -index 54e20ec1c..805b18ab5 100755 +index 54e20ec1c..397cf88d0 100755 --- a/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rjsmin/rjsmin.py +++ b/src/3rdparty/chromium/third_party/catapult/common/py_vulcanize/third_party/rjsmin/rjsmin.py +@@ -99,9 +99,9 @@ def _make_jsmin(python_only=False): + else: + return _rjsmin.jsmin + try: +- xrange ++ range + except NameError: +- xrange = range # pylint: disable = redefined-builtin ++ range = range # pylint: disable = redefined-builtin + + space_chars = r'[\000-\011\013\014\016-\040]' + @@ -167,7 +167,7 @@ def _make_jsmin(python_only=False): """ Make id_literal like char class """ match = _re.compile(what).match @@ -32133,5377 +33016,222 @@ index 54e20ec1c..805b18ab5 100755 ]) return r'[%s]' % fix_charclass(result) -diff --git a/src/3rdparty/chromium/third_party/catapult/third_party/beautifulsoup4/AUTHORS.txt b/src/3rdparty/chromium/third_party/catapult/third_party/beautifulsoup4/AUTHORS.txt -deleted file mode 100644 -index 8c113de6c..000000000 ---- a/src/3rdparty/chromium/third_party/catapult/third_party/beautifulsoup4/AUTHORS.txt -+++ /dev/null -@@ -1,43 +0,0 @@ --Behold, mortal, the origins of Beautiful Soup... --================================================ -- --Leonard Richardson is the primary programmer. -- --Aaron DeVore is awesome. -- --Mark Pilgrim provided the encoding detection code that forms the base --of UnicodeDammit. -- --Thomas Kluyver and Ezio Melotti finished the work of getting Beautiful --Soup 4 working under Python 3. -- --Simon Willison wrote soupselect, which was used to make Beautiful Soup --support CSS selectors. -- --Sam Ruby helped with a lot of edge cases. -- --Jonathan Ellis was awarded the prestigous Beau Potage D'Or for his --work in solving the nestable tags conundrum. -- --An incomplete list of people have contributed patches to Beautiful --Soup: -- -- Istvan Albert, Andrew Lin, Anthony Baxter, Andrew Boyko, Tony Chang, -- Zephyr Fang, Fuzzy, Roman Gaufman, Yoni Gilad, Richie Hindle, Peteris -- Krumins, Kent Johnson, Ben Last, Robert Leftwich, Staffan Malmgren, -- Ksenia Marasanova, JP Moins, Adam Monsen, John Nagle, "Jon", Ed -- Oskiewicz, Greg Phillips, Giles Radford, Arthur Rudolph, Marko -- Samastur, Jouni Seppänen, Alexander Schmolck, Andy Theyers, Glyn -- Webster, Paul Wright, Danny Yoo -- --An incomplete list of people who made suggestions or found bugs or --found ways to break Beautiful Soup: -- -- Hanno Böck, Matteo Bertini, Chris Curvey, Simon Cusack, Bruce Eckel, -- Matt Ernst, Michael Foord, Tom Harris, Bill de hOra, Donald Howes, -- Matt Patterson, Scott Roberts, Steve Strassmann, Mike Williams, -- warchild at redho dot com, Sami Kuisma, Carlos Rocha, Bob Hutchison, -- Joren Mc, Michal Migurski, John Kleven, Tim Heaney, Tripp Lilley, Ed -- Summers, Dennis Sutch, Chris Smith, Aaron Sweep^W Swartz, Stuart -- Turner, Greg Edwards, Kevin J Kalupson, Nikos Kouremenos, Artur de -- Sousa Rocha, Yichun Wei, Per Vognsen -diff --git a/src/3rdparty/chromium/third_party/catapult/third_party/beautifulsoup4/CHANGELOG b/src/3rdparty/chromium/third_party/catapult/third_party/beautifulsoup4/CHANGELOG -new file mode 100644 -index 000000000..fa9755561 ---- /dev/null -+++ b/src/3rdparty/chromium/third_party/catapult/third_party/beautifulsoup4/CHANGELOG -@@ -0,0 +1,1697 @@ -+Beautiful Soup's official support for Python 2 ended on January 1st, -+2021. The final release to support Python 2 was Beautiful Soup -+4.9.3. In the Launchpad Bazaar repository, the final revision to support -+Python 2 was revision 605. -+ -+= 4.11.1 (20220408) -+ -+This release was done to ensure that the unit tests are packaged along -+with the released source. There are no functionality changes in this -+release, but there are a few other packaging changes: -+ -+* The Japanese and Korean translations of the documentation are included. -+* The changelog is now packaged as CHANGELOG, and the license file is -+ packaged as LICENSE. NEWS.txt and COPYING.txt are still present, -+ but may be removed in the future. -+* TODO.txt is no longer packaged, since a TODO is not relevant for released -+ code. -+ -+= 4.11.0 (20220407) -+ -+* Ported unit tests to use pytest. -+ -+* Added special string classes, RubyParenthesisString and RubyTextString, -+ to make it possible to treat ruby text specially in get_text() calls. -+ [bug=1941980] -+ -+* It's now possible to customize the way output is indented by -+ providing a value for the 'indent' argument to the Formatter -+ constructor. The 'indent' argument works very similarly to the -+ argument of the same name in the Python standard library's -+ json.dump() function. [bug=1955497] -+ -+* If the charset-normalizer Python module -+ (https://pypi.org/project/charset-normalizer/) is installed, Beautiful -+ Soup will use it to detect the character sets of incoming documents. -+ This is also the module used by newer versions of the Requests library. -+ For the sake of backwards compatibility, chardet and cchardet both take -+ precedence if installed. [bug=1955346] -+ -+* Added a workaround for an lxml bug -+ (https://bugs.launchpad.net/lxml/+bug/1948551) that causes -+ problems when parsing a Unicode string beginning with BYTE ORDER MARK. -+ [bug=1947768] -+ -+* Issue a warning when an HTML parser is used to parse a document that -+ looks like XML but not XHTML. [bug=1939121] -+ -+* Do a better job of keeping track of namespaces as an XML document is -+ parsed, so that CSS selectors that use namespaces will do the right -+ thing more often. [bug=1946243] -+ -+* Some time ago, the misleadingly named "text" argument to find-type -+ methods was renamed to the more accurate "string." But this supposed -+ "renaming" didn't make it into important places like the method -+ signatures or the docstrings. That's corrected in this -+ version. "text" still works, but will give a DeprecationWarning. -+ [bug=1947038] -+ -+* Fixed a crash when pickling a BeautifulSoup object that has no -+ tree builder. [bug=1934003] -+ -+* Fixed a crash when overriding multi_valued_attributes and using the -+ html5lib parser. [bug=1948488] -+ -+* Standardized the wording of the MarkupResemblesLocatorWarning -+ warnings to omit untrusted input and make the warnings less -+ judgmental about what you ought to be doing. [bug=1955450] -+ -+* Removed support for the iconv_codec library, which doesn't seem -+ to exist anymore and was never put up on PyPI. (The closest -+ replacement on PyPI, iconv_codecs, is GPL-licensed, so we can't use -+ it--it's also quite old.) -+ -+= 4.10.0 (20210907) -+ -+* This is the first release of Beautiful Soup to only support Python -+ 3. I dropped Python 2 support to maintain support for newer versions -+ (58 and up) of setuptools. See: -+ https://github.com/pypa/setuptools/issues/2769 [bug=1942919] -+ -+* The behavior of methods like .get_text() and .strings now differs -+ depending on the type of tag. The change is visible with HTML tags -+ like --""" -- soup = BeautifulSoup(doc, "xml") -- # lxml would have stripped this while parsing, but we can add -- # it later. -- soup.script.string = 'console.log("< < hey > > ");' -- encoded = soup.encode() -- self.assertTrue(b"< < hey > >" in encoded) -- -- def test_can_parse_unicode_document(self): -- markup = u'Sacr\N{LATIN SMALL LETTER E WITH ACUTE} bleu!' -- soup = self.soup(markup) -- self.assertEqual(u'Sacr\xe9 bleu!', soup.root.string) -- -- def test_popping_namespaced_tag(self): -- markup = 'b2012-07-02T20:33:42Zcd' -- soup = self.soup(markup) -- self.assertEqual( -- unicode(soup.rss), markup) -- -- def test_docstring_includes_correct_encoding(self): -- soup = self.soup("") -- self.assertEqual( -- soup.encode("latin1"), -- b'\n') -- -- def test_large_xml_document(self): -- """A large XML document should come out the same as it went in.""" -- markup = (b'\n' -- + b'0' * (2**12) -- + b'') -- soup = self.soup(markup) -- self.assertEqual(soup.encode("utf-8"), markup) -- -- -- def test_tags_are_empty_element_if_and_only_if_they_are_empty(self): -- self.assertSoupEquals("

", "

") -- self.assertSoupEquals("

foo

") -- -- def test_namespaces_are_preserved(self): -- markup = 'This tag is in the a namespaceThis tag is in the b namespace' -- soup = self.soup(markup) -- root = soup.root -- self.assertEqual("http://example.com/", root['xmlns:a']) -- self.assertEqual("http://example.net/", root['xmlns:b']) -- -- def test_closing_namespaced_tag(self): -- markup = '

20010504

' -- soup = self.soup(markup) -- self.assertEqual(unicode(soup.p), markup) -- -- def test_namespaced_attributes(self): -- markup = '' -- soup = self.soup(markup) -- self.assertEqual(unicode(soup.foo), markup) -- -- def test_namespaced_attributes_xml_namespace(self): -- markup = 'bar' -- soup = self.soup(markup) -- self.assertEqual(unicode(soup.foo), markup) -- --class HTML5TreeBuilderSmokeTest(HTMLTreeBuilderSmokeTest): -- """Smoke test for a tree builder that supports HTML5.""" -- -- def test_real_xhtml_document(self): -- # Since XHTML is not HTML5, HTML5 parsers are not tested to handle -- # XHTML documents in any particular way. -- pass -- -- def test_html_tags_have_namespace(self): -- markup = "" -- soup = self.soup(markup) -- self.assertEqual("http://www.w3.org/1999/xhtml", soup.a.namespace) -- -- def test_svg_tags_have_namespace(self): -- markup = '' -- soup = self.soup(markup) -- namespace = "http://www.w3.org/2000/svg" -- self.assertEqual(namespace, soup.svg.namespace) -- self.assertEqual(namespace, soup.circle.namespace) -- -- -- def test_mathml_tags_have_namespace(self): -- markup = '5' -- soup = self.soup(markup) -- namespace = 'http://www.w3.org/1998/Math/MathML' -- self.assertEqual(namespace, soup.math.namespace) -- self.assertEqual(namespace, soup.msqrt.namespace) -- -- def test_xml_declaration_becomes_comment(self): -- markup = '' -- soup = self.soup(markup) -- self.assertTrue(isinstance(soup.contents[0], Comment)) -- self.assertEqual(soup.contents[0], '?xml version="1.0" encoding="utf-8"?') -- self.assertEqual("html", soup.contents[0].next_element.name) -- --def skipIf(condition, reason): -- def nothing(test, *args, **kwargs): -- return None -- -- def decorator(test_item): -- if condition: -- return nothing -- else: -- return test_item -- -- return decorator -diff --git a/src/3rdparty/chromium/third_party/catapult/third_party/beautifulsoup4/bs4/tests/__init__.py b/src/3rdparty/chromium/third_party/catapult/third_party/beautifulsoup4/bs4/tests/__init__.py -index 142c8cc3f..4af4b0ce0 100644 ---- a/src/3rdparty/chromium/third_party/catapult/third_party/beautifulsoup4/bs4/tests/__init__.py -+++ b/src/3rdparty/chromium/third_party/catapult/third_party/beautifulsoup4/bs4/tests/__init__.py -@@ -1 +1,1191 @@ --"The beautifulsoup tests." -+# encoding: utf-8 -+"""Helper classes for tests.""" -+ -+# Use of this source code is governed by the MIT license. -+__license__ = "MIT" -+ -+import pickle -+import copy -+import functools -+import warnings -+import pytest -+from bs4 import BeautifulSoup -+from bs4.element import ( -+ CharsetMetaAttributeValue, -+ Comment, -+ ContentMetaAttributeValue, -+ Doctype, -+ PYTHON_SPECIFIC_ENCODINGS, -+ SoupStrainer, -+ Script, -+ Stylesheet, -+ Tag -+) -+ -+from bs4.builder import ( -+ DetectsXMLParsedAsHTML, -+ HTMLParserTreeBuilder, -+ XMLParsedAsHTMLWarning, -+) -+default_builder = HTMLParserTreeBuilder -+ -+BAD_DOCUMENT = """A bare string -+ -+ -+
-+
HTML5 does allow CDATA sections in SVG
-+
A tag
-+
A
tag that supposedly has contents.
-+
AT&T
-+
-+
-+
This numeric entity is missing the final semicolon:
-+
-+
a
-+
This document contains (do you see it?)
-+
This document ends with That attribute value was bogus
-+The doctype is invalid because it contains extra whitespace -+
That boolean attribute had no value
-+
Here's a nonexistent entity: &#foo; (do you see it?)
-+
This document ends before the entity finishes: > -+

Paragraphs shouldn't contain block display elements, but this one does:

you see?

-+Multiple values for the same attribute. -+
Here's a table
-+
-+
This tag contains nothing but whitespace:
-+

This p tag is cut off by

the end of the blockquote tag
-+
Here's a nested table:
foo
This table contains bare markup
-+ -+
This document contains a surprise doctype
-+ -+
Tag name contains Unicode characters
-+ -+ -+""" -+ -+ -+class SoupTest(object): -+ -+ @property -+ def default_builder(self): -+ return default_builder -+ -+ def soup(self, markup, **kwargs): -+ """Build a Beautiful Soup object from markup.""" -+ builder = kwargs.pop('builder', self.default_builder) -+ return BeautifulSoup(markup, builder=builder, **kwargs) -+ -+ def document_for(self, markup, **kwargs): -+ """Turn an HTML fragment into a document. -+ -+ The details depend on the builder. -+ """ -+ return self.default_builder(**kwargs).test_fragment_to_document(markup) -+ -+ def assert_soup(self, to_parse, compare_parsed_to=None): -+ """Parse some markup using Beautiful Soup and verify that -+ the output markup is as expected. -+ """ -+ builder = self.default_builder -+ obj = BeautifulSoup(to_parse, builder=builder) -+ if compare_parsed_to is None: -+ compare_parsed_to = to_parse -+ -+ # Verify that the documents come out the same. -+ assert obj.decode() == self.document_for(compare_parsed_to) -+ -+ # Also run some checks on the BeautifulSoup object itself: -+ -+ # Verify that every tag that was opened was eventually closed. -+ -+ # There are no tags in the open tag counter. -+ assert all(v==0 for v in list(obj.open_tag_counter.values())) -+ -+ # The only tag in the tag stack is the one for the root -+ # document. -+ assert [obj.ROOT_TAG_NAME] == [x.name for x in obj.tagStack] -+ -+ assertSoupEquals = assert_soup -+ -+ def assertConnectedness(self, element): -+ """Ensure that next_element and previous_element are properly -+ set for all descendants of the given element. -+ """ -+ earlier = None -+ for e in element.descendants: -+ if earlier: -+ assert e == earlier.next_element -+ assert earlier == e.previous_element -+ earlier = e -+ -+ def linkage_validator(self, el, _recursive_call=False): -+ """Ensure proper linkage throughout the document.""" -+ descendant = None -+ # Document element should have no previous element or previous sibling. -+ # It also shouldn't have a next sibling. -+ if el.parent is None: -+ assert el.previous_element is None,\ -+ "Bad previous_element\nNODE: {}\nPREV: {}\nEXPECTED: {}".format( -+ el, el.previous_element, None -+ ) -+ assert el.previous_sibling is None,\ -+ "Bad previous_sibling\nNODE: {}\nPREV: {}\nEXPECTED: {}".format( -+ el, el.previous_sibling, None -+ ) -+ assert el.next_sibling is None,\ -+ "Bad next_sibling\nNODE: {}\nNEXT: {}\nEXPECTED: {}".format( -+ el, el.next_sibling, None -+ ) -+ -+ idx = 0 -+ child = None -+ last_child = None -+ last_idx = len(el.contents) - 1 -+ for child in el.contents: -+ descendant = None -+ -+ # Parent should link next element to their first child -+ # That child should have no previous sibling -+ if idx == 0: -+ if el.parent is not None: -+ assert el.next_element is child,\ -+ "Bad next_element\nNODE: {}\nNEXT: {}\nEXPECTED: {}".format( -+ el, el.next_element, child -+ ) -+ assert child.previous_element is el,\ -+ "Bad previous_element\nNODE: {}\nPREV: {}\nEXPECTED: {}".format( -+ child, child.previous_element, el -+ ) -+ assert child.previous_sibling is None,\ -+ "Bad previous_sibling\nNODE: {}\nPREV {}\nEXPECTED: {}".format( -+ child, child.previous_sibling, None -+ ) -+ -+ # If not the first child, previous index should link as sibling to this index -+ # Previous element should match the last index or the last bubbled up descendant -+ else: -+ assert child.previous_sibling is el.contents[idx - 1],\ -+ "Bad previous_sibling\nNODE: {}\nPREV {}\nEXPECTED {}".format( -+ child, child.previous_sibling, el.contents[idx - 1] -+ ) -+ assert el.contents[idx - 1].next_sibling is child,\ -+ "Bad next_sibling\nNODE: {}\nNEXT {}\nEXPECTED {}".format( -+ el.contents[idx - 1], el.contents[idx - 1].next_sibling, child -+ ) -+ -+ if last_child is not None: -+ assert child.previous_element is last_child,\ -+ "Bad previous_element\nNODE: {}\nPREV {}\nEXPECTED {}\nCONTENTS {}".format( -+ child, child.previous_element, last_child, child.parent.contents -+ ) -+ assert last_child.next_element is child,\ -+ "Bad next_element\nNODE: {}\nNEXT {}\nEXPECTED {}".format( -+ last_child, last_child.next_element, child -+ ) -+ -+ if isinstance(child, Tag) and child.contents: -+ descendant = self.linkage_validator(child, True) -+ # A bubbled up descendant should have no next siblings -+ assert descendant.next_sibling is None,\ -+ "Bad next_sibling\nNODE: {}\nNEXT {}\nEXPECTED {}".format( -+ descendant, descendant.next_sibling, None -+ ) -+ -+ # Mark last child as either the bubbled up descendant or the current child -+ if descendant is not None: -+ last_child = descendant -+ else: -+ last_child = child -+ -+ # If last child, there are non next siblings -+ if idx == last_idx: -+ assert child.next_sibling is None,\ -+ "Bad next_sibling\nNODE: {}\nNEXT {}\nEXPECTED {}".format( -+ child, child.next_sibling, None -+ ) -+ idx += 1 -+ -+ child = descendant if descendant is not None else child -+ if child is None: -+ child = el -+ -+ if not _recursive_call and child is not None: -+ target = el -+ while True: -+ if target is None: -+ assert child.next_element is None, \ -+ "Bad next_element\nNODE: {}\nNEXT {}\nEXPECTED {}".format( -+ child, child.next_element, None -+ ) -+ break -+ elif target.next_sibling is not None: -+ assert child.next_element is target.next_sibling, \ -+ "Bad next_element\nNODE: {}\nNEXT {}\nEXPECTED {}".format( -+ child, child.next_element, target.next_sibling -+ ) -+ break -+ target = target.parent -+ -+ # We are done, so nothing to return -+ return None -+ else: -+ # Return the child to the recursive caller -+ return child -+ -+ def assert_selects(self, tags, should_match): -+ """Make sure that the given tags have the correct text. -+ -+ This is used in tests that define a bunch of tags, each -+ containing a single string, and then select certain strings by -+ some mechanism. -+ """ -+ assert [tag.string for tag in tags] == should_match -+ -+ def assert_selects_ids(self, tags, should_match): -+ """Make sure that the given tags have the correct IDs. -+ -+ This is used in tests that define a bunch of tags, each -+ containing a single string, and then select certain strings by -+ some mechanism. -+ """ -+ assert [tag['id'] for tag in tags] == should_match -+ -+ -+class TreeBuilderSmokeTest(object): -+ # Tests that are common to HTML and XML tree builders. -+ -+ @pytest.mark.parametrize( -+ "multi_valued_attributes", -+ [None, dict(b=['class']), {'*': ['notclass']}] -+ ) -+ def test_attribute_not_multi_valued(self, multi_valued_attributes): -+ markup = '' -+ soup = self.soup(markup, multi_valued_attributes=multi_valued_attributes) -+ assert soup.a['class'] == 'a b c' -+ -+ @pytest.mark.parametrize( -+ "multi_valued_attributes", [dict(a=['class']), {'*': ['class']}] -+ ) -+ def test_attribute_multi_valued(self, multi_valued_attributes): -+ markup = '' -+ soup = self.soup( -+ markup, multi_valued_attributes=multi_valued_attributes -+ ) -+ assert soup.a['class'] == ['a', 'b', 'c'] -+ -+ def test_fuzzed_input(self): -+ # This test centralizes in one place the various fuzz tests -+ # for Beautiful Soup created by the oss-fuzz project. -+ -+ # These strings superficially resemble markup, but they -+ # generally can't be parsed into anything. The best we can -+ # hope for is that parsing these strings won't crash the -+ # parser. -+ # -+ # n.b. This markup is commented out because these fuzz tests -+ # _do_ crash the parser. However the crashes are due to bugs -+ # in html.parser, not Beautiful Soup -- otherwise I'd fix the -+ # bugs! -+ -+ bad_markup = [ -+ # https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28873 -+ # https://github.com/guidovranken/python-library-fuzzers/blob/master/corp-html/519e5b4269a01185a0d5e76295251921da2f0700 -+ # https://bugs.python.org/issue37747 -+ # -+ #b'\nSome CSS" -+ ) -+ assert isinstance(soup.style.string, Stylesheet) -+ assert isinstance(soup.script.string, Script) -+ -+ soup = self.soup( -+ "" -+ ) -+ assert isinstance(soup.style.string, Stylesheet) -+ # The contents of the style tag resemble an HTML comment, but -+ # it's not treated as a comment. -+ assert soup.style.string == "" -+ assert isinstance(soup.style.string, Stylesheet) -+ -+ def test_pickle_and_unpickle_identity(self): -+ # Pickling a tree, then unpickling it, yields a tree identical -+ # to the original. -+ tree = self.soup("foo") -+ dumped = pickle.dumps(tree, 2) -+ loaded = pickle.loads(dumped) -+ assert loaded.__class__ == BeautifulSoup -+ assert loaded.decode() == tree.decode() -+ -+ def assertDoctypeHandled(self, doctype_fragment): -+ """Assert that a given doctype string is handled correctly.""" -+ doctype_str, soup = self._document_with_doctype(doctype_fragment) -+ -+ # Make sure a Doctype object was created. -+ doctype = soup.contents[0] -+ assert doctype.__class__ == Doctype -+ assert doctype == doctype_fragment -+ assert soup.encode("utf8")[:len(doctype_str)] == doctype_str -+ -+ # Make sure that the doctype was correctly associated with the -+ # parse tree and that the rest of the document parsed. -+ assert soup.p.contents[0] == 'foo' -+ -+ def _document_with_doctype(self, doctype_fragment, doctype_string="DOCTYPE"): -+ """Generate and parse a document with the given doctype.""" -+ doctype = '' % (doctype_string, doctype_fragment) -+ markup = doctype + '\n

foo

' -+ soup = self.soup(markup) -+ return doctype.encode("utf8"), soup -+ -+ def test_normal_doctypes(self): -+ """Make sure normal, everyday HTML doctypes are handled correctly.""" -+ self.assertDoctypeHandled("html") -+ self.assertDoctypeHandled( -+ 'html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"') -+ -+ def test_empty_doctype(self): -+ soup = self.soup("") -+ doctype = soup.contents[0] -+ assert "" == doctype.strip() -+ -+ def test_mixed_case_doctype(self): -+ # A lowercase or mixed-case doctype becomes a Doctype. -+ for doctype_fragment in ("doctype", "DocType"): -+ doctype_str, soup = self._document_with_doctype( -+ "html", doctype_fragment -+ ) -+ -+ # Make sure a Doctype object was created and that the DOCTYPE -+ # is uppercase. -+ doctype = soup.contents[0] -+ assert doctype.__class__ == Doctype -+ assert doctype == "html" -+ assert soup.encode("utf8")[:len(doctype_str)] == b"" -+ -+ # Make sure that the doctype was correctly associated with the -+ # parse tree and that the rest of the document parsed. -+ assert soup.p.contents[0] == 'foo' -+ -+ def test_public_doctype_with_url(self): -+ doctype = 'html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"' -+ self.assertDoctypeHandled(doctype) -+ -+ def test_system_doctype(self): -+ self.assertDoctypeHandled('foo SYSTEM "http://www.example.com/"') -+ -+ def test_namespaced_system_doctype(self): -+ # We can handle a namespaced doctype with a system ID. -+ self.assertDoctypeHandled('xsl:stylesheet SYSTEM "htmlent.dtd"') -+ -+ def test_namespaced_public_doctype(self): -+ # Test a namespaced doctype with a public id. -+ self.assertDoctypeHandled('xsl:stylesheet PUBLIC "htmlent.dtd"') -+ -+ def test_real_xhtml_document(self): -+ """A real XHTML document should come out more or less the same as it went in.""" -+ markup = b""" -+ -+ -+Hello. -+Goodbye. -+""" -+ with warnings.catch_warnings(record=True) as w: -+ soup = self.soup(markup) -+ assert soup.encode("utf-8").replace(b"\n", b"") == markup.replace(b"\n", b"") -+ -+ # No warning was issued about parsing an XML document as HTML, -+ # because XHTML is both. -+ assert w == [] -+ -+ -+ def test_namespaced_html(self): -+ # When a namespaced XML document is parsed as HTML it should -+ # be treated as HTML with weird tag names. -+ markup = b"""content""" -+ with warnings.catch_warnings(record=True) as w: -+ soup = self.soup(markup) -+ -+ assert 2 == len(soup.find_all("ns1:foo")) -+ -+ # n.b. no "you're parsing XML as HTML" warning was given -+ # because there was no XML declaration. -+ assert [] == w -+ -+ def test_detect_xml_parsed_as_html(self): -+ # A warning is issued when parsing an XML document as HTML, -+ # but basic stuff should still work. -+ markup = b"""string""" -+ with warnings.catch_warnings(record=True) as w: -+ soup = self.soup(markup) -+ assert soup.tag.string == 'string' -+ [warning] = w -+ assert isinstance(warning.message, XMLParsedAsHTMLWarning) -+ assert str(warning.message) == XMLParsedAsHTMLWarning.MESSAGE -+ -+ # NOTE: the warning is not issued if the document appears to -+ # be XHTML (tested with test_real_xhtml_document in the -+ # superclass) or if there is no XML declaration (tested with -+ # test_namespaced_html in the superclass). -+ -+ def test_processing_instruction(self): -+ # We test both Unicode and bytestring to verify that -+ # process_markup correctly sets processing_instruction_class -+ # even when the markup is already Unicode and there is no -+ # need to process anything. -+ markup = """""" -+ soup = self.soup(markup) -+ assert markup == soup.decode() -+ -+ markup = b"""""" -+ soup = self.soup(markup) -+ assert markup == soup.encode("utf8") -+ -+ def test_deepcopy(self): -+ """Make sure you can copy the tree builder. -+ -+ This is important because the builder is part of a -+ BeautifulSoup object, and we want to be able to copy that. -+ """ -+ copy.deepcopy(self.default_builder) -+ -+ def test_p_tag_is_never_empty_element(self): -+ """A

tag is never designated as an empty-element tag. -+ -+ Even if the markup shows it as an empty-element tag, it -+ shouldn't be presented that way. -+ """ -+ soup = self.soup("

") -+ assert not soup.p.is_empty_element -+ assert str(soup.p) == "

" -+ -+ def test_unclosed_tags_get_closed(self): -+ """A tag that's not closed by the end of the document should be closed. -+ -+ This applies to all tags except empty-element tags. -+ """ -+ self.assert_soup("

", "

") -+ self.assert_soup("", "") -+ -+ self.assert_soup("
", "
") -+ -+ def test_br_is_always_empty_element_tag(self): -+ """A
tag is designated as an empty-element tag. -+ -+ Some parsers treat

as one
tag, some parsers as -+ two tags, but it should always be an empty-element tag. -+ """ -+ soup = self.soup("

") -+ assert soup.br.is_empty_element -+ assert str(soup.br) == "
" -+ -+ def test_nested_formatting_elements(self): -+ self.assert_soup("") -+ -+ def test_double_head(self): -+ html = ''' -+ -+ -+Ordinary HEAD element test -+ -+ -+ -+Hello, world! -+ -+ -+''' -+ soup = self.soup(html) -+ assert "text/javascript" == soup.find('script')['type'] -+ -+ def test_comment(self): -+ # Comments are represented as Comment objects. -+ markup = "

foobaz

" -+ self.assert_soup(markup) -+ -+ soup = self.soup(markup) -+ comment = soup.find(string="foobar") -+ assert comment.__class__ == Comment -+ -+ # The comment is properly integrated into the tree. -+ foo = soup.find(string="foo") -+ assert comment == foo.next_element -+ baz = soup.find(string="baz") -+ assert comment == baz.previous_element -+ -+ def test_preserved_whitespace_in_pre_and_textarea(self): -+ """Whitespace must be preserved in
 and "
-+        self.assert_soup(pre_markup)
-+        self.assert_soup(textarea_markup)
-+
-+        soup = self.soup(pre_markup)
-+        assert soup.pre.prettify() == pre_markup
-+
-+        soup = self.soup(textarea_markup)
-+        assert soup.textarea.prettify() == textarea_markup
-+
-+        soup = self.soup("")
-+        assert soup.textarea.prettify() == ""
-+
-+    def test_nested_inline_elements(self):
-+        """Inline elements can be nested indefinitely."""
-+        b_tag = "Inside a B tag"
-+        self.assert_soup(b_tag)
-+
-+        nested_b_tag = "

A nested tag

" -+ self.assert_soup(nested_b_tag) -+ -+ double_nested_b_tag = "

A doubly nested tag

" -+ self.assert_soup(nested_b_tag) -+ -+ def test_nested_block_level_elements(self): -+ """Block elements can be nested.""" -+ soup = self.soup('

Foo

') -+ blockquote = soup.blockquote -+ assert blockquote.p.b.string == 'Foo' -+ assert blockquote.b.string == 'Foo' -+ -+ def test_correctly_nested_tables(self): -+ """One table can go inside another one.""" -+ markup = ('' -+ '' -+ "') -+ -+ self.assert_soup( -+ markup, -+ '
Here's another table:" -+ '' -+ '' -+ '
foo
Here\'s another table:' -+ '
foo
' -+ '
') -+ -+ self.assert_soup( -+ "" -+ "" -+ "
Foo
Bar
Baz
") -+ -+ def test_multivalued_attribute_with_whitespace(self): -+ # Whitespace separating the values of a multi-valued attribute -+ # should be ignored. -+ -+ markup = '
' -+ soup = self.soup(markup) -+ assert ['foo', 'bar'] == soup.div['class'] -+ -+ # If you search by the literal name of the class it's like the whitespace -+ # wasn't there. -+ assert soup.div == soup.find('div', class_="foo bar") -+ -+ def test_deeply_nested_multivalued_attribute(self): -+ # html5lib can set the attributes of the same tag many times -+ # as it rearranges the tree. This has caused problems with -+ # multivalued attributes. -+ markup = '
' -+ soup = self.soup(markup) -+ assert ["css"] == soup.div.div['class'] -+ -+ def test_multivalued_attribute_on_html(self): -+ # html5lib uses a different API to set the attributes ot the -+ # tag. This has caused problems with multivalued -+ # attributes. -+ markup = '' -+ soup = self.soup(markup) -+ assert ["a", "b"] == soup.html['class'] -+ -+ def test_angle_brackets_in_attribute_values_are_escaped(self): -+ self.assert_soup('', '') -+ -+ def test_strings_resembling_character_entity_references(self): -+ # "&T" and "&p" look like incomplete character entities, but they are -+ # not. -+ self.assert_soup( -+ "

• AT&T is in the s&p 500

", -+ "

\u2022 AT&T is in the s&p 500

" -+ ) -+ -+ def test_apos_entity(self): -+ self.assert_soup( -+ "

Bob's Bar

", -+ "

Bob's Bar

", -+ ) -+ -+ def test_entities_in_foreign_document_encoding(self): -+ # “ and ” are invalid numeric entities referencing -+ # Windows-1252 characters. - references a character common -+ # to Windows-1252 and Unicode, and ☃ references a -+ # character only found in Unicode. -+ # -+ # All of these entities should be converted to Unicode -+ # characters. -+ markup = "

“Hello” -☃

" -+ soup = self.soup(markup) -+ assert "“Hello†-☃" == soup.p.string -+ -+ def test_entities_in_attributes_converted_to_unicode(self): -+ expect = '

' -+ self.assert_soup('

', expect) -+ self.assert_soup('

', expect) -+ self.assert_soup('

', expect) -+ self.assert_soup('

', expect) -+ -+ def test_entities_in_text_converted_to_unicode(self): -+ expect = '

pi\N{LATIN SMALL LETTER N WITH TILDE}ata

' -+ self.assert_soup("

piñata

", expect) -+ self.assert_soup("

piñata

", expect) -+ self.assert_soup("

piñata

", expect) -+ self.assert_soup("

piñata

", expect) -+ -+ def test_quot_entity_converted_to_quotation_mark(self): -+ self.assert_soup("

I said "good day!"

", -+ '

I said "good day!"

') -+ -+ def test_out_of_range_entity(self): -+ expect = "\N{REPLACEMENT CHARACTER}" -+ self.assert_soup("�", expect) -+ self.assert_soup("�", expect) -+ self.assert_soup("�", expect) -+ -+ def test_multipart_strings(self): -+ "Mostly to prevent a recurrence of a bug in the html5lib treebuilder." -+ soup = self.soup("

\nfoo

") -+ assert "p" == soup.h2.string.next_element.name -+ assert "p" == soup.p.name -+ self.assertConnectedness(soup) -+ -+ def test_empty_element_tags(self): -+ """Verify consistent handling of empty-element tags, -+ no matter how they come in through the markup. -+ """ -+ self.assert_soup('


', "


") -+ self.assert_soup('


', "


") -+ -+ def test_head_tag_between_head_and_body(self): -+ "Prevent recurrence of a bug in the html5lib treebuilder." -+ content = """ -+ -+ foo -+ -+""" -+ soup = self.soup(content) -+ assert soup.html.body is not None -+ self.assertConnectedness(soup) -+ -+ def test_multiple_copies_of_a_tag(self): -+ "Prevent recurrence of a bug in the html5lib treebuilder." -+ content = """ -+ -+ -+ -+ -+ -+""" -+ soup = self.soup(content) -+ self.assertConnectedness(soup.article) -+ -+ def test_basic_namespaces(self): -+ """Parsers don't need to *understand* namespaces, but at the -+ very least they should not choke on namespaces or lose -+ data.""" -+ -+ markup = b'4' -+ soup = self.soup(markup) -+ assert markup == soup.encode() -+ html = soup.html -+ assert 'http://www.w3.org/1999/xhtml' == soup.html['xmlns'] -+ assert 'http://www.w3.org/1998/Math/MathML' == soup.html['xmlns:mathml'] -+ assert 'http://www.w3.org/2000/svg' == soup.html['xmlns:svg'] -+ -+ def test_multivalued_attribute_value_becomes_list(self): -+ markup = b'' -+ soup = self.soup(markup) -+ assert ['foo', 'bar'] == soup.a['class'] -+ -+ # -+ # Generally speaking, tests below this point are more tests of -+ # Beautiful Soup than tests of the tree builders. But parsers are -+ # weird, so we run these tests separately for every tree builder -+ # to detect any differences between them. -+ # -+ -+ def test_can_parse_unicode_document(self): -+ # A seemingly innocuous document... but it's in Unicode! And -+ # it contains characters that can't be represented in the -+ # encoding found in the declaration! The horror! -+ markup = 'Sacr\N{LATIN SMALL LETTER E WITH ACUTE} bleu!' -+ soup = self.soup(markup) -+ assert 'Sacr\xe9 bleu!' == soup.body.string -+ -+ def test_soupstrainer(self): -+ """Parsers should be able to work with SoupStrainers.""" -+ strainer = SoupStrainer("b") -+ soup = self.soup("A bold statement", -+ parse_only=strainer) -+ assert soup.decode() == "bold" -+ -+ def test_single_quote_attribute_values_become_double_quotes(self): -+ self.assert_soup("", -+ '') -+ -+ def test_attribute_values_with_nested_quotes_are_left_alone(self): -+ text = """a""" -+ self.assert_soup(text) -+ -+ def test_attribute_values_with_double_nested_quotes_get_quoted(self): -+ text = """a""" -+ soup = self.soup(text) -+ soup.foo['attr'] = 'Brawls happen at "Bob\'s Bar"' -+ self.assert_soup( -+ soup.foo.decode(), -+ """a""") -+ -+ def test_ampersand_in_attribute_value_gets_escaped(self): -+ self.assert_soup('', -+ '') -+ -+ self.assert_soup( -+ 'foo', -+ 'foo') -+ -+ def test_escaped_ampersand_in_attribute_value_is_left_alone(self): -+ self.assert_soup('') -+ -+ def test_entities_in_strings_converted_during_parsing(self): -+ # Both XML and HTML entities are converted to Unicode characters -+ # during parsing. -+ text = "

<<sacré bleu!>>

" -+ expected = "

<<sacr\N{LATIN SMALL LETTER E WITH ACUTE} bleu!>>

" -+ self.assert_soup(text, expected) -+ -+ def test_smart_quotes_converted_on_the_way_in(self): -+ # Microsoft smart quotes are converted to Unicode characters during -+ # parsing. -+ quote = b"

\x91Foo\x92

" -+ soup = self.soup(quote) -+ assert soup.p.string == "\N{LEFT SINGLE QUOTATION MARK}Foo\N{RIGHT SINGLE QUOTATION MARK}" -+ -+ def test_non_breaking_spaces_converted_on_the_way_in(self): -+ soup = self.soup("  ") -+ assert soup.a.string == "\N{NO-BREAK SPACE}" * 2 -+ -+ def test_entities_converted_on_the_way_out(self): -+ text = "

<<sacré bleu!>>

" -+ expected = "

<<sacr\N{LATIN SMALL LETTER E WITH ACUTE} bleu!>>

".encode("utf-8") -+ soup = self.soup(text) -+ assert soup.p.encode("utf-8") == expected -+ -+ def test_real_iso_latin_document(self): -+ # Smoke test of interrelated functionality, using an -+ # easy-to-understand document. -+ -+ # Here it is in Unicode. Note that it claims to be in ISO-Latin-1. -+ unicode_html = '

Sacr\N{LATIN SMALL LETTER E WITH ACUTE} bleu!

' -+ -+ # That's because we're going to encode it into ISO-Latin-1, and use -+ # that to test. -+ iso_latin_html = unicode_html.encode("iso-8859-1") -+ -+ # Parse the ISO-Latin-1 HTML. -+ soup = self.soup(iso_latin_html) -+ # Encode it to UTF-8. -+ result = soup.encode("utf-8") -+ -+ # What do we expect the result to look like? Well, it would -+ # look like unicode_html, except that the META tag would say -+ # UTF-8 instead of ISO-Latin-1. -+ expected = unicode_html.replace("ISO-Latin-1", "utf-8") -+ -+ # And, of course, it would be in UTF-8, not Unicode. -+ expected = expected.encode("utf-8") -+ -+ # Ta-da! -+ assert result == expected -+ -+ def test_real_shift_jis_document(self): -+ # Smoke test to make sure the parser can handle a document in -+ # Shift-JIS encoding, without choking. -+ shift_jis_html = ( -+ b'
'
-+            b'\x82\xb1\x82\xea\x82\xcdShift-JIS\x82\xc5\x83R\x81[\x83f'
-+            b'\x83B\x83\x93\x83O\x82\xb3\x82\xea\x82\xbd\x93\xfa\x96{\x8c'
-+            b'\xea\x82\xcc\x83t\x83@\x83C\x83\x8b\x82\xc5\x82\xb7\x81B'
-+            b'
') -+ unicode_html = shift_jis_html.decode("shift-jis") -+ soup = self.soup(unicode_html) -+ -+ # Make sure the parse tree is correctly encoded to various -+ # encodings. -+ assert soup.encode("utf-8") == unicode_html.encode("utf-8") -+ assert soup.encode("euc_jp") == unicode_html.encode("euc_jp") -+ -+ def test_real_hebrew_document(self): -+ # A real-world test to make sure we can convert ISO-8859-9 (a -+ # Hebrew encoding) to UTF-8. -+ hebrew_document = b'Hebrew (ISO 8859-8) in Visual Directionality

Hebrew (ISO 8859-8) in Visual Directionality

\xed\xe5\xec\xf9' -+ soup = self.soup( -+ hebrew_document, from_encoding="iso8859-8") -+ # Some tree builders call it iso8859-8, others call it iso-8859-9. -+ # That's not a difference we really care about. -+ assert soup.original_encoding in ('iso8859-8', 'iso-8859-8') -+ assert soup.encode('utf-8') == ( -+ hebrew_document.decode("iso8859-8").encode("utf-8") -+ ) -+ -+ def test_meta_tag_reflects_current_encoding(self): -+ # Here's the tag saying that a document is -+ # encoded in Shift-JIS. -+ meta_tag = ('') -+ -+ # Here's a document incorporating that meta tag. -+ shift_jis_html = ( -+ '\n%s\n' -+ '' -+ 'Shift-JIS markup goes here.') % meta_tag -+ soup = self.soup(shift_jis_html) -+ -+ # Parse the document, and the charset is seemingly unaffected. -+ parsed_meta = soup.find('meta', {'http-equiv': 'Content-type'}) -+ content = parsed_meta['content'] -+ assert 'text/html; charset=x-sjis' == content -+ -+ # But that value is actually a ContentMetaAttributeValue object. -+ assert isinstance(content, ContentMetaAttributeValue) -+ -+ # And it will take on a value that reflects its current -+ # encoding. -+ assert 'text/html; charset=utf8' == content.encode("utf8") -+ -+ # For the rest of the story, see TestSubstitutions in -+ # test_tree.py. -+ -+ def test_html5_style_meta_tag_reflects_current_encoding(self): -+ # Here's the tag saying that a document is -+ # encoded in Shift-JIS. -+ meta_tag = ('') -+ -+ # Here's a document incorporating that meta tag. -+ shift_jis_html = ( -+ '\n%s\n' -+ '' -+ 'Shift-JIS markup goes here.') % meta_tag -+ soup = self.soup(shift_jis_html) -+ -+ # Parse the document, and the charset is seemingly unaffected. -+ parsed_meta = soup.find('meta', id="encoding") -+ charset = parsed_meta['charset'] -+ assert 'x-sjis' == charset -+ -+ # But that value is actually a CharsetMetaAttributeValue object. -+ assert isinstance(charset, CharsetMetaAttributeValue) -+ -+ # And it will take on a value that reflects its current -+ # encoding. -+ assert 'utf8' == charset.encode("utf8") -+ -+ def test_python_specific_encodings_not_used_in_charset(self): -+ # You can encode an HTML document using a Python-specific -+ # encoding, but that encoding won't be mentioned _inside_ the -+ # resulting document. Instead, the document will appear to -+ # have no encoding. -+ for markup in [ -+ b'' -+ b'' -+ ]: -+ soup = self.soup(markup) -+ for encoding in PYTHON_SPECIFIC_ENCODINGS: -+ if encoding in ( -+ 'idna', 'mbcs', 'oem', 'undefined', -+ 'string_escape', 'string-escape' -+ ): -+ # For one reason or another, these will raise an -+ # exception if we actually try to use them, so don't -+ # bother. -+ continue -+ encoded = soup.encode(encoding) -+ assert b'meta charset=""' in encoded -+ assert encoding.encode("ascii") not in encoded -+ -+ def test_tag_with_no_attributes_can_have_attributes_added(self): -+ data = self.soup("text") -+ data.a['foo'] = 'bar' -+ assert 'text' == data.a.decode() -+ -+ def test_closing_tag_with_no_opening_tag(self): -+ # Without BeautifulSoup.open_tag_counter, the tag will -+ # cause _popToTag to be called over and over again as we look -+ # for a tag that wasn't there. The result is that 'text2' -+ # will show up outside the body of the document. -+ soup = self.soup("

text1

text2
") -+ assert "

text1

text2
" == soup.body.decode() -+ -+ def test_worst_case(self): -+ """Test the worst case (currently) for linking issues.""" -+ -+ soup = self.soup(BAD_DOCUMENT) -+ self.linkage_validator(soup) -+ -+ -+class XMLTreeBuilderSmokeTest(TreeBuilderSmokeTest): -+ -+ def test_pickle_and_unpickle_identity(self): -+ # Pickling a tree, then unpickling it, yields a tree identical -+ # to the original. -+ tree = self.soup("foo") -+ dumped = pickle.dumps(tree, 2) -+ loaded = pickle.loads(dumped) -+ assert loaded.__class__ == BeautifulSoup -+ assert loaded.decode() == tree.decode() -+ -+ def test_docstring_generated(self): -+ soup = self.soup("") -+ assert soup.encode() == b'\n' -+ -+ def test_xml_declaration(self): -+ markup = b"""\n""" -+ soup = self.soup(markup) -+ assert markup == soup.encode("utf8") -+ -+ def test_python_specific_encodings_not_used_in_xml_declaration(self): -+ # You can encode an XML document using a Python-specific -+ # encoding, but that encoding won't be mentioned _inside_ the -+ # resulting document. -+ markup = b"""\n""" -+ soup = self.soup(markup) -+ for encoding in PYTHON_SPECIFIC_ENCODINGS: -+ if encoding in ( -+ 'idna', 'mbcs', 'oem', 'undefined', -+ 'string_escape', 'string-escape' -+ ): -+ # For one reason or another, these will raise an -+ # exception if we actually try to use them, so don't -+ # bother. -+ continue -+ encoded = soup.encode(encoding) -+ assert b'' in encoded -+ assert encoding.encode("ascii") not in encoded -+ -+ def test_processing_instruction(self): -+ markup = b"""\n""" -+ soup = self.soup(markup) -+ assert markup == soup.encode("utf8") -+ -+ def test_real_xhtml_document(self): -+ """A real XHTML document should come out *exactly* the same as it went in.""" -+ markup = b""" -+ -+ -+Hello. -+Goodbye. -+""" -+ soup = self.soup(markup) -+ assert soup.encode("utf-8") == markup -+ -+ def test_nested_namespaces(self): -+ doc = b""" -+ -+ -+ -+ -+ -+""" -+ soup = self.soup(doc) -+ assert doc == soup.encode() -+ -+ def test_formatter_processes_script_tag_for_xml_documents(self): -+ doc = """ -+ -+""" -+ soup = BeautifulSoup(doc, "lxml-xml") -+ # lxml would have stripped this while parsing, but we can add -+ # it later. -+ soup.script.string = 'console.log("< < hey > > ");' -+ encoded = soup.encode() -+ assert b"< < hey > >" in encoded -+ -+ def test_can_parse_unicode_document(self): -+ markup = 'Sacr\N{LATIN SMALL LETTER E WITH ACUTE} bleu!' -+ soup = self.soup(markup) -+ assert 'Sacr\xe9 bleu!' == soup.root.string -+ -+ def test_can_parse_unicode_document_begining_with_bom(self): -+ markup = '\N{BYTE ORDER MARK}Sacr\N{LATIN SMALL LETTER E WITH ACUTE} bleu!' -+ soup = self.soup(markup) -+ assert 'Sacr\xe9 bleu!' == soup.root.string -+ -+ def test_popping_namespaced_tag(self): -+ markup = 'b2012-07-02T20:33:42Zcd' -+ soup = self.soup(markup) -+ assert str(soup.rss) == markup -+ -+ def test_docstring_includes_correct_encoding(self): -+ soup = self.soup("") -+ assert soup.encode("latin1") == b'\n' -+ -+ def test_large_xml_document(self): -+ """A large XML document should come out the same as it went in.""" -+ markup = (b'\n' -+ + b'0' * (2**12) -+ + b'') -+ soup = self.soup(markup) -+ assert soup.encode("utf-8") == markup -+ -+ def test_tags_are_empty_element_if_and_only_if_they_are_empty(self): -+ self.assert_soup("

", "

") -+ self.assert_soup("

foo

") -+ -+ def test_namespaces_are_preserved(self): -+ markup = 'This tag is in the a namespaceThis tag is in the b namespace' -+ soup = self.soup(markup) -+ root = soup.root -+ assert "http://example.com/" == root['xmlns:a'] -+ assert "http://example.net/" == root['xmlns:b'] -+ -+ def test_closing_namespaced_tag(self): -+ markup = '

20010504

' -+ soup = self.soup(markup) -+ assert str(soup.p) == markup -+ -+ def test_namespaced_attributes(self): -+ markup = '' -+ soup = self.soup(markup) -+ assert str(soup.foo) == markup -+ -+ def test_namespaced_attributes_xml_namespace(self): -+ markup = 'bar' -+ soup = self.soup(markup) -+ assert str(soup.foo) == markup -+ -+ def test_find_by_prefixed_name(self): -+ doc = """ -+foo -+ bar -+ baz -+ -+""" -+ soup = self.soup(doc) -+ -+ # There are three tags. -+ assert 3 == len(soup.find_all('tag')) -+ -+ # But two of them are ns1:tag and one of them is ns2:tag. -+ assert 2 == len(soup.find_all('ns1:tag')) -+ assert 1 == len(soup.find_all('ns2:tag')) -+ -+ assert 1, len(soup.find_all('ns2:tag', key='value')) -+ assert 3, len(soup.find_all(['ns1:tag', 'ns2:tag'])) -+ -+ def test_copy_tag_preserves_namespace(self): -+ xml = """ -+""" -+ -+ soup = self.soup(xml) -+ tag = soup.document -+ duplicate = copy.copy(tag) -+ -+ # The two tags have the same namespace prefix. -+ assert tag.prefix == duplicate.prefix -+ -+ def test_worst_case(self): -+ """Test the worst case (currently) for linking issues.""" -+ -+ soup = self.soup(BAD_DOCUMENT) -+ self.linkage_validator(soup) -+ -+ -+class HTML5TreeBuilderSmokeTest(HTMLTreeBuilderSmokeTest): -+ """Smoke test for a tree builder that supports HTML5.""" -+ -+ def test_real_xhtml_document(self): -+ # Since XHTML is not HTML5, HTML5 parsers are not tested to handle -+ # XHTML documents in any particular way. -+ pass -+ -+ def test_html_tags_have_namespace(self): -+ markup = "" -+ soup = self.soup(markup) -+ assert "http://www.w3.org/1999/xhtml" == soup.a.namespace -+ -+ def test_svg_tags_have_namespace(self): -+ markup = '' -+ soup = self.soup(markup) -+ namespace = "http://www.w3.org/2000/svg" -+ assert namespace == soup.svg.namespace -+ assert namespace == soup.circle.namespace -+ -+ -+ def test_mathml_tags_have_namespace(self): -+ markup = '5' -+ soup = self.soup(markup) -+ namespace = 'http://www.w3.org/1998/Math/MathML' -+ assert namespace == soup.math.namespace -+ assert namespace == soup.msqrt.namespace -+ -+ def test_xml_declaration_becomes_comment(self): -+ markup = '' -+ soup = self.soup(markup) -+ assert isinstance(soup.contents[0], Comment) -+ assert soup.contents[0] == '?xml version="1.0" encoding="utf-8"?' -+ assert "html" == soup.contents[0].next_element.name -+ -+def skipIf(condition, reason): -+ def nothing(test, *args, **kwargs): -+ return None -+ -+ def decorator(test_item): -+ if condition: -+ return nothing -+ else: -+ return test_item -+ -+ return decorator -diff --git a/src/3rdparty/chromium/third_party/catapult/third_party/beautifulsoup4/bs4/tests/test_builder.py b/src/3rdparty/chromium/third_party/catapult/third_party/beautifulsoup4/bs4/tests/test_builder.py -new file mode 100644 -index 000000000..75370712a ---- /dev/null -+++ b/src/3rdparty/chromium/third_party/catapult/third_party/beautifulsoup4/bs4/tests/test_builder.py -@@ -0,0 +1,29 @@ -+import pytest -+from unittest.mock import patch -+from bs4.builder import DetectsXMLParsedAsHTML -+ -+class TestDetectsXMLParsedAsHTML(object): -+ -+ @pytest.mark.parametrize( -+ "markup,looks_like_xml", -+ [("No xml declaration", False), -+ ("obviously HTMLActually XHTML", False), -+ (" < html>Tricky XHTML", False), -+ ("", True), -+ ] -+ ) -+ def test_warn_if_markup_looks_like_xml(self, markup, looks_like_xml): -+ # Test of our ability to guess at whether markup looks XML-ish -+ # _and_ not HTML-ish. -+ with patch('bs4.builder.DetectsXMLParsedAsHTML._warn') as mock: -+ for data in markup, markup.encode('utf8'): -+ result = DetectsXMLParsedAsHTML.warn_if_markup_looks_like_xml( -+ data -+ ) -+ assert result == looks_like_xml -+ if looks_like_xml: -+ assert mock.called -+ else: -+ assert not mock.called -+ mock.reset_mock() -diff --git a/src/3rdparty/chromium/third_party/catapult/third_party/beautifulsoup4/bs4/tests/test_builder_registry.py b/src/3rdparty/chromium/third_party/catapult/third_party/beautifulsoup4/bs4/tests/test_builder_registry.py -index 92ad10fb0..5fa874c80 100644 ---- a/src/3rdparty/chromium/third_party/catapult/third_party/beautifulsoup4/bs4/tests/test_builder_registry.py -+++ b/src/3rdparty/chromium/third_party/catapult/third_party/beautifulsoup4/bs4/tests/test_builder_registry.py -@@ -1,6 +1,7 @@ - """Tests of the builder registry.""" - --import unittest -+import pytest -+import warnings - - from bs4 import BeautifulSoup - from bs4.builder import ( -@@ -25,62 +26,58 @@ except ImportError: - LXML_PRESENT = False - - --class BuiltInRegistryTest(unittest.TestCase): -+class TestBuiltInRegistry(object): - """Test the built-in registry with the default builders registered.""" - - def test_combination(self): -+ assert registry.lookup('strict', 'html') == HTMLParserTreeBuilder - if LXML_PRESENT: -- self.assertEqual(registry.lookup('fast', 'html'), -- LXMLTreeBuilder) -- -- if LXML_PRESENT: -- self.assertEqual(registry.lookup('permissive', 'xml'), -- LXMLTreeBuilderForXML) -- self.assertEqual(registry.lookup('strict', 'html'), -- HTMLParserTreeBuilder) -+ assert registry.lookup('fast', 'html') == LXMLTreeBuilder -+ assert registry.lookup('permissive', 'xml') == LXMLTreeBuilderForXML - if HTML5LIB_PRESENT: -- self.assertEqual(registry.lookup('html5lib', 'html'), -- HTML5TreeBuilder) -+ assert registry.lookup('html5lib', 'html') == HTML5TreeBuilder - - def test_lookup_by_markup_type(self): - if LXML_PRESENT: -- self.assertEqual(registry.lookup('html'), LXMLTreeBuilder) -- self.assertEqual(registry.lookup('xml'), LXMLTreeBuilderForXML) -+ assert registry.lookup('html') == LXMLTreeBuilder -+ assert registry.lookup('xml') == LXMLTreeBuilderForXML - else: -- self.assertEqual(registry.lookup('xml'), None) -+ assert registry.lookup('xml') == None - if HTML5LIB_PRESENT: -- self.assertEqual(registry.lookup('html'), HTML5TreeBuilder) -+ assert registry.lookup('html') == HTML5TreeBuilder - else: -- self.assertEqual(registry.lookup('html'), HTMLParserTreeBuilder) -+ assert registry.lookup('html') == HTMLParserTreeBuilder - - def test_named_library(self): - if LXML_PRESENT: -- self.assertEqual(registry.lookup('lxml', 'xml'), -- LXMLTreeBuilderForXML) -- self.assertEqual(registry.lookup('lxml', 'html'), -- LXMLTreeBuilder) -+ assert registry.lookup('lxml', 'xml') == LXMLTreeBuilderForXML -+ assert registry.lookup('lxml', 'html') == LXMLTreeBuilder - if HTML5LIB_PRESENT: -- self.assertEqual(registry.lookup('html5lib'), -- HTML5TreeBuilder) -+ assert registry.lookup('html5lib') == HTML5TreeBuilder - -- self.assertEqual(registry.lookup('html.parser'), -- HTMLParserTreeBuilder) -+ assert registry.lookup('html.parser') == HTMLParserTreeBuilder - - def test_beautifulsoup_constructor_does_lookup(self): -- # You can pass in a string. -- BeautifulSoup("", features="html") -- # Or a list of strings. -- BeautifulSoup("", features=["html", "fast"]) - -+ with warnings.catch_warnings(record=True) as w: -+ # This will create a warning about not explicitly -+ # specifying a parser, but we'll ignore it. -+ -+ # You can pass in a string. -+ BeautifulSoup("", features="html") -+ # Or a list of strings. -+ BeautifulSoup("", features=["html", "fast"]) -+ pass -+ - # You'll get an exception if BS can't find an appropriate - # builder. -- self.assertRaises(ValueError, BeautifulSoup, -- "", features="no-such-feature") -+ with pytest.raises(ValueError): -+ BeautifulSoup("", features="no-such-feature") - --class RegistryTest(unittest.TestCase): -+class TestRegistry(object): - """Test the TreeBuilderRegistry class in general.""" - -- def setUp(self): -+ def setup_method(self): - self.registry = TreeBuilderRegistry() - - def builder_for_features(self, *feature_list): -@@ -95,28 +92,28 @@ class RegistryTest(unittest.TestCase): - - # Since the builder advertises no features, you can't find it - # by looking up features. -- self.assertEqual(self.registry.lookup('foo'), None) -+ assert self.registry.lookup('foo') is None - - # But you can find it by doing a lookup with no features, if - # this happens to be the only registered builder. -- self.assertEqual(self.registry.lookup(), builder) -+ assert self.registry.lookup() == builder - - def test_register_with_features_makes_lookup_succeed(self): - builder = self.builder_for_features('foo', 'bar') -- self.assertEqual(self.registry.lookup('foo'), builder) -- self.assertEqual(self.registry.lookup('bar'), builder) -+ assert self.registry.lookup('foo') is builder -+ assert self.registry.lookup('bar') is builder - - def test_lookup_fails_when_no_builder_implements_feature(self): - builder = self.builder_for_features('foo', 'bar') -- self.assertEqual(self.registry.lookup('baz'), None) -+ assert self.registry.lookup('baz') is None - - def test_lookup_gets_most_recent_registration_when_no_feature_specified(self): - builder1 = self.builder_for_features('foo') - builder2 = self.builder_for_features('bar') -- self.assertEqual(self.registry.lookup(), builder2) -+ assert self.registry.lookup() == builder2 - - def test_lookup_fails_when_no_tree_builders_registered(self): -- self.assertEqual(self.registry.lookup(), None) -+ assert self.registry.lookup() is None - - def test_lookup_gets_most_recent_builder_supporting_all_features(self): - has_one = self.builder_for_features('foo') -@@ -128,14 +125,12 @@ class RegistryTest(unittest.TestCase): - - # There are two builders featuring 'foo' and 'bar', but - # the one that also features 'quux' was registered later. -- self.assertEqual(self.registry.lookup('foo', 'bar'), -- has_both_late) -+ assert self.registry.lookup('foo', 'bar') == has_both_late - - # There is only one builder featuring 'foo', 'bar', and 'baz'. -- self.assertEqual(self.registry.lookup('foo', 'bar', 'baz'), -- has_both_early) -+ assert self.registry.lookup('foo', 'bar', 'baz') == has_both_early - - def test_lookup_fails_when_cannot_reconcile_requested_features(self): - builder1 = self.builder_for_features('foo', 'bar') - builder2 = self.builder_for_features('foo', 'baz') -- self.assertEqual(self.registry.lookup('bar', 'baz'), None) -+ assert self.registry.lookup('bar', 'baz') is None -diff --git a/src/3rdparty/chromium/third_party/catapult/third_party/beautifulsoup4/bs4/tests/test_dammit.py b/src/3rdparty/chromium/third_party/catapult/third_party/beautifulsoup4/bs4/tests/test_dammit.py -new file mode 100644 -index 000000000..9971234e3 ---- /dev/null -+++ b/src/3rdparty/chromium/third_party/catapult/third_party/beautifulsoup4/bs4/tests/test_dammit.py -@@ -0,0 +1,371 @@ -+# encoding: utf-8 -+import pytest -+import logging -+import bs4 -+from bs4 import BeautifulSoup -+from bs4.dammit import ( -+ EntitySubstitution, -+ EncodingDetector, -+ UnicodeDammit, -+) -+ -+class TestUnicodeDammit(object): -+ """Standalone tests of UnicodeDammit.""" -+ -+ def test_unicode_input(self): -+ markup = "I'm already Unicode! \N{SNOWMAN}" -+ dammit = UnicodeDammit(markup) -+ assert dammit.unicode_markup == markup -+ -+ def test_smart_quotes_to_unicode(self): -+ markup = b"\x91\x92\x93\x94" -+ dammit = UnicodeDammit(markup) -+ assert dammit.unicode_markup == "\u2018\u2019\u201c\u201d" -+ -+ def test_smart_quotes_to_xml_entities(self): -+ markup = b"\x91\x92\x93\x94" -+ dammit = UnicodeDammit(markup, smart_quotes_to="xml") -+ assert dammit.unicode_markup == "‘’“”" -+ -+ def test_smart_quotes_to_html_entities(self): -+ markup = b"\x91\x92\x93\x94" -+ dammit = UnicodeDammit(markup, smart_quotes_to="html") -+ assert dammit.unicode_markup == "‘’“”" -+ -+ def test_smart_quotes_to_ascii(self): -+ markup = b"\x91\x92\x93\x94" -+ dammit = UnicodeDammit(markup, smart_quotes_to="ascii") -+ assert dammit.unicode_markup == """''""""" -+ -+ def test_detect_utf8(self): -+ utf8 = b"Sacr\xc3\xa9 bleu! \xe2\x98\x83" -+ dammit = UnicodeDammit(utf8) -+ assert dammit.original_encoding.lower() == 'utf-8' -+ assert dammit.unicode_markup == 'Sacr\xe9 bleu! \N{SNOWMAN}' -+ -+ def test_convert_hebrew(self): -+ hebrew = b"\xed\xe5\xec\xf9" -+ dammit = UnicodeDammit(hebrew, ["iso-8859-8"]) -+ assert dammit.original_encoding.lower() == 'iso-8859-8' -+ assert dammit.unicode_markup == '\u05dd\u05d5\u05dc\u05e9' -+ -+ def test_dont_see_smart_quotes_where_there_are_none(self): -+ utf_8 = b"\343\202\261\343\203\274\343\202\277\343\202\244 Watch" -+ dammit = UnicodeDammit(utf_8) -+ assert dammit.original_encoding.lower() == 'utf-8' -+ assert dammit.unicode_markup.encode("utf-8") == utf_8 -+ -+ def test_ignore_inappropriate_codecs(self): -+ utf8_data = "RäksmörgÃ¥s".encode("utf-8") -+ dammit = UnicodeDammit(utf8_data, ["iso-8859-8"]) -+ assert dammit.original_encoding.lower() == 'utf-8' -+ -+ def test_ignore_invalid_codecs(self): -+ utf8_data = "RäksmörgÃ¥s".encode("utf-8") -+ for bad_encoding in ['.utf8', '...', 'utF---16.!']: -+ dammit = UnicodeDammit(utf8_data, [bad_encoding]) -+ assert dammit.original_encoding.lower() == 'utf-8' -+ -+ def test_exclude_encodings(self): -+ # This is UTF-8. -+ utf8_data = "RäksmörgÃ¥s".encode("utf-8") -+ -+ # But if we exclude UTF-8 from consideration, the guess is -+ # Windows-1252. -+ dammit = UnicodeDammit(utf8_data, exclude_encodings=["utf-8"]) -+ assert dammit.original_encoding.lower() == 'windows-1252' -+ -+ # And if we exclude that, there is no valid guess at all. -+ dammit = UnicodeDammit( -+ utf8_data, exclude_encodings=["utf-8", "windows-1252"]) -+ assert dammit.original_encoding == None -+ -+class TestEncodingDetector(object): -+ -+ def test_encoding_detector_replaces_junk_in_encoding_name_with_replacement_character(self): -+ detected = EncodingDetector( -+ b'') -+ encodings = list(detected.encodings) -+ assert 'utf-\N{REPLACEMENT CHARACTER}' in encodings -+ -+ def test_detect_html5_style_meta_tag(self): -+ -+ for data in ( -+ b'', -+ b"", -+ b"", -+ b""): -+ dammit = UnicodeDammit(data, is_html=True) -+ assert "euc-jp" == dammit.original_encoding -+ -+ def test_last_ditch_entity_replacement(self): -+ # This is a UTF-8 document that contains bytestrings -+ # completely incompatible with UTF-8 (ie. encoded with some other -+ # encoding). -+ # -+ # Since there is no consistent encoding for the document, -+ # Unicode, Dammit will eventually encode the document as UTF-8 -+ # and encode the incompatible characters as REPLACEMENT -+ # CHARACTER. -+ # -+ # If chardet is installed, it will detect that the document -+ # can be converted into ISO-8859-1 without errors. This happens -+ # to be the wrong encoding, but it is a consistent encoding, so the -+ # code we're testing here won't run. -+ # -+ # So we temporarily disable chardet if it's present. -+ doc = b"""\357\273\277 -+\330\250\330\252\330\261 -+\310\322\321\220\312\321\355\344""" -+ chardet = bs4.dammit.chardet_dammit -+ logging.disable(logging.WARNING) -+ try: -+ def noop(str): -+ return None -+ bs4.dammit.chardet_dammit = noop -+ dammit = UnicodeDammit(doc) -+ assert True == dammit.contains_replacement_characters -+ assert "\ufffd" in dammit.unicode_markup -+ -+ soup = BeautifulSoup(doc, "html.parser") -+ assert soup.contains_replacement_characters -+ finally: -+ logging.disable(logging.NOTSET) -+ bs4.dammit.chardet_dammit = chardet -+ -+ def test_byte_order_mark_removed(self): -+ # A document written in UTF-16LE will have its byte order marker stripped. -+ data = b'\xff\xfe<\x00a\x00>\x00\xe1\x00\xe9\x00<\x00/\x00a\x00>\x00' -+ dammit = UnicodeDammit(data) -+ assert "áé" == dammit.unicode_markup -+ assert "utf-16le" == dammit.original_encoding -+ -+ def test_known_definite_versus_user_encodings(self): -+ # The known_definite_encodings are used before sniffing the -+ # byte-order mark; the user_encodings are used afterwards. -+ -+ # Here's a document in UTF-16LE. -+ data = b'\xff\xfe<\x00a\x00>\x00\xe1\x00\xe9\x00<\x00/\x00a\x00>\x00' -+ dammit = UnicodeDammit(data) -+ -+ # We can process it as UTF-16 by passing it in as a known -+ # definite encoding. -+ before = UnicodeDammit(data, known_definite_encodings=["utf-16"]) -+ assert "utf-16" == before.original_encoding -+ -+ # If we pass UTF-18 as a user encoding, it's not even -+ # tried--the encoding sniffed from the byte-order mark takes -+ # precedence. -+ after = UnicodeDammit(data, user_encodings=["utf-8"]) -+ assert "utf-16le" == after.original_encoding -+ assert ["utf-16le"] == [x[0] for x in dammit.tried_encodings] -+ -+ # Here's a document in ISO-8859-8. -+ hebrew = b"\xed\xe5\xec\xf9" -+ dammit = UnicodeDammit(hebrew, known_definite_encodings=["utf-8"], -+ user_encodings=["iso-8859-8"]) -+ -+ # The known_definite_encodings don't work, BOM sniffing does -+ # nothing (it only works for a few UTF encodings), but one of -+ # the user_encodings does work. -+ assert "iso-8859-8" == dammit.original_encoding -+ assert ["utf-8", "iso-8859-8"] == [x[0] for x in dammit.tried_encodings] -+ -+ def test_deprecated_override_encodings(self): -+ # override_encodings is a deprecated alias for -+ # known_definite_encodings. -+ hebrew = b"\xed\xe5\xec\xf9" -+ dammit = UnicodeDammit( -+ hebrew, -+ known_definite_encodings=["shift-jis"], -+ override_encodings=["utf-8"], -+ user_encodings=["iso-8859-8"], -+ ) -+ assert "iso-8859-8" == dammit.original_encoding -+ -+ # known_definite_encodings and override_encodings were tried -+ # before user_encodings. -+ assert ["shift-jis", "utf-8", "iso-8859-8"] == ( -+ [x[0] for x in dammit.tried_encodings] -+ ) -+ -+ def test_detwingle(self): -+ # Here's a UTF8 document. -+ utf8 = ("\N{SNOWMAN}" * 3).encode("utf8") -+ -+ # Here's a Windows-1252 document. -+ windows_1252 = ( -+ "\N{LEFT DOUBLE QUOTATION MARK}Hi, I like Windows!" -+ "\N{RIGHT DOUBLE QUOTATION MARK}").encode("windows_1252") -+ -+ # Through some unholy alchemy, they've been stuck together. -+ doc = utf8 + windows_1252 + utf8 -+ -+ # The document can't be turned into UTF-8: -+ with pytest.raises(UnicodeDecodeError): -+ doc.decode("utf8") -+ -+ # Unicode, Dammit thinks the whole document is Windows-1252, -+ # and decodes it into "☃☃☃“Hi, I like Windows!â€Ã¢ËœÆ’☃☃" -+ -+ # But if we run it through fix_embedded_windows_1252, it's fixed: -+ fixed = UnicodeDammit.detwingle(doc) -+ assert "☃☃☃“Hi, I like Windows!â€â˜ƒâ˜ƒâ˜ƒ" == fixed.decode("utf8") -+ -+ def test_detwingle_ignores_multibyte_characters(self): -+ # Each of these characters has a UTF-8 representation ending -+ # in \x93. \x93 is a smart quote if interpreted as -+ # Windows-1252. But our code knows to skip over multibyte -+ # UTF-8 characters, so they'll survive the process unscathed. -+ for tricky_unicode_char in ( -+ "\N{LATIN SMALL LIGATURE OE}", # 2-byte char '\xc5\x93' -+ "\N{LATIN SUBSCRIPT SMALL LETTER X}", # 3-byte char '\xe2\x82\x93' -+ "\xf0\x90\x90\x93", # This is a CJK character, not sure which one. -+ ): -+ input = tricky_unicode_char.encode("utf8") -+ assert input.endswith(b'\x93') -+ output = UnicodeDammit.detwingle(input) -+ assert output == input -+ -+ def test_find_declared_encoding(self): -+ # Test our ability to find a declared encoding inside an -+ # XML or HTML document. -+ # -+ # Even if the document comes in as Unicode, it may be -+ # interesting to know what encoding was claimed -+ # originally. -+ -+ html_unicode = '' -+ html_bytes = html_unicode.encode("ascii") -+ -+ xml_unicode= '' -+ xml_bytes = xml_unicode.encode("ascii") -+ -+ m = EncodingDetector.find_declared_encoding -+ assert m(html_unicode, is_html=False) is None -+ assert "utf-8" == m(html_unicode, is_html=True) -+ assert "utf-8" == m(html_bytes, is_html=True) -+ -+ assert "iso-8859-1" == m(xml_unicode) -+ assert "iso-8859-1" == m(xml_bytes) -+ -+ # Normally, only the first few kilobytes of a document are checked for -+ # an encoding. -+ spacer = b' ' * 5000 -+ assert m(spacer + html_bytes) is None -+ assert m(spacer + xml_bytes) is None -+ -+ # But you can tell find_declared_encoding to search an entire -+ # HTML document. -+ assert ( -+ m(spacer + html_bytes, is_html=True, search_entire_document=True) -+ == "utf-8" -+ ) -+ -+ # The XML encoding declaration has to be the very first thing -+ # in the document. We'll allow whitespace before the document -+ # starts, but nothing else. -+ assert m(xml_bytes, search_entire_document=True) == "iso-8859-1" -+ assert m(b' ' + xml_bytes, search_entire_document=True) == "iso-8859-1" -+ assert m(b'a' + xml_bytes, search_entire_document=True) is None -+ -+ -+class TestEntitySubstitution(object): -+ """Standalone tests of the EntitySubstitution class.""" -+ def setup_method(self): -+ self.sub = EntitySubstitution -+ -+ def test_simple_html_substitution(self): -+ # Unicode characters corresponding to named HTML entites -+ # are substituted, and no others. -+ s = "foo\u2200\N{SNOWMAN}\u00f5bar" -+ assert self.sub.substitute_html(s) == "foo∀\N{SNOWMAN}õbar" -+ -+ def test_smart_quote_substitution(self): -+ # MS smart quotes are a common source of frustration, so we -+ # give them a special test. -+ quotes = b"\x91\x92foo\x93\x94" -+ dammit = UnicodeDammit(quotes) -+ assert self.sub.substitute_html(dammit.markup) == "‘’foo“”" -+ -+ def test_html5_entity(self): -+ # Some HTML5 entities correspond to single- or multi-character -+ # Unicode sequences. -+ -+ for entity, u in ( -+ # A few spot checks of our ability to recognize -+ # special character sequences and convert them -+ # to named entities. -+ ('⊧', '\u22a7'), -+ ('𝔑', '\U0001d511'), -+ ('≧̸', '\u2267\u0338'), -+ ('¬', '\xac'), -+ ('⫬', '\u2aec'), -+ -+ # We _could_ convert | to &verbarr;, but we don't, because -+ # | is an ASCII character. -+ ('|' '|'), -+ -+ # Similarly for the fj ligature, which we could convert to -+ # fj, but we don't. -+ ("fj", "fj"), -+ -+ # We do convert _these_ ASCII characters to HTML entities, -+ # because that's required to generate valid HTML. -+ ('>', '>'), -+ ('<', '<'), -+ ('&', '&'), -+ ): -+ template = '3 %s 4' -+ raw = template % u -+ with_entities = template % entity -+ assert self.sub.substitute_html(raw) == with_entities -+ -+ def test_html5_entity_with_variation_selector(self): -+ # Some HTML5 entities correspond either to a single-character -+ # Unicode sequence _or_ to the same character plus U+FE00, -+ # VARIATION SELECTOR 1. We can handle this. -+ data = "fjords \u2294 penguins" -+ markup = "fjords ⊔ penguins" -+ assert self.sub.substitute_html(data) == markup -+ -+ data = "fjords \u2294\ufe00 penguins" -+ markup = "fjords ⊔︀ penguins" -+ assert self.sub.substitute_html(data) == markup -+ -+ def test_xml_converstion_includes_no_quotes_if_make_quoted_attribute_is_false(self): -+ s = 'Welcome to "my bar"' -+ assert self.sub.substitute_xml(s, False) == s -+ -+ def test_xml_attribute_quoting_normally_uses_double_quotes(self): -+ assert self.sub.substitute_xml("Welcome", True) == '"Welcome"' -+ assert self.sub.substitute_xml("Bob's Bar", True) == '"Bob\'s Bar"' -+ -+ def test_xml_attribute_quoting_uses_single_quotes_when_value_contains_double_quotes(self): -+ s = 'Welcome to "my bar"' -+ assert self.sub.substitute_xml(s, True) == "'Welcome to \"my bar\"'" -+ -+ def test_xml_attribute_quoting_escapes_single_quotes_when_value_contains_both_single_and_double_quotes(self): -+ s = 'Welcome to "Bob\'s Bar"' -+ assert self.sub.substitute_xml(s, True) == '"Welcome to "Bob\'s Bar""' -+ -+ def test_xml_quotes_arent_escaped_when_value_is_not_being_quoted(self): -+ quoted = 'Welcome to "Bob\'s Bar"' -+ assert self.sub.substitute_xml(quoted) == quoted -+ -+ def test_xml_quoting_handles_angle_brackets(self): -+ assert self.sub.substitute_xml("foo") == "foo<bar>" -+ -+ def test_xml_quoting_handles_ampersands(self): -+ assert self.sub.substitute_xml("AT&T") == "AT&T" -+ -+ def test_xml_quoting_including_ampersands_when_they_are_part_of_an_entity(self): -+ assert self.sub.substitute_xml("ÁT&T") == "&Aacute;T&T" -+ -+ def test_xml_quoting_ignoring_ampersands_when_they_are_part_of_an_entity(self): -+ assert self.sub.substitute_xml_containing_entities("ÁT&T") == "ÁT&T" -+ -+ def test_quotes_not_html_substituted(self): -+ """There's no need to do this except inside attribute values.""" -+ text = 'Bob\'s "bar"' -+ assert self.sub.substitute_html(text) == text -diff --git a/src/3rdparty/chromium/third_party/catapult/third_party/beautifulsoup4/bs4/tests/test_docs.py b/src/3rdparty/chromium/third_party/catapult/third_party/beautifulsoup4/bs4/tests/test_docs.py -index 5b9f67709..0194d6973 100644 ---- a/src/3rdparty/chromium/third_party/catapult/third_party/beautifulsoup4/bs4/tests/test_docs.py -+++ b/src/3rdparty/chromium/third_party/catapult/third_party/beautifulsoup4/bs4/tests/test_docs.py -@@ -1,5 +1,7 @@ - "Test harness for doctests." - -+# TODO: Pretty sure this isn't used and should be deleted. -+ - # pylint: disable-msg=E0611,W0142 - - __metaclass__ = type -diff --git a/src/3rdparty/chromium/third_party/catapult/third_party/beautifulsoup4/bs4/tests/test_element.py b/src/3rdparty/chromium/third_party/catapult/third_party/beautifulsoup4/bs4/tests/test_element.py -new file mode 100644 -index 000000000..6d08ab5d0 ---- /dev/null -+++ b/src/3rdparty/chromium/third_party/catapult/third_party/beautifulsoup4/bs4/tests/test_element.py -@@ -0,0 +1,74 @@ -+"""Tests of classes in element.py. -+ -+The really big classes -- Tag, PageElement, and NavigableString -- -+are tested in separate files. -+""" -+ -+from bs4.element import ( -+ CharsetMetaAttributeValue, -+ ContentMetaAttributeValue, -+ NamespacedAttribute, -+) -+from . import SoupTest -+ -+ -+class TestNamedspacedAttribute(object): -+ -+ def test_name_may_be_none_or_missing(self): -+ a = NamespacedAttribute("xmlns", None) -+ assert a == "xmlns" -+ -+ a = NamespacedAttribute("xmlns", "") -+ assert a == "xmlns" -+ -+ a = NamespacedAttribute("xmlns") -+ assert a == "xmlns" -+ -+ def test_namespace_may_be_none_or_missing(self): -+ a = NamespacedAttribute(None, "tag") -+ assert a == "tag" -+ -+ a = NamespacedAttribute("", "tag") -+ assert a == "tag" -+ -+ def test_attribute_is_equivalent_to_colon_separated_string(self): -+ a = NamespacedAttribute("a", "b") -+ assert "a:b" == a -+ -+ def test_attributes_are_equivalent_if_prefix_and_name_identical(self): -+ a = NamespacedAttribute("a", "b", "c") -+ b = NamespacedAttribute("a", "b", "c") -+ assert a == b -+ -+ # The actual namespace is not considered. -+ c = NamespacedAttribute("a", "b", None) -+ assert a == c -+ -+ # But name and prefix are important. -+ d = NamespacedAttribute("a", "z", "c") -+ assert a != d -+ -+ e = NamespacedAttribute("z", "b", "c") -+ assert a != e -+ -+ -+class TestAttributeValueWithCharsetSubstitution(object): -+ """Certain attributes are designed to have the charset of the -+ final document substituted into their value. -+ """ -+ -+ def test_content_meta_attribute_value(self): -+ # The value of a CharsetMetaAttributeValue is whatever -+ # encoding the string is in. -+ value = CharsetMetaAttributeValue("euc-jp") -+ assert "euc-jp" == value -+ assert "euc-jp" == value.original_value -+ assert "utf8" == value.encode("utf8") -+ assert "ascii" == value.encode("ascii") -+ -+ def test_content_meta_attribute_value(self): -+ value = ContentMetaAttributeValue("text/html; charset=euc-jp") -+ assert "text/html; charset=euc-jp" == value -+ assert "text/html; charset=euc-jp" == value.original_value -+ assert "text/html; charset=utf8" == value.encode("utf8") -+ assert "text/html; charset=ascii" == value.encode("ascii") -diff --git a/src/3rdparty/chromium/third_party/catapult/third_party/beautifulsoup4/bs4/tests/test_formatter.py b/src/3rdparty/chromium/third_party/catapult/third_party/beautifulsoup4/bs4/tests/test_formatter.py -new file mode 100644 -index 000000000..84d4e3b2e ---- /dev/null -+++ b/src/3rdparty/chromium/third_party/catapult/third_party/beautifulsoup4/bs4/tests/test_formatter.py -@@ -0,0 +1,113 @@ -+import pytest -+ -+from bs4.element import Tag -+from bs4.formatter import ( -+ Formatter, -+ HTMLFormatter, -+ XMLFormatter, -+) -+from . import SoupTest -+ -+class TestFormatter(SoupTest): -+ -+ def test_default_attributes(self): -+ # Test the default behavior of Formatter.attributes(). -+ formatter = Formatter() -+ tag = Tag(name="tag") -+ tag['b'] = 1 -+ tag['a'] = 2 -+ -+ # Attributes come out sorted by name. In Python 3, attributes -+ # normally come out of a dictionary in the order they were -+ # added. -+ assert [('a', 2), ('b', 1)] == formatter.attributes(tag) -+ -+ # This works even if Tag.attrs is None, though this shouldn't -+ # normally happen. -+ tag.attrs = None -+ assert [] == formatter.attributes(tag) -+ -+ assert ' ' == formatter.indent -+ -+ def test_sort_attributes(self): -+ # Test the ability to override Formatter.attributes() to, -+ # e.g., disable the normal sorting of attributes. -+ class UnsortedFormatter(Formatter): -+ def attributes(self, tag): -+ self.called_with = tag -+ for k, v in sorted(tag.attrs.items()): -+ if k == 'ignore': -+ continue -+ yield k,v -+ -+ soup = self.soup('

') -+ formatter = UnsortedFormatter() -+ decoded = soup.decode(formatter=formatter) -+ -+ # attributes() was called on the

tag. It filtered out one -+ # attribute and sorted the other two. -+ assert formatter.called_with == soup.p -+ assert '

' == decoded -+ -+ def test_empty_attributes_are_booleans(self): -+ # Test the behavior of empty_attributes_are_booleans as well -+ # as which Formatters have it enabled. -+ -+ for name in ('html', 'minimal', None): -+ formatter = HTMLFormatter.REGISTRY[name] -+ assert False == formatter.empty_attributes_are_booleans -+ -+ formatter = XMLFormatter.REGISTRY[None] -+ assert False == formatter.empty_attributes_are_booleans -+ -+ formatter = HTMLFormatter.REGISTRY['html5'] -+ assert True == formatter.empty_attributes_are_booleans -+ -+ # Verify that the constructor sets the value. -+ formatter = Formatter(empty_attributes_are_booleans=True) -+ assert True == formatter.empty_attributes_are_booleans -+ -+ # Now demonstrate what it does to markup. -+ for markup in ( -+ "", -+ '' -+ ): -+ soup = self.soup(markup) -+ for formatter in ('html', 'minimal', 'xml', None): -+ assert b'' == soup.option.encode(formatter='html') -+ assert b'' == soup.option.encode(formatter='html5') -+ -+ @pytest.mark.parametrize( -+ "indent,expect", -+ [ -+ (None, '\n\ntext\n\n'), -+ (-1, '\n\ntext\n\n'), -+ (0, '\n\ntext\n\n'), -+ ("", '\n\ntext\n\n'), -+ -+ (1, '\n \n text\n \n'), -+ (2, '\n \n text\n \n'), -+ -+ ("\t", '\n\t\n\t\ttext\n\t\n'), -+ ('abc', '\nabc\nabcabctext\nabc\n'), -+ -+ # Some invalid inputs -- the default behavior is used. -+ (object(), '\n \n text\n \n'), -+ (b'bytes', '\n \n text\n \n'), -+ ] -+ ) -+ def test_indent(self, indent, expect): -+ # Pretty-print a tree with a Formatter set to -+ # indent in a certain way and verify the results. -+ soup = self.soup("text") -+ formatter = Formatter(indent=indent) -+ assert soup.prettify(formatter=formatter) == expect -+ -+ # Pretty-printing only happens with prettify(), not -+ # encode(). -+ assert soup.encode(formatter=formatter) != expect -+ -+ def test_default_indent_value(self): -+ formatter = Formatter() -+ assert formatter.indent == ' ' -+ -diff --git a/src/3rdparty/chromium/third_party/catapult/third_party/beautifulsoup4/bs4/tests/test_html5lib.py b/src/3rdparty/chromium/third_party/catapult/third_party/beautifulsoup4/bs4/tests/test_html5lib.py -index 594c3e1f2..b32ab3042 100644 ---- a/src/3rdparty/chromium/third_party/catapult/third_party/beautifulsoup4/bs4/tests/test_html5lib.py -+++ b/src/3rdparty/chromium/third_party/catapult/third_party/beautifulsoup4/bs4/tests/test_html5lib.py -@@ -5,10 +5,10 @@ import warnings - try: - from bs4.builder import HTML5TreeBuilder - HTML5LIB_PRESENT = True --except ImportError, e: -+except ImportError as e: - HTML5LIB_PRESENT = False - from bs4.element import SoupStrainer --from bs4.testing import ( -+from . import ( - HTML5TreeBuilderSmokeTest, - SoupTest, - skipIf, -@@ -17,12 +17,12 @@ from bs4.testing import ( - @skipIf( - not HTML5LIB_PRESENT, - "html5lib seems not to be present, not testing its tree builder.") --class HTML5LibBuilderSmokeTest(SoupTest, HTML5TreeBuilderSmokeTest): -+class TestHTML5LibBuilder(SoupTest, HTML5TreeBuilderSmokeTest): - """See ``HTML5TreeBuilderSmokeTest``.""" - - @property - def default_builder(self): -- return HTML5TreeBuilder() -+ return HTML5TreeBuilder - - def test_soupstrainer(self): - # The html5lib tree builder does not support SoupStrainers. -@@ -30,12 +30,9 @@ class HTML5LibBuilderSmokeTest(SoupTest, HTML5TreeBuilderSmokeTest): - markup = "

A bold statement.

" - with warnings.catch_warnings(record=True) as w: - soup = self.soup(markup, parse_only=strainer) -- self.assertEqual( -- soup.decode(), self.document_for(markup)) -+ assert soup.decode() == self.document_for(markup) - -- self.assertTrue( -- "the html5lib tree builder doesn't support parse_only" in -- str(w[0].message)) -+ assert "the html5lib tree builder doesn't support parse_only" in str(w[0].message) - - def test_correctly_nested_tables(self): - """html5lib inserts tags where other parsers don't.""" -@@ -46,13 +43,13 @@ class HTML5LibBuilderSmokeTest(SoupTest, HTML5TreeBuilderSmokeTest): - 'foo' - '') - -- self.assertSoupEquals( -+ self.assert_soup( - markup, - '
Here\'s another table:' - '
foo
' - '
') - -- self.assertSoupEquals( -+ self.assert_soup( - "" - "" - "
Foo
Bar
Baz
") -@@ -69,17 +66,158 @@ class HTML5LibBuilderSmokeTest(SoupTest, HTML5TreeBuilderSmokeTest): - ''' - soup = self.soup(markup) - # Verify that we can reach the

tag; this means the tree is connected. -- self.assertEqual(b"

foo

", soup.p.encode()) -+ assert b"

foo

" == soup.p.encode() - - def test_reparented_markup(self): - markup = '

foo

\n

bar

' - soup = self.soup(markup) -- self.assertEqual(u"

foo

\n

bar

", soup.body.decode()) -- self.assertEqual(2, len(soup.find_all('p'))) -+ assert "

foo

\n

bar

" == soup.body.decode() -+ assert 2 == len(soup.find_all('p')) - - - def test_reparented_markup_ends_with_whitespace(self): - markup = '

foo

\n

bar

\n' - soup = self.soup(markup) -- self.assertEqual(u"

foo

\n

bar

\n", soup.body.decode()) -- self.assertEqual(2, len(soup.find_all('p'))) -+ assert "

foo

\n

bar

\n" == soup.body.decode() -+ assert 2 == len(soup.find_all('p')) -+ -+ def test_reparented_markup_containing_identical_whitespace_nodes(self): -+ """Verify that we keep the two whitespace nodes in this -+ document distinct when reparenting the adjacent tags. -+ """ -+ markup = '
' -+ soup = self.soup(markup) -+ space1, space2 = soup.find_all(string=' ') -+ tbody1, tbody2 = soup.find_all('tbody') -+ assert space1.next_element is tbody1 -+ assert tbody2.next_element is space2 -+ -+ def test_reparented_markup_containing_children(self): -+ markup = '' -+ soup = self.soup(markup) -+ noscript = soup.noscript -+ assert "target" == noscript.next_element -+ target = soup.find(string='target') -+ -+ # The 'aftermath' string was duplicated; we want the second one. -+ final_aftermath = soup.find_all(string='aftermath')[-1] -+ -+ # The