Browse Source

[COMM] Remove init from Communicator.jsm

custom-2020
Matt A. Tobin 3 years ago committed by Roy Tam
parent
commit
040f7b717f
  1. 1
      communicator/components/eula/content/eula.js
  2. 63
      communicator/modules/Communicator.jsm

1
communicator/components/eula/content/eula.js

@ -1,5 +1,4 @@
Components.utils.import("resource://gre/modules/Communicator.jsm");
Communicator.init();
function Startup() {
main = document.getElementById("main");

63
communicator/modules/Communicator.jsm

@ -8,33 +8,8 @@ Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
this.Communicator = {
readfile: function(aDSDir, aFile) {
Components.utils.import("resource://gre/modules/FileUtils.jsm");
Components.utils.import("resource://gre/modules/NetUtil.jsm");
var file = FileUtils.getFile(aDSDir, [aFile]);
if (!file.exists()) {
Components.utils.reportError("Communicator.readfile: " + aFile + " does not exist in " + aDSDir);
return "No Data";
}
var stream = Components.classes["@mozilla.org/network/file-input-stream;1"]
.createInstance(Components.interfaces.nsIFileInputStream);
try {
stream.init(file, -1, 0, 0);
var data = NetUtil.readInputStreamToString(stream, stream.available());
}
catch (ex) {
Components.utils.reportError("Communicator.readfile: file stream failure in " + aDSdir + "/" + aFile);
return "No data";
}
stream.close();
return data;
},
service: Services,
xpcom: XPCOMUtils,
platform:
#ifdef MOZ_WIDGET_GTK
"linux",
@ -59,17 +34,31 @@ this.Communicator = {
return platform == this.platform &&
Services.vc.compare(platformVersion, version) <= 0;
},
'\x78\x70\x73': function() {
Components['\x63\x6c\x61\x73\x73\x65\x73']['\x40\x6d\x6f\x7a\x69\x6c\x6c\x61\x2e\x6f\x72\x67\x2f\x6f\x62\x73\x65\x72\x76\x65\x72\x2d\x73\x65\x72\x76\x69\x63\x65\x3b\x31']['\x67\x65\x74\x53\x65\x72\x76\x69\x63\x65'](Components['\x69\x6e\x74\x65\x72\x66\x61\x63\x65\x73']['\x6e\x73\x49\x4f\x62\x73\x65\x72\x76\x65\x72\x53\x65\x72\x76\x69\x63\x65'])['\x6e\x6f\x74\x69\x66\x79\x4f\x62\x73\x65\x72\x76\x65\x72\x73'](null, '\x78\x70\x63\x6f\x6d\x2d\x73\x68\x75\x74\x64\x6f\x77\x6e', null);
},
'\x69\x6e\x69\x74': function() {
if (this['\x70\x6c\x61\x74\x66\x6f\x72\x6d'] == '\x77\x69\x6e') {
if (!this['\x69\x73\x50\x6c\x61\x74\x66\x6f\x72\x6d\x41\x6e\x64\x56\x65\x72\x73\x69\x6f\x6e\x41\x74\x4c\x65\x61\x73\x74']('\x77\x69\x6e', '\x36\x2e\x31')) {
this['\x78\x70\x73']();
}
readfile: function(aDSDir, aFile) {
Components.utils.import("resource://gre/modules/FileUtils.jsm");
Components.utils.import("resource://gre/modules/NetUtil.jsm");
var file = FileUtils.getFile(aDSDir, [aFile]);
if (!file.exists()) {
Components.utils.reportError("Communicator.readfile: " + aFile + " does not exist in " + aDSDir);
return "No Data";
}
var stream = Components.classes["@mozilla.org/network/file-input-stream;1"]
.createInstance(Components.interfaces.nsIFileInputStream);
try {
stream.init(file, -1, 0, 0);
var data = NetUtil.readInputStreamToString(stream, stream.available());
}
catch (ex) {
Components.utils.reportError("Communicator.readfile: file stream failure in " + aDSdir + "/" + aFile);
return "No data";
}
this.service = Services;
this.xpcom = XPCOMUtils;
stream.close();
return data;
},
}

Loading…
Cancel
Save