From a71addb12a3ac62fa0d77ea864fcdcf8b632e1a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adomas=20Ven=C4=8Dkauskas?= Date: Thu, 26 Aug 2021 16:21:48 +0300 Subject: [PATCH] Make sure including include.js multiple times does not break monkey-patching This is important for plugins that want to monkey-patch interfaces that are only accessible via require() calls --- chrome/content/zotero/include.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/include.js b/chrome/content/zotero/include.js index b2f11a03a6..63a7f72d26 100644 --- a/chrome/content/zotero/include.js +++ b/chrome/content/zotero/include.js @@ -17,9 +17,11 @@ var winName; if (typeof window != 'undefined') { winName = window.name; } -Components.classes["@mozilla.org/moz/jssubscript-loader;1"] - .getService(Components.interfaces.mozIJSSubScriptLoader) - .loadSubScript('resource://zotero/require.js'); +if (typeof require == "undefined") { + Components.classes["@mozilla.org/moz/jssubscript-loader;1"] + .getService(Components.interfaces.mozIJSSubScriptLoader) + .loadSubScript('resource://zotero/require.js'); +} if (winName) { window.name = winName;