Potentially fix ProgressWindow crash
The call to _window.addEventListener() might have been causing an error when _window was null or undefined (no main Zotero window could be found), which would prevent _windowLoading from being set to true and the window from being added to the ProgressWindowSet, which might have caused unpredictable behavior when positioning windows later on. I could only briefly reproduce the issue, so this is just one idea. The call to addEventListener on a potentially null _window was definitely a bug but I don't know if it caused the crash.
This commit is contained in:
parent
cc5e1106ec
commit
95d8b37f0a
1 changed files with 8 additions and 11 deletions
|
@ -115,24 +115,24 @@ Zotero.ProgressWindow = function(options = {}) {
|
||||||
* Shows the progress window
|
* Shows the progress window
|
||||||
*/
|
*/
|
||||||
this.show = function show() {
|
this.show = function show() {
|
||||||
if(_windowLoading || _windowLoaded) { // already loading or loaded
|
if (_windowLoading || _windowLoaded) { // already loading or loaded
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"].
|
if (!_window) {
|
||||||
getService(Components.interfaces.nsIWindowWatcher);
|
_window = Zotero.getMainWindow();
|
||||||
|
|
||||||
if (!_window){
|
|
||||||
_window = Components.classes["@mozilla.org/appshell/window-mediator;1"]
|
|
||||||
.getService(Components.interfaces.nsIWindowMediator)
|
|
||||||
.getMostRecentWindow("navigator:browser");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_window) {
|
if (_window) {
|
||||||
_progressWindow = _window.openDialog("chrome://zotero/content/progressWindow.xul",
|
_progressWindow = _window.openDialog("chrome://zotero/content/progressWindow.xul",
|
||||||
"", "chrome,dialog=no,titlebar=no,popup=yes");
|
"", "chrome,dialog=no,titlebar=no,popup=yes");
|
||||||
|
_window.addEventListener('close', () => {
|
||||||
|
this.close();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
let ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
|
||||||
|
.getService(Components.interfaces.nsIWindowWatcher);
|
||||||
_progressWindow = ww.openWindow(null, "chrome://zotero/content/progressWindow.xul",
|
_progressWindow = ww.openWindow(null, "chrome://zotero/content/progressWindow.xul",
|
||||||
"", "chrome,dialog=no,titlebar=no,popup=yes", null);
|
"", "chrome,dialog=no,titlebar=no,popup=yes", null);
|
||||||
}
|
}
|
||||||
|
@ -140,9 +140,6 @@ Zotero.ProgressWindow = function(options = {}) {
|
||||||
_progressWindow.addEventListener("mouseover", _onMouseOver, false);
|
_progressWindow.addEventListener("mouseover", _onMouseOver, false);
|
||||||
_progressWindow.addEventListener("mouseout", _onMouseOut, false);
|
_progressWindow.addEventListener("mouseout", _onMouseOut, false);
|
||||||
_progressWindow.addEventListener("mouseup", _onMouseUp, false);
|
_progressWindow.addEventListener("mouseup", _onMouseUp, false);
|
||||||
_window.addEventListener('close', () => {
|
|
||||||
this.close();
|
|
||||||
});
|
|
||||||
|
|
||||||
_windowLoading = true;
|
_windowLoading = true;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue