From 072983bfa7d0d323c4fe3a02ead2ba050a1ed183 Mon Sep 17 00:00:00 2001 From: MSVSphere Packaging Team Date: Thu, 26 Sep 2024 01:19:35 +0300 Subject: [PATCH] import chromium-129.0.6668.70-1.el9 --- .chromium.metadata | 2 +- .gitignore | 2 +- ...103.0.5060.53-update-rjsmin-to-1.2.0.patch | 1700 ----------------- .../chromium-129-el8-atk-compiler-error.patch | 1083 +++++++++++ ...-java-only-allowed-in-android-builds.patch | 13 - SPECS/chromium.spec | 85 +- 6 files changed, 1103 insertions(+), 1782 deletions(-) delete mode 100644 SOURCES/chromium-103.0.5060.53-update-rjsmin-to-1.2.0.patch create mode 100644 SOURCES/chromium-129-el8-atk-compiler-error.patch delete mode 100644 SOURCES/chromium-91.0.4472.77-java-only-allowed-in-android-builds.patch diff --git a/.chromium.metadata b/.chromium.metadata index 771492b1..c3f4ffc1 100644 --- a/.chromium.metadata +++ b/.chromium.metadata @@ -1,3 +1,3 @@ -7806b006b3cc1fe919ec61a2aae5602e42da66c5 SOURCES/chromium-129.0.6668.58-clean.tar.xz +b0b4c63dab16d273a6a9485b1e002390521e6a82 SOURCES/chromium-129.0.6668.70-clean.tar.xz 7e5d2c7864c5c83ec789b59c77cd9c20d2594916 SOURCES/linux-arm64-0.19.2.tgz dea187019741602d57aaf189a80abba261fbd2aa SOURCES/linux-x64-0.19.2.tgz diff --git a/.gitignore b/.gitignore index 6af5d84b..e55e61f5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -SOURCES/chromium-129.0.6668.58-clean.tar.xz +SOURCES/chromium-129.0.6668.70-clean.tar.xz SOURCES/linux-arm64-0.19.2.tgz SOURCES/linux-x64-0.19.2.tgz diff --git a/SOURCES/chromium-103.0.5060.53-update-rjsmin-to-1.2.0.patch b/SOURCES/chromium-103.0.5060.53-update-rjsmin-to-1.2.0.patch deleted file mode 100644 index 29a5d9cc..00000000 --- a/SOURCES/chromium-103.0.5060.53-update-rjsmin-to-1.2.0.patch +++ /dev/null @@ -1,1700 +0,0 @@ -diff -up chromium-103.0.5060.53/third_party/catapult/common/py_vulcanize/third_party/rjsmin/rjsmin.c.12 chromium-103.0.5060.53/third_party/catapult/common/py_vulcanize/third_party/rjsmin/rjsmin.c ---- chromium-103.0.5060.53/third_party/catapult/common/py_vulcanize/third_party/rjsmin/rjsmin.c.12 2022-06-28 12:50:10.167324583 +0000 -+++ chromium-103.0.5060.53/third_party/catapult/common/py_vulcanize/third_party/rjsmin/rjsmin.c 2021-11-14 19:50:55.000000000 +0000 -@@ -1,5 +1,5 @@ - /* -- * Copyright 2011 - 2015 -+ * Copyright 2011 - 2021 - * Andr\xe9 Malo or his licensors, as applicable - * - * Licensed under the Apache License, Version 2.0 (the "License"); -@@ -18,21 +18,21 @@ - #include "cext.h" - EXT_INIT_FUNC; - --#define RJSMIN_DULL_BIT (1 << 0) --#define RJSMIN_PRE_REGEX_BIT (1 << 1) --#define RJSMIN_REGEX_DULL_BIT (1 << 2) --#define RJSMIN_REGEX_CC_DULL_BIT (1 << 3) --#define RJSMIN_ID_LIT_BIT (1 << 4) --#define RJSMIN_ID_LIT_O_BIT (1 << 5) --#define RJSMIN_ID_LIT_C_BIT (1 << 6) --#define RJSMIN_STRING_DULL_BIT (1 << 7) --#define RJSMIN_SPACE_BIT (1 << 8) --#define RJSMIN_POST_REGEX_OFF_BIT (1 << 9) -+#define RJSMIN_DULL_BIT (1 << 0) -+#define RJSMIN_PRE_REGEX_BIT (1 << 1) -+#define RJSMIN_REGEX_DULL_BIT (1 << 2) -+#define RJSMIN_REGEX_CC_DULL_BIT (1 << 3) -+#define RJSMIN_ID_LIT_BIT (1 << 4) -+#define RJSMIN_ID_LIT_O_BIT (1 << 5) -+#define RJSMIN_ID_LIT_C_BIT (1 << 6) -+#define RJSMIN_STRING_DULL_BIT (1 << 7) -+#define RJSMIN_SPACE_BIT (1 << 8) -+#define RJSMIN_POST_REGEX_OFF_BIT (1 << 9) -+#define RJSMIN_A_Z_BIT (1 << 10) - --#ifdef EXT3 --typedef Py_UNICODE rchar; --#else - typedef unsigned char rchar; -+#ifdef U -+#undef U - #endif - #define U(c) ((rchar)(c)) - -@@ -66,66 +66,120 @@ typedef unsigned char rchar; - #define RJSMIN_IS_PRE_REGEX_1(c) ((U(c) <= 127) && \ - (rjsmin_charmask[U(c) & 0x7F] & RJSMIN_PRE_REGEX_BIT)) - -+#define RJSMIN_IS_A_Z(c) ((U(c) <= 127) && \ -+ (rjsmin_charmask[U(c) & 0x7F] & RJSMIN_A_Z_BIT)) -+ - - static const unsigned short rjsmin_charmask[128] = { -- 396, 396, 396, 396, 396, 396, 396, 396, -- 396, 396, 2, 396, 396, 2, 396, 396, -- 396, 396, 396, 396, 396, 396, 396, 396, -- 396, 396, 396, 396, 396, 396, 396, 396, -- 396, 687, 588, 653, 765, 653, 143, 588, -- 687, 205, 653, 237, 143, 237, 141, 648, -- 765, 765, 765, 765, 765, 765, 765, 765, -- 765, 765, 143, 143, 653, 143, 653, 143, -- 653, 765, 765, 765, 765, 765, 765, 765, -- 765, 765, 765, 765, 765, 765, 765, 765, -- 765, 765, 765, 765, 765, 765, 765, 765, -- 765, 765, 765, 683, 513, 197, 653, 765, -- 653, 765, 765, 765, 765, 765, 765, 765, -- 765, 765, 765, 765, 765, 765, 765, 765, -- 765, 765, 765, 765, 765, 765, 765, 765, -- 765, 765, 765, 687, 143, 207, 653, 765 -+ 396, 396, 396, 396, 396, 396, 396, 396, -+ 396, 396, 2, 396, 396, 2, 396, 396, -+ 396, 396, 396, 396, 396, 396, 396, 396, -+ 396, 396, 396, 396, 396, 396, 396, 396, -+ 396, 687, 588, 653, 765, 653, 143, 588, -+ 687, 205, 655, 239, 143, 239, 141, 648, -+ 765, 765, 765, 765, 765, 765, 765, 765, -+ 765, 765, 143, 143, 653, 143, 653, 143, -+ 653, 765, 765, 765, 765, 765, 765, 765, -+ 765, 765, 765, 765, 765, 765, 765, 765, -+ 765, 765, 765, 765, 765, 765, 765, 765, -+ 765, 765, 765, 683, 513, 197, 653, 765, -+ 588, 1789, 1789, 1789, 1789, 1789, 1789, 1789, -+ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, -+ 1789, 1789, 1789, 1789, 1789, 1789, 1789, 1789, -+ 1789, 1789, 1789, 687, 143, 207, 653, 765 - }; - -+ - static Py_ssize_t - rjsmin(const rchar *source, rchar *target, Py_ssize_t length, - int keep_bang_comments) - { -- const rchar *reset, *pcreset = NULL, *pctoken = NULL, *xtarget, -- *sentinel = source + length; -- rchar *tstart = target; -- int post_regex = 0; -- rchar c, quote, spaced = U(' '); -+ const rchar -+ *sentinel = source + length, /* never hit this pointer (source buf) */ -+ *reset, /* reset pointer (source buf) */ -+ *pcreset = NULL, /* pre-comment reset pointer (source buf) */ -+ *pctoken = NULL, /* pre-comment token pointer (target buf) -+ * Pointing to before the last kept comment, if any */ -+ *rsreset = NULL, /* regex-with-method reset pointer (source buf) */ -+ *xtarget; /* pre-regex-2 target pointer */ -+ -+ rchar *tstart = target, /* Target start pointer for reference */ -+ *rtreset = NULL; /* regex-with-method reset pointer (target buf) */ -+ -+ int rsdot, /* seen dot after regex-with-method pattern? */ -+ post_regex = 0; -+ rchar c, quote, -+ spaced = U(' '); /* the last seen kind of space (nl taking prio), -+ * init with ' ' */ - -+ /* main loop */ - while (source < sentinel) { - c = *source++; -+ - if (RJSMIN_IS_DULL(c)) { - if (post_regex) post_regex = 0; - if (pctoken) pctoken = NULL; - if (spaced == U('\n')) spaced = U(' '); -+ if (rsreset) { -+ /* both a-z and . are covered by "dull" */ -+ if (!rsdot) { -+ if (c != U('.')) { -+ /* reset regex-with-method to the starting slash */ -+ source = rsreset; -+ target = rtreset; -+ rsreset = NULL; -+ continue; /* main loop */ -+ } -+ /* Found a dot after possible regex, looking for a-z now */ -+ rsdot = 1; -+ } -+ else if (!RJSMIN_IS_A_Z(c)) { -+ /* reset regex-with-method to the starting slash */ -+ source = rsreset; -+ target = rtreset; -+ rsreset = NULL; -+ continue; /* main loop */ -+ } -+ else { -+ /* Successfull finish the regex-with-method match */ -+ rsreset = NULL; -+ } -+ } - - *target++ = c; -- continue; -+ continue; /* main loop */ - } -+ - switch (c) { - - /* String */ -- case U('\''): case U('"'): -+ case U('\''): case U('"'): case U('`'): - if (post_regex) post_regex = 0; - if (pctoken) pctoken = NULL; - if (spaced == U('\n')) spaced = U(' '); -+ if (rsreset) { -+ /* reset regex-with-method to the starting slash */ -+ source = rsreset; -+ target = rtreset; -+ rsreset = NULL; -+ continue; /* main loop */ -+ } - - reset = source; - *target++ = quote = c; -+ -+ /* string loop */ - while (source < sentinel) { - c = *source++; - *target++ = c; - if (RJSMIN_IS_STRING_DULL(c)) -- continue; -+ continue; /* string loop */ -+ - switch (c) { -- case U('\''): case U('"'): -+ case U('\''): case U('"'): case U('`'): - if (c == quote) -- goto cont; -- continue; -+ goto cont; /* main loop */ -+ continue; /* string loop */ - case U('\\'): - if (source < sentinel) { - c = *source++; -@@ -134,13 +188,18 @@ rjsmin(const rchar *source, rchar *targe - && *source == U('\n')) - *target++ = *source++; - } -- continue; -+ continue; /* string loop */ -+ case U('\r'): case U('\n'): -+ if (quote != U('`')) -+ break; /* string reset */ -+ continue; /* string loop */ - } -- break; -+ break; /* string reset */ - } -+ /* string reset */ - target -= source - reset; - source = reset; -- continue; -+ continue; /* main loop */ - - /* Comment or Regex or something else entirely */ - case U('/'): -@@ -148,6 +207,13 @@ rjsmin(const rchar *source, rchar *targe - if (post_regex) post_regex = 0; - if (pctoken) pctoken = NULL; - if (spaced == U('\n')) spaced = U(' '); -+ if (rsreset) { -+ /* reset regex-with-method to the starting slash */ -+ source = rsreset; -+ target = rtreset; -+ rsreset = NULL; -+ continue; /* main loop */ -+ } - - *target++ = c; - } -@@ -157,7 +223,19 @@ rjsmin(const rchar *source, rchar *targe - case U('*'): case U('/'): - goto skip_or_copy_ws; - -+ /* Regex or slash */ - default: -+ if (rsreset) { -+ /* reset regex-with-method to the starting slash */ -+ if (post_regex) post_regex = 0; -+ if (pctoken) pctoken = NULL; -+ if (spaced == U('\n')) spaced = U(' '); -+ source = rsreset; -+ target = rtreset; -+ rsreset = NULL; -+ continue; /* main loop */ -+ } -+ - xtarget = NULL; - if ( target == tstart - || RJSMIN_IS_PRE_REGEX_1(*((pctoken ? pctoken : target) -@@ -176,99 +254,148 @@ rjsmin(const rchar *source, rchar *targe - || !RJSMIN_IS_ID_LITERAL(*(xtarget - 7)) - ) - )) { -- -- /* Regex */ -+ /* nothing to do here, continuing down below -+ * We could unset rsreset here, but we know it already -+ * is. */ -+ ; -+ } -+ else if (*((pctoken ? pctoken : target) - 1) == U(')')) { -+ xtarget = NULL; -+ rsreset = source; -+ rtreset = target + 1; -+ rsdot = 0; -+ } -+ else { -+ /* Just a slash */ - if (post_regex) post_regex = 0; - if (pctoken) pctoken = NULL; -+ if (spaced == U('\n')) spaced = U(' '); - -- reset = source; -- if (spaced == U('\n')) { -- spaced = U(' '); -- if (xtarget) -- *target++ = U('\n'); -- } -+ *target++ = c; -+ continue; /* main loop */ -+ } - -- *target++ = U('/'); -- while (source < sentinel) { -- c = *source++; -- *target++ = c; -- if (RJSMIN_IS_REGEX_DULL(c)) -- continue; -- switch (c) { -- case U('/'): -- post_regex = 1; -- goto cont; -- case U('\\'): -- if (source < sentinel) { -- c = *source++; -- *target++ = c; -- if (c == U('\r') || c == U('\n')) -- break; -- } -- continue; -- case U('['): -- while (source < sentinel) { -- c = *source++; -- *target++ = c; -- if (RJSMIN_IS_REGEX_CC_DULL(c)) -- continue; -- switch (c) { -- case U('\\'): -- if (source < sentinel) { -- c = *source++; -- *target++ = c; -- if (c == U('\r') || c == U('\n')) -- break; -- } -- continue; -- case U(']'): -- goto cont_regex; -+ if (post_regex) post_regex = 0; -+ if (pctoken) pctoken = NULL; -+ -+ reset = source; -+ if (spaced == U('\n')) { -+ spaced = U(' '); -+ if (xtarget) -+ *target++ = U('\n'); -+ } -+ -+ *target++ = U('/'); -+ -+ /* regex loop */ -+ while (source < sentinel) { -+ c = *source++; -+ *target++ = c; -+ -+ if (RJSMIN_IS_REGEX_DULL(c)) -+ continue; /* regex loop */ -+ -+ switch (c) { -+ case U('/'): -+ while (source < sentinel -+ && RJSMIN_IS_A_Z(*source)) -+ *target++ = *source++; -+ post_regex = !rsreset; -+ /* This check is supposed to make it faster. -+ * It doesn't. It slows it down. I wonder why... -+ */ -+ /* -+ * if (!post_regex -+ * && source < sentinel - 1 -+ * && *source == U('.') -+ * && RJSMIN_IS_A_Z(*(source + 1))) -+ * rsreset = NULL; -+ */ -+ -+ goto cont; /* main loop */ -+ -+ case U('\\'): -+ if (source < sentinel) { -+ c = *source++; -+ *target++ = c; -+ if (c == U('\r') || c == U('\n')) -+ break; /* regex reset */ -+ } -+ continue; /* regex loop */ -+ -+ case U('['): -+ /* regex CC loop */ -+ while (source < sentinel) { -+ c = *source++; -+ *target++ = c; -+ -+ if (RJSMIN_IS_REGEX_CC_DULL(c)) -+ continue; /* regex CC loop */ -+ -+ switch (c) { -+ case U('\\'): -+ if (source < sentinel) { -+ c = *source++; -+ *target++ = c; -+ if (c == U('\r') || c == U('\n')) -+ break; /* regex reset */ - } -+ continue; /* regex CC loop */ -+ -+ case U(']'): -+ goto cont_regex; /* regex loop */ - } -- break; - } -- break; -- cont_regex: -- continue; -+ break; /* regex reset */ -+ - } -- target -= source - reset; -- source = reset; -- } -- else { -- /* Just a slash */ -- if (post_regex) post_regex = 0; -- if (pctoken) pctoken = NULL; -- if (spaced == U('\n')) spaced = U(' '); -+ break; /* regex reset */ - -- *target++ = c; -+ cont_regex: -+ continue; /* regex loop */ - } -- continue; -+ -+ /* regex reset */ -+ target -= source - reset; -+ source = reset; -+ rsreset = NULL; -+ continue; /* main loop */ - } - } -- continue; -+ continue; /* main loop */ /* LCOV_EXCL_LINE */ - - /* Whitespace */ - default: - skip_or_copy_ws: -+ /* remember if we've seen a newline, start with: no */ - quote = U(' '); - --source; -+ -+ /* space loop */ - while (source < sentinel) { - c = *source++; - if (RJSMIN_IS_SPACE(c)) -- continue; -+ continue; /* space loop */ -+ - switch (c) { - case U('\r'): case U('\n'): - quote = U('\n'); -- continue; -+ continue; /* space loop */ -+ -+ /* Can only be a comment at this point -+ * (or ending prematurely) */ - case U('/'): - if (source < sentinel) { - switch (*source) { -+ -+ /* multiline comment */ - case U('*'): - reset = source++; - /* copy bang comment, if requested */ - if ( keep_bang_comments && source < sentinel - && *source == U('!')) { - if (!pctoken) { -+ /* Backtracking if ending prematurely */ - pctoken = target; - pcreset = reset; - } -@@ -276,6 +403,8 @@ rjsmin(const rchar *source, rchar *targe - *target++ = U('/'); - *target++ = U('*'); - *target++ = *source++; -+ -+ /* comment loop */ - while (source < sentinel) { - c = *source++; - *target++ = c; -@@ -283,20 +412,21 @@ rjsmin(const rchar *source, rchar *targe - && *source == U('/')) { - *target++ = *source++; - reset = NULL; -- break; -+ break; /* continue space loop */ - } - } - if (!reset) -- continue; -+ continue; /* space loop */ - -+ /* comment reset */ - target -= source - reset; - source = reset; - if (pcreset == reset) { - pctoken = NULL; - pcreset = NULL; - } -- - } -+ - /* strip regular comment */ - else { - while (source < sentinel) { -@@ -305,41 +435,52 @@ rjsmin(const rchar *source, rchar *targe - && *source == U('/')) { - ++source; - reset = NULL; -- break; -+ break; /* continue space loop */ - } - } - if (!reset) -- continue; -+ continue; /* space loop */ -+ -+ /* comment reset: fallback to slash */ - source = reset; - *target++ = U('/'); - } -- goto cont; -+ goto cont; /* main loop */ -+ -+ /* single line comment */ - case U('/'): - ++source; -+ -+ /* single line comment loop */ - while (source < sentinel) { - c = *source++; - switch (c) { - case U('\n'): -- break; -+ break; /* continue space loop */ -+ - case U('\r'): - if (source < sentinel - && *source == U('\n')) - ++source; -- break; -+ break; /* continue space loop */ -+ - default: -- continue; -+ continue; /* single line comment loop */ - } -- break; -+ break; /* continue space loop */ - } - quote = U('\n'); -- continue; -+ continue; /* space loop */ - } - } - } -+ -+ /* No more spacy character found */ - --source; -- break; -+ break; /* end space loop */ - } - -+ /* Copy a space if needed */ - if ((tstart < (pctoken ? pctoken : target) && source < sentinel) - && ((quote == U('\n') - && ((RJSMIN_IS_ID_LITERAL_CLOSE(*((pctoken ? -@@ -363,8 +504,9 @@ rjsmin(const rchar *source, rchar *targe - pcreset = NULL; - spaced = quote; - } -+ - cont: -- continue; -+ continue; /* main loop */ - } - return (Py_ssize_t)(target - tstart); - } -@@ -385,15 +527,15 @@ substitution regex.\n\ - :Note: This is a hand crafted C implementation built on the regex\n\ - semantics.\n\ - \n\ --:Parameters:\n\ -- `script` : ``str``\n\ -+Parameters:\n\ -+ script (str):\n\ - Script to minify\n\ - \n\ -- `keep_bang_comments` : ``bool``\n\ -+ keep_bang_comments (bool):\n\ - Keep comments starting with an exclamation mark? (``/*!...*/``)\n\ - \n\ --:Return: Minified script\n\ --:Rtype: ``str``"); -+Returns:\n\ -+ str: Minified script"); - - static PyObject * - rjsmin_jsmin(PyObject *self, PyObject *args, PyObject *kwds) -@@ -404,15 +546,15 @@ rjsmin_jsmin(PyObject *self, PyObject *a - int keep_bang_comments; - #ifdef EXT2 - int uni; --#define UOBJ "O" - #endif - #ifdef EXT3 --#define UOBJ "U" -+ int bytes; -+ rchar *bytescript; - #endif - -- if (!PyArg_ParseTupleAndKeywords(args, kwds, UOBJ "|O", kwlist, -+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|O", kwlist, - &script, &keep_bang_comments_)) -- return NULL; -+ LCOV_EXCL_LINE_RETURN(NULL); - - if (!keep_bang_comments_) - keep_bang_comments = 0; -@@ -425,28 +567,27 @@ rjsmin_jsmin(PyObject *self, PyObject *a - #ifdef EXT2 - if (PyUnicode_Check(script)) { - if (!(script = PyUnicode_AsUTF8String(script))) -- return NULL; -+ LCOV_EXCL_LINE_RETURN(NULL); - uni = 1; - } -+ else if (!PyString_Check(script)) { -+ PyErr_SetString(PyExc_TypeError, "Unexpected type"); -+ return NULL; -+ } - else { - if (!(script = PyObject_Str(script))) -- return NULL; -+ LCOV_EXCL_LINE_RETURN(NULL); - uni = 0; - } --#endif -- --#ifdef EXT3 -- Py_INCREF(script); --#define PyString_GET_SIZE PyUnicode_GET_SIZE --#define PyString_AS_STRING PyUnicode_AS_UNICODE --#define _PyString_Resize PyUnicode_Resize --#define PyString_FromStringAndSize PyUnicode_FromUnicode --#endif -- - slength = PyString_GET_SIZE(script); -+ - if (!(result = PyString_FromStringAndSize(NULL, slength))) { -+ LCOV_EXCL_START -+ - Py_DECREF(script); - return NULL; -+ -+ LCOV_EXCL_STOP - } - Py_BEGIN_ALLOW_THREADS - length = rjsmin((rchar *)PyString_AS_STRING(script), -@@ -456,30 +597,97 @@ rjsmin_jsmin(PyObject *self, PyObject *a - - Py_DECREF(script); - if (length < 0) { -+ LCOV_EXCL_START -+ - Py_DECREF(result); - return NULL; -+ -+ LCOV_EXCL_STOP - } - if (length != slength && _PyString_Resize(&result, length) == -1) -- return NULL; -+ LCOV_EXCL_LINE_RETURN(NULL); - --#ifdef EXT2 - if (uni) { - script = PyUnicode_DecodeUTF8(PyString_AS_STRING(result), - PyString_GET_SIZE(result), "strict"); - Py_DECREF(result); -- if (!script) -- return NULL; -- result = script; -+ return script; - } --#endif -+ - return result; -+ -+#else /* EXT3 */ -+ -+ if (PyUnicode_Check(script)) { -+ bytes = 0; -+ script = PyUnicode_AsUTF8String(script); -+ bytescript = (rchar *)PyBytes_AS_STRING(script); -+ slength = PyBytes_GET_SIZE(script); -+ } -+ else if (PyBytes_Check(script)) { -+ bytes = 1; -+ Py_INCREF(script); -+ bytescript = (rchar *)PyBytes_AS_STRING(script); -+ slength = PyBytes_GET_SIZE(script); -+ } -+ else if (PyByteArray_Check(script)) { -+ bytes = 2; -+ Py_INCREF(script); -+ bytescript = (rchar *)PyByteArray_AS_STRING(script); -+ slength = PyByteArray_GET_SIZE(script); -+ } -+ else { -+ PyErr_SetString(PyExc_TypeError, "Unexpected type"); -+ return NULL; -+ } -+ -+ if (!(result = PyBytes_FromStringAndSize(NULL, slength))) { -+ LCOV_EXCL_START -+ -+ Py_DECREF(script); -+ return NULL; -+ -+ LCOV_EXCL_STOP -+ } -+ Py_BEGIN_ALLOW_THREADS -+ length = rjsmin(bytescript, (rchar *)PyBytes_AS_STRING(result), -+ slength, keep_bang_comments); -+ Py_END_ALLOW_THREADS -+ -+ Py_DECREF(script); -+ if (length < 0) { -+ LCOV_EXCL_START -+ -+ Py_DECREF(result); -+ return NULL; -+ -+ LCOV_EXCL_STOP -+ } -+ -+ if (!bytes) { -+ script = PyUnicode_DecodeUTF8(PyBytes_AS_STRING(result), length, -+ "strict"); -+ Py_DECREF(result); -+ return script; -+ } -+ if (bytes == 1) { -+ if (length != slength) { -+ _PyBytes_Resize(&result, length); -+ } -+ return result; -+ } -+ /* bytes == 2: bytearray */ -+ script = PyByteArray_FromStringAndSize(PyBytes_AS_STRING(result), length); -+ Py_DECREF(result); -+ return script; -+#endif - } - - /* ------------------------ BEGIN MODULE DEFINITION ------------------------ */ - - EXT_METHODS = { - {"jsmin", -- (PyCFunction)rjsmin_jsmin, METH_VARARGS | METH_KEYWORDS, -+ EXT_CFUNC(rjsmin_jsmin), METH_VARARGS | METH_KEYWORDS, - rjsmin_jsmin__doc__}, - - {NULL} /* Sentinel */ -@@ -499,10 +707,10 @@ EXT_INIT_FUNC { - - /* Create the module and populate stuff */ - if (!(m = EXT_CREATE(&EXT_DEFINE_VAR))) -- EXT_INIT_ERROR(NULL); -+ EXT_INIT_ERROR(LCOV_EXCL_LINE(NULL)); - - EXT_ADD_UNICODE(m, "__author__", "Andr\xe9 Malo", "latin-1"); -- EXT_ADD_STRING(m, "__docformat__", "restructuredtext en"); -+ EXT_ADD_STRING(m, "__version__", STRINGIFY(EXT_VERSION)); - - EXT_INIT_RETURN(m); - } -diff -up chromium-103.0.5060.53/third_party/catapult/common/py_vulcanize/third_party/rjsmin/rjsmin.py.12 chromium-103.0.5060.53/third_party/catapult/common/py_vulcanize/third_party/rjsmin/rjsmin.py ---- chromium-103.0.5060.53/third_party/catapult/common/py_vulcanize/third_party/rjsmin/rjsmin.py.12 2022-07-01 20:33:39.317727375 +0000 -+++ chromium-103.0.5060.53/third_party/catapult/common/py_vulcanize/third_party/rjsmin/rjsmin.py 2021-11-14 20:24:16.000000000 +0000 -@@ -1,6 +1,6 @@ - #!/usr/bin/env python - # -*- coding: ascii -*- --r""" -+u""" - ===================== - Javascript Minifier - ===================== -@@ -11,7 +11,7 @@ The minifier is based on the semantics o - - :Copyright: - -- Copyright 2011 - 2015 -+ Copyright 2011 - 2021 - Andr\xe9 Malo or his licensors, as applicable - - :License: -@@ -39,9 +39,11 @@ same results as the original ``jsmin.c`` - - Newline characters are not allowed inside string and regex literals, except - for line continuations in string literals (ECMA-5). - - "return /regex/" is recognized correctly. -+- More characters are allowed before regexes. - - Line terminators after regex literals are handled more sensibly - - "+ +" and "- -" sequences are not collapsed to '++' or '--' - - Newlines before ! operators are removed more sensibly -+- (Unnested) template literals are supported (ECMA-6) - - Comments starting with an exclamation mark (``!``) can be kept optionally - - rJSmin does not handle streams, but only complete strings. (However, the - module provides a "streamy" interface). -@@ -56,20 +58,17 @@ file for details. - - rjsmin.c is a reimplementation of rjsmin.py in C and speeds it up even more. - --Both python 2 and python 3 are supported. -+Supported python versions are 2.7 and 3.6+. - - .. _jsmin.c by Douglas Crockford: - http://www.crockford.com/javascript/jsmin.c - """ --if __doc__: -- # pylint: disable = redefined-builtin -- __doc__ = __doc__.encode('ascii').decode('unicode_escape') --__author__ = r"Andr\xe9 Malo".encode('ascii').decode('unicode_escape') --__docformat__ = "restructuredtext en" -+__author__ = u"Andr\xe9 Malo" - __license__ = "Apache License, Version 2.0" --__version__ = '1.0.12' -+__version__ = '1.2.0' - __all__ = ['jsmin'] - -+import functools as _ft - import re as _re - - -@@ -80,13 +79,13 @@ def _make_jsmin(python_only=False): - .. _jsmin.c by Douglas Crockford: - http://www.crockford.com/javascript/jsmin.c - -- :Parameters: -- `python_only` : ``bool`` -+ Parameters: -+ python_only (bool): - Use only the python variant. If true, the c extension is not even - tried to be loaded. - -- :Return: Minifier -- :Rtype: ``callable`` -+ Returns: -+ callable: Minifier - """ - # pylint: disable = unused-variable - # pylint: disable = too-many-locals -@@ -97,7 +96,10 @@ def _make_jsmin(python_only=False): - except ImportError: - pass - else: -- return _rjsmin.jsmin -+ # Ensure that the C version is in sync -+ # https://github.com/ndparker/rjsmin/issues/11 -+ if getattr(_rjsmin, '__version__', None) == __version__: -+ return _rjsmin.jsmin - try: - xrange - except NameError: -@@ -110,15 +112,16 @@ def _make_jsmin(python_only=False): - space_comment_nobang = r'(?:/\*(?!!)[^*]*\*+(?:[^/*][^*]*\*+)*/)' - bang_comment = r'(?:/\*![^*]*\*+(?:[^/*][^*]*\*+)*/)' - -- string1 = \ -- r'(?:\047[^\047\\\r\n]*(?:\\(?:[^\r\n]|\r?\n|\r)[^\047\\\r\n]*)*\047)' -+ string1 = r"(?:'[^'\\\r\n]*(?:\\(?:[^\r\n]|\r?\n|\r)[^'\\\r\n]*)*')" -+ string1 = string1.replace("'", r'\047') # portability - string2 = r'(?:"[^"\\\r\n]*(?:\\(?:[^\r\n]|\r?\n|\r)[^"\\\r\n]*)*")' -- string3 = r'(?:`(?:[^`\\]|\\.)*`)' -+ string3 = r'(?:`[^`\\]*(?:\\(?:[^\r\n]|\r?\n|\r)[^`\\]*)*`)' -+ string3 = string3.replace('`', r'\140') # portability - strings = r'(?:%s|%s|%s)' % (string1, string2, string3) - - charclass = r'(?:\[[^\\\]\r\n]*(?:\\[^\r\n][^\\\]\r\n]*)*\])' - nospecial = r'[^/\\\[\r\n]' -- regex = r'(?:/(?![\r\n/*])%s*(?:(?:\\[^\r\n]|%s)%s*)*/)' % ( -+ regex = r'(?:/(?![\r\n/*])%s*(?:(?:\\[^\r\n]|%s)%s*)*/[a-z]*)' % ( - nospecial, charclass, nospecial - ) - space = r'(?:%s|%s)' % (space_chars, space_comment) -@@ -154,7 +157,7 @@ def _make_jsmin(python_only=False): - ) for first, last in result]) # noqa - - return _re.sub( -- r'([\000-\040\047])', # \047 for better portability -+ r"([\000-\040'`])", # ' and ` for better portability - lambda m: '\\%03o' % ord(m.group(1)), ( - sequentize(result) - .replace('\\', '\\\\') -@@ -180,42 +183,48 @@ def _make_jsmin(python_only=False): - return r'[%s]' % fix_charclass(result) - - not_id_literal = not_id_literal_(r'[a-zA-Z0-9_$]') -- preregex1 = r'[(,=:\[!&|?{};\r\n]' -+ preregex1 = r'[(,=:\[!&|?{};\r\n+*-]' - preregex2 = r'%(not_id_literal)sreturn' % locals() - - id_literal = id_literal_(r'[a-zA-Z0-9_$]') - id_literal_open = id_literal_(r'[a-zA-Z0-9_${\[(!+-]') -- id_literal_close = id_literal_(r'[a-zA-Z0-9_$}\])"\047+-]') -+ id_literal_close = id_literal_(r'[a-zA-Z0-9_$}\])"\047\140+-]') - post_regex_off = id_literal_(r'[^\000-\040}\])?:|,;.&=+-]') - -- dull = r'[^\047"`/\000-\040]' -+ dull = r'[^\047"\140/\000-\040]' - - space_sub_simple = _re.compile(( -- # noqa pylint: disable = bad-continuation -+ # noqa pylint: disable = bad-option-value, bad-continuation - - r'(%(dull)s+)' # 0 - r'|(%(strings)s%(dull)s*)' # 1 -- r'|(?<=%(preregex1)s)' -+ r'|(?<=[)])' - r'%(space)s*(?:%(newline)s%(space)s*)*' - r'(%(regex)s)' # 2 -- r'(%(space)s*(?:%(newline)s%(space)s*)+' # 3 -+ r'(?=%(space)s*(?:%(newline)s%(space)s*)*' -+ r'\.' -+ r'%(space)s*(?:%(newline)s%(space)s*)*[a-z])' -+ r'|(?<=%(preregex1)s)' -+ r'%(space)s*(?:%(newline)s%(space)s*)*' -+ r'(%(regex)s)' # 3 -+ r'(%(space)s*(?:%(newline)s%(space)s*)+' # 4 - r'(?=%(post_regex_off)s))?' - r'|(?<=%(preregex2)s)' -- r'%(space)s*(?:(%(newline)s)%(space)s*)*' # 4 -- r'(%(regex)s)' # 5 -- r'(%(space)s*(?:%(newline)s%(space)s*)+' # 6 -+ r'%(space)s*(?:(%(newline)s)%(space)s*)*' # 5 -+ r'(%(regex)s)' # 6 -+ r'(%(space)s*(?:%(newline)s%(space)s*)+' # 7 - r'(?=%(post_regex_off)s))?' - r'|(?<=%(id_literal_close)s)' -- r'%(space)s*(?:(%(newline)s)%(space)s*)+' # 7 -+ r'%(space)s*(?:(%(newline)s)%(space)s*)+' # 8 - r'(?=%(id_literal_open)s)' -- r'|(?<=%(id_literal)s)(%(space)s)+(?=%(id_literal)s)' # 8 -- r'|(?<=\+)(%(space)s)+(?=\+)' # 9 -- r'|(?<=-)(%(space)s)+(?=-)' # 10 -+ r'|(?<=%(id_literal)s)(%(space)s)+(?=%(id_literal)s)' # 9 -+ r'|(?<=\+)(%(space)s)+(?=\+)' # 10 -+ r'|(?<=-)(%(space)s)+(?=-)' # 11 - r'|%(space)s+' - r'|(?:%(newline)s%(space)s*)+' - ) % locals()).sub - -- # print space_sub_simple.__self__.pattern -+ # print(space_sub_simple.__self__.pattern) - - def space_subber_simple(match): - """ Substitution callback """ -@@ -227,48 +236,56 @@ def _make_jsmin(python_only=False): - elif groups[1]: - return groups[1] - elif groups[2]: -- if groups[3]: -- return groups[2] + '\n' - return groups[2] -- elif groups[5]: -+ elif groups[3]: -+ if groups[4]: -+ return groups[3] + '\n' -+ return groups[3] -+ elif groups[6]: - return "%s%s%s" % ( -- groups[4] and '\n' or '', -- groups[5], -- groups[6] and '\n' or '', -+ groups[5] and '\n' or '', -+ groups[6], -+ groups[7] and '\n' or '', - ) -- elif groups[7]: -+ elif groups[8]: - return '\n' -- elif groups[8] or groups[9] or groups[10]: -+ elif groups[9] or groups[10] or groups[11]: - return ' ' - else: - return '' - - space_sub_banged = _re.compile(( -- # noqa pylint: disable = bad-continuation -+ # noqa pylint: disable = bad-option-value, bad-continuation - - r'(%(dull)s+)' # 0 - r'|(%(strings)s%(dull)s*)' # 1 -- r'|(?<=%(preregex1)s)' -+ r'|(?<=[)])' - r'(%(space)s*(?:%(newline)s%(space)s*)*)' # 2 - r'(%(regex)s)' # 3 -- r'(%(space)s*(?:%(newline)s%(space)s*)+' # 4 -+ r'(?=%(space)s*(?:%(newline)s%(space)s*)*' -+ r'\.' -+ r'%(space)s*(?:%(newline)s%(space)s*)*[a-z])' -+ r'|(?<=%(preregex1)s)' -+ r'(%(space)s*(?:%(newline)s%(space)s*)*)' # 4 -+ r'(%(regex)s)' # 5 -+ r'(%(space)s*(?:%(newline)s%(space)s*)+' # 6 - r'(?=%(post_regex_off)s))?' - r'|(?<=%(preregex2)s)' -- r'(%(space)s*(?:(%(newline)s)%(space)s*)*)' # 5, 6 -- r'(%(regex)s)' # 7 -- r'(%(space)s*(?:%(newline)s%(space)s*)+' # 8 -+ r'(%(space)s*(?:(%(newline)s)%(space)s*)*)' # 7, 8 -+ r'(%(regex)s)' # 9 -+ r'(%(space)s*(?:%(newline)s%(space)s*)+' # 10 - r'(?=%(post_regex_off)s))?' - r'|(?<=%(id_literal_close)s)' -- r'(%(space)s*(?:%(newline)s%(space)s*)+)' # 9 -+ r'(%(space)s*(?:%(newline)s%(space)s*)+)' # 11 - r'(?=%(id_literal_open)s)' -- r'|(?<=%(id_literal)s)(%(space)s+)(?=%(id_literal)s)' # 10 -- r'|(?<=\+)(%(space)s+)(?=\+)' # 11 -- r'|(?<=-)(%(space)s+)(?=-)' # 12 -- r'|(%(space)s+)' # 13 -- r'|((?:%(newline)s%(space)s*)+)' # 14 -+ r'|(?<=%(id_literal)s)(%(space)s+)(?=%(id_literal)s)' # 12 -+ r'|(?<=\+)(%(space)s+)(?=\+)' # 13 -+ r'|(?<=-)(%(space)s+)(?=-)' # 14 -+ r'|(%(space)s+)' # 15 -+ r'|((?:%(newline)s%(space)s*)+)' # 16 - ) % locals()).sub - -- # print space_sub_banged.__self__.pattern -+ # print(space_sub_banged.__self__.pattern) - - keep = _re.compile(( - r'%(space_chars)s+|%(space_comment_nobang)s+|%(newline)s+' -@@ -276,7 +293,7 @@ def _make_jsmin(python_only=False): - ) % locals()).sub - keeper = lambda m: m.groups()[0] or '' - -- # print keep.__self__.pattern -+ # print(keep.__self__.pattern) - - def space_subber_banged(match): - """ Substitution callback """ -@@ -288,26 +305,34 @@ def _make_jsmin(python_only=False): - elif groups[1]: - return groups[1] - elif groups[3]: -- return "%s%s%s%s" % ( -+ return "%s%s" % ( - keep(keeper, groups[2]), - groups[3], -- keep(keeper, groups[4] or ''), -- groups[4] and '\n' or '', - ) -- elif groups[7]: -- return "%s%s%s%s%s" % ( -- keep(keeper, groups[5]), -+ elif groups[5]: -+ return "%s%s%s%s" % ( -+ keep(keeper, groups[4]), -+ groups[5], -+ keep(keeper, groups[6] or ''), - groups[6] and '\n' or '', -- groups[7], -- keep(keeper, groups[8] or ''), -- groups[8] and '\n' or '', - ) - elif groups[9]: -- return keep(keeper, groups[9]) + '\n' -- elif groups[10] or groups[11] or groups[12]: -- return keep(keeper, groups[10] or groups[11] or groups[12]) or ' ' -+ return "%s%s%s%s%s" % ( -+ keep(keeper, groups[7]), -+ groups[8] and '\n' or '', -+ groups[9], -+ keep(keeper, groups[10] or ''), -+ groups[10] and '\n' or '', -+ ) -+ elif groups[11]: -+ return keep(keeper, groups[11]) + '\n' -+ elif groups[12] or groups[13] or groups[14]: -+ return keep(keeper, groups[12] or groups[13] or groups[14]) or ' ' - else: -- return keep(keeper, groups[13] or groups[14]) -+ return keep(keeper, groups[15] or groups[16]) -+ -+ banged = _ft.partial(space_sub_banged, space_subber_banged) -+ simple = _ft.partial(space_sub_simple, space_subber_simple) - - def jsmin(script, keep_bang_comments=False): - r""" -@@ -320,32 +345,51 @@ def _make_jsmin(python_only=False): - .. _jsmin.c by Douglas Crockford: - http://www.crockford.com/javascript/jsmin.c - -- :Parameters: -- `script` : ``str`` -+ Parameters: -+ script (str): - Script to minify - -- `keep_bang_comments` : ``bool`` -+ keep_bang_comments (bool): - Keep comments starting with an exclamation mark? (``/*!...*/``) - -- :Return: Minified script -- :Rtype: ``str`` -+ Returns: -+ str: Minified script - """ - # pylint: disable = redefined-outer-name - -- if keep_bang_comments: -- return space_sub_banged( -- space_subber_banged, '\n%s\n' % script -- ).strip() -- else: -- return space_sub_simple( -- space_subber_simple, '\n%s\n' % script -- ).strip() -+ is_bytes, script = _as_str(script) -+ script = (banged if keep_bang_comments else simple)( -+ '\n%s\n' % script -+ ).strip() -+ if is_bytes: -+ script = script.encode('latin-1') -+ if is_bytes == 2: -+ script = bytearray(script) -+ return script - - return jsmin - - jsmin = _make_jsmin() - - -+def _as_str(script): -+ """ Make sure the script is a text string """ -+ is_bytes = False -+ if str is bytes: -+ if not isinstance(script, basestring): # noqa pylint: disable = undefined-variable -+ raise TypeError("Unexpected type") -+ elif isinstance(script, bytes): -+ is_bytes = True -+ script = script.decode('latin-1') -+ elif isinstance(script, bytearray): -+ is_bytes = 2 -+ script = script.decode('latin-1') -+ elif not isinstance(script, str): -+ raise TypeError("Unexpected type") -+ -+ return is_bytes, script -+ -+ - def jsmin_for_posers(script, keep_bang_comments=False): - r""" - Minify javascript based on `jsmin.c by Douglas Crockford`_\. -@@ -361,49 +405,61 @@ def jsmin_for_posers(script, keep_bang_c - utilizes the resulting regexes. It's here for fun and may - vanish any time. Use the `jsmin` function instead. - -- :Parameters: -- `script` : ``str`` -+ Parameters: -+ script (str): - Script to minify - -- `keep_bang_comments` : ``bool`` -+ keep_bang_comments (bool): - Keep comments starting with an exclamation mark? (``/*!...*/``) - -- :Return: Minified script -- :Rtype: ``str`` -+ Returns: -+ str: Minified script - """ - if not keep_bang_comments: - rex = ( -- r'([^\047"/\000-\040]+)|((?:(?:\047[^\047\\\r\n]*(?:\\(?:[^\r\n]' -- r'|\r?\n|\r)[^\047\\\r\n]*)*\047)|(?:"[^"\\\r\n]*(?:\\(?:[^\r\n]' -- r'|\r?\n|\r)[^"\\\r\n]*)*"))[^\047"/\000-\040]*)|(?<=[(,=:\[!&|?' -- r'{};\r\n])(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*' -- r'][^*]*\*+)*/))*(?:(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\0' -- r'14\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)*((?:/(?![\r' -- r'\n/*])[^/\\\[\r\n]*(?:(?:\\[^\r\n]|(?:\[[^\\\]\r\n]*(?:\\[^\r' -- r'\n][^\\\]\r\n]*)*\]))[^/\\\[\r\n]*)*/))((?:[\000-\011\013\014' -+ r'([^\047"\140/\000-\040]+)|((?:(?:\047[^\047\\\r\n]*(?:\\(?:[^' -+ r'\r\n]|\r?\n|\r)[^\047\\\r\n]*)*\047)|(?:"[^"\\\r\n]*(?:\\(?:[^' -+ r'\r\n]|\r?\n|\r)[^"\\\r\n]*)*")|(?:\140[^\140\\]*(?:\\(?:[^\r\n' -+ r']|\r?\n|\r)[^\140\\]*)*\140))[^\047"\140/\000-\040]*)|(?<=[)])' -+ r'(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+' -+ r')*/))*(?:(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\014\016-\0' -+ r'40]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)*((?:/(?![\r\n/*])[^/' -+ r'\\\[\r\n]*(?:(?:\\[^\r\n]|(?:\[[^\\\]\r\n]*(?:\\[^\r\n][^\\\]' -+ r'\r\n]*)*\]))[^/\\\[\r\n]*)*/[a-z]*))(?=(?:[\000-\011\013\014\0' -+ r'16-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*(?:(?:(?://[^\r\n' -+ r']*)?[\r\n])(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^' -+ r'/*][^*]*\*+)*/))*)*\.(?:[\000-\011\013\014\016-\040]|(?:/\*[^*' -+ r']*\*+(?:[^/*][^*]*\*+)*/))*(?:(?:(?://[^\r\n]*)?[\r\n])(?:[\00' -+ r'0-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)' -+ r'*[a-z])|(?<=[(,=:\[!&|?{};\r\n+*-])(?:[\000-\011\013\014\016-' -+ r'\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*(?:(?:(?://[^\r\n]*)' -+ r'?[\r\n])(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*]' -+ r'[^*]*\*+)*/))*)*((?:/(?![\r\n/*])[^/\\\[\r\n]*(?:(?:\\[^\r\n]|' -+ r'(?:\[[^\\\]\r\n]*(?:\\[^\r\n][^\\\]\r\n]*)*\]))[^/\\\[\r\n]*)*' -+ r'/[a-z]*))((?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/' -+ r'*][^*]*\*+)*/))*(?:(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013' -+ r'\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)+(?=[^\000' -+ r'-\040&)+,.:;=?\]|}-]))?|(?<=[\000-#%-,./:-@\[-^\140{-~-]return' -+ r')(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*' -+ r'+)*/))*(?:((?:(?://[^\r\n]*)?[\r\n]))(?:[\000-\011\013\014\016' -+ r'-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)*((?:/(?![\r\n/*])' -+ r'[^/\\\[\r\n]*(?:(?:\\[^\r\n]|(?:\[[^\\\]\r\n]*(?:\\[^\r\n][^' -+ r'\\\]\r\n]*)*\]))[^/\\\[\r\n]*)*/[a-z]*))((?:[\000-\011\013\014' - r'\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*(?:(?:(?://[^\r' - r'\n]*)?[\r\n])(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:' -- r'[^/*][^*]*\*+)*/))*)+(?=[^\000-\040&)+,.:;=?\]|}-]))?|(?<=[\00' -- r'0-#%-,./:-@\[-^`{-~-]return)(?:[\000-\011\013\014\016-\040]|(?' -- r':/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*(?:((?:(?://[^\r\n]*)?[\r\n]' -- r'))(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*' -- r'\*+)*/))*)*((?:/(?![\r\n/*])[^/\\\[\r\n]*(?:(?:\\[^\r\n]|(?:\[' -- r'[^\\\]\r\n]*(?:\\[^\r\n][^\\\]\r\n]*)*\]))[^/\\\[\r\n]*)*/))((' -- r'?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)' -- r'*/))*(?:(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\014\016-\04' -- r'0]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)+(?=[^\000-\040&)+,.:;' -- r'=?\]|}-]))?|(?<=[^\000-!#%&(*,./:-@\[\\^`{|~])(?:[\000-\011\01' -- r'3\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*(?:((?:(?:' -- r'//[^\r\n]*)?[\r\n]))(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]' -- r'*\*+(?:[^/*][^*]*\*+)*/))*)+(?=[^\000-\040"#%-\047)*,./:-@\\-^' -- r'`|-~])|(?<=[^\000-#%-,./:-@\[-^`{-~-])((?:[\000-\011\013\014\0' -- r'16-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/)))+(?=[^\000-#%-,./' -- r':-@\[-^`{-~-])|(?<=\+)((?:[\000-\011\013\014\016-\040]|(?:/\*[' -- r'^*]*\*+(?:[^/*][^*]*\*+)*/)))+(?=\+)|(?<=-)((?:[\000-\011\013' -- r'\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/)))+(?=-)|(?:[' -- r'\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/)' -- r')+|(?:(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\014\016-\040]' -- r'|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)+' -+ r'[^/*][^*]*\*+)*/))*)+(?=[^\000-\040&)+,.:;=?\]|}-]))?|(?<=[^\0' -+ r'00-!#%&(*,./:-@\[\\^{|~])(?:[\000-\011\013\014\016-\040]|(?:/' -+ r'\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*(?:((?:(?://[^\r\n]*)?[\r\n]))' -+ r'(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+' -+ r')*/))*)+(?=[^\000-\040"#%-\047)*,./:-@\\-^\140|-~])|(?<=[^\000' -+ r'-#%-,./:-@\[-^\140{-~-])((?:[\000-\011\013\014\016-\040]|(?:/' -+ r'\*[^*]*\*+(?:[^/*][^*]*\*+)*/)))+(?=[^\000-#%-,./:-@\[-^\140{-' -+ r'~-])|(?<=\+)((?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:' -+ r'[^/*][^*]*\*+)*/)))+(?=\+)|(?<=-)((?:[\000-\011\013\014\016-\0' -+ r'40]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/)))+(?=-)|(?:[\000-\011\0' -+ r'13\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))+|(?:(?:(?' -+ r'://[^\r\n]*)?[\r\n])(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]' -+ r'*\*+(?:[^/*][^*]*\*+)*/))*)+' - ) - - def subber(match): -@@ -412,59 +468,72 @@ def jsmin_for_posers(script, keep_bang_c - return ( - groups[0] or - groups[1] or -- (groups[3] and (groups[2] + '\n')) or - groups[2] or -- (groups[5] and "%s%s%s" % ( -- groups[4] and '\n' or '', -- groups[5], -- groups[6] and '\n' or '', -+ (groups[4] and (groups[3] + '\n')) or -+ groups[3] or -+ (groups[6] and "%s%s%s" % ( -+ groups[5] and '\n' or '', -+ groups[6], -+ groups[7] and '\n' or '', - )) or -- (groups[7] and '\n') or -- (groups[8] and ' ') or -+ (groups[8] and '\n') or - (groups[9] and ' ') or - (groups[10] and ' ') or -+ (groups[11] and ' ') or - '' - ) - else: - rex = ( -- r'([^\047"/\000-\040]+)|((?:(?:\047[^\047\\\r\n]*(?:\\(?:[^\r\n]' -- r'|\r?\n|\r)[^\047\\\r\n]*)*\047)|(?:"[^"\\\r\n]*(?:\\(?:[^\r\n]' -- r'|\r?\n|\r)[^"\\\r\n]*)*"))[^\047"/\000-\040]*)|(?<=[(,=:\[!&|?' -- r'{};\r\n])((?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/' -- r'*][^*]*\*+)*/))*(?:(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013' -- r'\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)*)((?:/(?!' -- r'[\r\n/*])[^/\\\[\r\n]*(?:(?:\\[^\r\n]|(?:\[[^\\\]\r\n]*(?:\\[^' -- r'\r\n][^\\\]\r\n]*)*\]))[^/\\\[\r\n]*)*/))((?:[\000-\011\013\01' -- r'4\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*(?:(?:(?://[^' -+ r'([^\047"\140/\000-\040]+)|((?:(?:\047[^\047\\\r\n]*(?:\\(?:[^' -+ r'\r\n]|\r?\n|\r)[^\047\\\r\n]*)*\047)|(?:"[^"\\\r\n]*(?:\\(?:[^' -+ r'\r\n]|\r?\n|\r)[^"\\\r\n]*)*")|(?:\140[^\140\\]*(?:\\(?:[^\r\n' -+ r']|\r?\n|\r)[^\140\\]*)*\140))[^\047"\140/\000-\040]*)|(?<=[)])' -+ r'((?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*' -+ r'+)*/))*(?:(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\014\016-' -+ r'\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)*)((?:/(?![\r\n/*])' -+ r'[^/\\\[\r\n]*(?:(?:\\[^\r\n]|(?:\[[^\\\]\r\n]*(?:\\[^\r\n][^' -+ r'\\\]\r\n]*)*\]))[^/\\\[\r\n]*)*/[a-z]*))(?=(?:[\000-\011\013\0' -+ r'14\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*(?:(?:(?://[^' - r'\r\n]*)?[\r\n])(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(' -- r'?:[^/*][^*]*\*+)*/))*)+(?=[^\000-\040&)+,.:;=?\]|}-]))?|(?<=[' -- r'\000-#%-,./:-@\[-^`{-~-]return)((?:[\000-\011\013\014\016-\040' -- r']|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*(?:((?:(?://[^\r\n]*)?[' -- r'\r\n]))(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][' -- r'^*]*\*+)*/))*)*)((?:/(?![\r\n/*])[^/\\\[\r\n]*(?:(?:\\[^\r\n]|' -- r'(?:\[[^\\\]\r\n]*(?:\\[^\r\n][^\\\]\r\n]*)*\]))[^/\\\[\r\n]*)*' -- r'/))((?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]' -- r'*\*+)*/))*(?:(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\014\01' -- r'6-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)+(?=[^\000-\040&)' -- r'+,.:;=?\]|}-]))?|(?<=[^\000-!#%&(*,./:-@\[\\^`{|~])((?:[\000-' -- r'\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*(?:' -- r'(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\014\016-\040]|(?:/' -- r'\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)+)(?=[^\000-\040"#%-\047)*,./' -- r':-@\\-^`|-~])|(?<=[^\000-#%-,./:-@\[-^`{-~-])((?:[\000-\011\01' -- r'3\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))+)(?=[^\000' -- r'-#%-,./:-@\[-^`{-~-])|(?<=\+)((?:[\000-\011\013\014\016-\040]|' -- r'(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))+)(?=\+)|(?<=-)((?:[\000-\0' -- r'11\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))+)(?=-' -- r')|((?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*' -- r'\*+)*/))+)|((?:(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\014' -- r'\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)+)' -+ r'?:[^/*][^*]*\*+)*/))*)*\.(?:[\000-\011\013\014\016-\040]|(?:/' -+ r'\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*(?:(?:(?://[^\r\n]*)?[\r\n])(?' -+ r':[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*' -+ r'/))*)*[a-z])|(?<=[(,=:\[!&|?{};\r\n+*-])((?:[\000-\011\013\014' -+ r'\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*(?:(?:(?://[^\r' -+ r'\n]*)?[\r\n])(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:' -+ r'[^/*][^*]*\*+)*/))*)*)((?:/(?![\r\n/*])[^/\\\[\r\n]*(?:(?:\\[^' -+ r'\r\n]|(?:\[[^\\\]\r\n]*(?:\\[^\r\n][^\\\]\r\n]*)*\]))[^/\\\[\r' -+ r'\n]*)*/[a-z]*))((?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+' -+ r'(?:[^/*][^*]*\*+)*/))*(?:(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\01' -+ r'1\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)+(?=[' -+ r'^\000-\040&)+,.:;=?\]|}-]))?|(?<=[\000-#%-,./:-@\[-^\140{-~-]r' -+ r'eturn)((?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][' -+ r'^*]*\*+)*/))*(?:((?:(?://[^\r\n]*)?[\r\n]))(?:[\000-\011\013\0' -+ r'14\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)*)((?:/(?![' -+ r'\r\n/*])[^/\\\[\r\n]*(?:(?:\\[^\r\n]|(?:\[[^\\\]\r\n]*(?:\\[^' -+ r'\r\n][^\\\]\r\n]*)*\]))[^/\\\[\r\n]*)*/[a-z]*))((?:[\000-\011' -+ r'\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*(?:(?:(' -+ r'?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\014\016-\040]|(?:/\*[^*' -+ r']*\*+(?:[^/*][^*]*\*+)*/))*)+(?=[^\000-\040&)+,.:;=?\]|}-]))?|' -+ r'(?<=[^\000-!#%&(*,./:-@\[\\^{|~])((?:[\000-\011\013\014\016-\0' -+ r'40]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*(?:(?:(?://[^\r\n]*)?[' -+ r'\r\n])(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^' -+ r'*]*\*+)*/))*)+)(?=[^\000-\040"#%-\047)*,./:-@\\-^\140|-~])|(?<' -+ r'=[^\000-#%-,./:-@\[-^\140{-~-])((?:[\000-\011\013\014\016-\040' -+ r']|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))+)(?=[^\000-#%-,./:-@\[-^' -+ r'\140{-~-])|(?<=\+)((?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*' -+ r'\*+(?:[^/*][^*]*\*+)*/))+)(?=\+)|(?<=-)((?:[\000-\011\013\014' -+ r'\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))+)(?=-)|((?:[\00' -+ r'0-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))+)' -+ r'|((?:(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\014\016-\040]|' -+ r'(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)+)' - ) - -- keep = _re.compile(( -+ keep = _re.compile( - r'[\000-\011\013\014\016-\040]+|(?:/\*(?!!)[^*]*\*+(?:[^/*][^*]*' - r'\*+)*/)+|(?:(?://[^\r\n]*)?[\r\n])+|((?:/\*![^*]*\*+(?:[^/*][^' - r'*]*\*+)*/)+)' -- ) % locals()).sub -+ ).sub - keeper = lambda m: m.groups()[0] or '' - - def subber(match): -@@ -473,27 +542,37 @@ def jsmin_for_posers(script, keep_bang_c - return ( - groups[0] or - groups[1] or -- (groups[3] and "%s%s%s%s" % ( -+ groups[3] and "%s%s" % ( - keep(keeper, groups[2]), - groups[3], -- keep(keeper, groups[4] or ''), -- groups[4] and '\n' or '', -- )) or -- (groups[7] and "%s%s%s%s%s" % ( -- keep(keeper, groups[5]), -+ ) or -+ groups[5] and "%s%s%s%s" % ( -+ keep(keeper, groups[4]), -+ groups[5], -+ keep(keeper, groups[6] or ''), - groups[6] and '\n' or '', -- groups[7], -- keep(keeper, groups[8] or ''), -+ ) or -+ groups[9] and "%s%s%s%s%s" % ( -+ keep(keeper, groups[7]), - groups[8] and '\n' or '', -- )) or -- (groups[9] and keep(keeper, groups[9] + '\n')) or -- (groups[10] and keep(keeper, groups[10]) or ' ') or -- (groups[11] and keep(keeper, groups[11]) or ' ') or -- (groups[12] and keep(keeper, groups[12]) or ' ') or -- keep(keeper, groups[13] or groups[14]) -+ groups[9], -+ keep(keeper, groups[10] or ''), -+ groups[10] and '\n' or '', -+ ) or -+ groups[11] and (keep(keeper, groups[11]) + '\n') or -+ groups[12] and (keep(keeper, groups[12]) or ' ') or -+ groups[13] and (keep(keeper, groups[13]) or ' ') or -+ groups[14] and (keep(keeper, groups[14]) or ' ') or -+ keep(keeper, groups[15] or groups[16]) - ) - -- return _re.sub(rex, subber, '\n%s\n' % script).strip() -+ is_bytes, script = _as_str(script) -+ script = _re.sub(rex, subber, '\n%s\n' % script).strip() -+ if is_bytes: -+ script = script.encode('latin-1') -+ if is_bytes == 2: -+ script = bytearray(script) -+ return script - - - if __name__ == '__main__': -diff -up chromium-103.0.5060.53/third_party/catapult/common/py_vulcanize/third_party/rjsmin/setup.py.12 chromium-103.0.5060.53/third_party/catapult/common/py_vulcanize/third_party/rjsmin/setup.py ---- chromium-103.0.5060.53/third_party/catapult/common/py_vulcanize/third_party/rjsmin/setup.py.12 2022-06-28 12:50:10.171324444 +0000 -+++ chromium-103.0.5060.53/third_party/catapult/common/py_vulcanize/third_party/rjsmin/setup.py 2021-11-05 17:03:12.000000000 +0000 -@@ -1,41 +1,264 @@ - #!/usr/bin/env python - # -*- coding: ascii -*- --# --# Copyright 2006 - 2013 --# Andr\xe9 Malo or his licensors, as applicable --# --# Licensed under the Apache License, Version 2.0 (the "License"); --# you may not use this file except in compliance with the License. --# You may obtain a copy of the License at --# --# http://www.apache.org/licenses/LICENSE-2.0 --# --# Unless required by applicable law or agreed to in writing, software --# distributed under the License is distributed on an "AS IS" BASIS, --# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --# See the License for the specific language governing permissions and --# limitations under the License. -+u""" -+:Copyright: - -+ Copyright 2011 - 2021 -+ Andr\xe9 Malo or his licensors, as applicable -+ -+:License: -+ -+ Licensed under the Apache License, Version 2.0 (the "License"); -+ you may not use this file except in compliance with the License. -+ You may obtain a copy of the License at -+ -+ http://www.apache.org/licenses/LICENSE-2.0 -+ -+ Unless required by applicable law or agreed to in writing, software -+ distributed under the License is distributed on an "AS IS" BASIS, -+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -+ See the License for the specific language governing permissions and -+ limitations under the License. -+ -+=========================================== -+ rJSmin - A Javascript Minifier For Python -+=========================================== -+ -+rJSmin - A Javascript Minifier For Python. -+""" -+from __future__ import print_function -+__author__ = u"Andr\xe9 Malo" -+__docformat__ = "restructuredtext en" -+ -+import os as _os -+import posixpath as _posixpath - import sys as _sys --from _setup import run - -+# pylint: disable = no-name-in-module, import-error, raise-missing-from -+import setuptools as _setuptools -+ -+# pylint: disable = invalid-name -+ -+ -+def _doc(filename): -+ """ Read docs file """ -+ # pylint: disable = unspecified-encoding -+ args = {} if str is bytes else dict(encoding='utf-8') -+ try: -+ with open(_os.path.join('docs', filename), **args) as fp: -+ return fp.read() -+ except IOError: -+ return None -+ -+ -+def _lines(multiline): -+ """ Split multiline string into single line % empty and comments """ -+ return [line for line in ( -+ line.strip() for line in multiline.splitlines(False) -+ ) if line and not line.startswith('#')] -+ -+ -+package = dict( -+ name='rjsmin', -+ top='.', -+ pathname='.', -+ provides=_doc('PROVIDES'), -+ desc=_doc('SUMMARY').strip(), -+ longdesc=_doc('DESCRIPTION'), -+ author=__author__, -+ email='nd@perlig.de', -+ license="Apache License, Version 2.0", -+ keywords=_lines(_doc('KEYWORDS')), -+ url='http://opensource.perlig.de/rjsmin/', -+ classifiers=_lines(_doc('CLASSIFIERS') or ''), -+ -+ packages=False, -+ py_modules=['rjsmin'], -+ version_file='rjsmin.py', -+ install_requires=[], -+) -+ -+ -+class BuildFailed(Exception): -+ """ The build has failed """ -+ -+ -+from distutils.command import build_ext as _build_ext # pylint: disable = wrong-import-order -+from distutils import errors as _errors # pylint: disable = wrong-import-order -+class build_ext(_build_ext.build_ext): # pylint: disable = no-init -+ """ Improved extension building code """ -+ -+ def run(self): -+ """ Unify exception """ -+ try: -+ _build_ext.build_ext.run(self) -+ except _errors.DistutilsPlatformError: -+ raise BuildFailed() -+ -+ -+ def build_extension(self, ext): -+ """ -+ Build C extension - with extended functionality - --def setup(args=None, _manifest=0): -- """ Main setup function """ -- from _setup.ext import Extension -+ The following features are added here: - -- if 'java' in _sys.platform.lower(): -- # no c extension for jython -- ext = None -+ - The macros ``EXT_PACKAGE`` and ``EXT_MODULE`` will be filled (or -+ unset) depending on the extensions name, but only if they are not -+ already defined. -+ -+ - "." is added to the include directories (for cext.h) -+ -+ :Parameters: -+ `ext` : `Extension` -+ The extension to build -+ -+ :Return: whatever ``distutils.command.build_ext.build_ext`` returns -+ :Rtype: any -+ """ -+ # handle name macros -+ macros = dict(ext.define_macros or ()) -+ tup = ext.name.split('.') -+ if len(tup) == 1: -+ pkg, mod = None, tup[0] -+ else: -+ pkg, mod = '.'.join(tup[:-1]), tup[-1] -+ if pkg is not None and 'EXT_PACKAGE' not in macros: -+ ext.define_macros.append(('EXT_PACKAGE', pkg)) -+ if 'EXT_MODULE' not in macros: -+ ext.define_macros.append(('EXT_MODULE', mod)) -+ if pkg is None: -+ macros = dict(ext.undef_macros or ()) -+ if 'EXT_PACKAGE' not in macros: -+ ext.undef_macros.append('EXT_PACKAGE') -+ -+ import pprint; pprint.pprint(ext.__dict__) -+ try: -+ return _build_ext.build_ext.build_extension(self, ext) -+ except (_errors.CCompilerError, _errors.DistutilsExecError, -+ _errors.DistutilsPlatformError, IOError, ValueError): -+ raise BuildFailed() -+ -+ -+class Extension(_setuptools.Extension): -+ """ improved functionality """ -+ -+ def __init__(self, *args, **kwargs): -+ """ Initialization """ -+ version = kwargs.pop('version') -+ self.depends = [] -+ if 'depends' in kwargs: -+ self.depends = kwargs['depends'] -+ _setuptools.Extension.__init__(self, *args, **kwargs) -+ self.define_macros.append(('EXT_VERSION', version)) -+ -+ # add include path -+ included = '.' -+ if included not in self.include_dirs: -+ self.include_dirs.append(included) -+ -+ # add cext.h to the dependencies -+ cext_h = _posixpath.normpath(_posixpath.join(included, 'cext.h')) -+ for item in self.depends: -+ if _posixpath.normpath(item) == cext_h: -+ break -+ else: -+ self.depends.append(cext_h) -+ -+ -+EXTENSIONS = lambda v: [Extension('_rjsmin', ["rjsmin.c"], version=v)] -+ -+ -+def do_setup(cext): -+ """ Main """ -+ # pylint: disable = too-many-branches -+ # pylint: disable = unspecified-encoding -+ -+ args = {} if str is bytes else dict(encoding='utf-8') -+ version_file = '%s/%s' % (package['pathname'], -+ package.get('version_file', '__init__.py')) -+ with open(version_file, **args) as fp: -+ for line in fp: # pylint: disable = redefined-outer-name -+ if line.startswith('__version__'): -+ version = line.split('=', 1)[1].strip() -+ if version.startswith(("'", '"')): -+ version = version[1:-1].strip() -+ break -+ else: -+ raise RuntimeError("Version not found") -+ -+ kwargs = {} -+ -+ if not cext or 'java' in _sys.platform.lower(): -+ extensions = [] - else: -- ext=[Extension('_rjsmin', sources=['rjsmin.c'])] -+ extensions = EXTENSIONS(version) -+ -+ if extensions: -+ if 'build_ext' in globals(): -+ kwargs.setdefault('cmdclass', {})['build_ext'] = build_ext -+ kwargs['ext_modules'] = extensions -+ -+ cflags = None -+ if _os.environ.get('CFLAGS') is None: -+ from distutils import ccompiler as _ccompiler -+ -+ compiler = _ccompiler.get_default_compiler() -+ try: -+ with open("debug.%s.cflags" % compiler) as fp: -+ cflags = ' '.join([ -+ line for line in (line.strip() for line in fp) -+ if line and not line.startswith('#') -+ ]).split() or None -+ except IOError: -+ pass -+ -+ if cflags: -+ gcov = 'coverage' in ' '.join(cflags) -+ for ext in extensions: -+ # pylint: disable = attribute-defined-outside-init -+ ext.extra_compile_args = \ -+ getattr(ext, 'extra_compile_args', []) + cflags -+ if gcov: -+ ext.libraries.append('gcov') -+ -+ -+ if package.get('packages', True): -+ kwargs['packages'] = [package['top']] + [ -+ '%s.%s' % (package['top'], item) -+ for item in -+ _setuptools.find_packages(package['pathname']) -+ ] -+ if package.get('py_modules'): -+ kwargs['py_modules'] = package['py_modules'] - -- return run(script_args=args, ext=ext, manifest_only=_manifest) -+ _setuptools.setup( -+ name=package['name'], -+ author=package['author'], -+ author_email=package['email'], -+ license=package['license'], -+ classifiers=package['classifiers'], -+ description=package['desc'], -+ long_description=package['longdesc'], -+ url=package['url'], -+ install_requires=package['install_requires'], -+ version=version, -+ zip_safe=False, -+ **kwargs -+ ) - - --def manifest(): -- """ Create List of packaged files """ -- return setup((), _manifest=1) -+def setup(): -+ """ Run setup """ -+ try: -+ do_setup(True) -+ except BuildFailed: -+ env = 'SETUP_CEXT_REQUIRED' -+ if _os.environ.get(env, '') not in ('', '0'): -+ raise -+ print("C extension build failed - building python only version now. " -+ "Set '%s' environment variable to '1' to make it fail." -+ % (env,), file=_sys.stderr) -+ do_setup(False) - - - if __name__ == '__main__': diff --git a/SOURCES/chromium-129-el8-atk-compiler-error.patch b/SOURCES/chromium-129-el8-atk-compiler-error.patch new file mode 100644 index 00000000..58e4cfbb --- /dev/null +++ b/SOURCES/chromium-129-el8-atk-compiler-error.patch @@ -0,0 +1,1083 @@ +diff -up chromium-129.0.6668.58/content/browser/accessibility/accessibility_auralinux_browsertest.cc.me chromium-129.0.6668.58/content/browser/accessibility/accessibility_auralinux_browsertest.cc +--- chromium-129.0.6668.58/content/browser/accessibility/accessibility_auralinux_browsertest.cc.me 2024-09-18 19:26:40.951100740 +0200 ++++ chromium-129.0.6668.58/content/browser/accessibility/accessibility_auralinux_browsertest.cc 2024-09-18 19:28:06.219700474 +0200 +@@ -3,6 +3,7 @@ + // found in the LICENSE file. + + #include ++#include + + #include + #include +@@ -547,6 +548,10 @@ IN_PROC_BROWSER_TEST_F(AccessibilityAura + g_object_unref(div_element); + } + ++#if defined(ATK_CHECK_VERSION) && ATK_CHECK_VERSION(2, 30, 0) ++#define ATK_230 ++#endif ++ + IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest, + TestCharacterExtentsWithInvalidArguments) { + AtkText* atk_text = SetUpSampleParagraph(); +@@ -569,12 +574,14 @@ IN_PROC_BROWSER_TEST_F(AccessibilityAura + EXPECT_EQ(expect, width); + EXPECT_EQ(expect, height); + ++#ifdef ATK_230 + atk_text_get_character_extents(atk_text, invalid_offset, &x, &y, &width, + &height, ATK_XY_PARENT); + EXPECT_EQ(expect, x); + EXPECT_EQ(expect, y); + EXPECT_EQ(expect, width); + EXPECT_EQ(expect, height); ++#endif // ATK_230 + + atk_text_get_character_extents(atk_text, invalid_offset, &x, &y, &width, + &height, ATK_XY_WINDOW); +@@ -593,12 +600,14 @@ IN_PROC_BROWSER_TEST_F(AccessibilityAura + EXPECT_EQ(expect, width); + EXPECT_EQ(expect, height); + ++#ifdef ATK_230 + atk_text_get_character_extents(atk_text, invalid_offset, &x, &y, &width, + &height, ATK_XY_PARENT); + EXPECT_EQ(expect, x); + EXPECT_EQ(expect, y); + EXPECT_EQ(expect, width); + EXPECT_EQ(expect, height); ++#endif // ATK_230 + + atk_text_get_character_extents(atk_text, invalid_offset, &x, &y, &width, + &height, ATK_XY_WINDOW); +@@ -613,7 +622,9 @@ IN_PROC_BROWSER_TEST_F(AccessibilityAura + AtkCoordType kCoordinateTypes[] = { + ATK_XY_SCREEN, + ATK_XY_WINDOW, ++#ifdef ATK_230 + ATK_XY_PARENT, ++#endif // ATK_230 + }; + + IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest, +@@ -872,6 +883,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityAura + TestCharacterExtentsInScrollableInput(); + } + ++#if defined(ATK_230) + typedef bool (*ScrollToPointFunc)(AtkComponent* component, + AtkCoordType coords, + gint x, +@@ -881,6 +893,18 @@ typedef bool (*ScrollToFunc)(AtkComponen + // TODO(crbug.com/40866728): Enable this test. + IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest, + DISABLED_TestScrollToPoint) { ++ // There's a chance we may be compiled with a newer version of ATK and then ++ // run with an older one, so we need to do a runtime check for this method ++ // that is available in ATK 2.30 instead of linking directly. ++ ScrollToPointFunc scroll_to_point = reinterpret_cast( ++ dlsym(RTLD_DEFAULT, "atk_component_scroll_to_point")); ++ if (!scroll_to_point) { ++ LOG(WARNING) ++ << "Skipping AccessibilityAuraLinuxBrowserTest::TestScrollToPoint" ++ " because ATK version < 2.30 detected."; ++ return; ++ } ++ + LoadSampleParagraphInScrollableDocument(); + AtkText* atk_text = GetSampleParagraph(); + ASSERT_TRUE(ATK_IS_COMPONENT(atk_text)); +@@ -893,7 +917,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityAura + AccessibilityNotificationWaiter location_changed_waiter( + shell()->web_contents(), ui::kAXModeComplete, + ax::mojom::Event::kLocationChanged); +- atk_component_scroll_to_point(atk_component, ATK_XY_PARENT, 0, 0); ++ scroll_to_point(atk_component, ATK_XY_PARENT, 0, 0); + ASSERT_TRUE(location_changed_waiter.WaitForNotification()); + + atk_component_get_extents(atk_component, &x, &y, nullptr, nullptr, +@@ -902,20 +926,20 @@ IN_PROC_BROWSER_TEST_F(AccessibilityAura + EXPECT_GT(prev_y, y); + + constexpr int kScrollToY = 0; +- atk_component_scroll_to_point(atk_component, ATK_XY_SCREEN, 0, kScrollToY); ++ scroll_to_point(atk_component, ATK_XY_SCREEN, 0, kScrollToY); + ASSERT_TRUE(location_changed_waiter.WaitForNotification()); + atk_component_get_extents(atk_component, &x, &y, nullptr, nullptr, + ATK_XY_SCREEN); + EXPECT_EQ(kScrollToY, y); + + constexpr int kScrollToY_2 = 243; +- atk_component_scroll_to_point(atk_component, ATK_XY_SCREEN, 0, kScrollToY_2); ++ scroll_to_point(atk_component, ATK_XY_SCREEN, 0, kScrollToY_2); + ASSERT_TRUE(location_changed_waiter.WaitForNotification()); + atk_component_get_extents(atk_component, nullptr, &y, nullptr, nullptr, + ATK_XY_SCREEN); + EXPECT_EQ(kScrollToY_2, y); + +- atk_component_scroll_to_point(atk_component, ATK_XY_SCREEN, 0, 129); ++ scroll_to_point(atk_component, ATK_XY_SCREEN, 0, 129); + ASSERT_TRUE(location_changed_waiter.WaitForNotification()); + atk_component_get_extents(atk_component, nullptr, &y, nullptr, nullptr, + ATK_XY_SCREEN); +@@ -932,6 +956,17 @@ IN_PROC_BROWSER_TEST_F(AccessibilityAura + // TODO(crbug.com/40866728): Enable this test. + IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest, + DISABLED_TestScrollTo) { ++ // There's a chance we may be compiled with a newer version of ATK and then ++ // run with an older one, so we need to do a runtime check for this method ++ // that is available in ATK 2.30 instead of linking directly. ++ ScrollToFunc scroll_to = reinterpret_cast( ++ dlsym(RTLD_DEFAULT, "atk_component_scroll_to")); ++ if (!scroll_to) { ++ LOG(WARNING) << "Skipping AccessibilityAuraLinuxBrowserTest::TestScrollTo" ++ " because ATK version < 2.30 detected."; ++ return; ++ } ++ + LoadInitialAccessibilityTreeFromHtml( + R"HTML( + +@@ -973,8 +1008,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityAura + AccessibilityNotificationWaiter waiter( + shell()->web_contents(), ui::kAXModeComplete, + ax::mojom::Event::kScrollPositionChanged); +- ASSERT_TRUE( +- atk_component_scroll_to(ATK_COMPONENT(target), ATK_SCROLL_TOP_EDGE)); ++ ASSERT_TRUE(scroll_to(ATK_COMPONENT(target), ATK_SCROLL_TOP_EDGE)); + ASSERT_TRUE(waiter.WaitForNotification()); + int x, y; + atk_component_get_extents(ATK_COMPONENT(target), &x, &y, nullptr, nullptr, +@@ -982,40 +1016,35 @@ IN_PROC_BROWSER_TEST_F(AccessibilityAura + EXPECT_EQ(y, doc_y); + EXPECT_NE(x, doc_x); + +- ASSERT_TRUE( +- atk_component_scroll_to(ATK_COMPONENT(target), ATK_SCROLL_TOP_LEFT)); ++ ASSERT_TRUE(scroll_to(ATK_COMPONENT(target), ATK_SCROLL_TOP_LEFT)); + ASSERT_TRUE(waiter.WaitForNotification()); + atk_component_get_extents(ATK_COMPONENT(target), &x, &y, nullptr, nullptr, + ATK_XY_SCREEN); + EXPECT_EQ(y, doc_y); + EXPECT_EQ(x, doc_x); + +- ASSERT_TRUE( +- atk_component_scroll_to(ATK_COMPONENT(target), ATK_SCROLL_BOTTOM_EDGE)); ++ ASSERT_TRUE(scroll_to(ATK_COMPONENT(target), ATK_SCROLL_BOTTOM_EDGE)); + ASSERT_TRUE(waiter.WaitForNotification()); + atk_component_get_extents(ATK_COMPONENT(target), &x, &y, nullptr, nullptr, + ATK_XY_SCREEN); + EXPECT_NE(y, doc_y); + EXPECT_EQ(x, doc_x); + +- ASSERT_TRUE( +- atk_component_scroll_to(ATK_COMPONENT(target), ATK_SCROLL_RIGHT_EDGE)); ++ ASSERT_TRUE(scroll_to(ATK_COMPONENT(target), ATK_SCROLL_RIGHT_EDGE)); + ASSERT_TRUE(waiter.WaitForNotification()); + atk_component_get_extents(ATK_COMPONENT(target), &x, &y, nullptr, nullptr, + ATK_XY_SCREEN); + EXPECT_NE(y, doc_y); + EXPECT_NE(x, doc_x); + +- ASSERT_TRUE( +- atk_component_scroll_to(ATK_COMPONENT(target2), ATK_SCROLL_LEFT_EDGE)); ++ ASSERT_TRUE(scroll_to(ATK_COMPONENT(target2), ATK_SCROLL_LEFT_EDGE)); + ASSERT_TRUE(waiter.WaitForNotification()); + atk_component_get_extents(ATK_COMPONENT(target2), &x, &y, nullptr, nullptr, + ATK_XY_SCREEN); + EXPECT_NE(y, doc_y); + EXPECT_EQ(x, doc_x); + +- ASSERT_TRUE( +- atk_component_scroll_to(ATK_COMPONENT(target2), ATK_SCROLL_TOP_LEFT)); ++ ASSERT_TRUE(scroll_to(ATK_COMPONENT(target2), ATK_SCROLL_TOP_LEFT)); + ASSERT_TRUE(waiter.WaitForNotification()); + atk_component_get_extents(ATK_COMPONENT(target2), &x, &y, nullptr, nullptr, + ATK_XY_SCREEN); +@@ -1047,10 +1076,39 @@ IN_PROC_BROWSER_TEST_F(AccessibilityAura + g_object_unref(target2); + g_object_unref(target3); + } ++#endif // defined(ATK_230) ++ ++#if defined(ATK_CHECK_VERSION) && ATK_CHECK_VERSION(2, 32, 0) ++typedef gboolean (*ScrollSubstringToFunc)(AtkText* text, ++ gint start_offset, ++ gint end_offset, ++ AtkScrollType type); ++ScrollSubstringToFunc g_scroll_substring_to = nullptr; ++ ++NO_SANITIZE("cfi-icall") ++gboolean ScrollSubstringTo(AtkText* text, ++ gint start_offset, ++ gint end_offset, ++ AtkScrollType type) { ++ EXPECT_NE(g_scroll_substring_to, nullptr); ++ return g_scroll_substring_to(text, start_offset, end_offset, type); ++} + + // TODO(crbug.com/40866728): Enable this test. + IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest, + DISABLED_TestScrollSubstringTo) { ++ // There's a chance we may be compiled with a newer version of ATK and then ++ // run with an older one, so we need to do a runtime check for this method ++ // that is available in ATK 2.32 instead of linking directly. ++ g_scroll_substring_to = reinterpret_cast( ++ dlsym(RTLD_DEFAULT, "atk_text_scroll_substring_to")); ++ if (!g_scroll_substring_to) { ++ LOG(WARNING) << "Skipping " ++ "AccessibilityAuraLinuxBrowserTest::TestSubstringScrollTo" ++ " because ATK version < 2.32 detected."; ++ return; ++ } ++ + LoadInitialAccessibilityTreeFromHtml( + R"HTML( + +@@ -1084,8 +1142,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityAura + AccessibilityNotificationWaiter waiter( + shell()->web_contents(), ui::kAXModeComplete, + ax::mojom::Event::kScrollPositionChanged); +- ASSERT_TRUE(atk_text_scroll_substring_to(ATK_TEXT(target1), 1, 2, +- ATK_SCROLL_TOP_EDGE)); ++ ASSERT_TRUE(ScrollSubstringTo(ATK_TEXT(target1), 1, 2, ATK_SCROLL_TOP_EDGE)); + ASSERT_TRUE(waiter.WaitForNotification()); + int x, y; + atk_text_get_character_extents(ATK_TEXT(target1), 1, &x, &y, nullptr, nullptr, +@@ -1093,40 +1150,37 @@ IN_PROC_BROWSER_TEST_F(AccessibilityAura + EXPECT_EQ(y, doc_y); + EXPECT_NE(x, doc_x); + +- ASSERT_TRUE(atk_text_scroll_substring_to(ATK_TEXT(target1), 1, 2, +- ATK_SCROLL_TOP_LEFT)); ++ ASSERT_TRUE(ScrollSubstringTo(ATK_TEXT(target1), 1, 2, ATK_SCROLL_TOP_LEFT)); + ASSERT_TRUE(waiter.WaitForNotification()); + atk_text_get_character_extents(ATK_TEXT(target1), 1, &x, &y, nullptr, nullptr, + ATK_XY_SCREEN); + EXPECT_EQ(y, doc_y); + EXPECT_EQ(x, doc_x); + +- ASSERT_TRUE(atk_text_scroll_substring_to(ATK_TEXT(target1), 1, 2, +- ATK_SCROLL_BOTTOM_EDGE)); ++ ASSERT_TRUE( ++ ScrollSubstringTo(ATK_TEXT(target1), 1, 2, ATK_SCROLL_BOTTOM_EDGE)); + ASSERT_TRUE(waiter.WaitForNotification()); + atk_text_get_character_extents(ATK_TEXT(target1), 1, &x, &y, nullptr, nullptr, + ATK_XY_SCREEN); + EXPECT_NE(y, doc_y); + EXPECT_EQ(x, doc_x); + +- ASSERT_TRUE(atk_text_scroll_substring_to(ATK_TEXT(target1), 1, 2, +- ATK_SCROLL_RIGHT_EDGE)); ++ ASSERT_TRUE( ++ ScrollSubstringTo(ATK_TEXT(target1), 1, 2, ATK_SCROLL_RIGHT_EDGE)); + ASSERT_TRUE(waiter.WaitForNotification()); + atk_text_get_character_extents(ATK_TEXT(target1), 1, &x, &y, nullptr, nullptr, + ATK_XY_SCREEN); + EXPECT_NE(y, doc_y); + EXPECT_NE(x, doc_x); + +- ASSERT_TRUE(atk_text_scroll_substring_to(ATK_TEXT(target1), 1, 2, +- ATK_SCROLL_LEFT_EDGE)); ++ ASSERT_TRUE(ScrollSubstringTo(ATK_TEXT(target1), 1, 2, ATK_SCROLL_LEFT_EDGE)); + ASSERT_TRUE(waiter.WaitForNotification()); + atk_text_get_character_extents(ATK_TEXT(target1), 1, &x, &y, nullptr, nullptr, + ATK_XY_SCREEN); + EXPECT_NE(y, doc_y); + EXPECT_EQ(x, doc_x); + +- ASSERT_TRUE(atk_text_scroll_substring_to(ATK_TEXT(target1), 1, 2, +- ATK_SCROLL_TOP_LEFT)); ++ ASSERT_TRUE(ScrollSubstringTo(ATK_TEXT(target1), 1, 2, ATK_SCROLL_TOP_LEFT)); + ASSERT_TRUE(waiter.WaitForNotification()); + atk_text_get_character_extents(ATK_TEXT(target1), 1, &x, &y, nullptr, nullptr, + ATK_XY_SCREEN); +@@ -1136,9 +1190,42 @@ IN_PROC_BROWSER_TEST_F(AccessibilityAura + g_object_unref(target1); + } + ++typedef gboolean (*ScrollSubstringToPointFunc)(AtkText* text, ++ gint start_offset, ++ gint end_offset, ++ AtkCoordType coord_type, ++ gint x, ++ gint y); ++ScrollSubstringToPointFunc g_scroll_substring_to_point = nullptr; ++ ++NO_SANITIZE("cfi-icall") ++gboolean ScrollSubstringToPoint(AtkText* text, ++ gint start_offset, ++ gint end_offset, ++ AtkCoordType coord_type, ++ gint x, ++ gint y) { ++ EXPECT_NE(g_scroll_substring_to_point, nullptr); ++ return g_scroll_substring_to_point(text, start_offset, end_offset, coord_type, ++ x, y); ++} ++ + // TODO(crbug.com/40866728): Enable this test. + IN_PROC_BROWSER_TEST_F(AccessibilityAuraLinuxBrowserTest, + DISABLED_TestScrollSubstringToPoint) { ++ // There's a chance we may be compiled with a newer version of ATK and then ++ // run with an older one, so we need to do a runtime check for this method ++ // that is available in ATK 2.30 instead of linking directly. ++ g_scroll_substring_to_point = reinterpret_cast( ++ dlsym(RTLD_DEFAULT, "atk_text_scroll_substring_to_point")); ++ if (!g_scroll_substring_to_point) { ++ LOG(WARNING) ++ << "Skipping " ++ "AccessibilityAuraLinuxBrowserTest::TestScrollSubstringToPoint" ++ " because ATK version < 2.30 detected."; ++ return; ++ } ++ + LoadSampleParagraphInScrollableDocument(); + AtkText* atk_text = GetSampleParagraph(); + ASSERT_TRUE(ATK_IS_COMPONENT(atk_text)); +@@ -1151,7 +1238,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityAura + AccessibilityNotificationWaiter location_changed_waiter( + shell()->web_contents(), ui::kAXModeComplete, + ax::mojom::Event::kLocationChanged); +- atk_text_scroll_substring_to_point(atk_text, 1, 2, ATK_XY_PARENT, 0, 0); ++ ScrollSubstringToPoint(atk_text, 1, 2, ATK_XY_PARENT, 0, 0); + ASSERT_TRUE(location_changed_waiter.WaitForNotification()); + + atk_text_get_character_extents(atk_text, 1, &x, &y, nullptr, nullptr, +@@ -1160,22 +1247,20 @@ IN_PROC_BROWSER_TEST_F(AccessibilityAura + EXPECT_GT(prev_y, y); + + constexpr int kScrollToY = 0; +- atk_text_scroll_substring_to_point(atk_text, 1, 2, ATK_XY_SCREEN, 0, +- kScrollToY); ++ ScrollSubstringToPoint(atk_text, 1, 2, ATK_XY_SCREEN, 0, kScrollToY); + ASSERT_TRUE(location_changed_waiter.WaitForNotification()); + atk_text_get_character_extents(atk_text, 1, &x, &y, nullptr, nullptr, + ATK_XY_SCREEN); + EXPECT_EQ(kScrollToY, y); + + constexpr int kScrollToY_2 = 243; +- atk_text_scroll_substring_to_point(atk_text, 1, 2, ATK_XY_SCREEN, 0, +- kScrollToY_2); ++ ScrollSubstringToPoint(atk_text, 1, 2, ATK_XY_SCREEN, 0, kScrollToY_2); + ASSERT_TRUE(location_changed_waiter.WaitForNotification()); + atk_text_get_character_extents(atk_text, 1, &x, &y, nullptr, nullptr, + ATK_XY_SCREEN); + EXPECT_EQ(kScrollToY_2, y); + +- atk_text_scroll_substring_to_point(atk_text, 1, 2, ATK_XY_SCREEN, 0, 129); ++ ScrollSubstringToPoint(atk_text, 1, 2, ATK_XY_SCREEN, 0, 129); + ASSERT_TRUE(location_changed_waiter.WaitForNotification()); + atk_text_get_character_extents(atk_text, 1, &x, &y, nullptr, nullptr, + ATK_XY_SCREEN); +@@ -1191,6 +1276,7 @@ IN_PROC_BROWSER_TEST_F(AccessibilityAura + + g_object_unref(atk_text); + } ++#endif // defined(ATK_CHECK_VERSION) && ATK_CHECK_VERSION(2, 32, 0) + + #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) + // Flaky on crbug.com/1026149 +diff -up chromium-129.0.6668.58/ui/accessibility/platform/ax_platform_node_auralinux.cc.me chromium-129.0.6668.58/ui/accessibility/platform/ax_platform_node_auralinux.cc +--- chromium-129.0.6668.58/ui/accessibility/platform/ax_platform_node_auralinux.cc.me 2024-09-18 19:26:26.040821017 +0200 ++++ chromium-129.0.6668.58/ui/accessibility/platform/ax_platform_node_auralinux.cc 2024-09-18 19:28:06.220700493 +0200 +@@ -2,7 +2,6 @@ + // Use of this source code is governed by a BSD-style license that can be + // found in the LICENSE file. + +-#include "base/version.h" + #ifdef UNSAFE_BUFFERS_BUILD + // TODO(crbug.com/40285824): Remove this and convert code to safer constructs. + #pragma allow_unsafe_buffers +@@ -10,6 +9,7 @@ + + #include "ui/accessibility/platform/ax_platform_node_auralinux.h" + ++#include + #include + + #include +@@ -47,14 +47,33 @@ + #include "ui/accessibility/platform/child_iterator.h" + #include "ui/gfx/geometry/rect_conversions.h" + +-// Function availability can be tested by checking whether its address is not +-// nullptr. +-#define WEAK_ATK_FN(x) extern "C" __attribute__((weak)) decltype(x) x +- +-// TODO(https://crbug.com/40549424): This may be removed when support for +-// Ubuntu 18.04 is dropped. +-WEAK_ATK_FN(atk_component_scroll_to_point); +-WEAK_ATK_FN(atk_text_scroll_substring_to_point); ++#if defined(ATK_CHECK_VERSION) && ATK_CHECK_VERSION(2, 10, 0) ++#define ATK_210 ++#endif ++ ++#if defined(ATK_CHECK_VERSION) && ATK_CHECK_VERSION(2, 12, 0) ++#define ATK_212 ++#endif ++ ++#if defined(ATK_CHECK_VERSION) && ATK_CHECK_VERSION(2, 16, 0) ++#define ATK_216 ++#endif ++ ++#if defined(ATK_CHECK_VERSION) && ATK_CHECK_VERSION(2, 26, 0) ++#define ATK_226 ++#endif ++ ++#if defined(ATK_CHECK_VERSION) && ATK_CHECK_VERSION(2, 30, 0) ++#define ATK_230 ++#endif ++ ++#if defined(ATK_CHECK_VERSION) && ATK_CHECK_VERSION(2, 32, 0) ++#define ATK_232 ++#endif ++ ++#if defined(ATK_CHECK_VERSION) && ATK_CHECK_VERSION(2, 34, 0) ++#define ATK_234 ++#endif + + namespace ui { + +@@ -146,11 +165,29 @@ AtkObject* g_active_top_level_frame = nu + + AtkObject* g_active_views_dialog = nullptr; + ++#if defined(ATK_216) + constexpr AtkRole kStaticRole = ATK_ROLE_STATIC; + constexpr AtkRole kSubscriptRole = ATK_ROLE_SUBSCRIPT; + constexpr AtkRole kSuperscriptRole = ATK_ROLE_SUPERSCRIPT; ++#else ++constexpr AtkRole kStaticRole = ATK_ROLE_TEXT; ++constexpr AtkRole kSubscriptRole = ATK_ROLE_TEXT; ++constexpr AtkRole kSuperscriptRole = ATK_ROLE_TEXT; ++#endif + ++#if defined(ATK_226) + constexpr AtkRole kAtkFootnoteRole = ATK_ROLE_FOOTNOTE; ++#else ++constexpr AtkRole kAtkFootnoteRole = ATK_ROLE_LIST_ITEM; ++#endif ++ ++#if defined(ATK_234) ++constexpr AtkRole kAtkRoleContentDeletion = ATK_ROLE_CONTENT_DELETION; ++constexpr AtkRole kAtkRoleContentInsertion = ATK_ROLE_CONTENT_INSERTION; ++#else ++constexpr AtkRole kAtkRoleContentDeletion = ATK_ROLE_SECTION; ++constexpr AtkRole kAtkRoleContentInsertion = ATK_ROLE_SECTION; ++#endif + + using GetTypeFunc = GType (*)(); + using GetColumnHeaderCellsFunc = GPtrArray* (*)(AtkTableCell* cell); +@@ -161,6 +198,11 @@ using GetRowColumnSpanFunc = bool (*)(At + gint* row_span, + gint* col_span); + ++static GetTypeFunc g_atk_table_cell_get_type; ++static GetColumnHeaderCellsFunc g_atk_table_cell_get_column_header_cells; ++static GetRowHeaderCellsFunc g_atk_table_cell_get_row_header_cells; ++static GetRowColumnSpanFunc g_atk_table_cell_get_row_column_span; ++ + // The ATK API often requires pointers to be used as out arguments, while + // allowing for those pointers to be null if the caller is not interested in + // the value. This function is a simpler helper to avoid continually checking +@@ -170,35 +212,17 @@ void SetIntPointerValueIfNotNull(int* po + *pointer = value; + } + +-// TODO(https://crbug.com/40549424): This may be removed when support for +-// Ubuntu 18.04 is dropped. ++#if defined(ATK_230) + bool SupportsAtkComponentScrollingInterface() { +- return atk_component_scroll_to_point; ++ return dlsym(RTLD_DEFAULT, "atk_component_scroll_to_point"); + } ++#endif + +-// TODO(https://crbug.com/40549424): This may be removed when support for +-// Ubuntu 18.04 is dropped. ++#if defined(ATK_232) + bool SupportsAtkTextScrollingInterface() { +- return atk_text_scroll_substring_to_point; +-} +- +-// TODO(https://crbug.com/40549424): This may be removed when support for +-// Ubuntu 18.04 is dropped. +-AtkRole GetAtkRoleContentDeletion() { +- base::Version atk_version(atk_get_version()); +- return atk_version.CompareTo(base::Version("2.34.0")) >= 0 +- ? ATK_ROLE_CONTENT_DELETION +- : ATK_ROLE_SECTION; +-} +- +-// TODO(https://crbug.com/40549424): This may be removed when support for +-// Ubuntu 18.04 is dropped. +-AtkRole GetAtkRoleContentInsertion() { +- base::Version atk_version(atk_get_version()); +- return atk_version.CompareTo(base::Version("2.34.0")) >= 0 +- ? ATK_ROLE_CONTENT_INSERTION +- : ATK_ROLE_SECTION; ++ return dlsym(RTLD_DEFAULT, "atk_text_scroll_substring_to_point"); + } ++#endif + + AtkObject* FindAtkObjectParentFrame(AtkObject* atk_object) { + AXPlatformNodeAuraLinux* node = +@@ -297,10 +321,12 @@ AXCoordinateSystem AtkCoordTypeToAXCoord + return AXCoordinateSystem::kScreenDIPs; + case ATK_XY_WINDOW: + return AXCoordinateSystem::kRootFrame; ++#if defined(ATK_230) + case ATK_XY_PARENT: + // AXCoordinateSystem does not support parent coordinates. + NOTIMPLEMENTED(); + return AXCoordinateSystem::kFrame; ++#endif + default: + return AXCoordinateSystem::kScreenDIPs; + } +@@ -513,6 +539,7 @@ gboolean GrabFocus(AtkComponent* atk_com + return obj->GrabFocus(); + } + ++#if defined(ATK_230) + gboolean ScrollTo(AtkComponent* atk_component, AtkScrollType scroll_type) { + g_return_val_if_fail(ATK_IS_COMPONENT(atk_component), FALSE); + +@@ -539,6 +566,7 @@ gboolean ScrollToPoint(AtkComponent* atk + obj->ScrollToPoint(atk_coord_type, x, y); + return TRUE; + } ++#endif + + void Init(AtkComponentIface* iface) { + iface->get_extents = GetExtents; +@@ -546,10 +574,12 @@ void Init(AtkComponentIface* iface) { + iface->get_size = GetSize; + iface->ref_accessible_at_point = RefAccesibleAtPoint; + iface->grab_focus = GrabFocus; ++#if defined(ATK_230) + if (SupportsAtkComponentScrollingInterface()) { + iface->scroll_to = ScrollTo; + iface->scroll_to_point = ScrollToPoint; + } ++#endif + } + + const GInterfaceInfo Info = {reinterpret_cast(Init), +@@ -1232,6 +1262,7 @@ gboolean AddSelection(AtkText* atk_text, + return SetSelection(atk_text, 0, start_offset, end_offset); + } + ++#if defined(ATK_210) + char* GetStringAtOffset(AtkText* atk_text, + int offset, + AtkTextGranularity atk_granularity, +@@ -1246,7 +1277,9 @@ char* GetStringAtOffset(AtkText* atk_tex + return GetTextWithBoundaryType(atk_text, offset, boundary, start_offset, + end_offset); + } ++#endif + ++#if defined(ATK_230) + gfx::Rect GetUnclippedParentHypertextRangeBoundsRect( + AXPlatformNodeDelegate* ax_platform_node_delegate, + const int start_offset, +@@ -1270,6 +1303,7 @@ gfx::Rect GetUnclippedParentHypertextRan + AXClippingBehavior::kClipped) + .OffsetFromOrigin(); + } ++#endif + + void GetCharacterExtents(AtkText* atk_text, + int offset, +@@ -1285,10 +1319,12 @@ void GetCharacterExtents(AtkText* atk_te + AXPlatformNodeAuraLinux::FromAtkObject(ATK_OBJECT(atk_text)); + if (obj) { + switch (coordinate_type) { ++#if defined(ATK_230) + case ATK_XY_PARENT: + rect = GetUnclippedParentHypertextRangeBoundsRect(obj->GetDelegate(), + offset, offset + 1); + break; ++#endif + default: + rect = obj->GetDelegate()->GetHypertextRangeBoundsRect( + obj->UnicodeToUTF16OffsetInText(offset), +@@ -1324,10 +1360,12 @@ void GetRangeExtents(AtkText* atk_text, + AXPlatformNodeAuraLinux::FromAtkObject(ATK_OBJECT(atk_text)); + if (obj) { + switch (coordinate_type) { ++#if defined(ATK_230) + case ATK_XY_PARENT: + rect = GetUnclippedParentHypertextRangeBoundsRect( + obj->GetDelegate(), start_offset, end_offset); + break; ++#endif + default: + rect = obj->GetDelegate()->GetHypertextRangeBoundsRect( + obj->UnicodeToUTF16OffsetInText(start_offset), +@@ -1377,6 +1415,7 @@ AtkAttributeSet* GetDefaultAttributes(At + return ToAtkAttributeSet(obj->GetDefaultTextAttributes()); + } + ++#if defined(ATK_232) + gboolean ScrollSubstringTo(AtkText* atk_text, + gint start_offset, + gint end_offset, +@@ -1407,6 +1446,7 @@ gboolean ScrollSubstringToPoint(AtkText* + return obj->ScrollSubstringToPoint(start_offset, end_offset, atk_coord_type, + x, y); + } ++#endif // ATK_232 + + void Init(AtkTextIface* iface) { + iface->get_text = GetText; +@@ -1429,12 +1469,16 @@ void Init(AtkTextIface* iface) { + iface->get_run_attributes = GetRunAttributes; + iface->get_default_attributes = GetDefaultAttributes; + ++#if defined(ATK_210) + iface->get_string_at_offset = GetStringAtOffset; ++#endif + ++#if defined(ATK_232) + if (SupportsAtkTextScrollingInterface()) { + iface->scroll_substring_to = ScrollSubstringTo; + iface->scroll_substring_to_point = ScrollSubstringToPoint; + } ++#endif + } + + const GInterfaceInfo Info = {reinterpret_cast(Init), +@@ -1837,11 +1881,15 @@ const GInterfaceInfo Info = {reinterpret + + } // namespace atk_table + ++// The ATK table cell interface was added in ATK 2.12. ++#if defined(ATK_212) ++ + namespace atk_table_cell { + + gint GetColumnSpan(AtkTableCell* cell) { ++ DCHECK(g_atk_table_cell_get_type); + g_return_val_if_fail( +- G_TYPE_CHECK_INSTANCE_TYPE((cell), atk_table_cell_get_type()), 0); ++ G_TYPE_CHECK_INSTANCE_TYPE((cell), AtkTableCellInterface::GetType()), 0); + + if (const AXPlatformNodeBase* obj = + AXPlatformNodeAuraLinux::FromAtkObject(ATK_OBJECT(cell))) { +@@ -1853,8 +1901,10 @@ gint GetColumnSpan(AtkTableCell* cell) { + } + + GPtrArray* GetColumnHeaderCells(AtkTableCell* cell) { ++ DCHECK(g_atk_table_cell_get_type); + g_return_val_if_fail( +- G_TYPE_CHECK_INSTANCE_TYPE((cell), atk_table_cell_get_type()), nullptr); ++ G_TYPE_CHECK_INSTANCE_TYPE((cell), AtkTableCellInterface::GetType()), ++ nullptr); + + GPtrArray* array = g_ptr_array_new_with_free_func(g_object_unref); + +@@ -1888,8 +1938,10 @@ GPtrArray* GetColumnHeaderCells(AtkTable + } + + gboolean GetCellPosition(AtkTableCell* cell, gint* row, gint* column) { ++ DCHECK(g_atk_table_cell_get_type); + g_return_val_if_fail( +- G_TYPE_CHECK_INSTANCE_TYPE((cell), atk_table_cell_get_type()), FALSE); ++ G_TYPE_CHECK_INSTANCE_TYPE((cell), AtkTableCellInterface::GetType()), ++ FALSE); + + if (auto* obj = AXPlatformNodeAuraLinux::FromAtkObject(ATK_OBJECT(cell))) { + std::optional row_index = obj->GetTableRow(); +@@ -1906,8 +1958,9 @@ gboolean GetCellPosition(AtkTableCell* c + } + + gint GetRowSpan(AtkTableCell* cell) { ++ DCHECK(g_atk_table_cell_get_type); + g_return_val_if_fail( +- G_TYPE_CHECK_INSTANCE_TYPE((cell), atk_table_cell_get_type()), 0); ++ G_TYPE_CHECK_INSTANCE_TYPE((cell), AtkTableCellInterface::GetType()), 0); + + if (auto* obj = AXPlatformNodeAuraLinux::FromAtkObject(ATK_OBJECT(cell))) { + // If the object is not a cell, we return 0. +@@ -1918,8 +1971,10 @@ gint GetRowSpan(AtkTableCell* cell) { + } + + GPtrArray* GetRowHeaderCells(AtkTableCell* cell) { ++ DCHECK(g_atk_table_cell_get_type); + g_return_val_if_fail( +- G_TYPE_CHECK_INSTANCE_TYPE((cell), atk_table_cell_get_type()), nullptr); ++ G_TYPE_CHECK_INSTANCE_TYPE((cell), AtkTableCellInterface::GetType()), ++ nullptr); + + GPtrArray* array = g_ptr_array_new_with_free_func(g_object_unref); + +@@ -1953,8 +2008,10 @@ GPtrArray* GetRowHeaderCells(AtkTableCel + } + + AtkObject* GetTable(AtkTableCell* cell) { ++ DCHECK(g_atk_table_cell_get_type); + g_return_val_if_fail( +- G_TYPE_CHECK_INSTANCE_TYPE((cell), atk_table_cell_get_type()), nullptr); ++ G_TYPE_CHECK_INSTANCE_TYPE((cell), AtkTableCellInterface::GetType()), ++ nullptr); + + if (auto* obj = AXPlatformNodeAuraLinux::FromAtkObject(ATK_OBJECT(cell))) { + if (auto* table = obj->GetTable()) +@@ -1980,6 +2037,8 @@ const GInterfaceInfo Info = {reinterpret + + } // namespace atk_table_cell + ++#endif // ATK_212 ++ + namespace atk_object { + + gpointer kAXPlatformNodeAuraLinuxParentClass = nullptr; +@@ -2246,6 +2305,50 @@ void Detach(AXPlatformNodeAuraLinuxObjec + + } // namespace + ++// static ++NO_SANITIZE("cfi-icall") ++GType AtkTableCellInterface::GetType() { ++ return g_atk_table_cell_get_type(); ++} ++ ++// static ++NO_SANITIZE("cfi-icall") ++GPtrArray* AtkTableCellInterface::GetColumnHeaderCells(AtkTableCell* cell) { ++ return g_atk_table_cell_get_column_header_cells(cell); ++} ++ ++// static ++NO_SANITIZE("cfi-icall") ++GPtrArray* AtkTableCellInterface::GetRowHeaderCells(AtkTableCell* cell) { ++ return g_atk_table_cell_get_row_header_cells(cell); ++} ++ ++// static ++NO_SANITIZE("cfi-icall") ++bool AtkTableCellInterface::GetRowColumnSpan(AtkTableCell* cell, ++ gint* row, ++ gint* column, ++ gint* row_span, ++ gint* col_span) { ++ return g_atk_table_cell_get_row_column_span(cell, row, column, row_span, ++ col_span); ++} ++ ++// static ++bool AtkTableCellInterface::Exists() { ++ g_atk_table_cell_get_type = reinterpret_cast( ++ dlsym(RTLD_DEFAULT, "atk_table_cell_get_type")); ++ g_atk_table_cell_get_column_header_cells = ++ reinterpret_cast( ++ dlsym(RTLD_DEFAULT, "atk_table_cell_get_column_header_cells")); ++ g_atk_table_cell_get_row_header_cells = ++ reinterpret_cast( ++ dlsym(RTLD_DEFAULT, "atk_table_cell_get_row_header_cells")); ++ g_atk_table_cell_get_row_column_span = reinterpret_cast( ++ dlsym(RTLD_DEFAULT, "atk_table_cell_get_row_column_span")); ++ return *g_atk_table_cell_get_type; ++} ++ + void AXPlatformNodeAuraLinux::EnsureGTypeInit() { + #if !GLIB_CHECK_VERSION(2, 36, 0) + static bool first_time = true; +@@ -2353,8 +2456,11 @@ GType AXPlatformNodeAuraLinux::GetAccess + g_type_add_interface_static(type, ATK_TYPE_TABLE, &atk_table::Info); + + if (interface_mask_.Implements(ImplementedAtkInterfaces::Value::kTableCell)) { +- g_type_add_interface_static(type, atk_table_cell_get_type(), +- &atk_table_cell::Info); ++ // Run-time check to ensure AtkTableCell is supported (requires ATK 2.12). ++ if (AtkTableCellInterface::Exists()) { ++ g_type_add_interface_static(type, AtkTableCellInterface::GetType(), ++ &atk_table_cell::Info); ++ } + } + + return type; +@@ -2584,9 +2690,9 @@ AtkRole AXPlatformNodeAuraLinux::GetAtkR + case ax::mojom::Role::kComplementary: + return ATK_ROLE_LANDMARK; + case ax::mojom::Role::kContentDeletion: +- return GetAtkRoleContentDeletion(); ++ return kAtkRoleContentDeletion; + case ax::mojom::Role::kContentInsertion: +- return GetAtkRoleContentInsertion(); ++ return kAtkRoleContentInsertion; + case ax::mojom::Role::kContentInfo: + case ax::mojom::Role::kFooter: + return ATK_ROLE_LANDMARK; +@@ -3020,12 +3126,14 @@ void AXPlatformNodeAuraLinux::GetAtkStat + static_cast(ax::mojom::AriaCurrentState::kFalse)) { + atk_state_set_add_state(atk_state_set, ATK_STATE_ACTIVE); + } ++#if defined(ATK_216) + // Runtime checks in case we were compiled with a newer version of ATK. + if (IsPlatformCheckable() && PlatformSupportsState(ATK_STATE_CHECKABLE)) + atk_state_set_add_state(atk_state_set, ATK_STATE_CHECKABLE); + if (HasIntAttribute(ax::mojom::IntAttribute::kHasPopup) && + PlatformSupportsState(ATK_STATE_HAS_POPUP)) + atk_state_set_add_state(atk_state_set, ATK_STATE_HAS_POPUP); ++#endif + if (GetBoolAttribute(ax::mojom::BoolAttribute::kBusy)) + atk_state_set_add_state(atk_state_set, ATK_STATE_BUSY); + if (GetBoolAttribute(ax::mojom::BoolAttribute::kModal)) +@@ -3064,9 +3172,11 @@ void AXPlatformNodeAuraLinux::GetAtkStat + if (GetData().GetRestriction() != ax::mojom::Restriction::kDisabled) { + if (GetDelegate()->IsReadOnlySupported() && + GetDelegate()->IsReadOnlyOrDisabled()) { ++#if defined(ATK_216) + // Runtime check in case we were compiled with a newer version of ATK. + if (PlatformSupportsState(ATK_STATE_READ_ONLY)) + atk_state_set_add_state(atk_state_set, ATK_STATE_READ_ONLY); ++#endif + } else { + atk_state_set_add_state(atk_state_set, ATK_STATE_ENABLED); + atk_state_set_add_state(atk_state_set, ATK_STATE_SENSITIVE); +@@ -3100,12 +3210,16 @@ struct AtkIntListRelation { + static AtkIntListRelation kIntListRelations[] = { + {ax::mojom::IntListAttribute::kControlsIds, ATK_RELATION_CONTROLLER_FOR, + ATK_RELATION_CONTROLLED_BY}, ++#if defined(ATK_226) + {ax::mojom::IntListAttribute::kDetailsIds, ATK_RELATION_DETAILS, + ATK_RELATION_DETAILS_FOR}, ++#endif + {ax::mojom::IntListAttribute::kDescribedbyIds, ATK_RELATION_DESCRIBED_BY, + ATK_RELATION_DESCRIPTION_FOR}, ++#if defined(ATK_226) + {ax::mojom::IntListAttribute::kErrormessageIds, ATK_RELATION_ERROR_MESSAGE, + ATK_RELATION_ERROR_FOR}, ++#endif + {ax::mojom::IntListAttribute::kFlowtoIds, ATK_RELATION_FLOWS_TO, + ATK_RELATION_FLOWS_FROM}, + {ax::mojom::IntListAttribute::kLabelledbyIds, ATK_RELATION_LABELLED_BY, +@@ -3884,6 +3998,7 @@ void AXPlatformNodeAuraLinux::OnReadonly + if (!obj) + return; + ++#if defined(ATK_216) + // Runtime check in case we were compiled with a newer version of ATK. + if (!PlatformSupportsState(ATK_STATE_READ_ONLY)) + return; +@@ -3891,6 +4006,7 @@ void AXPlatformNodeAuraLinux::OnReadonly + atk_object_notify_state_change( + obj, ATK_STATE_READ_ONLY, + GetData().GetRestriction() == ax::mojom::Restriction::kReadOnly); ++#endif + } + + void AXPlatformNodeAuraLinux::OnInvalidStatusChanged() { +@@ -4217,11 +4333,13 @@ gfx::Rect AXPlatformNodeAuraLinux::GetEx + extents.Offset(window_origin); + break; + } ++#if defined(ATK_230) + case ATK_XY_PARENT: { + gfx::Vector2d parent_origin = -GetParentOriginInScreenCoordinates(); + extents.Offset(parent_origin); + break; + } ++#endif + } + + return extents; +@@ -4651,6 +4769,7 @@ bool AXPlatformNodeAuraLinux::IsInLiveRe + return HasStringAttribute(ax::mojom::StringAttribute::kContainerLiveStatus); + } + ++#if defined(ATK_230) + void AXPlatformNodeAuraLinux::ScrollToPoint(AtkCoordType atk_coord_type, + int x, + int y) { +@@ -4723,7 +4842,9 @@ void AXPlatformNodeAuraLinux::ScrollNode + rect -= rect.OffsetFromOrigin(); + ScrollNodeRectIntoView(rect, atk_scroll_type); + } ++#endif // defined(ATK_230) + ++#if defined(ATK_232) + std::optional + AXPlatformNodeAuraLinux::GetUnclippedHypertextRangeBoundsRect(int start_offset, + int end_offset) { +@@ -4782,6 +4903,7 @@ bool AXPlatformNodeAuraLinux::ScrollSubs + + return true; + } ++#endif // defined(ATK_232) + + void AXPlatformNodeAuraLinux::ComputeStylesIfNeeded() { + if (!offset_to_text_attributes_.empty()) +@@ -4964,8 +5086,10 @@ gfx::Point AXPlatformNodeAuraLinux::Conv + switch (atk_coord_type) { + case ATK_XY_WINDOW: + return point + GetParentFrameOriginInScreenCoordinates(); ++#if defined(ATK_230) + case ATK_XY_PARENT: + return point + GetParentOriginInScreenCoordinates(); ++#endif + case ATK_XY_SCREEN: + default: + return point; +diff -up chromium-129.0.6668.58/ui/accessibility/platform/ax_platform_node_auralinux.h.me chromium-129.0.6668.58/ui/accessibility/platform/ax_platform_node_auralinux.h +--- chromium-129.0.6668.58/ui/accessibility/platform/ax_platform_node_auralinux.h.me 2024-09-18 19:26:54.167348688 +0200 ++++ chromium-129.0.6668.58/ui/accessibility/platform/ax_platform_node_auralinux.h 2024-09-18 19:28:06.220700493 +0200 +@@ -52,6 +52,31 @@ struct FindInPageResultInfo { + } + }; + ++// AtkTableCell was introduced in ATK 2.12. Ubuntu Trusty has ATK 2.10. ++// Compile-time checks are in place for ATK versions that are older than 2.12. ++// However, we also need runtime checks in case the version we are building ++// against is newer than the runtime version. To prevent a runtime error, we ++// check that we have a version of ATK that supports AtkTableCell. If we do, ++// we dynamically load the symbol; if we don't, the interface is absent from ++// the accessible object and its methods will not be exposed or callable. ++// The definitions below ensure we have no missing symbols. Note that in ++// environments where we have ATK > 2.12, the definitions of AtkTableCell and ++// AtkTableCellIface below are overridden by the runtime version. ++// TODO(accessibility) Remove AtkTableCellInterface when 2.12 is the minimum ++// supported version. ++struct COMPONENT_EXPORT(AX_PLATFORM) AtkTableCellInterface { ++ typedef struct _AtkTableCell AtkTableCell; ++ static GType GetType(); ++ static GPtrArray* GetColumnHeaderCells(AtkTableCell* cell); ++ static GPtrArray* GetRowHeaderCells(AtkTableCell* cell); ++ static bool GetRowColumnSpan(AtkTableCell* cell, ++ gint* row, ++ gint* column, ++ gint* row_span, ++ gint* col_span); ++ static bool Exists(); ++}; ++ + // This class with an enum is used to generate a bitmask which tracks the ATK + // interfaces that an AXPlatformNodeAuraLinux's ATKObject implements. + class ImplementedAtkInterfaces { +diff -up chromium-129.0.6668.58/ui/accessibility/platform/ax_platform_node_auralinux_unittest.cc.me chromium-129.0.6668.58/ui/accessibility/platform/ax_platform_node_auralinux_unittest.cc +--- chromium-129.0.6668.58/ui/accessibility/platform/ax_platform_node_auralinux_unittest.cc.me 2024-09-18 19:27:10.728659400 +0200 ++++ chromium-129.0.6668.58/ui/accessibility/platform/ax_platform_node_auralinux_unittest.cc 2024-09-18 19:28:06.221700512 +0200 +@@ -8,6 +8,7 @@ + #endif + + #include ++#include + #include + #include + +@@ -884,6 +885,17 @@ typedef bool (*ScrollToPointFunc)(AtkCom + typedef bool (*ScrollToFunc)(AtkComponent* component, AtkScrollType type); + + TEST_F(AXPlatformNodeAuraLinuxTest, AtkComponentScrollToPoint) { ++ // There's a chance we may be compiled with a newer version of ATK and then ++ // run with an older one, so we need to do a runtime check for this method ++ // that is available in ATK 2.30 instead of linking directly. ++ ScrollToPointFunc scroll_to_point = reinterpret_cast( ++ dlsym(RTLD_DEFAULT, "atk_component_scroll_to_point")); ++ if (!scroll_to_point) { ++ LOG(WARNING) << "Skipping AtkComponentScrollToPoint" ++ " because ATK version < 2.30 detected."; ++ return; ++ } ++ + AXNodeData root; + root.id = 1; + root.role = ax::mojom::Role::kRootWebArea; +@@ -911,8 +923,7 @@ TEST_F(AXPlatformNodeAuraLinuxTest, AtkC + EXPECT_EQ(10, width); + EXPECT_EQ(10, height); + +- atk_component_scroll_to_point(ATK_COMPONENT(child_obj), ATK_XY_SCREEN, 600, +- 650); ++ scroll_to_point(ATK_COMPONENT(child_obj), ATK_XY_SCREEN, 600, 650); + atk_component_get_extents(ATK_COMPONENT(child_obj), &x_left, &y_top, &width, + &height, ATK_XY_SCREEN); + EXPECT_EQ(610, x_left); +@@ -920,8 +931,7 @@ TEST_F(AXPlatformNodeAuraLinuxTest, AtkC + EXPECT_EQ(10, width); + EXPECT_EQ(10, height); + +- atk_component_scroll_to_point(ATK_COMPONENT(child_obj), ATK_XY_PARENT, 10, +- 10); ++ scroll_to_point(ATK_COMPONENT(child_obj), ATK_XY_PARENT, 10, 10); + atk_component_get_extents(ATK_COMPONENT(child_obj), &x_left, &y_top, &width, + &height, ATK_XY_SCREEN); + // The test wrapper scrolls every element when scrolling, so this should be +@@ -938,6 +948,17 @@ TEST_F(AXPlatformNodeAuraLinuxTest, AtkC + } + + TEST_F(AXPlatformNodeAuraLinuxTest, AtkComponentScrollTo) { ++ // There's a chance we may be compiled with a newer version of ATK and then ++ // run with an older one, so we need to do a runtime check for this method ++ // that is available in ATK 2.30 instead of linking directly. ++ ScrollToFunc scroll_to = reinterpret_cast( ++ dlsym(RTLD_DEFAULT, "atk_component_scroll_to")); ++ if (!scroll_to) { ++ LOG(WARNING) << "Skipping AtkComponentScrollTo" ++ " because ATK version < 2.30 detected."; ++ return; ++ } ++ + AXNodeData root; + root.id = 1; + root.role = ax::mojom::Role::kRootWebArea; +@@ -965,7 +986,7 @@ TEST_F(AXPlatformNodeAuraLinuxTest, AtkC + EXPECT_EQ(10, width); + EXPECT_EQ(10, height); + +- atk_component_scroll_to(ATK_COMPONENT(child_obj), ATK_SCROLL_ANYWHERE); ++ scroll_to(ATK_COMPONENT(child_obj), ATK_SCROLL_ANYWHERE); + atk_component_get_extents(ATK_COMPONENT(child_obj), &x_left, &y_top, &width, + &height, ATK_XY_SCREEN); + EXPECT_EQ(0, x_left); +diff -up chromium-129.0.6668.58/ui/accessibility/platform/inspect/ax_tree_formatter_auralinux.cc.me chromium-129.0.6668.58/ui/accessibility/platform/inspect/ax_tree_formatter_auralinux.cc +--- chromium-129.0.6668.58/ui/accessibility/platform/inspect/ax_tree_formatter_auralinux.cc.me 2024-09-18 19:27:20.965851455 +0200 ++++ chromium-129.0.6668.58/ui/accessibility/platform/inspect/ax_tree_formatter_auralinux.cc 2024-09-18 19:28:06.221700512 +0200 +@@ -474,18 +474,34 @@ void AXTreeFormatterAuraLinux::AddTableC + int row = 0, col = 0, row_span = 0, col_span = 0; + int n_row_headers = 0, n_column_headers = 0; + +- AtkTableCell* cell = G_TYPE_CHECK_INSTANCE_CAST( +- (atk_object), atk_table_cell_get_type(), AtkTableCell); ++ // Properties obtained via AtkTableCell, if possible. If we do not have at ++ // least ATK 2.12, use the same logic in our AtkTableCell implementation so ++ // that tests can still be run. ++ if (AtkTableCellInterface::Exists()) { ++ AtkTableCell* cell = G_TYPE_CHECK_INSTANCE_CAST( ++ (atk_object), AtkTableCellInterface::GetType(), AtkTableCell); + +- atk_table_cell_get_row_column_span(cell, &row, &col, &row_span, &col_span); ++ AtkTableCellInterface::GetRowColumnSpan(cell, &row, &col, &row_span, ++ &col_span); + +- GPtrArray* column_headers = atk_table_cell_get_column_header_cells(cell); +- n_column_headers = column_headers->len; +- g_ptr_array_unref(column_headers); ++ GPtrArray* column_headers = ++ AtkTableCellInterface::GetColumnHeaderCells(cell); ++ n_column_headers = column_headers->len; ++ g_ptr_array_unref(column_headers); + +- GPtrArray* row_headers = atk_table_cell_get_row_header_cells(cell); +- n_row_headers = row_headers->len; +- g_ptr_array_unref(row_headers); ++ GPtrArray* row_headers = AtkTableCellInterface::GetRowHeaderCells(cell); ++ n_row_headers = row_headers->len; ++ g_ptr_array_unref(row_headers); ++ } else { ++ row = node->GetTableRow().value_or(-1); ++ col = node->GetTableColumn().value_or(-1); ++ row_span = node->GetTableRowSpan().value_or(0); ++ col_span = node->GetTableColumnSpan().value_or(0); ++ if (role == ATK_ROLE_TABLE_CELL) { ++ n_column_headers = node->GetDelegate()->GetColHeaderNodeIds(col).size(); ++ n_row_headers = node->GetDelegate()->GetRowHeaderNodeIds(row).size(); ++ } ++ } + + std::vector cell_info; + cell_info.push_back(base::StringPrintf("row=%i", row)); diff --git a/SOURCES/chromium-91.0.4472.77-java-only-allowed-in-android-builds.patch b/SOURCES/chromium-91.0.4472.77-java-only-allowed-in-android-builds.patch deleted file mode 100644 index a4748d9a..00000000 --- a/SOURCES/chromium-91.0.4472.77-java-only-allowed-in-android-builds.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff -up chromium-91.0.4472.77/third_party/closure_compiler/compiler.py.java-allowed chromium-91.0.4472.77/third_party/closure_compiler/compiler.py ---- chromium-91.0.4472.77/third_party/closure_compiler/compiler.py.java-allowed 2021-06-02 17:14:48.445064647 +0000 -+++ chromium-91.0.4472.77/third_party/closure_compiler/compiler.py 2021-06-02 17:15:12.994836949 +0000 -@@ -13,8 +13,7 @@ import subprocess - - - _CURRENT_DIR = os.path.join(os.path.dirname(__file__)) --_JAVA_PATH = os.path.join(_CURRENT_DIR, "..", "jdk", "current", "bin", "java") --assert os.path.isfile(_JAVA_PATH), "java only allowed in android builds" -+_JAVA_PATH = "java" - - class Compiler(object): - """Runs the Closure compiler on given source files to typecheck them diff --git a/SPECS/chromium.spec b/SPECS/chromium.spec index 8e0d8d90..64191569 100644 --- a/SPECS/chromium.spec +++ b/SPECS/chromium.spec @@ -59,15 +59,6 @@ # set esbuild_version %global esbuild_version 0.19.2 -# set latest version for devtoolset and gcc-toolset -%global dts_version 12 -%if 0%{?rhel} == 8 || 0%{?rhel} == 9 -%global dts_version 13 -%endif - -# set name for toolset -%global toolset gcc-toolset - %if 0%{?rhel} == 8 %global chromium_pybin /usr/bin/python3.9 %else @@ -156,25 +147,11 @@ # enable|disable use_custom_libcxx %global use_custom_libcxx 1 -# enable clang by default -%global clang 1 - # enable|disable control flow integrity support %global cfi 0 %ifarch x86_64 aarch64 -%if %{clang} -%if 0%{?fedora} || 0%{?rhel} > 7 %global cfi 1 %endif -%endif -%endif - -# set correct toolchain -%if %{clang} -%global toolchain clang -%else -%global toolchain gcc -%endif # enable qt backend %global use_qt6 0 @@ -296,7 +273,7 @@ %endif Name: chromium%{chromium_channel} -Version: 129.0.6668.58 +Version: 129.0.6668.70 Release: 1%{?dist} Summary: A WebKit (Blink) powered web browser that Google doesn't want you to use Url: http://www.chromium.org/Home @@ -314,13 +291,6 @@ Patch20: chromium-disable-font-tests.patch # don't download binary blob Patch21: chromium-123-screen-ai-service.patch -# Fix issue where closure_compiler thinks java is only allowed in android builds -# https://bugs.chromium.org/p/chromium/issues/detail?id=1192875 -Patch65: chromium-91.0.4472.77-java-only-allowed-in-android-builds.patch - -# Update rjsmin to 1.2.0 -Patch69: chromium-103.0.5060.53-update-rjsmin-to-1.2.0.patch - # Disable tests on remoting build Patch82: chromium-98.0.4758.102-remoting-no-tests.patch @@ -362,6 +332,9 @@ Patch150: chromium-124-qt6.patch Patch305: chromium-124-el8-arm64-memory_tagging.patch Patch306: chromium-127-el8-ifunc-header.patch +# workaround for build error due to old atk version on el8 +Patch307: chromium-129-el8-atk-compiler-error.patch + # enable fstack-protector-strong Patch312: chromium-123-fstack-protector-strong.patch @@ -496,24 +469,13 @@ Source15: https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-%{esbuil BuildRequires: golang-github-evanw-esbuild %endif -%if %{clang} BuildRequires: clang BuildRequires: clang-tools-extra BuildRequires: llvm BuildRequires: lld -# needs for libatomic -%if 0%{?rhel} >= 8 -BuildRequires: %{toolset}-%{dts_version}-libatomic-devel -%endif -%else -%if 0%{?rhel} == 8 -BuildRequires: %{toolset}-%{dts_version}-binutils, %{toolset}-%{dts_version}-libatomic-devel -%endif -%if 0%{?fedora} || 0%{?rhel} > 8 -BuildRequires: gcc-c++ -BuildRequires: gcc -BuildRequires: binutils -%endif + +%if 0%{?rhel} && 0%{?rhel} <= 9 +BuildRequires: gcc-toolset-13-libatomic-devel %endif BuildRequires: rustc @@ -1037,8 +999,6 @@ Qt6 UI for chromium. %patch -P20 -p1 -b .disable-font-test %patch -P21 -p1 -b .screen-ai-service -%patch -P65 -p1 -b .java-only-allowed -%patch -P69 -p1 -b .update-rjsmin-to-1.2.0 %patch -P82 -p1 -b .remoting-no-tests %if ! %{bundlebrotli} @@ -1084,6 +1044,7 @@ Qt6 UI for chromium. %patch -P305 -p1 -b .el8-memory_tagging %patch -P306 -p1 -b .el8-ifunc-header %endif +%patch -P307 -p1 -b .el8-atk-compiler-error %endif %patch -P312 -p1 -b .fstack-protector-strong @@ -1229,11 +1190,9 @@ cp -a third_party/dav1d/version/version.h third_party/dav1d/libdav1d/include/dav %build # reduce warnings -%if %{clang} FLAGS=' -Wno-deprecated-declarations -Wno-unknown-warning-option -Wno-unused-command-line-argument' FLAGS+=' -Wno-unused-but-set-variable -Wno-unused-result -Wno-unused-function -Wno-unused-variable' FLAGS+=' -Wno-unused-const-variable -Wno-unneeded-internal-declaration -Wno-unknown-attributes -Wno-unknown-pragmas' -%endif %if %{system_build_flags} CFLAGS=${CFLAGS/-fexceptions} @@ -1264,29 +1223,16 @@ RUSTFLAGS=${RUSTFLAGS/debuginfo=?/debuginfo=0} %endif %endif -%if %{clang} export CC=clang export CXX=clang++ export AR=llvm-ar export NM=llvm-nm export READELF=llvm-readelf -%else -export CC=gcc -export CXX=g++ -export AR=ar -export NM=nm -export READELF=readelf -%endif export CFLAGS export CXXFLAGS export LDFLAGS export RUSTFLAGS -# enable gcc toolset on el8 -%if 0%{?rhel} == 8 && ! %{clang} -. /opt/rh/%{toolset}-%{dts_version}/enable -%endif - # need for error: the option `Z` is only accepted on the nightly compiler export RUSTC_BOOTSTRAP=1 @@ -1330,16 +1276,11 @@ CHROMIUM_CORE_GN_DEFINES+=' google_default_client_id="%{default_client_id}"' CHROMIUM_CORE_GN_DEFINES+=' google_default_client_secret="%{default_client_secret}"' %endif -%if %{clang} CHROMIUM_CORE_GN_DEFINES+=' is_clang=true' CHROMIUM_CORE_GN_DEFINES+=" clang_base_path=\"$clang_base_path\"" CHROMIUM_CORE_GN_DEFINES+=" clang_version=\"$clang_version\"" CHROMIUM_CORE_GN_DEFINES+=' clang_use_chrome_plugins=false' CHROMIUM_CORE_GN_DEFINES+=' use_lld=true' -%else -CHROMIUM_CORE_GN_DEFINES+=' is_clang=false' -CHROMIUM_CORE_GN_DEFINES+=' use_lld=false' -%endif # enable system rust CHROMIUM_CORE_GN_DEFINES+=' rust_sysroot_absolute="%{_prefix}"' @@ -1974,6 +1915,16 @@ getent group chrome-remote-desktop >/dev/null || groupadd -r chrome-remote-deskt %endif %changelog +* Wed Sep 25 2024 Than Ngo - 129.0.6668.70-1 +- update to 129.0.6668.70 + * High CVE-2024-9120: Use after free in Dawn + * High CVE-2024-9121: Inappropriate implementation in V8 + * High CVE-2024-9122: Type Confusion in V8 + * High CVE-2024-9123: Integer overflow in Skia + +* Thu Sep 19 2024 Than Ngo - 129.0.6668.58-2 +- clean up + * Tue Sep 17 2024 Than Ngo - 129.0.6668.58-1 - update to 129.0.6668.58 * High CVE-2024-8904: Type Confusion in V8