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 Ci = Components.interfaces;
|
||||
|
||||
Components.utils.import("resource://gre/modules/AddonManager.jsm");
|
||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
Components.utils.import("resource://ox/utils.jsm");
|
||||
|
@ -49,6 +48,13 @@ function OxFF() {
|
|||
this.username = oxff.get('username');
|
||||
this.password = oxff.get('password');
|
||||
|
||||
try {
|
||||
var em = Cc["@mozilla.org/extensions/manager;1"]
|
||||
.getService(Ci.nsIExtensionManager);
|
||||
var f = em.getInstallLocation('firefogg@firefogg.org').getItemFile('firefogg@firefogg.org', 'ffmpeg2theora');
|
||||
_this._ffmpeg2theora = f.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');
|
||||
|
@ -57,6 +63,7 @@ function OxFF() {
|
|||
_this._ffmpeg2theora = file.path;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -205,15 +212,36 @@ OxFF.prototype = {
|
|||
var base = this.base; //later base can not be a public property
|
||||
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);
|
||||
if (data) {
|
||||
for(key in data) {
|
||||
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);
|
||||
return true;
|
||||
},
|
||||
|
@ -351,6 +379,14 @@ OxFF.prototype = {
|
|||
var args = [oxff.getDBFile().path, _this._ffmpeg2theora];
|
||||
_this._daemon.runw(false, args, args.length);
|
||||
}
|
||||
|
||||
try {
|
||||
var em = Cc["@mozilla.org/extensions/manager;1"]
|
||||
.getService(Ci.nsIExtensionManager);
|
||||
var file = em.getInstallLocation(this.extensionID).getItemFile(this.extensionID, daemon);
|
||||
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');
|
||||
|
@ -359,6 +395,8 @@ OxFF.prototype = {
|
|||
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
|
||||
|
||||
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
|
||||
cd ..
|
||||
|
||||
#cleanup
|
||||
sed -i "s/version: \".*\"/version: \"bzr\"/g" OxFF/components/OxFF.js
|
||||
|
|
Loading…
Reference in a new issue