mirror of
https://github.com/webodf/WebODF.git
synced 2026-11-30 16:47:58 +01:00
Remove now-unused runtime.getFileSize function
This commit is contained in:
@@ -75,9 +75,6 @@ OdfView::slotLoadFinished(bool ok) {
|
||||
" var data = nativeio.read(path, offset, length);"
|
||||
" data = runtime.byteArrayFromString(data, 'binary');"
|
||||
" callback(nativeio.error()||null, data);"
|
||||
"};"
|
||||
"runtime.getFileSize = function (path, callback) {"
|
||||
" callback(nativeio.getFileSize(path));"
|
||||
"};";
|
||||
frame->evaluateJavaScript(js);
|
||||
}
|
||||
|
||||
@@ -783,8 +783,7 @@ function Docnosis(element) {
|
||||
}
|
||||
|
||||
function enhanceRuntime() {
|
||||
var read = runtime.read,
|
||||
getFileSize = runtime.getFileSize;
|
||||
var read = runtime.read;
|
||||
runtime.read = function (path, offset, length, callback) {
|
||||
if (openedFiles.hasOwnProperty(path)) {
|
||||
return openedFiles[path].read(offset, length, callback);
|
||||
@@ -792,13 +791,6 @@ function Docnosis(element) {
|
||||
return read(path, offset, length, callback);
|
||||
}
|
||||
};
|
||||
runtime.getFileSize = function (path, callback) {
|
||||
if (openedFiles.hasOwnProperty(path)) {
|
||||
return callback(openedFiles[path].file.size);
|
||||
} else {
|
||||
return getFileSize(path, callback);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
form = createForm();
|
||||
|
||||
@@ -77,8 +77,7 @@ function createEditor() {
|
||||
|
||||
function enhanceRuntime() {
|
||||
var openedFiles = {},
|
||||
read = runtime.read,
|
||||
getFileSize = runtime.getFileSize;
|
||||
read = runtime.read;
|
||||
runtime.read = function (path, offset, length, callback) {
|
||||
var array;
|
||||
if (openedFiles.hasOwnProperty(path)) {
|
||||
@@ -88,13 +87,6 @@ function createEditor() {
|
||||
return read(path, offset, length, callback);
|
||||
}
|
||||
};
|
||||
runtime.getFileSize = function (path, callback) {
|
||||
if (openedFiles.hasOwnProperty(path)) {
|
||||
return callback(openedFiles[path].byteLength);
|
||||
} else {
|
||||
return getFileSize(path, callback);
|
||||
}
|
||||
};
|
||||
runtime.registerFile = function (path, data) {
|
||||
openedFiles[path] = data;
|
||||
};
|
||||
|
||||
@@ -77,8 +77,7 @@ function createReviewEditor() {
|
||||
|
||||
function enhanceRuntime() {
|
||||
var openedFiles = {},
|
||||
read = runtime.read,
|
||||
getFileSize = runtime.getFileSize;
|
||||
read = runtime.read;
|
||||
runtime.read = function (path, offset, length, callback) {
|
||||
var array;
|
||||
if (openedFiles.hasOwnProperty(path)) {
|
||||
@@ -88,13 +87,6 @@ function createReviewEditor() {
|
||||
return read(path, offset, length, callback);
|
||||
}
|
||||
};
|
||||
runtime.getFileSize = function (path, callback) {
|
||||
if (openedFiles.hasOwnProperty(path)) {
|
||||
return callback(openedFiles[path].byteLength);
|
||||
} else {
|
||||
return getFileSize(path, callback);
|
||||
}
|
||||
};
|
||||
runtime.registerFile = function (path, data) {
|
||||
openedFiles[path] = data;
|
||||
};
|
||||
|
||||
@@ -110,12 +110,6 @@ Runtime.prototype.loadXML = function (path, callback) {"use strict"; };
|
||||
Runtime.prototype.writeFile = function (path, data, callback) {"use strict"; };
|
||||
/**
|
||||
* @param {!string} path
|
||||
/**
|
||||
* @param {!string} path
|
||||
* @param {!function(number):undefined} callback
|
||||
* @return {undefined}
|
||||
*/
|
||||
Runtime.prototype.getFileSize = function (path, callback) {"use strict"; };
|
||||
* @param {!function(?string):undefined} callback
|
||||
* @return {undefined}
|
||||
*/
|
||||
@@ -791,44 +785,12 @@ function BrowserRuntime(logoutput) {
|
||||
callback(e.message, null);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param {!string} path
|
||||
* @param {!function(number):undefined} callback
|
||||
* @return {undefined}
|
||||
*/
|
||||
function getFileSize(path, callback) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("HEAD", path, true);
|
||||
xhr.onreadystatechange = function () {
|
||||
if (xhr.readyState !== 4) {
|
||||
return;
|
||||
}
|
||||
var cl = xhr.getResponseHeader("Content-Length");
|
||||
if (cl) {
|
||||
callback(parseInt(cl, 10));
|
||||
} else {
|
||||
// Due to CORS implementation bugs, some browsers will not allow access to certain headers
|
||||
// even if the server says it's ok. This specific bug was observed in Cocoa's WebView on OSX10.8.
|
||||
// However, even though the browser won't pull the content-length header (coz it's a security risk!)
|
||||
// the content can still be fetched.
|
||||
readFile(path, "binary", function (err, data) {
|
||||
if (!err) {
|
||||
callback(data.length);
|
||||
} else {
|
||||
callback(-1);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
xhr.send(null);
|
||||
}
|
||||
this.readFile = readFile;
|
||||
this.read = read;
|
||||
this.readFileSync = readFileSync;
|
||||
this.writeFile = writeFile;
|
||||
this.deleteFile = deleteFile;
|
||||
this.loadXML = loadXML;
|
||||
this.getFileSize = getFileSize;
|
||||
this.log = log;
|
||||
this.enableAlerts = true;
|
||||
this.assert = Runtime.assert;
|
||||
@@ -1113,21 +1075,6 @@ function NodeJSRuntime() {
|
||||
}
|
||||
return s;
|
||||
};
|
||||
/**
|
||||
* @param {!string} path
|
||||
* @param {!function(number):undefined} callback
|
||||
* @return {undefined}
|
||||
*/
|
||||
this.getFileSize = function (path, callback) {
|
||||
path = pathmod.resolve(currentDirectory, path);
|
||||
fs.stat(path, function (err, stats) {
|
||||
if (err) {
|
||||
callback(-1);
|
||||
} else {
|
||||
callback(stats.size);
|
||||
}
|
||||
});
|
||||
};
|
||||
/**
|
||||
* @param {!string} msgOrCategory
|
||||
* @param {string=} msg
|
||||
@@ -1440,18 +1387,6 @@ function RhinoRuntime() {
|
||||
}
|
||||
return s;
|
||||
};
|
||||
/**
|
||||
* @param {!string} path
|
||||
* @param {!function(number):undefined} callback
|
||||
* @return {undefined}
|
||||
*/
|
||||
this.getFileSize = function (path, callback) {
|
||||
if (currentDirectory) {
|
||||
path = currentDirectory + "/" + path;
|
||||
}
|
||||
var file = new Packages.java.io.File(path);
|
||||
callback(file.length());
|
||||
};
|
||||
/**
|
||||
* @param {!string} msgOrCategory
|
||||
* @param {string=} msg
|
||||
|
||||
Reference in New Issue
Block a user