build: Remove Soup2 support

We started to support Soup3 in GNOME 41, and used it by default
since GNOME 43. This should be enough time for distros to adapt,
so GNOME 45 looks like a good moment to drop the old Soup2 support.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2776>
This commit is contained in:
Florian Müllner
2023-05-24 17:09:55 +02:00
committed by Marge Bot
parent 679fb5a11e
commit ba43c61917
5 changed files with 0 additions and 57 deletions

View File

@ -33,16 +33,6 @@ imports.gi.versions.TelepathyGLib = '0.12';
imports.gi.versions.TelepathyLogger = '0.2';
imports.gi.versions.UPowerGlib = '1.0';
try {
if (Config.HAVE_SOUP2)
throw new Error('Soup3 support not enabled');
const Soup_ = imports.gi.Soup;
} catch (e) {
imports.gi.versions.Soup = '2.4';
const { Soup } = imports.gi;
_injectSoup3Compat(Soup);
}
const {Clutter, Gdk, Gio, GLib, GObject, Meta, Polkit, Shell, St} = imports.gi;
const Gettext = imports.gettext;
const System = imports.system;
@ -101,42 +91,6 @@ function _patchLayoutClass(layoutClass, styleProps) {
}
}
/**
* Mimick the Soup 3 APIs we use when falling back to Soup 2.4
*
* @param {object} Soup 2.4 namespace
* @returns {void}
*/
function _injectSoup3Compat(Soup) {
Soup.StatusCode = Soup.KnownStatusCode;
Soup.Message.new_from_encoded_form =
function (method, uri, form) {
const soupUri = new Soup.URI(uri);
soupUri.set_query(form);
return Soup.Message.new_from_uri(method, soupUri);
};
Soup.Message.prototype.set_request_body_from_bytes =
function (contentType, bytes) {
this.set_request(
contentType,
Soup.MemoryUse.COPY,
new TextDecoder().decode(bytes.get_data()));
};
Soup.Session.prototype.send_and_read_async =
function (message, prio, cancellable, callback) {
this.queue_message(message, () => callback(this, message));
};
Soup.Session.prototype.send_and_read_finish =
function (message) {
if (message.status_code !== Soup.KnownStatusCode.OK)
return null;
return message.response_body.flatten().get_as_bytes();
};
}
function _makeEaseCallback(params, cleanup) {
let onComplete = params.onComplete;
delete params.onComplete;