1
/* ***** BEGIN LICENSE BLOCK *****
2
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
4
* The contents of this file are subject to the Mozilla Public License Version
5
* 1.1 (the "License"); you may not use this file except in compliance with
6
* the License. You may obtain a copy of the License at
7
* http://www.mozilla.org/MPL/
9
* Software distributed under the License is distributed on an "AS IS" basis,
10
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11
* for the specific language governing rights and limitations under the
14
* The Original Code is Weave.
16
* The Initial Developer of the Original Code is Mozilla.
17
* Portions created by the Initial Developer are Copyright (C) 2008
18
* the Initial Developer. All Rights Reserved.
21
* Dan Mills <thunder@mozilla.com>
23
* Alternatively, the contents of this file may be used under the terms of
24
* either the GNU General Public License Version 2 or later (the "GPL"), or
25
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
26
* in which case the provisions of the GPL or the LGPL are applicable instead
27
* of those above. If you wish to allow use of your version of this file only
28
* under the terms of either the GPL or the LGPL, and not to allow others to
29
* use your version of this file under the terms of the MPL, indicate your
30
* decision by deleting the provisions above and replace them with the notice
31
* and other provisions required by the GPL or the LGPL. If you do not delete
32
* the provisions above, a recipient may use your version of this file under
33
* the terms of any one of the MPL, the GPL or the LGPL.
35
* ***** END LICENSE BLOCK ***** */
37
const Cc = Components.classes;
38
const Ci = Components.interfaces;
39
const Cu = Components.utils;
41
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
43
function WeaveService() {
44
this.wrappedJSObject = this;
46
WeaveService.prototype = {
47
classID: Components.ID("{74b89fb0-f200-4ae8-a3ec-dd164117f6de}"),
49
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
50
Ci.nsISupportsWeakReference]),
52
observe: function BSS__observe(subject, topic, data) {
55
let os = Cc["@mozilla.org/observer-service;1"].
56
getService(Ci.nsIObserverService);
57
os.addObserver(this, "final-ui-startup", true);
60
case "final-ui-startup":
61
// Force Weave service to load if it hasn't triggered from overlays
62
this.timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
63
this.timer.initWithCallback({
65
Cu.import("resource://services-sync/main.js");
66
if (Weave.Status.checkSetup() != Weave.CLIENT_NOT_CONFIGURED)
69
}, 10000, Ci.nsITimer.TYPE_ONE_SHOT);
75
function AboutWeaveLog() {}
76
AboutWeaveLog.prototype = {
77
classID: Components.ID("{d28f8a0b-95da-48f4-b712-caf37097be41}"),
79
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule,
80
Ci.nsISupportsWeakReference]),
82
getURIFlags: function(aURI) {
86
newChannel: function(aURI) {
87
let dir = Cc["@mozilla.org/file/directory_service;1"].
88
getService(Ci.nsIProperties);
89
let file = dir.get("ProfD", Ci.nsILocalFile);
92
file.append("verbose-log.txt");
93
let ios = Cc["@mozilla.org/network/io-service;1"].
94
getService(Ci.nsIIOService);
95
let ch = ios.newChannel(ios.newFileURI(file).spec, null, null);
96
ch.originalURI = aURI;
101
function AboutWeaveLog1() {}
102
AboutWeaveLog1.prototype = {
103
classID: Components.ID("{a08ee179-df50-48e0-9c87-79e4dd5caeb1}"),
105
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule,
106
Ci.nsISupportsWeakReference]),
108
getURIFlags: function(aURI) {
112
newChannel: function(aURI) {
113
let dir = Cc["@mozilla.org/file/directory_service;1"].
114
getService(Ci.nsIProperties);
115
let file = dir.get("ProfD", Ci.nsILocalFile);
116
file.append("weave");
118
file.append("verbose-log.txt.1");
119
let ios = Cc["@mozilla.org/network/io-service;1"].
120
getService(Ci.nsIIOService);
121
let ch = ios.newChannel(ios.newFileURI(file).spec, null, null);
122
ch.originalURI = aURI;
127
let components = [WeaveService, AboutWeaveLog, AboutWeaveLog1];
130
function NSGetModule(compMgr, fileSpec) {
131
return XPCOMUtils.generateModule(components);
135
if (typeof XPCOMUtils.generateNSGetFactory == "function")
136
const NSGetFactory = XPCOMUtils.generateNSGetFactory(components);