[Pkg-javascript-commits] [pdf.js] 93/210: Remove 'info' and 'metadata' from GetDoc
David Prévot
taffit at moszumanska.debian.org
Thu Jun 5 14:21:05 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch upstream
in repository pdf.js.
commit f3f3db0d1598f7e3863ba6b5365f4736662d2af4
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date: Wed May 7 21:38:40 2014 +0200
Remove 'info' and 'metadata' from GetDoc
---
src/core/worker.js | 20 ++++++++++++--------
src/display/api.js | 22 ++++++++++++++--------
2 files changed, 26 insertions(+), 16 deletions(-)
diff --git a/src/core/worker.js b/src/core/worker.js
index 68b7016..5b29698 100644
--- a/src/core/worker.js
+++ b/src/core/worker.js
@@ -32,19 +32,13 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {
var parseSuccess = function parseSuccess() {
var numPagesPromise = pdfManager.ensureDoc('numPages');
var fingerprintPromise = pdfManager.ensureDoc('fingerprint');
- var infoPromise = pdfManager.ensureDoc('documentInfo');
- var metadataPromise = pdfManager.ensureCatalog('metadata');
var encryptedPromise = pdfManager.ensureXRef('encrypt');
Promise.all([numPagesPromise, fingerprintPromise,
- infoPromise, metadataPromise, encryptedPromise
- ]).then(function onDocReady(results) {
-
+ encryptedPromise]).then(function onDocReady(results) {
var doc = {
numPages: results[0],
fingerprint: results[1],
- info: results[2],
- metadata: results[3],
- encrypted: !!results[4],
+ encrypted: !!results[2],
};
loadDocumentCapability.resolve(doc);
},
@@ -325,6 +319,16 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {
}
);
+ handler.on('GetMetadata',
+ function wphSetupGetMetadata(data, deferred) {
+ Promise.all([pdfManager.ensureDoc('documentInfo'),
+ pdfManager.ensureCatalog('metadata')]).then(
+ function (results) {
+ deferred.resolve(results);
+ }, deferred.reject);
+ }
+ );
+
handler.on('GetData', function wphSetupGetData(data, deferred) {
pdfManager.requestLoadedStream();
pdfManager.onLoadedStream().then(function(stream) {
diff --git a/src/display/api.js b/src/display/api.js
index 0b6915c..977fb8c 100644
--- a/src/display/api.js
+++ b/src/display/api.js
@@ -299,14 +299,7 @@ var PDFDocumentProxy = (function PDFDocumentProxyClosure() {
* {Metadata} object with information from the metadata section of the PDF.
*/
getMetadata: function PDFDocumentProxy_getMetadata() {
- return new Promise(function (resolve) {
- var info = this.pdfInfo.info;
- var metadata = this.pdfInfo.metadata;
- resolve({
- info: info,
- metadata: (metadata ? new PDFJS.Metadata(metadata) : null)
- });
- }.bind(this));
+ return this.transport.getMetadata();
},
/**
* @return {Promise} A promise that is resolved with a TypedArray that has
@@ -1080,6 +1073,19 @@ var WorkerTransport = (function WorkerTransportClosure() {
}.bind(this));
},
+ getMetadata: function WorkerTransport_getMetadata() {
+ return new Promise(function (resolve) {
+ this.messageHandler.send('GetMetadata', null,
+ function transportMetadata(results) {
+ resolve({
+ info: results[0],
+ metadata: (results[1] ? new PDFJS.Metadata(results[1]) : null)
+ });
+ }
+ );
+ }.bind(this));
+ },
+
startCleanup: function WorkerTransport_startCleanup() {
this.messageHandler.send('Cleanup', null,
function endCleanup() {
--
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