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

--HG--
extra : source : 1f18d8c7210c75275a4ba49a0bd40cb5c81ea286
This commit is contained in:
Andrew McCreight 2017-05-08 14:56:18 -07:00
Родитель be06502b38
Коммит 0a340a3e90
1 изменённых файлов: 1 добавлений и 5 удалений

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

@ -62,11 +62,7 @@ PlacesCategoriesStarter.prototype = {
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;