"loader is undefined" for prefs on Linux

47 views
Skip to first unread message

Emiliano Heyns

unread,
Aug 30, 2021, 2:26:10 PM8/30/21
to zotero-dev
I have a user on OpenSUSE Tumbleweed that gets an error when opening the prefs, possible related to my prefs overlay, but I can't reproduce it on Ubuntu

[JavaScript Error: "loader is undefined" {file: "resource://zotero/loader.jsm" line: 451}]
load@resource://zotero/loader.jsm:451:7
anonymous@chrome://zotero/content/bindings/preferences-unix.xml line 768 > Function:3:1
_fireEvent@chrome://zotero/content/bindings/preferences-unix.xml:769:24
prefwindow_XBL_Constructor@chrome://zotero/content/bindings/preferences-unix.xml:646:13

does this sound familiar to anyone?

Emiliano Heyns

unread,
Sep 16, 2021, 8:09:30 AM9/16/21
to zotero-dev
I now have a 2nd user that experiences the same problem, but on Windows:

[JavaScript Error: "loader is undefined" {file: "resource://zotero/loader.jsm" line: 451}]
load@resource://zotero/loader.jsm:451:7
anonymous@chrome://zotero/content/bindings/preferences-win.xml line 768 > Function:3:1
_fireEvent@chrome://zotero/content/bindings/preferences-win.xml:769:24
prefwindow_XBL_Constructor@chrome://zotero/content/bindings/preferences-win.xml:646:13

The overlay does load at least partially, as I can see a label and a deck that I add in the overlay, but because of this error, the code doesn't proceed to unlock the BBT preferences.

Emiliano Heyns

unread,
Sep 16, 2021, 3:36:38 PM9/16/21
to zotero-dev
I'm not even sure on the load order here. If I'm reading preferences-unix.xml right, it is trying to feign an onload event? I don't have an onload handler defined in my overlay, so I'm not sure how my overlay interferes with it being called by something else. All the rest of the zotero preference panes work for these two users. I've tried to replicate this on windows and linux (my main platform is mac) but I cannot reproduce this myself.

Emiliano Heyns

unread,
Sep 22, 2021, 4:59:45 AM9/22/21
to zotero-dev
I now have a 3rd user who experiences this problem on the latest macos. I cannot reproduce this problem on any of the three myself.

adoma...@gmail.com

unread,
Oct 4, 2021, 8:35:25 AM10/4/21
to zotero-dev
What happens for these users when opening the prefs? Does the pref pane not show? Does it ever fix itself? Do they get an error prompt? I think we've seen the errors you've pasted in various Report IDs from users but they were always benign, and I think I've even seen this error myself. They started appearing when we moved to Firefox 60.

Emiliano Heyns

unread,
Oct 4, 2021, 10:48:43 AM10/4/21
to zotero-dev
The prefs window opens as usual for Zotero's own preferences, it's just that the BBT code in my overlay for the prefs window does not run, so my prefs UI never gets initialized. It does not seem to fix itself.

It could well be that the message is benign, but it's the only error that showed up in these users' logs, and the code in my overlay simply does not run at all -- I had a Zotero.debug as the first call, and that didn't show up.

Unfortunately it's been two weeks since the last message from these 3 users came in, and I can't reproduce it myself. One promised to test end of last week, but I've seen nothing yet.

Emiliano Heyns

unread,
Oct 17, 2021, 10:17:48 AM10/17/21
to zotero-dev
The loader message does seem harmless -- but for these users, the overlay is loading (I can see that because a Zotero.debug in a script tag logs a message), but the onpaneload isn't firing. I see no errors in the log, but the function I tied to onpaneload is not being called.

adoma...@gmail.com

unread,
Oct 18, 2021, 7:13:47 AM10/18/21
to zotero-dev
Ok, so I spent some time looking at BBT and our code. First, the error trace seems to be missing an intermediate filename (it's the anonymous function), which then calls loader.jsm. The only place in our whole codebase that imports loader.jsm is in require.js, which is imported in include.js. I couldn't quite figure out how loader.jsm:451 gets called by looking at the code, but perhaps that's irrelevant. Now, I see that BBT prefpane has a <script> tag for include.js. I don't think it's necessary since you're putting an overlay over Zotero preferences, where include.js is already included. That means that BBT prefs should have access to Zotero objects without the include. There's also a note at our code linking to a bug which says that you shouldn't have element tags before prefpane tags, which you're doing in BBT.  So this would be the first thing I'd try to change.

Emiliano Heyns

unread,
Oct 18, 2021, 10:58:53 AM10/18/21
to zotero-dev
On Monday, October 18, 2021 at 1:13:47 PM UTC+2 adoma...@gmail.com wrote:
Ok, so I spent some time looking at BBT and our code. First, the error trace seems to be missing an intermediate filename (it's the anonymous function), which then calls loader.jsm. The only place in our whole codebase that imports loader.jsm is in require.js, which is imported in include.js. I couldn't quite figure out how loader.jsm:451 gets called by looking at the code, but perhaps that's irrelevant. Now, I see that BBT prefpane has a <script> tag for include.js. I don't think it's necessary since you're putting an overlay over Zotero preferences, where include.js is already included. That means that BBT prefs should have access to Zotero objects without the include.

That is correct, and removing that from BBT and other plugins like sci-hub solved the problem. I also found I could remove loads of include.js everywhere in BBT, and my tests still ran without problem. So I wonder whether I should load it at all,.
 
There's also a note at our code linking to a bug which says that you shouldn't have element tags before prefpane tags, which you're doing in BBT.  So this would be the first thing I'd try to change.

You mean the popupset? I thought that had to go up front.
Reply all
Reply to author
Forward
0 new messages