Replace some nsIWindowMediator getService() calls with Services.wm
This commit is contained in:
parent
b0d9a9c82e
commit
68879a0ffc
3 changed files with 9 additions and 27 deletions
|
@ -2188,9 +2188,7 @@ Zotero.CollectionTreeView.prototype.drop = Zotero.Promise.coroutine(function* (r
|
|||
}
|
||||
*/
|
||||
|
||||
let wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
|
||||
.getService(Components.interfaces.nsIWindowMediator);
|
||||
let lastWin = wm.getMostRecentWindow("navigator:browser");
|
||||
let lastWin = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
lastWin.openDialog('chrome://zotero/content/merge.xul', '', 'chrome,modal,centerscreen', io);
|
||||
|
||||
yield Zotero.DB.executeTransaction(function* () {
|
||||
|
@ -2244,9 +2242,7 @@ Zotero.CollectionTreeView.prototype.drop = Zotero.Promise.coroutine(function* (r
|
|||
var url = data[i];
|
||||
|
||||
if (url.indexOf('file:///') == 0) {
|
||||
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
|
||||
.getService(Components.interfaces.nsIWindowMediator);
|
||||
var win = wm.getMostRecentWindow("navigator:browser");
|
||||
let win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
// If dragging currently loaded page, only convert to
|
||||
// file if not an HTML document
|
||||
if (win.content.location.href != url ||
|
||||
|
@ -2264,9 +2260,7 @@ Zotero.CollectionTreeView.prototype.drop = Zotero.Promise.coroutine(function* (r
|
|||
|
||||
// Still string, so remote URL
|
||||
if (typeof file == 'string') {
|
||||
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
|
||||
.getService(Components.interfaces.nsIWindowMediator);
|
||||
var win = wm.getMostRecentWindow("navigator:browser");
|
||||
let win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
win.ZoteroPane.addItemFromURL(url, 'temporaryPDFHack', null, row); // TODO: don't do this
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -3211,9 +3211,7 @@ Zotero.ItemTreeView.prototype.drop = Zotero.Promise.coroutine(function* (row, or
|
|||
else if (dataType == 'text/x-moz-url' || dataType == 'application/x-moz-file') {
|
||||
// Disallow drop into read-only libraries
|
||||
if (!collectionTreeRow.editable) {
|
||||
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
|
||||
.getService(Components.interfaces.nsIWindowMediator);
|
||||
var win = wm.getMostRecentWindow("navigator:browser");
|
||||
let win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
win.ZoteroPane.displayCannotEditLibraryMessage();
|
||||
return;
|
||||
}
|
||||
|
@ -3256,9 +3254,7 @@ Zotero.ItemTreeView.prototype.drop = Zotero.Promise.coroutine(function* (row, or
|
|||
if (dataType == 'text/x-moz-url') {
|
||||
var url = data[i];
|
||||
if (url.indexOf('file:///') == 0) {
|
||||
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
|
||||
.getService(Components.interfaces.nsIWindowMediator);
|
||||
var win = wm.getMostRecentWindow("navigator:browser");
|
||||
let win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
// If dragging currently loaded page, only convert to
|
||||
// file if not an HTML document
|
||||
if (win.content.location.href != url ||
|
||||
|
@ -3278,9 +3274,7 @@ Zotero.ItemTreeView.prototype.drop = Zotero.Promise.coroutine(function* (row, or
|
|||
if (typeof file == 'string') {
|
||||
if (parentItemID) {
|
||||
if (!collectionTreeRow.filesEditable) {
|
||||
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
|
||||
.getService(Components.interfaces.nsIWindowMediator);
|
||||
var win = wm.getMostRecentWindow("navigator:browser");
|
||||
let win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
win.ZoteroPane.displayCannotEditLibraryFilesMessage();
|
||||
return;
|
||||
}
|
||||
|
@ -3295,9 +3289,7 @@ Zotero.ItemTreeView.prototype.drop = Zotero.Promise.coroutine(function* (row, or
|
|||
});
|
||||
}
|
||||
else {
|
||||
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
|
||||
.getService(Components.interfaces.nsIWindowMediator);
|
||||
var win = wm.getMostRecentWindow("navigator:browser");
|
||||
let win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
win.ZoteroPane.addItemFromURL(url, 'temporaryPDFHack'); // TODO: don't do this
|
||||
}
|
||||
continue;
|
||||
|
@ -3318,9 +3310,7 @@ Zotero.ItemTreeView.prototype.drop = Zotero.Promise.coroutine(function* (row, or
|
|||
}
|
||||
else {
|
||||
if (file.leafName.endsWith(".lnk")) {
|
||||
let wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
|
||||
.getService(Components.interfaces.nsIWindowMediator);
|
||||
let win = wm.getMostRecentWindow("navigator:browser");
|
||||
let win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
win.ZoteroPane.displayCannotAddShortcutMessage(file.path);
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -3310,9 +3310,7 @@ var ZoteroPane = new function()
|
|||
else if (openInNewTab || !window.loadURI || uris.length > 1) {
|
||||
// if no gBrowser, find it
|
||||
if(!gBrowser) {
|
||||
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
|
||||
.getService(Components.interfaces.nsIWindowMediator);
|
||||
var browserWindow = wm.getMostRecentWindow("navigator:browser");
|
||||
let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
var gBrowser = browserWindow.gBrowser;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue