Skip to content

Commit

Permalink
1.5b.rev1
Browse files Browse the repository at this point in the history
* Fixes for Firefox 45
* nsIDOMFileReader
* Have to pass string principal to evalInSandbox
  • Loading branch information
Noitidart committed Feb 1, 2016
1 parent 0d26416 commit 1286283
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
13 changes: 9 additions & 4 deletions bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ const {TextDecoder, TextEncoder, OS} = Cu.import('resource://gre/modules/osfile.
Cu.import('resource://gre/modules/Promise.jsm');
Cu.import('resource://gre/modules/Services.jsm');
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
Cu.importGlobalProperties(['btoa', 'atob']);

var importGlobalPropertiesArr = ['btoa', 'atob'];
if (!Ci.nsIDOMFileReader) {
importGlobalPropertiesArr.push('FileReader');
}
Cu.importGlobalProperties(importGlobalPropertiesArr);

// Globals
const core = {
Expand Down Expand Up @@ -1109,7 +1114,7 @@ var gEditor = {
var do_saveCanToDisk = function() {
(gEditor.canComp.toBlobHD || gEditor.canComp.toBlob).call(gEditor.canComp, function(b) {
gEditor.closeOutEditor(e); // as i cant close out yet as i need this.canComp see line above this one: `(this.canComp.toBlobHD || this.canComp.toBlob).call(this.canComp, function(b) {`
var r = Cc['@mozilla.org/files/filereader;1'].createInstance(Ci.nsIDOMFileReader); //new FileReader();
var r = Ci.nsIDOMFileReader ? Cc['@mozilla.org/files/filereader;1'].createInstance(Ci.nsIDOMFileReader) : new FileReader();
r.onloadend = function() {
// r.result contains the ArrayBuffer.
// start - copy block link49842300
Expand Down Expand Up @@ -1668,8 +1673,8 @@ var gEditor = {
gEditor.closeOutEditor(e); // as i cant close out yet as i need this.canComp see line above this one: `(this.canComp.toBlobHD || this.canComp.toBlob).call(this.canComp, function(b) {` link374748304
// let file = new FileUtils.File('C:\\Users\\Vayeate\\Pictures\\imglogo.jpg');
console.log('blob ready:', b);
var fileReader = Cc['@mozilla.org/files/filereader;1'].createInstance(Ci.nsIDOMFileReader);

var fileReader = Ci.nsIDOMFileReader ? Cc['@mozilla.org/files/filereader;1'].createInstance(Ci.nsIDOMFileReader) : new FileReader();
fileReader.addEventListener('load', function (event) {
var buffer = event.target.result;
// console.error('buffer ready:', buffer.constructor.name);
Expand Down
3 changes: 2 additions & 1 deletion resources/scripts/fs_twitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,8 @@ function doRegisterJqueryScript() {
sandboxPrototype: aContentWindow,
wantXrays: false
};
var principal = docShell.chromeEventHandler.contentPrincipal; // aContentWindow.location.origin;
// var principal = docShell.chromeEventHandler.contentPrincipal; // in fx45 this is throwing NS_ERROR_ILLEGAL_VALUE: Illegal value
var principal = aContentWindow.location.origin;

aSandbox = Cu.Sandbox(principal, options);

Expand Down

0 comments on commit 1286283

Please sign in to comment.