Bug 211652 bookmarks.js fails on QueryInterface for nsIBookmarksService

r=caillon sr=bz
This commit is contained in:
timeless%mozdev.org 2003-07-14 21:16:33 +00:00
Родитель a193909a38
Коммит ef853f6b57
3 изменённых файлов: 21 добавлений и 13 удалений

Просмотреть файл

@ -97,20 +97,28 @@ function initServices()
kPREFContractID = "@mozilla.org/preferences-service;1";
kPREFIID = Components.interfaces.nsIPrefService;
PREF = Components.classes[kPREFContractID].getService(kPREFIID)
.getBranch(null);
try {
PREF = Components.classes[kPREFContractID].getService(kPREFIID)
.getBranch(null);
} catch (e) {}
kSOUNDContractID = "@mozilla.org/sound;1";
kSOUNDIID = Components.interfaces.nsISound;
SOUND = Components.classes[kSOUNDContractID].createInstance(kSOUNDIID);
try {
SOUND = Components.classes[kSOUNDContractID].createInstance(kSOUNDIID);
} catch (e) {}
kWINDOWContractID = "@mozilla.org/appshell/window-mediator;1";
kWINDOWIID = Components.interfaces.nsIWindowMediator;
WINDOWSVC = Components.classes[kWINDOWContractID].getService(kWINDOWIID);
try {
WINDOWSVC = Components.classes[kWINDOWContractID].getService(kWINDOWIID);
} catch (e) {}
kDSContractID = "@mozilla.org/widget/dragservice;1";
kDSIID = Components.interfaces.nsIDragService;
DS = Components.classes[kDSContractID].getService(kDSIID);
try {
DS = Components.classes[kDSContractID].getService(kDSIID);
} catch (e) {}
}
function initBMService()
@ -1309,7 +1317,7 @@ var BookmarksUtils = {
transaction.index[i] = RDFC.IndexOf(aSelection.item[i]);
}
}
if (aAction != "move" && !BookmarksUtils.all(transaction.isValid))
if (SOUND && aAction != "move" && !BookmarksUtils.all(transaction.isValid))
SOUND.beep();
var isCancelled = !BookmarksUtils.any(transaction.isValid);
if (!isCancelled) {
@ -1354,7 +1362,7 @@ var BookmarksUtils = {
transaction.parent[i] = aSelection.parent[i];
}
}
if (!BookmarksUtils.all(transaction.isValid))
if (SOUND && !BookmarksUtils.all(transaction.isValid))
SOUND.beep();
var isCancelled = !BookmarksUtils.any(transaction.isValid);
if (!isCancelled) {
@ -1371,7 +1379,7 @@ var BookmarksUtils = {
var isCancelled = !BookmarksUtils.any(transaction.isValid);
if (!isCancelled) {
BMSVC.transactionManager.doTransaction(transaction);
} else
} else if (SOUND)
SOUND.beep();
return !isCancelled;
},

Просмотреть файл

@ -447,7 +447,7 @@
<parameter name="aReverse"/>
<body><![CDATA[
var confirmed;
if (PREF.getBoolPref("browser.bookmarks.confirm_sorting")) {
if (PREF && PREF.getBoolPref("browser.bookmarks.confirm_sorting")) {
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
var title = BookmarksUtils.getLocaleString("confirm_sorting_title");
@ -572,7 +572,7 @@
mOuter: this,
canDropOn: function(index)
{
var dragSession = DS.getCurrentSession();
var dragSession = DS && DS.getCurrentSession();
if (!dragSession)
return false;
var selection = BookmarksUtils.getSelectionFromXferData(dragSession);
@ -580,7 +580,7 @@
},
canDropBeforeAfter: function(index, before)
{
var dragSession = DS.getCurrentSession();
var dragSession = DS && DS.getCurrentSession();
if (!dragSession)
return false;
var selection = BookmarksUtils.getSelectionFromXferData(dragSession);
@ -595,7 +595,7 @@
},
onDrop: function(row, orientation)
{
var dragSession = DS.getCurrentSession();
var dragSession = DS && DS.getCurrentSession();
if (!dragSession)
return;
var selection = BookmarksUtils.getSelectionFromXferData(dragSession);

Просмотреть файл

@ -79,7 +79,7 @@ function find()
function findMostRecentWindow(aType, aURI, aParam)
{
var topWindow = WINDOWSVC.getMostRecentWindow(aType);
var topWindow = WINDOWSVC && WINDOWSVC.getMostRecentWindow(aType);
if (!topWindow) gCreatingNewWindow = true;
return topWindow || openDialog("chrome://communicator/content/bookmarks/bookmarksManager.xul",
"", "chrome,all,dialog=no", aParam);