backport to firefox 3.6
This commit is contained in:
parent
94b5a2df79
commit
7abbd82c07
2 changed files with 60 additions and 20 deletions
|
@ -9,7 +9,6 @@
|
||||||
const Cc = Components.classes;
|
const Cc = Components.classes;
|
||||||
const Ci = Components.interfaces;
|
const Ci = Components.interfaces;
|
||||||
|
|
||||||
Components.utils.import("resource://gre/modules/AddonManager.jsm");
|
|
||||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
|
|
||||||
Components.utils.import("resource://ox/utils.jsm");
|
Components.utils.import("resource://ox/utils.jsm");
|
||||||
|
@ -49,14 +48,22 @@ function OxFF() {
|
||||||
this.username = oxff.get('username');
|
this.username = oxff.get('username');
|
||||||
this.password = oxff.get('password');
|
this.password = oxff.get('password');
|
||||||
|
|
||||||
AddonManager.getAddonByID('firefogg@firefogg.org', function(addon) {
|
try {
|
||||||
if (addon.hasResource('bin')) {
|
var em = Cc["@mozilla.org/extensions/manager;1"]
|
||||||
var resource = addon.getResourceURI('bin');
|
.getService(Ci.nsIExtensionManager);
|
||||||
var file = resource.QueryInterface(Ci.nsIFileURL).file.QueryInterface(Ci.nsILocalFile);
|
var f = em.getInstallLocation('firefogg@firefogg.org').getItemFile('firefogg@firefogg.org', 'ffmpeg2theora');
|
||||||
file.append('ffmpeg2theora');
|
_this._ffmpeg2theora = f.path;
|
||||||
_this._ffmpeg2theora = file.path;
|
} catch(e) {
|
||||||
}
|
Components.utils.import("resource://gre/modules/AddonManager.jsm");
|
||||||
});
|
AddonManager.getAddonByID('firefogg@firefogg.org', function(addon) {
|
||||||
|
if (addon.hasResource('bin')) {
|
||||||
|
var resource = addon.getResourceURI('bin');
|
||||||
|
var file = resource.QueryInterface(Ci.nsIFileURL).file.QueryInterface(Ci.nsILocalFile);
|
||||||
|
file.append('ffmpeg2theora');
|
||||||
|
_this._ffmpeg2theora = file.path;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,15 +212,36 @@ OxFF.prototype = {
|
||||||
var base = this.base; //later base can not be a public property
|
var base = this.base; //later base can not be a public property
|
||||||
var url = base + action;
|
var url = base + action;
|
||||||
|
|
||||||
|
//req.open("POST", url, true, this.username, this.password);
|
||||||
|
req.open("POST", url, true);
|
||||||
|
|
||||||
|
try {
|
||||||
var formData = Cc["@mozilla.org/files/formdata;1"].createInstance(Ci.nsIDOMFormData);
|
var formData = Cc["@mozilla.org/files/formdata;1"].createInstance(Ci.nsIDOMFormData);
|
||||||
if (data) {
|
if (data) {
|
||||||
for(key in data) {
|
for(key in data) {
|
||||||
formData.append(key, data[key]);
|
formData.append(key, data[key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch(e) {
|
||||||
|
var converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].createInstance(Ci.nsIScriptableUnicodeConverter);
|
||||||
|
converter.charset = "UTF-8";
|
||||||
|
var boundary = "--------XX" + Math.random();
|
||||||
|
var formData='';
|
||||||
|
if (data) {
|
||||||
|
for(key in data) {
|
||||||
|
if (data[key]) {
|
||||||
|
formData +="--" + boundary + "\r\n" +
|
||||||
|
"Content-Disposition: form-data; name=\""+key+"\"\r\n\r\n" +
|
||||||
|
data[key] + "\r\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
formData += "--" + boundary + "--\r\n";
|
||||||
|
req.setRequestHeader("Content-type", "multipart/form-data; boundary=" + boundary);
|
||||||
|
req.setRequestHeader("Content-length", formData.length);
|
||||||
|
var formData = converter.convertToInputStream(formData);
|
||||||
|
}
|
||||||
|
|
||||||
//req.open("POST", url, true, this.username, this.password);
|
|
||||||
req.open("POST", url, true);
|
|
||||||
req.send(formData);
|
req.send(formData);
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
@ -351,14 +379,24 @@ OxFF.prototype = {
|
||||||
var args = [oxff.getDBFile().path, _this._ffmpeg2theora];
|
var args = [oxff.getDBFile().path, _this._ffmpeg2theora];
|
||||||
_this._daemon.runw(false, args, args.length);
|
_this._daemon.runw(false, args, args.length);
|
||||||
}
|
}
|
||||||
AddonManager.getAddonByID(this.extensionID, function(addon) {
|
|
||||||
if (addon.hasResource('bin')) {
|
try {
|
||||||
var resource = addon.getResourceURI('bin');
|
var em = Cc["@mozilla.org/extensions/manager;1"]
|
||||||
var file = resource.QueryInterface(Ci.nsIFileURL).file.QueryInterface(Ci.nsILocalFile);
|
.getService(Ci.nsIExtensionManager);
|
||||||
file.append(daemon);
|
var file = em.getInstallLocation(this.extensionID).getItemFile(this.extensionID, daemon);
|
||||||
runDaemon(file);
|
runDaemon(file);
|
||||||
}
|
} catch(e) {
|
||||||
});
|
Components.utils.import("resource://gre/modules/AddonManager.jsm");
|
||||||
|
AddonManager.getAddonByID(this.extensionID, function(addon) {
|
||||||
|
if (addon.hasResource('bin')) {
|
||||||
|
var resource = addon.getResourceURI('bin');
|
||||||
|
var file = resource.QueryInterface(Ci.nsIFileURL).file.QueryInterface(Ci.nsILocalFile);
|
||||||
|
file.append(daemon);
|
||||||
|
runDaemon(file);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
4
build.sh
4
build.sh
|
@ -14,8 +14,10 @@ sed -i "s/version: \".*\"/version: \"$version\"/g" OxFF/components/OxFF.js
|
||||||
sed -i "s/em:version>.*<\/em:version/em:version>$version<\/em:version/g" OxFF/install.rdf
|
sed -i "s/em:version>.*<\/em:version/em:version>$version<\/em:version/g" OxFF/install.rdf
|
||||||
|
|
||||||
rm -f dist/OxFF-$version.xpi
|
rm -f dist/OxFF-$version.xpi
|
||||||
zip -9 -r dist/OxFF-$version.xpi * \
|
cd OxFF
|
||||||
|
zip -9 -r ../dist/OxFF-$version.xpi * \
|
||||||
-x \*.~1~ -x \*.orig
|
-x \*.~1~ -x \*.orig
|
||||||
|
cd ..
|
||||||
|
|
||||||
#cleanup
|
#cleanup
|
||||||
sed -i "s/version: \".*\"/version: \"bzr\"/g" OxFF/components/OxFF.js
|
sed -i "s/version: \".*\"/version: \"bzr\"/g" OxFF/components/OxFF.js
|
||||||
|
|
Loading…
Reference in a new issue