зеркало из https://github.com/mozilla/gecko-dev.git
bug 394838: make nsHandlerService::remove remove all assertions; r=biesi, sr=dmose
This commit is contained in:
Родитель
2145eeea65
Коммит
7036fd0a58
|
@ -362,8 +362,29 @@ HandlerService.prototype = {
|
||||||
this._removeAssertions(preferredHandlerID);
|
this._removeAssertions(preferredHandlerID);
|
||||||
|
|
||||||
var infoID = this._getInfoID(this._getClass(aHandlerInfo), aHandlerInfo.type);
|
var infoID = this._getInfoID(this._getClass(aHandlerInfo), aHandlerInfo.type);
|
||||||
|
|
||||||
|
// Get a list of possible handlers. After we have removed the info record,
|
||||||
|
// we'll check if any other info records reference these handlers, and we'll
|
||||||
|
// remove the handler records that aren't referenced by other info records.
|
||||||
|
var possibleHandlerIDs = [];
|
||||||
|
var possibleHandlerTargets = this._getTargets(infoID, NC_POSSIBLE_APP);
|
||||||
|
while (possibleHandlerTargets.hasMoreElements()) {
|
||||||
|
let possibleHandlerTarget = possibleHandlerTargets.getNext();
|
||||||
|
// Note: possibleHandlerTarget should always be an nsIRDFResource.
|
||||||
|
// The conditional is just here in case of a corrupt RDF datasource.
|
||||||
|
if (possibleHandlerTarget instanceof Ci.nsIRDFResource)
|
||||||
|
possibleHandlerIDs.push(possibleHandlerTarget.ValueUTF8);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove the info record.
|
||||||
this._removeAssertions(infoID);
|
this._removeAssertions(infoID);
|
||||||
|
|
||||||
|
// Now that we've removed the info record, remove any possible handlers
|
||||||
|
// that aren't referenced by other info records.
|
||||||
|
for each (let possibleHandlerID in possibleHandlerIDs)
|
||||||
|
if (!this._existsResourceTarget(NC_POSSIBLE_APP, possibleHandlerID))
|
||||||
|
this._removeAssertions(possibleHandlerID);
|
||||||
|
|
||||||
var typeID = this._getTypeID(this._getClass(aHandlerInfo), aHandlerInfo.type);
|
var typeID = this._getTypeID(this._getClass(aHandlerInfo), aHandlerInfo.type);
|
||||||
this._removeAssertions(typeID);
|
this._removeAssertions(typeID);
|
||||||
|
|
||||||
|
@ -1250,9 +1271,12 @@ HandlerService.prototype = {
|
||||||
var properties = this._ds.ArcLabelsOut(source);
|
var properties = this._ds.ArcLabelsOut(source);
|
||||||
|
|
||||||
while (properties.hasMoreElements()) {
|
while (properties.hasMoreElements()) {
|
||||||
var property = properties.getNext();
|
let property = properties.getNext();
|
||||||
var target = this._ds.GetTarget(source, property, true);
|
let targets = this._ds.GetTargets(source, property, true);
|
||||||
this._ds.Unassert(source, property, target);
|
while (targets.hasMoreElements()) {
|
||||||
|
let target = targets.getNext();
|
||||||
|
this._ds.Unassert(source, property, target);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче