[Pkg-javascript-commits] [pdf.js] 124/246: Removes some bind() calls from fetchAsync
David Prévot
taffit at moszumanska.debian.org
Sun Sep 7 15:36:32 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository pdf.js.
commit cc180d7e2b214ce301a40367f9c9e6223027fbdb
Author: Yury Delendik <ydelendik at mozilla.com>
Date: Tue Aug 5 21:22:12 2014 -0500
Removes some bind() calls from fetchAsync
---
src/core/obj.js | 33 +++++++++++++++++----------------
1 file changed, 17 insertions(+), 16 deletions(-)
diff --git a/src/core/obj.js b/src/core/obj.js
index fcaee03..693dd63 100644
--- a/src/core/obj.js
+++ b/src/core/obj.js
@@ -583,7 +583,7 @@ var Catalog = (function CatalogClosure() {
}
nodesToVisit.push(obj);
next();
- }.bind(this), capability.reject.bind(capability));
+ }, capability.reject);
return;
}
@@ -1287,21 +1287,22 @@ var XRef = (function XRefClosure() {
},
fetchAsync: function XRef_fetchAsync(ref, suppressEncryption) {
- return new Promise(function (resolve, reject) {
- var tryFetch = function () {
- try {
- resolve(this.fetch(ref, suppressEncryption));
- } catch (e) {
- if (e instanceof MissingDataException) {
- this.stream.manager.requestRange(e.begin, e.end, tryFetch);
- return;
- }
- reject(e);
- }
- }.bind(this);
- tryFetch();
- }.bind(this));
- },
+ var streamManager = this.stream.manager;
+ var xref = this;
+ return new Promise(function tryFetch(resolve, reject) {
+ try {
+ resolve(xref.fetch(ref, suppressEncryption));
+ } catch (e) {
+ if (e instanceof MissingDataException) {
+ streamManager.requestRange(e.begin, e.end, function () {
+ tryFetch(resolve, reject);
+ });
+ return;
+ }
+ reject(e);
+ }
+ });
+ },
getCatalogObj: function XRef_getCatalogObj() {
return this.root;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git
More information about the Pkg-javascript-commits
mailing list