зеркало из https://github.com/mozilla/pjs.git
Bug 342110 crash when copying and pasting bookmark folder [@ nsBookmarksService::UpdateBookmarkForwardProxy], r=sspitzer, sr=mconnor
This commit is contained in:
Родитель
73de8c6700
Коммит
ada1ae10ff
|
@ -588,13 +588,13 @@ var BookmarksCommand = {
|
|||
items[i] = RDF.GetResource(childs[0]);
|
||||
var propArray = [];
|
||||
for (var k = 0; k < childCount; ++k) {
|
||||
var props = [RDF.GetResource(childs[p*k]), null, null, null, null, null, null];
|
||||
for (var j = 1; j < p; ++j) {
|
||||
var prop = childs[p*k+j];
|
||||
if (prop)
|
||||
props[j] = RDF.GetLiteral(prop);
|
||||
propArray.push(RDF.GetLiteral(prop));
|
||||
else
|
||||
propArray.push(null);
|
||||
}
|
||||
propArray.push(props);
|
||||
}
|
||||
removedProps.push(propArray);
|
||||
}
|
||||
|
@ -1608,13 +1608,13 @@ var BookmarksUtils = {
|
|||
// (if the selection is folder save all childs property)
|
||||
var propArray;
|
||||
if (aAction != "move") {
|
||||
propArray = [aSelection.item[i], null, null, null, null, null, null];
|
||||
propArray = new Array(gBmProperties.length);
|
||||
var aType = BookmarksUtils.resolveType(aSelection.item[i]);
|
||||
if (aType != "Livemark") {// don't change livemark properties
|
||||
for (var j = 0; j < gBmProperties.length; ++j) {
|
||||
var oldValue = BMDS.GetTarget(aSelection.item[i], gBmProperties[j], true);
|
||||
if (oldValue)
|
||||
propArray[j+1] = oldValue.QueryInterface(kRDFLITIID);
|
||||
propArray[j] = oldValue.QueryInterface(kRDFLITIID);
|
||||
}
|
||||
}
|
||||
if (aType == "Folder" || aType == "Livemark")
|
||||
|
@ -1647,13 +1647,13 @@ var BookmarksUtils = {
|
|||
if (child instanceof Components.interfaces.nsIRDFResource){
|
||||
var aType = BookmarksUtils.resolveType(child);
|
||||
var childResource = child.QueryInterface(kRDFRSCIID);
|
||||
var props = [childResource, null, null, null, null, null, null];
|
||||
var props = new Array(gBmProperties.length);
|
||||
// don't change livemark properties
|
||||
if (aType != "Livemark") {
|
||||
for (var j = 0; j < gBmProperties.length; ++j) {
|
||||
var oldValue = BMDS.GetTarget(childResource, gBmProperties[j], true);
|
||||
if (oldValue)
|
||||
props[(j+1)] = oldValue.QueryInterface(kRDFLITIID);
|
||||
props[(j)] = oldValue.QueryInterface(kRDFLITIID);
|
||||
}
|
||||
}
|
||||
propArray.push(props);
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
|
||||
interface nsIRDFResource;
|
||||
interface nsIRDFNode;
|
||||
interface nsIRDFLiteral;
|
||||
interface nsITransactionManager;
|
||||
|
||||
/**
|
||||
|
@ -73,7 +74,7 @@ interface nsIBookmarkTransactionManager : nsISupports
|
|||
in long aIndex,
|
||||
in nsIRDFResource aParent,
|
||||
in unsigned long aPropCount,
|
||||
[array, size_is(aPropCount)] in nsIRDFNode aRemovedProps);
|
||||
[array, size_is(aPropCount)] in nsIRDFLiteral aRemovedProps);
|
||||
|
||||
/**
|
||||
* Constants corresponding to the 3 different types of transactions possible
|
||||
|
|
|
@ -97,14 +97,14 @@ function bookmarkTransactionManager() {
|
|||
var oldValue = this.BMDS.GetTarget(this.item, this.Properties[i], true);
|
||||
// must check, if paste call after copy the oldvalue didn't remove.
|
||||
if (!oldValue) {
|
||||
var newValue = aProps[i+1];
|
||||
var newValue = aProps[i];
|
||||
if (newValue) {
|
||||
this.BMDS.Assert(this.item,
|
||||
this.Properties[i],
|
||||
newValue, true);
|
||||
}
|
||||
} else {
|
||||
this.removedProp[i+1] = oldValue;
|
||||
this.removedProp[i] = oldValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ function bookmarkTransactionManager() {
|
|||
}
|
||||
for each (var prop in aProps) {
|
||||
for (var i = 0; i < this.Properties.length; i++) {
|
||||
var oldValue = aProps[i+1];
|
||||
var oldValue = aProps[i];
|
||||
if (oldValue) {
|
||||
this.BMDS.Unassert(this.item, this.Properties[i], oldValue);
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ function bookmarkTransactionManager() {
|
|||
rdfService.GetResource("http://home.netscape.com/NC-rdf#FeedURL")];
|
||||
|
||||
function bkmkInsertTxn(aAction) {
|
||||
this.type = "insert";
|
||||
this.type = "insert";
|
||||
// move container declaration to here so it can be recognized if
|
||||
// undoTransaction is call after the BM manager is close and reopen.
|
||||
this.container = Components.classes["@mozilla.org/rdf/container;1"]
|
||||
|
|
|
@ -973,7 +973,8 @@ nsBookmarksService::UpdateLivemarkChildren(nsIRDFResource* aSource)
|
|||
if (rv == NS_RDF_NO_VALUE)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIRDFLiteral> feedUrlLiteral = do_QueryInterface(feedUrlNode);
|
||||
nsCOMPtr<nsIRDFLiteral> feedUrlLiteral = do_QueryInterface(feedUrlNode, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
const PRUnichar *feedUrl = nsnull;
|
||||
rv = feedUrlLiteral->GetValueConst(&feedUrl);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
|
|
@ -3794,7 +3794,8 @@ nsBookmarksService::UpdateBookmarkForwardProxy(nsIRDFDataSource* aDS, nsIRDFReso
|
|||
}
|
||||
|
||||
// unfortunately, urlNode is a Literal; we need it to be a Resource
|
||||
nsCOMPtr<nsIRDFLiteral> urlLiteral = do_QueryInterface(urlNode);
|
||||
nsCOMPtr<nsIRDFLiteral> urlLiteral = do_QueryInterface(urlNode, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
const PRUnichar *urlstr;
|
||||
rv = urlLiteral->GetValueConst(&urlstr);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
|
Загрузка…
Ссылка в новой задаче