Bug 413954 - nsHandlerService.store fails to remove applications. r=myk, sr=dmose, a1.9=beltzner
--- a/uriloader/exthandler/nsHandlerService.js
+++ b/uriloader/exthandler/nsHandlerService.js
@@ -15,16 +15,17 @@
*
* The Initial Developer of the Original Code is Mozilla.
* Portions created by the Initial Developer are Copyright (C) 2007
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Myk Melez <myk@mozilla.org>
* Dan Mosedale <dmose@mozilla.org>
+ * Florian Queze <florian@queze.net>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
@@ -669,28 +670,28 @@ HandlerService.prototype = {
var newHandlerApps =
aHandlerInfo.possibleApplicationHandlers.enumerate();
while (newHandlerApps.hasMoreElements()) {
let handlerApp =
newHandlerApps.getNext().QueryInterface(Ci.nsIHandlerApp);
let handlerAppID = this._getPossibleHandlerAppID(handlerApp);
if (!this._hasResourceAssertion(infoID, NC_POSSIBLE_APP, handlerAppID)) {
this._storeHandlerApp(handlerAppID, handlerApp);
- this._addResourceTarget(infoID, NC_POSSIBLE_APP, handlerAppID);
+ this._addResourceAssertion(infoID, NC_POSSIBLE_APP, handlerAppID);
}
delete currentHandlerApps[handlerAppID];
}
// Finally, remove any old handler apps that aren't being used anymore,
// and if those handler apps aren't being used by any other type either,
// then completely remove their record from the datastore so we don't
// leave it clogged up with information about handler apps we don't care
// about anymore.
for (let handlerAppID in currentHandlerApps) {
- this._removeTarget(infoID, NC_POSSIBLE_APP, handlerAppID);
+ this._removeResourceAssertion(infoID, NC_POSSIBLE_APP, handlerAppID);
if (!this._existsResourceTarget(NC_POSSIBLE_APP, handlerAppID))
this._removeAssertions(handlerAppID);
}
},
/**
* Store the given handler app.
*
@@ -1143,26 +1144,44 @@ HandlerService.prototype = {
* The difference between this method and _setResource is that this one adds
* an assertion even if one already exists, which allows its callers to make
* sets of assertions (i.e. to set a property to multiple targets).
*
* @param sourceURI {string} the URI of the source
* @param propertyURI {string} the URI of the property
* @param targetURI {string} the URI of the target
*/
- _addResourceTarget: function HS__addResourceTarget(sourceURI, propertyURI,
- targetURI) {
+ _addResourceAssertion: function HS__addResourceAssertion(sourceURI,
+ propertyURI,
+ targetURI) {
var source = this._rdf.GetResource(sourceURI);
var property = this._rdf.GetResource(propertyURI);
var target = this._rdf.GetResource(targetURI);
this._ds.Assert(source, property, target, true);
},
/**
+ * Remove an assertion with a resource target.
+ *
+ * @param sourceURI {string} the URI of the source
+ * @param propertyURI {string} the URI of the property
+ * @param targetURI {string} the URI of the target
+ */
+ _removeResourceAssertion: function HS__removeResourceAssertion(sourceURI,
+ propertyURI,
+ targetURI) {
+ var source = this._rdf.GetResource(sourceURI);
+ var property = this._rdf.GetResource(propertyURI);
+ var target = this._rdf.GetResource(targetURI);
+
+ this._ds.Unassert(source, property, target);
+ },
+
+ /**
* Whether or not a property of an RDF source has a given resource target.
*
* @param sourceURI {string} the URI of the source
* @param propertyURI {string} the URI of the property
* @param targetURI {string} the URI of the target
*
* @returns {boolean} whether or not there is such an assertion
*/