mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
72 lines
2.3 KiB
JavaScript
72 lines
2.3 KiB
JavaScript
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
const Cc = Components.classes;
|
|
const Ci = Components.interfaces;
|
|
const Cu = Components.utils;
|
|
|
|
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
|
Cu.import("resource://gre/modules/Services.jsm");
|
|
Cu.import("resource://gre/modules/FileUtils.jsm");
|
|
|
|
function WeaveService() {
|
|
this.wrappedJSObject = this;
|
|
}
|
|
WeaveService.prototype = {
|
|
classID: Components.ID("{74b89fb0-f200-4ae8-a3ec-dd164117f6de}"),
|
|
|
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
|
|
Ci.nsISupportsWeakReference]),
|
|
|
|
observe: function BSS__observe(subject, topic, data) {
|
|
switch (topic) {
|
|
case "app-startup":
|
|
let os = Cc["@mozilla.org/observer-service;1"].
|
|
getService(Ci.nsIObserverService);
|
|
os.addObserver(this, "final-ui-startup", true);
|
|
break;
|
|
|
|
case "final-ui-startup":
|
|
// Force Weave service to load if it hasn't triggered from overlays
|
|
this.timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
|
this.timer.initWithCallback({
|
|
notify: function() {
|
|
Cu.import("resource://services-sync/main.js");
|
|
if (Weave.Status.checkSetup() != Weave.CLIENT_NOT_CONFIGURED)
|
|
Weave.Service;
|
|
}
|
|
}, 10000, Ci.nsITimer.TYPE_ONE_SHOT);
|
|
break;
|
|
}
|
|
}
|
|
};
|
|
|
|
function AboutWeaveLog() {}
|
|
AboutWeaveLog.prototype = {
|
|
classID: Components.ID("{d28f8a0b-95da-48f4-b712-caf37097be41}"),
|
|
|
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule,
|
|
Ci.nsISupportsWeakReference]),
|
|
|
|
getURIFlags: function(aURI) {
|
|
return 0;
|
|
},
|
|
|
|
newChannel: function(aURI) {
|
|
let dir = FileUtils.getDir("ProfD", ["weave", "logs"], true);
|
|
let uri = Services.io.newFileURI(dir);
|
|
let channel = Services.io.newChannelFromURI(uri);
|
|
channel.originalURI = aURI;
|
|
|
|
// Setting the owner to null means that we'll go through the normal
|
|
// path in GetChannelPrincipal and create a codebase principal based
|
|
// on the channel's originalURI
|
|
channel.owner = null;
|
|
return channel;
|
|
}
|
|
};
|
|
|
|
const components = [WeaveService, AboutWeaveLog];
|
|
const NSGetFactory = XPCOMUtils.generateNSGetFactory(components);
|