Bug 1363443 - Use Cu.isModuleLoaded to see if the module is loaded in PlacesCategoriesStarter.js. r=mak
Cu.isModuleLoaded is more direct, and also the current method will
break if jsms begin to share globals, as in
bug 1186409.
This patch is by billm from
bug 1186409.
MozReview-Commit-ID: KoHMTJpmHg2
--- a/toolkit/components/places/PlacesCategoriesStarter.js
+++ b/toolkit/components/places/PlacesCategoriesStarter.js
@@ -57,21 +57,17 @@ function PlacesCategoriesStarter() {
PlacesCategoriesStarter.prototype = {
// nsIObserver
observe: function PCS_observe(aSubject, aTopic, aData) {
switch (aTopic) {
case PlacesUtils.TOPIC_SHUTDOWN:
Services.obs.removeObserver(this, PlacesUtils.TOPIC_SHUTDOWN);
Services.obs.removeObserver(this, TOPIC_GATHER_TELEMETRY);
- let globalObj =
- Cu.getGlobalForObject(PlacesCategoriesStarter.prototype);
- let descriptor =
- Object.getOwnPropertyDescriptor(globalObj, "PlacesDBUtils");
- if (descriptor.value !== undefined) {
+ if (Cu.isModuleLoaded("resource://gre/modules/PlacesDBUtils.jsm")) {
PlacesDBUtils.shutdown();
}
break;
case TOPIC_GATHER_TELEMETRY:
PlacesDBUtils.telemetry();
break;
case "idle-daily":
// Once a week run places.sqlite maintenance tasks.