1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/components/crashes/CrashService.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,33 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +"use strict"; 1.9 + 1.10 +const {classes: Cc, interfaces: Ci, utils: Cu} = Components; 1.11 + 1.12 +Cu.import("resource://gre/modules/Services.jsm", this); 1.13 +Cu.import("resource://gre/modules/XPCOMUtils.jsm", this); 1.14 + 1.15 +/** 1.16 + * This component makes crash data available throughout the application. 1.17 + * 1.18 + * It is a service because some background activity will eventually occur. 1.19 + */ 1.20 +this.CrashService = function () {}; 1.21 + 1.22 +CrashService.prototype = Object.freeze({ 1.23 + classID: Components.ID("{92668367-1b17-4190-86b2-1061b2179744}"), 1.24 + QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]), 1.25 + 1.26 + observe: function (subject, topic, data) { 1.27 + switch (topic) { 1.28 + case "profile-after-change": 1.29 + // Side-effect is the singleton is instantiated. 1.30 + let m = Services.crashmanager; 1.31 + break; 1.32 + } 1.33 + }, 1.34 +}); 1.35 + 1.36 +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([CrashService]);