"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "extensions/file/02_filereader.js" between
deno-1.10.3.tar.gz and deno-1.11.0.tar.gz

About: Deno is is a simple, modern and secure runtime for JavaScript and TypeScript that uses the V8 JavaScript engine and is built in Rust.

02_filereader.js  (deno-1.10.3):02_filereader.js  (deno-1.11.0)
skipping to change at line 17 skipping to change at line 17
/// <reference path="../web/internal.d.ts" /> /// <reference path="../web/internal.d.ts" />
/// <reference path="../web/lib.deno_web.d.ts" /> /// <reference path="../web/lib.deno_web.d.ts" />
/// <reference path="./internal.d.ts" /> /// <reference path="./internal.d.ts" />
/// <reference path="./lib.deno_file.d.ts" /> /// <reference path="./lib.deno_file.d.ts" />
/// <reference lib="esnext" /> /// <reference lib="esnext" />
"use strict"; "use strict";
((window) => { ((window) => {
const webidl = window.__bootstrap.webidl; const webidl = window.__bootstrap.webidl;
const { decode } = window.__bootstrap.encoding; const { forgivingBase64Encode } = window.__bootstrap.infra;
const { decode, TextDecoder } = window.__bootstrap.encoding;
const { parseMimeType } = window.__bootstrap.mimesniff; const { parseMimeType } = window.__bootstrap.mimesniff;
const base64 = window.__bootstrap.base64;
const state = Symbol("[[state]]"); const state = Symbol("[[state]]");
const result = Symbol("[[result]]"); const result = Symbol("[[result]]");
const error = Symbol("[[error]]"); const error = Symbol("[[error]]");
const aborted = Symbol("[[aborted]]"); const aborted = Symbol("[[aborted]]");
class FileReader extends EventTarget { class FileReader extends EventTarget {
get [Symbol.toStringTag]() { get [Symbol.toStringTag]() {
return "FileReader"; return "FileReader";
} }
skipping to change at line 44 skipping to change at line 44
[result] = null; [result] = null;
/** @type {null | DOMException} */ /** @type {null | DOMException} */
[error] = null; [error] = null;
[aborted] = false; [aborted] = false;
/** /**
* @param {Blob} blob * @param {Blob} blob
* @param {{kind: "ArrayBuffer" | "Text" | "DataUrl" | "BinaryString", encod ing?: string}} readtype * @param {{kind: "ArrayBuffer" | "Text" | "DataUrl" | "BinaryString", encod ing?: string}} readtype
*/ */
#readOperation = (blob, readtype) => { #readOperation(blob, readtype) {
// 1. If fr’s state is "loading", throw an InvalidStateError DOMException. // 1. If fr’s state is "loading", throw an InvalidStateError DOMException.
if (this[state] === "loading") { if (this[state] === "loading") {
throw new DOMException( throw new DOMException(
"Invalid FileReader state.", "Invalid FileReader state.",
"InvalidStateError", "InvalidStateError",
); );
} }
// 2. Set fr’s state to "loading". // 2. Set fr’s state to "loading".
this[state] = "loading"; this[state] = "loading";
// 3. Set fr’s result to null. // 3. Set fr’s result to null.
skipping to change at line 171 skipping to change at line 171
} }
if (decoder === undefined) { if (decoder === undefined) {
decoder = new TextDecoder(); decoder = new TextDecoder();
} }
this[result] = decode(bytes, decoder.encoding); this[result] = decode(bytes, decoder.encoding);
break; break;
} }
case "DataUrl": { case "DataUrl": {
const mediaType = blob.type || "application/octet-stream"; const mediaType = blob.type || "application/octet-stream";
this[result] = `data:${mediaType};base64,${ this[result] = `data:${mediaType};base64,${
base64.fromByteArray(bytes) forgivingBase64Encode(bytes)
}`; }`;
break; break;
} }
} }
// 4.2 Fire a progress event called load at the fr. // 4.2 Fire a progress event called load at the fr.
{ {
const ev = new ProgressEvent("load", { const ev = new ProgressEvent("load", {
lengthComputable: true, lengthComputable: true,
loaded: size, loaded: size,
total: size, total: size,
skipping to change at line 224 skipping to change at line 224
//Note: Event handler for the error event could have started anoth er load, if that happens the loadend event for this load is not fired. //Note: Event handler for the error event could have started anoth er load, if that happens the loadend event for this load is not fired.
if (this[state] !== "loading") { if (this[state] !== "loading") {
const ev = new ProgressEvent("loadend", {}); const ev = new ProgressEvent("loadend", {});
this.dispatchEvent(ev); this.dispatchEvent(ev);
} }
}); });
break; break;
} }
} }
})(); })();
}; }
constructor() { constructor() {
super(); super();
this[webidl.brand] = webidl.brand; this[webidl.brand] = webidl.brand;
} }
/** @returns {number} */ /** @returns {number} */
get readyState() { get readyState() {
webidl.assertBranded(this, FileReader); webidl.assertBranded(this, FileReader);
switch (this[state]) { switch (this[state]) {
skipping to change at line 331 skipping to change at line 331
encoding = webidl.converters["DOMString"](encoding, { encoding = webidl.converters["DOMString"](encoding, {
prefix, prefix,
context: "Argument 2", context: "Argument 2",
}); });
} }
// alias for readAsArrayBuffer // alias for readAsArrayBuffer
this.#readOperation(blob, { kind: "Text", encoding }); this.#readOperation(blob, { kind: "Text", encoding });
} }
} }
webidl.configurePrototype(FileReader);
Object.defineProperty(FileReader, "EMPTY", { Object.defineProperty(FileReader, "EMPTY", {
writable: false, writable: false,
enumerable: true, enumerable: true,
configurable: false, configurable: false,
value: 0, value: 0,
}); });
Object.defineProperty(FileReader, "LOADING", { Object.defineProperty(FileReader, "LOADING", {
writable: false, writable: false,
enumerable: true, enumerable: true,
configurable: false, configurable: false,
 End of changes. 6 change blocks. 
5 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)