Skip to content

Commit 215a649

Browse files
committed
create new Soup session on refresh
1 parent 390a709 commit 215a649

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

extension.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,7 @@ class BingWallpaperIndicator extends PanelMenu.Button {
115115
// take a variety of actions when the gsettings values are modified by prefs
116116
this._settings = ExtensionUtils.getSettings(Utils.BING_SCHEMA);
117117

118-
this.httpSession = new Soup.Session();
119-
Soup.Session.prototype.add_feature.call(this.httpSession, new Soup.ProxyResolverDefault()); // unclear if this is necessary
120-
if (this._settings.get_boolean('debug-logging')) {
121-
this.logger = Soup.Logger.new(Soup.LoggerLogLevel.HEADERS, -1);
122-
this.logger.attach(this.httpSession);
123-
this.logger.set_printer(soupPrinter);
124-
}
118+
this._initSoup();
125119

126120
getActorCompat(this).visible = !this._settings.get_boolean('hide');
127121

@@ -218,6 +212,16 @@ class BingWallpaperIndicator extends PanelMenu.Button {
218212
}
219213
}
220214

215+
_initSoup() {
216+
this.httpSession = new Soup.Session();
217+
Soup.Session.prototype.add_feature.call(this.httpSession, new Soup.ProxyResolverDefault()); // unclear if this is necessary
218+
if (this._settings.get_boolean('debug-logging')) {
219+
this.logger = Soup.Logger.new(Soup.LoggerLogLevel.HEADERS, -1);
220+
this.logger.attach(this.httpSession);
221+
this.logger.set_printer(soupPrinter);
222+
}
223+
}
224+
221225
// listen for configuration changes
222226
_setConnections() {
223227
this._settings.connect('changed::hide', () => {
@@ -487,6 +491,7 @@ class BingWallpaperIndicator extends PanelMenu.Button {
487491
this._updatePending = true;
488492
this._restartTimeout();
489493
let market = this._settings.get_string('market');
494+
this._initSoup(); // get new session, incase we aren't detecting proxy changes
490495
// create an http message
491496
let url = BingImageURL + (market != 'auto' ? market : '');
492497
let request = Soup.Message.new('GET', url);

0 commit comments

Comments
 (0)