From c3c0b363c1094ec2bd1a15bb9c6304428c2d8d88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adomas=20Ven=C4=8Dkauskas?= Date: Tue, 15 Nov 2022 15:23:24 +0200 Subject: [PATCH] Make sure URL constructor is available in non-window environment --- chrome/content/zotero/xpcom/proxy.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/proxy.js b/chrome/content/zotero/xpcom/proxy.js index 7a80806ce5..59020b084f 100644 --- a/chrome/content/zotero/xpcom/proxy.js +++ b/chrome/content/zotero/xpcom/proxy.js @@ -458,7 +458,12 @@ Zotero.Proxy.prototype.erase = Zotero.Promise.coroutine(function* () { Zotero.Proxy.prototype.toProper = function(m) { if (!Array.isArray(m)) { // make sure url has a trailing slash - m = new URL(m).href; + if (typeof URL === 'undefined') { + m = new (Services.wm.getMostRecentWindow("navigator:browser")).URL(m).href; + } + else { + m = new URL(m).href; + } let match = this.regexp.exec(m); if (!match) { return m