First commit

This commit is contained in:
Pierre Hubert
2016-11-19 12:08:12 +01:00
commit 990540b2b9
4706 changed files with 931207 additions and 0 deletions

4
3rdparty/pdf.js/test/.gitignore vendored Executable file
View File

@ -0,0 +1,4 @@
ref/
tmp/
*.log
test_snapshots/

174
3rdparty/pdf.js/test/downloadutils.js vendored Executable file
View File

@ -0,0 +1,174 @@
/* -*- Mode: js; js-indent-level: 2; indent-tabs-mode: nil; tab-width: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
/*
* Copyright 2014 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*jslint node: true */
'use strict';
var fs = require('fs');
var crypto = require('crypto');
var http = require('http');
var https = require('https');
function downloadFile(file, url, callback, redirects) {
var completed = false;
var protocol = /^https:\/\//.test(url) ? https : http;
protocol.get(url, function (response) {
var redirectTo;
if (response.statusCode === 301 || response.statusCode === 302 ||
response.statusCode === 307 || response.statusCode === 308) {
if (redirects > 10) {
callback('Too many redirects');
}
redirectTo = response.headers.location;
redirectTo = require('url').resolve(url, redirectTo);
downloadFile(file, redirectTo, callback, (redirects || 0) + 1);
return;
}
if (response.statusCode === 404 && url.indexOf('web.archive.org') < 0) {
// trying waybackmachine
redirectTo = 'http://web.archive.org/web/' + url;
downloadFile(file, redirectTo, callback, (redirects || 0) + 1);
return;
}
if (response.statusCode !== 200) {
if (!completed) {
completed = true;
callback('HTTP ' + response.statusCode);
}
return;
}
var stream = fs.createWriteStream(file);
stream.on('error', function (err) {
if (!completed) {
completed = true;
callback(err);
}
});
response.pipe(stream);
stream.on('finish', function() {
stream.close();
if (!completed) {
completed = true;
callback();
}
});
}).on('error', function (err) {
if (!completed) {
if (typeof err === 'object' && err.errno === 'ENOTFOUND' &&
url.indexOf('web.archive.org') < 0) {
// trying waybackmachine
var redirectTo = 'http://web.archive.org/web/' + url;
downloadFile(file, redirectTo, callback, (redirects || 0) + 1);
return;
}
completed = true;
callback(err);
}
});
}
function downloadManifestFiles(manifest, callback) {
function downloadNext() {
if (i >= links.length) {
callback();
return;
}
var file = links[i].file;
var url = links[i].url;
console.log('Downloading ' + url + ' to ' + file + '...');
downloadFile(file, url, function (err) {
if (err) {
console.error('Error during downloading of ' + url + ': ' + err);
fs.writeFileSync(file, ''); // making it empty file
fs.writeFileSync(file + '.error', err);
}
i++;
downloadNext();
});
}
var links = manifest.filter(function (item) {
return item.link && !fs.existsSync(item.file);
}).map(function (item) {
var file = item.file;
var linkfile = file + '.link';
var url = fs.readFileSync(linkfile).toString();
url = url.replace(/\s+$/, '');
return {file: file, url: url};
});
var i = 0;
downloadNext();
}
function calculateMD5(file, callback) {
var hash = crypto.createHash('md5');
var stream = fs.createReadStream(file);
stream.on('data', function (data) {
hash.update(data);
});
stream.on('error', function (err) {
callback(err);
});
stream.on('end', function() {
var result = hash.digest('hex');
callback(null, result);
});
}
function verifyManifestFiles(manifest, callback) {
function verifyNext() {
if (i >= manifest.length) {
callback(error);
return;
}
var item = manifest[i];
if (fs.existsSync(item.file + '.error')) {
console.error('WARNING: File was not downloaded. See "' +
item.file + '.error" file.');
error = true;
i++;
verifyNext();
return;
}
calculateMD5(item.file, function (err, md5) {
if (err) {
console.log('WARNING: Unable to open file for reading "' + err + '".');
error = true;
} else if (!item.md5) {
console.error('WARNING: Missing md5 for file "' + item.file + '". ' +
'Hash for current file is "' + md5 + '"');
error = true;
} else if (md5 !== item.md5) {
console.error('WARNING: MD5 of file "' + item.file +
'" does not match file. Expected "' +
item.md5 + '" computed "' + md5 + '"');
error = true;
}
i++;
verifyNext();
});
}
var i = 0;
var error = false;
verifyNext();
}
exports.downloadManifestFiles = downloadManifestFiles;
exports.verifyManifestFiles = verifyManifestFiles;

475
3rdparty/pdf.js/test/driver.js vendored Executable file
View File

@ -0,0 +1,475 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
/* Copyright 2012 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals PDFJS, combineUrl, StatTimer, Promise */
'use strict';
var WAITING_TIME = 100; // ms
var PDF_TO_CSS_UNITS = 96.0 / 72.0;
/**
* @class
*/
var NullTextLayerBuilder = (function NullTextLayerBuilderClosure() {
/**
* @constructs NullTextLayerBuilder
*/
function NullTextLayerBuilder() {}
NullTextLayerBuilder.prototype = {
beginLayout: function NullTextLayerBuilder_BeginLayout() {},
endLayout: function NullTextLayerBuilder_EndLayout() {},
appendText: function NullTextLayerBuilder_AppendText() {}
};
return NullTextLayerBuilder;
})();
/**
* @class
*/
var SimpleTextLayerBuilder = (function SimpleTextLayerBuilderClosure() {
/**
* @constructs SimpleTextLayerBuilder
*/
function SimpleTextLayerBuilder(ctx, viewport) {
this.ctx = ctx;
this.viewport = viewport;
this.textCounter = 0;
}
SimpleTextLayerBuilder.prototype = {
appendText: function SimpleTextLayerBuilder_AppendText(geom, styles) {
var style = styles[geom.fontName];
var ctx = this.ctx, viewport = this.viewport;
var tx = PDFJS.Util.transform(this.viewport.transform, geom.transform);
var angle = Math.atan2(tx[1], tx[0]);
var fontHeight = Math.sqrt((tx[2] * tx[2]) + (tx[3] * tx[3]));
var fontAscent = (style.ascent ? style.ascent * fontHeight :
(style.descent ? (1 + style.descent) * fontHeight : fontHeight));
ctx.save();
ctx.beginPath();
ctx.strokeStyle = 'red';
ctx.fillStyle = 'yellow';
ctx.translate(tx[4] + (fontAscent * Math.sin(angle)),
tx[5] - (fontAscent * Math.cos(angle)));
ctx.rotate(angle);
ctx.rect(0, 0, geom.width * viewport.scale, geom.height * viewport.scale);
ctx.stroke();
ctx.fill();
ctx.restore();
ctx.font = fontHeight + 'px ' + style.fontFamily;
ctx.fillStyle = 'black';
ctx.fillText(geom.str, tx[4], tx[5]);
this.textCounter++;
},
setTextContent:
function SimpleTextLayerBuilder_SetTextContent(textContent) {
this.ctx.save();
var textItems = textContent.items;
for (var i = 0, ii = textItems.length; i < ii; i++) {
this.appendText(textItems[i], textContent.styles);
}
this.ctx.restore();
}
};
return SimpleTextLayerBuilder;
})();
/**
* @typedef {Object} DriverOptions
* @property {HTMLSpanElement} inflight - Field displaying the number of
* inflight requests.
* @property {HTMLInputElement} disableScrolling - Checkbox to disable
* automatic scrolling of the output container.
* @property {HTMLPreElement} output - Container for all output messages.
* @property {HTMLDivElement} end - Container for a completion message.
*/
/**
* @class
*/
var Driver = (function DriverClosure() {
/**
* @constructs Driver
* @param {DriverOptions} options
*/
function Driver(options) {
// Configure the global PDFJS object
PDFJS.workerSrc = '../src/worker_loader.js';
PDFJS.cMapPacked = true;
PDFJS.cMapUrl = '../external/bcmaps/';
PDFJS.enableStats = true;
// Set the passed options
this.inflight = options.inflight;
this.disableScrolling = options.disableScrolling;
this.output = options.output;
this.end = options.end;
// Set parameters from the query string
var parameters = this._getQueryStringParameters();
this.browser = parameters.browser;
this.manifestFile = parameters.manifestFile;
this.appPath = parameters.path;
this.delay = (parameters.delay | 0) || 0;
this.inFlightRequests = 0;
// Create a working canvas
this.canvas = document.createElement('canvas');
}
Driver.prototype = {
_getQueryStringParameters: function Driver_getQueryStringParameters() {
var queryString = window.location.search.substring(1);
var values = queryString.split('&');
var parameters = {};
for (var i = 0, ii = values.length; i < ii; i++) {
var value = values[i].split('=');
parameters[unescape(value[0])] = unescape(value[1]);
}
return parameters;
},
run: function Driver_run() {
var self = this;
this._info('User agent: ' + navigator.userAgent);
this._log('Harness thinks this browser is "' + this.browser +
'" with path "' + this.appPath + '"\n');
this._log('Fetching manifest "' + this.manifestFile + '"... ');
var r = new XMLHttpRequest();
r.open('GET', this.manifestFile, false);
r.onreadystatechange = function() {
if (r.readyState === 4) {
self._log('done\n');
self.manifest = JSON.parse(r.responseText);
self.currentTask = 0;
self._nextTask();
}
};
if (this.delay > 0) {
this._log('\nDelaying for ' + this.delay + ' ms...\n');
}
// When gathering the stats the numbers seem to be more reliable
// if the browser is given more time to start.
setTimeout(function() {
r.send(null);
}, this.delay);
},
_nextTask: function Driver_nextTask() {
var self = this;
var failure = '';
this._cleanup();
if (this.currentTask === this.manifest.length) {
this._done();
return;
}
var task = this.manifest[this.currentTask];
task.round = 0;
task.pageNum = task.firstPage || 1;
task.stats = { times: [] };
this._log('Loading file "' + task.file + '"\n');
var absoluteUrl = combineUrl(window.location.href, task.file);
PDFJS.disableRange = task.disableRange;
PDFJS.disableAutoFetch = !task.enableAutoFetch;
try {
PDFJS.getDocument({
url: absoluteUrl,
password: task.password
}).then(function(doc) {
task.pdfDoc = doc;
self._nextPage(task, failure);
}, function(e) {
failure = 'Loading PDF document: ' + e;
self._nextPage(task, failure);
});
return;
} catch (e) {
failure = 'Loading PDF document: ' + this._exceptionToString(e);
}
this._nextPage(task, failure);
},
_cleanup: function Driver_cleanup() {
// Clear out all the stylesheets since a new one is created for each font.
while (document.styleSheets.length > 0) {
var styleSheet = document.styleSheets[0];
while (styleSheet.cssRules.length > 0) {
styleSheet.deleteRule(0);
}
var ownerNode = styleSheet.ownerNode;
ownerNode.parentNode.removeChild(ownerNode);
}
var body = document.body;
while (body.lastChild !== this.end) {
body.removeChild(body.lastChild);
}
// Wipe out the link to the pdfdoc so it can be GC'ed.
for (var i = 0; i < this.manifest.length; i++) {
if (this.manifest[i].pdfDoc) {
this.manifest[i].pdfDoc.destroy();
delete this.manifest[i].pdfDoc;
}
}
},
_exceptionToString: function Driver_exceptionToString(e) {
if (typeof e !== 'object') {
return String(e);
}
if (!('message' in e)) {
return JSON.stringify(e);
}
return e.message + ('stack' in e ? ' at ' + e.stack.split('\n')[0] : '');
},
_getLastPageNumber: function Driver_getLastPageNumber(task) {
if (!task.pdfDoc) {
return task.firstPage || 1;
}
var lastPageNumber = task.lastPage || 0;
if (!lastPageNumber || lastPageNumber > task.pdfDoc.numPages) {
lastPageNumber = task.pdfDoc.numPages;
}
return lastPageNumber;
},
_nextPage: function Driver_nextPage(task, loadError) {
var self = this;
var failure = loadError || '';
if (!task.pdfDoc) {
var dataUrl = this.canvas.toDataURL('image/png');
this._sendResult(dataUrl, task, failure, function () {
self._log('done' + (failure ? ' (failed !: ' + failure + ')' : '') +
'\n');
self.currentTask++;
self._nextTask();
});
return;
}
if (task.pageNum > this._getLastPageNumber(task)) {
if (++task.round < task.rounds) {
this._log(' Round ' + (1 + task.round) + '\n');
task.pageNum = task.firstPage || 1;
} else {
this.currentTask++;
this._nextTask();
return;
}
}
if (task.skipPages && task.skipPages.indexOf(task.pageNum) >= 0) {
this._log(' Skipping page ' + task.pageNum + '/' +
task.pdfDoc.numPages + '... ');
// Empty the canvas
this.canvas.width = 1;
this.canvas.height = 1;
this._clearCanvas();
this._snapshot(task, '');
return;
}
if (!failure) {
try {
this._log(' Loading page ' + task.pageNum + '/' +
task.pdfDoc.numPages + '... ');
var ctx = this.canvas.getContext('2d');
task.pdfDoc.getPage(task.pageNum).then(function(page) {
var viewport = page.getViewport(PDF_TO_CSS_UNITS);
self.canvas.width = viewport.width;
self.canvas.height = viewport.height;
self._clearCanvas();
var drawContext, textLayerBuilder;
var resolveInitPromise;
var initPromise = new Promise(function (resolve) {
resolveInitPromise = resolve;
});
if (task.type === 'text') {
// Using a dummy canvas for PDF context drawing operations
if (!self.dummyCanvas) {
self.dummyCanvas = document.createElement('canvas');
}
drawContext = self.dummyCanvas.getContext('2d');
// The text builder will draw its content on the test canvas
textLayerBuilder = new SimpleTextLayerBuilder(ctx, viewport);
page.getTextContent().then(function(textContent) {
textLayerBuilder.setTextContent(textContent);
resolveInitPromise();
});
} else {
drawContext = ctx;
textLayerBuilder = new NullTextLayerBuilder();
resolveInitPromise();
}
var renderContext = {
canvasContext: drawContext,
viewport: viewport
};
var completeRender = (function(error) {
page.destroy();
task.stats = page.stats;
page.stats = new StatTimer();
self._snapshot(task, error);
});
initPromise.then(function () {
page.render(renderContext).promise.then(function() {
completeRender(false);
},
function(error) {
completeRender('render : ' + error);
});
});
},
function(error) {
self._snapshot(task, 'render : ' + error);
});
} catch (e) {
failure = 'page setup : ' + this._exceptionToString(e);
this._snapshot(task, failure);
}
}
},
_clearCanvas: function Driver_clearCanvas() {
var ctx = this.canvas.getContext('2d');
ctx.beginPath();
ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
},
_snapshot: function Driver_snapshot(task, failure) {
var self = this;
this._log('Snapshotting... ');
var dataUrl = this.canvas.toDataURL('image/png');
this._sendResult(dataUrl, task, failure, function () {
self._log('done' + (failure ? ' (failed !: ' + failure + ')' : '') +
'\n');
task.pageNum++;
self._nextPage(task);
});
},
_quit: function Driver_quit() {
this._log('Done !');
this.end.textContent = 'Tests finished. Close this window!';
// Send the quit request
var r = new XMLHttpRequest();
r.open('POST', '/tellMeToQuit?path=' + escape(this.appPath), false);
r.onreadystatechange = function(e) {
if (r.readyState === 4) {
window.close();
}
};
r.send(null);
},
_info: function Driver_info(message) {
this._send('/info', JSON.stringify({
browser: this.browser,
message: message
}));
},
_log: function Driver_log(message) {
// Using insertAdjacentHTML yields a large performance gain and
// reduces runtime significantly.
if (this.output.insertAdjacentHTML) {
this.output.insertAdjacentHTML('BeforeEnd', message);
} else {
this.output.textContent += message;
}
if (message.lastIndexOf('\n') >= 0 && !this.disableScrolling.checked) {
// Scroll to the bottom of the page
this.output.scrollTop = this.output.scrollHeight;
}
},
_done: function Driver_done() {
if (this.inFlightRequests > 0) {
this.inflight.textContent = this.inFlightRequests;
setTimeout(this._done(), WAITING_TIME);
} else {
setTimeout(this._quit(), WAITING_TIME);
}
},
_sendResult: function Driver_sendResult(snapshot, task, failure,
callback) {
var result = JSON.stringify({
browser: this.browser,
id: task.id,
numPages: task.pdfDoc ?
(task.lastPage || task.pdfDoc.numPages) : 0,
lastPageNum: this._getLastPageNumber(task),
failure: failure,
file: task.file,
round: task.round,
page: task.pageNum,
snapshot: snapshot,
stats: task.stats.times
});
this._send('/submit_task_results', result, callback);
},
_send: function Driver_send(url, message, callback) {
var self = this;
var r = new XMLHttpRequest();
r.open('POST', url, true);
r.setRequestHeader('Content-Type', 'application/json');
r.onreadystatechange = function(e) {
if (r.readyState === 4) {
self.inFlightRequests--;
// Retry until successful
if (r.status !== 200) {
setTimeout(function() {
self._send(url, message);
});
}
if (callback) {
callback();
}
}
};
this.inflight.textContent = this.inFlightRequests++;
r.send(message);
}
};
return Driver;
})();

116
3rdparty/pdf.js/test/features/index.html vendored Executable file
View File

@ -0,0 +1,116 @@
<!DOCTYPE html>
<!--
Copyright 2012 Mozilla Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html>
<head>
<meta charset="utf-8">
<title>Required features testing for PDF.js</title>
<style>
body { font-family: sans-serif; }
#tests { width: 920px; border-collapse:collapse; margin: 20px 0; }
#tests td, #tests th { border: 1px solid black; }
.name { text-align: left; }
.test, .emu, .impact, .area { text-align: center; }
.test-Skipped { background-color: #C0C0C0; }
.test-Success { background-color: #C0FFC0; }
.test-Failed { background-color: #FFC0C0; }
.test-Failed.emu-Yes { background-color: #FFFFC0; }
</style>
<style id="fontFaces">
@font-face { font-family: 'plus'; src: url(data:font/opentype;base64,AAEAAAAOAIAA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src="tests.js"></script>
</head>
<body>
<h1>Required Features for PDF.js</h1>
<div>User Agent: <span id="userAgent"></span></div>
<script>
document.getElementById('userAgent').innerHTML = navigator.userAgent;
</script>
<table id="tests">
<caption>Tests Results</caption>
<thead>
<tr><th class="name">Name</th><th class="test">Test</th><th class="impact">Impact</th><th class="area">Area</th><th class="emu">Emulated</th><th></th></tr>
</thead>
<tbody id="output">
</tbody>
</table>
<div id="canvasHolder" style="display: none;">
</div>
<div id="plusfontusage" style="font-family: plus; visibility: hidden;">`</div>
<script>
var wikiPageBase = 'https://github.com/mozilla/pdf.js/wiki/Required-Browser-Features#user-content-';
var output = document.getElementById('output');
// for some browser textContent is absent using innerHTML :/
for (var i = 0; i < tests.length; i++) {
var test = tests[i];
var row = document.createElement('tr');
row.id = 'test-results-' + test.id;
var nameTd = document.createElement('td');
nameTd.className = 'name';
nameTd.innerHTML = test.name;
row.appendChild(nameTd);
var testTd = document.createElement('td');
testTd.className = 'test';
testTd.innerHTML = 'Running...';
row.appendChild(testTd);
var impactTd = document.createElement('td');
impactTd.className = 'impact';
impactTd.innerHTML = test.impact;
row.appendChild(impactTd);
var areaTd = document.createElement('td');
areaTd.className = 'area';
areaTd.innerHTML = test.area;
row.appendChild(areaTd);
var emulatedTd = document.createElement('td');
emulatedTd.className = 'emu';
row.appendChild(emulatedTd);
output.appendChild(row);
var infoTd = document.createElement('td');
infoTd.className = 'emu';
var infoA = document.createElement('a');
infoA.href = wikiPageBase + test.id;
infoA.innerHTML = 'info';
infoTd.appendChild(infoA);
row.appendChild(infoTd);
output.appendChild(row);
var publish = (function(row, testTd, emulatedTd) {
return function (result) {
row.className = 'test-' + result.output + ' emu-' + result.emulated;
testTd.innerHTML = result.output;
emulatedTd.innerHTML = result.emulated;
};
})(row, testTd, emulatedTd);
var result;
try {
result = test.run();
} catch (e) {
console.error('test run failed: ' + e);
result = { output: 'Failed', emulated: '?' };
}
if (result.then)
result.then(publish);
else
publish(result);
}
</script>
</body>
</html>

667
3rdparty/pdf.js/test/features/tests.js vendored Executable file
View File

@ -0,0 +1,667 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
/* Copyright 2012 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// simple and incomplete implementation of promises
function Promise() {}
Promise.prototype = {
then: function (callback) {
this.callback = callback;
if ('result' in this) callback(this.result);
},
resolve: function (result) {
if ('result' in this) return;
this.result = result;
if ('callback' in this) this.callback(result);
}
};
var isCanvasSupported = (function () {
try {
document.createElement('canvas').getContext('2d').fillStyle = '#FFFFFF';
return true;
} catch (e) {
return false;
}
})();
var tests = [
{
id: 'canvas',
name: 'CANVAS element is present',
run: function () {
if (isCanvasSupported) {
return { output: 'Success', emulated: '' };
} else {
return { output: 'Failed', emulated: 'No' };
}
},
impact: 'Critical',
area: 'Core'
},
{
id: 'get-literal',
name: 'get-literal properties',
run: function () {
try {
var Test = eval('var Test = { get t() { return {}; } }; Test');
Test.t.test = true;
return { output: 'Success', emulated: '' };
} catch (e) {
return { output: 'Failed', emulated: 'No' };
}
},
impact: 'Critical',
area: 'Core'
},
{
id: 'addEventListener',
name: 'addEventListener() is present',
run: function () {
var div = document.createElement('div');
if (div.addEventListener)
return { output: 'Success', emulated: '' };
else
return { output: 'Failed', emulated: 'No' };
},
impact: 'Critical',
area: 'Core'
},
{
id: 'Uint8Array',
name: 'Uint8Array is present',
run: function () {
if (typeof Uint8Array !== 'undefined')
return { output: 'Success', emulated: '' };
else
return { output: 'Failed', emulated: 'Yes' };
},
impact: 'Critical',
area: 'Core'
},
{
id: 'Uint16Array',
name: 'Uint16Array is present',
run: function () {
if (typeof Uint16Array !== 'undefined')
return { output: 'Success', emulated: '' };
else
return { output: 'Failed', emulated: 'Yes' };
},
impact: 'Critical',
area: 'Core'
},
{
id: 'Int32Array',
name: 'Int32Array is present',
run: function () {
if (typeof Int32Array !== 'undefined')
return { output: 'Success', emulated: '' };
else
return { output: 'Failed', emulated: 'Yes' };
},
impact: 'Critical',
area: 'Core'
},
{
id: 'Float32Array',
name: 'Float32Array is present',
run: function () {
if (typeof Float32Array !== 'undefined')
return { output: 'Success', emulated: '' };
else
return { output: 'Failed', emulated: 'Yes' };
},
impact: 'Critical',
area: 'Core'
},
{
id: 'Float64Array',
name: 'Float64Array is present',
run: function () {
if (typeof Float64Array !== 'undefined')
return { output: 'Success', emulated: '' };
else
return { output: 'Failed', emulated: 'Yes' };
},
impact: 'Critical',
area: 'Core'
},
{
id: 'Object-create',
name: 'Object.create() is present',
run: function () {
if (Object.create instanceof Function)
return { output: 'Success', emulated: '' };
else
return { output: 'Failed', emulated: 'Yes' };
},
impact: 'Critical',
area: 'Core'
},
{
id: 'Object-defineProperty',
name: 'Object.defineProperty() is present',
run: function () {
if (Object.defineProperty instanceof Function)
return { output: 'Success', emulated: '' };
else
return { output: 'Failed', emulated: 'Yes' };
},
impact: 'Critical',
area: 'Core'
},
{
id: 'Object-defineProperty-DOM',
name: 'Object.defineProperty() can be used on DOM objects',
run: function () {
if (!(Object.defineProperty instanceof Function))
return { output: 'Skipped', emulated: '' };
try {
// some browsers (e.g. safari) cannot use defineProperty() on DOM objects
// and thus the native version is not sufficient
Object.defineProperty(new Image(), 'id', { value: 'test' });
return { output: 'Success', emulated: '' };
} catch (e) {
return { output: 'Failed', emulated: 'Yes' };
}
},
impact: 'Important',
area: 'Viewer'
},
{
id: 'get-literal-redefine',
name: 'Defined via get-literal properties can be redefined',
run: function () {
if (!(Object.defineProperty instanceof Function))
return { output: 'Skipped', emulated: '' };
try {
var TestGetter = eval('var Test = function () {}; Test.prototype = { get id() { } }; Test');
Object.defineProperty(new TestGetter(), 'id',
{ value: '', configurable: true, enumerable: true, writable: false });
return { output: 'Success', emulated: '' };
} catch (e) {
return { output: 'Failed', emulated: 'Yes' };
}
},
impact: 'Critical',
area: 'Core'
},
{
id: 'Object-keys',
name: 'Object.keys() is present',
run: function () {
if (Object.keys instanceof Function)
return { output: 'Success', emulated: '' };
else
return { output: 'Failed', emulated: 'Yes' };
},
impact: 'Critical',
area: 'Core'
},
{
id: 'FileReader',
name: 'FileReader is present',
run: function () {
if (typeof FileReader !== 'undefined')
return { output: 'Success', emulated: '' };
else
return { output: 'Failed', emulated: 'No' };
},
impact: 'Normal',
area: 'Demo'
},
{
id: 'FileReader-readAsArrayBuffer',
name: 'FileReader.prototype.readAsArrayBuffer() is present',
run: function () {
if (typeof FileReader === 'undefined')
return { output: 'Skipped', emulated: '' };
if (FileReader.prototype.readAsArrayBuffer instanceof Function)
return { output: 'Success', emulated: '' };
else
return { output: 'Failed', emulated: 'Yes' };
},
impact: 'Normal',
area: 'Demo'
},
{
id: 'XMLHttpRequest-overrideMimeType',
name: 'XMLHttpRequest.prototype.overrideMimeType() is present',
run: function () {
if (XMLHttpRequest.prototype.overrideMimeType instanceof Function)
return { output: 'Success', emulated: '' };
else
return { output: 'Failed', emulated: 'Yes' };
},
impact: 'Important',
area: 'Viewer'
},
{
id: 'XMLHttpRequest-response',
name: 'XMLHttpRequest.prototype.response is present',
run: function () {
var xhr = new XMLHttpRequest();
if ('response' in xhr)
return { output: 'Success', emulated: '' };
else
return { output: 'Failed', emulated: 'Yes' };
},
impact: 'Critical',
area: 'Core'
},
{
id: 'bota',
name: 'btoa() is present',
run: function () {
if ('btoa' in window)
return { output: 'Success', emulated: '' };
else
return { output: 'Failed', emulated: 'Yes' };
},
impact: 'Critical',
area: 'Core'
},
{
id: 'atob',
name: 'atob() is present',
run: function () {
if ('atob' in window)
return { output: 'Success', emulated: '' };
else
return { output: 'Failed', emulated: 'Yes' };
},
impact: 'Critical',
area: 'Core'
},
{
id: 'Function-bind',
name: 'Function.prototype.bind is present',
run: function () {
if (Function.prototype.bind instanceof Function)
return { output: 'Success', emulated: '' };
else
return { output: 'Failed', emulated: 'Yes' };
},
impact: 'Critical',
area: 'Core'
},
{
id: 'dataset',
name: 'dataset is present for HTML element',
run: function () {
var div = document.createElement('div');
if ('dataset' in div)
return { output: 'Success', emulated: '' };
else
return { output: 'Failed', emulated: 'Yes' };
},
impact: 'Important',
area: 'Viewer'
},
{
id: 'classList',
name: 'classList is present for HTML element',
run: function () {
var div = document.createElement('div');
if ('classList' in div)
return { output: 'Success', emulated: '' };
else
return { output: 'Failed', emulated: 'Yes' };
},
impact: 'Important',
area: 'Viewer'
},
{
id: 'console',
name: 'console object is present',
run: function () {
if ('console' in window)
return { output: 'Success', emulated: '' };
else
return { output: 'Failed', emulated: 'Yes' };
},
impact: 'Critical',
area: 'Core'
},
{
id: 'console-log-bind',
name: 'console.log is a bind-able function',
run: function () {
if (!('console' in window))
return { output: 'Skipped', emulated: '' };
if ('bind' in console.log)
return { output: 'Success', emulated: '' };
else
return { output: 'Failed', emulated: 'Yes' };
},
impact: 'Critical',
area: 'Core'
},
{
id: 'navigator-language',
name: 'navigator.language is present',
run: function () {
if ('language' in navigator)
return { output: 'Success', emulated: '' };
else
return { output: 'Failed', emulated: 'Yes' };
},
impact: 'Important',
area: 'Viewer'
},
{
id: 'fillRule-evenodd',
name: 'evenodd fill rule is supported',
run: function () {
if (!isCanvasSupported)
return { output: 'Skipped', emulated: '' };
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
ctx.rect(1, 1, 50, 50);
ctx.rect(5, 5, 41, 41);
if ('mozFillRule' in ctx) {
ctx.mozFillRule = 'evenodd';
ctx.fill();
} else {
ctx.fill('evenodd');
}
var data = ctx.getImageData(0, 0, 50, 50).data;
var isEvenOddFill = data[20 * 4 + 20 * 200 + 3] == 0 &&
data[2 * 4 + 2 * 200 + 3] != 0;
if (isEvenOddFill)
return { output: 'Success', emulated: '' };
else
return { output: 'Failed', emulated: 'No' };
},
impact: 'Important',
area: 'Core'
},
{
id: 'dash-array',
name: 'dashed line style is supported',
run: function () {
if (!isCanvasSupported)
return { output: 'Skipped', emulated: '' };
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
ctx.moveTo(0,5);
ctx.lineTo(50, 5);
ctx.lineWidth = 10;
if ('setLineDash' in ctx) {
ctx.setLineDash([10, 10]);
ctx.lineDashOffset = 0;
} else {
ctx.mozDash = [10, 10];
ctx.mozDashOffset = 0;
}
ctx.stroke();
var data = ctx.getImageData(0, 0, 50, 50).data;
var isDashed = data[5 * 4 + 5 * 200 + 3] != 0 &&
data[15 * 4 + 5 * 200 + 3] == 0;
if (isDashed)
return { output: 'Success', emulated: '' };
else
return { output: 'Failed', emulated: 'No' };
},
impact: 'Important',
area: 'Core'
},
{
id: 'font-face',
name: '@font-face is supported/enabled',
run: function () {
if (!isCanvasSupported)
return { output: 'Skipped', emulated: '' };
var promise = new Promise();
setTimeout(function() {
if (checkCanvas('plus'))
promise.resolve({ output: 'Success', emulated: '' });
else
promise.resolve({ output: 'Failed', emulated: 'No' });
}, 2000);
return promise;
},
impact: 'Important',
area: 'Core'
},
{
id: 'font-face-sync',
name: '@font-face loading completion detection',
run: function () {
if (!isCanvasSupported)
return { output: 'Skipped', emulated: '' };
// Add the font-face rule to the document
var rule = '@font-face { font-family: \'plus-loaded\'; src: url(data:font/opentype;base64,AAEAAAAOAIAAAwBgRkZUTWNJJVkAAAZEAAAAHEdERUYANQAkAAAGHAAAAChPUy8yVkDi7gAAAWgAAABgY21hcPAZ92QAAAHcAAABUmN2dCAAIQJ5AAADMAAAAARnYXNw//8AAwAABhQAAAAIZ2x5Zk7Cd0UAAANEAAAA8GhlYWT8fgSnAAAA7AAAADZoaGVhBuoD7QAAASQAAAAkaG10eAwCALUAAAHIAAAAFGxvY2EA5gCyAAADNAAAAA5tYXhwAEoAPQAAAUgAAAAgbmFtZWDR73sAAAQ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ABAEoAAANrAyQACwAAATMRIRUFESMRBTUhAZqTAT7+wpP+sAFQAyT+p4cC/r4BQgGKAAAAAAAOAK4AAQAAAAAAAAAHABAAAQAAAAAAAQAEACIAAQAAAAAAAgAGADUAAQAAAAAAAwAgAH4AAQAAAAAABAAEAKkAAQAAAAAABQAQANAAAQAAAAAABgAEAOsAAwABBAkAAAAOAAAAAwABBAkAAQAIABgAAwABBAkAAgAMACcAAwABBAkAAwBAADwAAwABBAkABAAIAJ8AAwABBAkABQAgAK4AAwABBAkABgAIAOEATQBvAHoAaQBsAGwAYQAATW96aWxsYQAAcABsAHUAcwAAcGx1cwAATQBlAGQAaQB1AG0AAE1lZGl1bQAARgBvAG4AdABGAG8AcgBnAGUAIAAyAC4AMAAgADoAIABwAGwAdQBzACAAOgAgADEALQAxADIALQAyADAAMQAyAABGb250Rm9yZ2UgMi4wIDogcGx1cyA6IDEtMTItMjAxMgAAcABsAHUAcwAAcGx1cwAAVgBlAHIAcwBpAG8AbgAgADAAMAAxAC4AMAAwADAAIAAAVmVyc2lvbiAwMDEuMDAwIAAAcABsAHUAcwAAcGx1cwAAAAACAAAAAAAA/4MAMgAAAAEAAAAAAAAAAAAAAAAAAAAAAAYAAAABAAIAQwECAQMHdW5pRjAwMAd1bmlGMDMwAAAAAAAB//8AAgABAAAADgAAABgAIAAAAAIAAQABAAUAAQAEAAAAAgAAAAEAAAABAAAAAAABAAAAAMmJbzEAAAAAzN/V8gAAAADM3+A1AA==); }';
var styleElement = document.getElementById('fontFaces');
var styleSheet = styleElement.sheet;
styleSheet.insertRule(rule, styleSheet.cssRules.length);
// checking if data urls are loaded synchronously
if (checkCanvas('plus-loaded'))
return { output: 'Success', emulated: '' };
// TODO checking if data urls are loaded asynchronously
var usageElement = document.createElement('div');
usageElement.setAttribute('style', 'font-family: plus-loaded; visibility: hidden;');
usageElement.textContent = '`';
document.body.appendChild(usageElement);
// verify is font is loaded
var promise = new Promise();
setTimeout(function() {
if (checkCanvas('plus-loaded'))
promise.resolve({ output: 'Failed', emulated: 'Yes' });
else
promise.resolve({ output: 'Failed', emulated: 'No' });
}, 2000);
return promise;
},
impact: 'Important',
area: 'Core'
},
{
id: 'Worker',
name: 'Worker is present',
run: function () {
if (typeof Worker != 'undefined')
return { output: 'Success', emulated: '' };
else
return { output: 'Failed', emulated: 'No' };
},
impact: 'Important',
area: 'Core'
},
{
id: 'Worker-Uint8Array',
name: 'Worker can receive/send typed arrays',
run: function () {
if (typeof Worker == 'undefined')
return { output: 'Skipped', emulated: '' };
try {
var worker = new Worker('worker-stub.js');
var promise = new Promise();
var timeout = setTimeout(function () {
promise.resolve({ output: 'Failed', emulated: '?' });
}, 5000);
worker.addEventListener('message', function (e) {
var data = e.data;
if (data.action == 'test' && data.result)
promise.resolve({ output: 'Success', emulated: '' });
else
promise.resolve({ output: 'Failed', emulated: 'Yes' });
}, false);
worker.postMessage({action: 'test',
data: new Uint8Array(60000000)}); // 60MB
return promise;
} catch (e) {
return { output: 'Failed', emulated: 'Yes' };
}
},
impact: 'Important',
area: 'Core'
},
{
id: 'Worker-transfers',
name: 'Worker can use transfers for postMessage',
run: function () {
if (typeof Worker == 'undefined')
return { output: 'Skipped', emulated: '' };
try {
var worker = new Worker('worker-stub.js');
var promise = new Promise();
var timeout = setTimeout(function () {
promise.resolve({ output: 'Failed', emulated: '?' });
}, 5000);
worker.addEventListener('message', function (e) {
var data = e.data;
if (data.action == 'test-transfers' && data.result)
promise.resolve({ output: 'Success', emulated: '' });
else
promise.resolve({ output: 'Failed', emulated: 'Yes' });
}, false);
var testObj = new Uint8Array([255]);
worker.postMessage({action: 'test-transfers',
data: testObj}, [testObj.buffer]);
return promise;
} catch (e) {
return { output: 'Failed', emulated: 'Yes' };
}
},
impact: 'Normal',
area: 'Core'
},
{
id: 'Worker-xhr-response',
name: 'XMLHttpRequest supports the reponse property in web workers',
run: function () {
if (typeof Worker == 'undefined')
return { output: 'Skipped', emulated: '' };
try {
var worker = new Worker('worker-stub.js');
var promise = new Promise();
var timeout = setTimeout(function () {
promise.resolve({ output: 'Failed', emulated: '?' });
}, 5000);
worker.addEventListener('message', function (e) {
var data = e.data;
if (data.action == 'xhr' && data.result)
promise.resolve({ output: 'Success', emulated: '' });
else
promise.resolve({ output: 'Failed', emulated: 'Yes' });
}, false);
worker.postMessage({action: 'xhr'});
return promise;
} catch (e) {
return { output: 'Failed', emulated: 'Yes' };
}
},
impact: 'Important',
area: 'Core'
},
{
id: 'Canvas Blend Mode',
name: 'Canvas supports extended blend modes',
run: function () {
var fail = { output: 'Failed', emulated: 'No' };
var ctx = document.createElement('canvas').getContext('2d');
ctx.canvas.width = 1;
ctx.canvas.height = 1;
var mode = 'difference';
ctx.globalCompositeOperation = mode;
if (ctx.globalCompositeOperation !== mode) {
return fail;
}
// Chrome supports setting the value, but it may not actually be
// implemented, so we have to actually test the blend mode.
ctx.fillStyle = 'red';
ctx.fillRect(0, 0, 1, 1);
ctx.fillStyle = 'blue';
ctx.fillRect(0, 0, 1, 1);
var pix = ctx.getImageData(0, 0, 1, 1).data;
if (pix[0] !== 255 || pix[1] !== 0 || pix[2] !== 255) {
return fail;
}
return { output: 'Success', emulated: '' };
},
impact: 'Important',
area: 'Core'
}
];
function checkCanvas(font) {
var canvas = document.createElement('canvas');
var canvasHolder = document.getElementById('canvasHolder');
canvasHolder.appendChild(canvas);
var ctx = canvas.getContext('2d');
ctx.font = '40px \'' + font + '\'';
ctx.fillText('\u0060', 0, 40);
var data = ctx.getImageData(0, 0, 40, 40).data;
canvasHolder.removeChild(canvas);
// detects plus figure
var minx = 40, maxx = 0, miny = 40, maxy = 0;
for (var y = 0; y < 40; y++) {
for (var x = 0; x < 40; x++) {
if (data[x * 4 + y * 160 + 3] == 0) continue; // no color
minx = Math.min(minx, x); miny = Math.min(miny, y);
maxx = Math.max(maxx, x); maxy = Math.max(maxy, y);
}
}
var colors = [[0, 0, 0], [0, 0, 0], [0, 0, 0]];
var counts = [[0, 0, 0], [0, 0, 0], [0, 0, 0]];
for (var y = miny; y <= maxy; y++) {
for (var x = minx; x <= maxx; x++) {
var i = Math.floor((x - minx) * 3 / (maxx - minx + 1));
var j = Math.floor((y - miny) * 3 / (maxy - miny + 1));
counts[i][j]++;
if (data[x * 4 + y * 160 + 3] != 0)
colors[i][j]++;
}
}
var isPlus =
colors[0][0] * 3 < counts[0][0] &&
colors[0][1] * 3 > counts[0][1] &&
colors[0][2] * 3 < counts[0][2] &&
colors[1][0] * 3 > counts[1][0] &&
colors[1][1] * 3 > counts[1][1] &&
colors[1][2] * 3 > counts[1][2] &&
colors[2][0] * 3 < counts[2][0] &&
colors[2][1] * 3 > counts[2][1] &&
colors[2][2] * 3 < counts[2][2];
return isPlus;
}

39
3rdparty/pdf.js/test/features/worker-stub.js vendored Executable file
View File

@ -0,0 +1,39 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
/* Copyright 2012 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
onmessage = function (e) {
var data = e.data;
switch (data.action) {
case 'test':
postMessage({action: 'test', result: data.data instanceof Uint8Array});
break;
case 'test-transfers':
postMessage({action: 'test-transfers', result: data.data[0] === 255});
break;
case 'xhr':
var xhr = new XMLHttpRequest();
var responseExists = 'response' in xhr;
// check if the property is actually implemented
try {
var dummy = xhr.responseType;
} catch (e) {
responseExists = false;
}
postMessage({action: 'xhr', result: responseExists});
break;
}
};

17
3rdparty/pdf.js/test/font/font_core_spec.js vendored Executable file
View File

@ -0,0 +1,17 @@
'use strict';
describe('font1', function() {
var font1_1 = decodeFontData('T1RUTw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tub3duVW5rbm93bgBPAHIAaQBnAGkAbgBhAGwAIABsAGkAYwBlAG4AYwBlAEsASABQAEYATABFACsATQBUAFMAWQBVAG4AawBuAG8AdwBuAHUAbgBpAHEAdQBlAEkARABLAEgAUABGAEwARQArAE0AVABTAFkAVgBlAHIAcwBpAG8AbgAgADAALgAxADEAVQBuAGsAbgBvAHcAbgBVAG4AawBuAG8AdwBuAFUAbgBrAG4AbwB3AG4AAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==');
describe('test harness testing', function() {
it('returns output', function() {
var output;
waitsFor(function() { return output; }, 10000);
ttx(font1_1, function(result) { output = result; });
runs(function() {
verifyTtxOutput(output);
expect(/<ttFont /.test(output)).toEqual(true);
expect(/<\/ttFont>/.test(output)).toEqual(true);
});
});
});
});

23
3rdparty/pdf.js/test/font/font_fpgm_spec.js vendored Executable file

File diff suppressed because one or more lines are too long

40
3rdparty/pdf.js/test/font/font_os2_spec.js vendored Executable file

File diff suppressed because one or more lines are too long

57
3rdparty/pdf.js/test/font/font_post_spec.js vendored Executable file

File diff suppressed because one or more lines are too long

101
3rdparty/pdf.js/test/font/font_test.html vendored Executable file
View File

@ -0,0 +1,101 @@
<!DOCTYPE html>
<html>
<head>
<title>pdf.js unit test</title>
<link rel="shortcut icon" type="image/png" href="../../external/jasmine/jasmine_favicon.png">
<link rel="stylesheet" type="text/css" href="../../external/jasmine/jasmine.css">
<script src="../../external/jasmine/jasmine.js"></script>
<script src="../../external/jasmine/jasmine-html.js"></script>
<script src="../unit/testreporter.js"></script>
<script src="fontutils.js"></script>
<!-- include source files here... -->
<script src="../../src/core/network.js"></script>
<script src="../../src/core/chunked_stream.js"></script>
<script src="../../src/core/pdf_manager.js"></script>
<script src="../../src/core/core.js"></script>
<script src="../../src/shared/util.js"></script>
<script src="../../src/display/api.js"></script>
<script src="../../src/display/canvas.js"></script>
<script src="../../src/display/webgl.js"></script>
<script src="../../src/core/obj.js"></script>
<script src="../../src/core/annotation.js"></script>
<script src="../../src/core/function.js"></script>
<script src="../../src/core/charsets.js"></script>
<script src="../../src/core/colorspace.js"></script>
<script src="../../src/core/crypto.js"></script>
<script src="../../src/core/pattern.js"></script>
<script src="../../src/core/evaluator.js"></script>
<script src="../../src/core/cmap.js"></script>
<script src="../../src/core/fonts.js"></script>
<script src="../../src/core/glyphlist.js"></script>
<script src="../../src/core/image.js"></script>
<script src="../../src/core/metrics.js"></script>
<script src="../../src/core/parser.js"></script>
<script src="../../src/core/ps_parser.js"></script>
<script src="../../src/display/pattern_helper.js"></script>
<script src="../../src/display/annotation_helper.js"></script>
<script src="../../src/core/stream.js"></script>
<script src="../../src/core/worker.js"></script>
<script src="../../src/display/metadata.js"></script>
<script src="../../src/core/jpg.js"></script>
<script>PDFJS.workerSrc = '../../src/worker_loader.js';</script>
<!-- include spec files here... -->
<script src="font_core_spec.js"></script>
<script src="font_os2_spec.js"></script>
<script src="font_post_spec.js"></script>
<script src="font_fpgm_spec.js"></script>
<script>
'use strict';
(function pdfJsUnitTest() {
function queryParams() {
var qs = window.location.search.substring(1);
var kvs = qs.split('&');
var params = { };
for (var i = 0; i < kvs.length; ++i) {
var kv = kvs[i].split('=');
params[unescape(kv[0])] = unescape(kv[1]);
}
return params;
}
var jasmineEnv = jasmine.getEnv();
jasmineEnv.updateInterval = 1000;
var trivialReporter = new jasmine.TrivialReporter();
jasmineEnv.addReporter(trivialReporter);
var params = queryParams();
if (params['browser']) {
var testReporter = new TestReporter(params['browser'], params['path']);
jasmineEnv.addReporter(testReporter);
}
jasmineEnv.specFilter = function pdfJsUnitTestSpecFilter(spec) {
return trivialReporter.specFilter(spec);
};
var currentWindowOnload = window.onload;
window.onload = function pdfJsUnitTestOnload() {
if (currentWindowOnload) {
currentWindowOnload();
}
execJasmine();
};
function execJasmine() {
jasmineEnv.execute();
}
})();
</script>
</head>
<body>
</body>
</html>

92
3rdparty/pdf.js/test/font/fontutils.js vendored Executable file
View File

@ -0,0 +1,92 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
/*
* Copyright 2013 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
var base64alphabet =
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
function decodeFontData(base64) {
var result = [];
var bits = 0, bitsLength = 0;
for (var i = 0, ii = base64.length; i < ii; i++) {
var ch = base64[i];
if (ch <= ' ') {
continue;
}
var index = base64alphabet.indexOf(ch);
if (index < 0) {
throw new Error('Invalid character');
}
if (index >= 64) {
break;
}
bits = (bits << 6) | index;
bitsLength += 6;
if (bitsLength >= 8) {
bitsLength -= 8;
var code = (bits >> bitsLength) & 0xFF;
result.push(code);
}
}
return new Uint8Array(result);
}
function encodeFontData(data) {
var buffer = '';
var i, n;
for (i = 0, n = data.length; i < n; i += 3) {
var b1 = data[i] & 0xFF;
var b2 = data[i + 1] & 0xFF;
var b3 = data[i + 2] & 0xFF;
var d1 = b1 >> 2, d2 = ((b1 & 3) << 4) | (b2 >> 4);
var d3 = i + 1 < n ? ((b2 & 0xF) << 2) | (b3 >> 6) : 64;
var d4 = i + 2 < n ? (b3 & 0x3F) : 64;
buffer += (base64alphabet.charAt(d1) + base64alphabet.charAt(d2) +
base64alphabet.charAt(d3) + base64alphabet.charAt(d4));
}
return buffer;
}
function ttx(data, callback) {
var xhr = new XMLHttpRequest();
xhr.open('POST', '/ttx');
var encodedData = encodeFontData(data);
xhr.setRequestHeader('Content-type', 'text/plain');
xhr.setRequestHeader('Content-length', encodedData.length);
xhr.onreadystatechange = function getPdfOnreadystatechange(e) {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
callback(xhr.responseText);
} else {
callback('<error>Transport error: ' + xhr.statusText + '</error>');
}
}
};
xhr.send(encodedData);
}
function verifyTtxOutput(output) {
var m = /^<error>(.*?)<\/error>/.exec(output);
if (m) {
throw m[1];
}
}

86
3rdparty/pdf.js/test/font/ttxdriver.js vendored Executable file
View File

@ -0,0 +1,86 @@
/* -*- Mode: js; js-indent-level: 2; indent-tabs-mode: nil; tab-width: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
/*
* Copyright 2014 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*jslint node: true */
'use strict';
var fs = require('fs');
var path = require('path');
var spawn = require('child_process').spawn;
var ttxResourcesHome = path.join(__dirname, '..', 'ttx');
var nextTTXTaskId = Date.now();
function runTtx(ttxResourcesHome, fontPath, registerOnCancel, callback) {
fs.realpath(ttxResourcesHome, function (err, ttxResourcesHome) {
var fontToolsHome = path.join(ttxResourcesHome, 'fonttools-code');
fs.realpath(fontPath, function (err, fontPath) {
var ttxPath = path.join('Tools', 'ttx');
if (!fs.existsSync(path.join(fontToolsHome, ttxPath))) {
callback('TTX was not found, please checkout PDF.js submodules');
return;
}
var ttxEnv = {
'PYTHONPATH': path.join(fontToolsHome, 'Lib'),
'PYTHONDONTWRITEBYTECODE': true
};
var ttxStdioMode = 'ignore';
var ttx = spawn('python', [ttxPath, fontPath],
{cwd: fontToolsHome, stdio: ttxStdioMode, env: ttxEnv});
var ttxRunError;
registerOnCancel(function (reason) {
ttxRunError = reason;
callback(reason);
ttx.kill();
});
ttx.on('error', function (err) {
ttxRunError = err;
callback('Unable to execute ttx');
});
ttx.on('close', function (code) {
if (ttxRunError) {
return;
}
callback();
});
});
});
}
exports.translateFont = function translateFont(content, registerOnCancel,
callback) {
var buffer = new Buffer(content, 'base64');
var taskId = (nextTTXTaskId++).toString();
var fontPath = path.join(ttxResourcesHome, taskId + '.otf');
var resultPath = path.join(ttxResourcesHome, taskId + '.ttx');
fs.writeFileSync(fontPath, buffer);
runTtx(ttxResourcesHome, fontPath, registerOnCancel, function (err) {
fs.unlink(fontPath);
if (err) {
console.error(err);
callback(err);
} else if (!fs.existsSync(resultPath)) {
callback('Output was not generated');
} else {
callback(null, fs.readFileSync(resultPath));
fs.unlink(resultPath);
}
});
};

19
3rdparty/pdf.js/test/mozcentral/Makefile.in vendored Executable file
View File

@ -0,0 +1,19 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
DEPTH = @DEPTH@
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
relativesrcdir = @relativesrcdir@
include $(DEPTH)/config/autoconf.mk
MOCHITEST_BROWSER_FILES = \
browser_pdfjs_main.js \
browser_pdfjs_savedialog.js \
file_pdfjs_test.pdf \
$(NULL)
include $(topsrcdir)/config/rules.mk

7
3rdparty/pdf.js/test/mozcentral/browser.ini vendored Executable file
View File

@ -0,0 +1,7 @@
[DEFAULT]
skip-if = e10s # Bug 942707 - PDF viewer doesn't work with e10s.
support-files = file_pdfjs_test.pdf
[browser_pdfjs_main.js]
[browser_pdfjs_savedialog.js]
[browser_pdfjs_views.js]

View File

@ -0,0 +1,86 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
const RELATIVE_DIR = "browser/extensions/pdfjs/test/";
const TESTROOT = "http://example.com/browser/" + RELATIVE_DIR;
function test() {
var tab;
let handlerService = Cc["@mozilla.org/uriloader/handler-service;1"].getService(Ci.nsIHandlerService);
let mimeService = Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService);
let handlerInfo = mimeService.getFromTypeAndExtension('application/pdf', 'pdf');
// Make sure pdf.js is the default handler.
is(handlerInfo.alwaysAskBeforeHandling, false, 'pdf handler defaults to always-ask is false');
is(handlerInfo.preferredAction, Ci.nsIHandlerInfo.handleInternally, 'pdf handler defaults to internal');
info('Pref action: ' + handlerInfo.preferredAction);
waitForExplicitFinish();
registerCleanupFunction(function() {
gBrowser.removeTab(tab);
});
tab = gBrowser.addTab(TESTROOT + "file_pdfjs_test.pdf");
var newTabBrowser = gBrowser.getBrowserForTab(tab);
newTabBrowser.addEventListener("load", function eventHandler() {
newTabBrowser.removeEventListener("load", eventHandler, true);
var document = newTabBrowser.contentDocument,
window = newTabBrowser.contentWindow;
// Runs tests after all 'load' event handlers have fired off
window.addEventListener("documentload", function() {
runTests(document, window, tab, finish);
}, false, true);
}, true);
}
function runTests(document, window, tab, callback) {
//
// Overall sanity tests
//
ok(document.querySelector('div#viewer'), "document content has viewer UI");
ok('PDFJS' in window.wrappedJSObject, "window content has PDFJS object");
//
// Browser Find
//
ok(gBrowser.isFindBarInitialized(tab), "Browser FindBar initialized!");
//
// Sidebar: open
//
var sidebar = document.querySelector('button#sidebarToggle'),
outerContainer = document.querySelector('div#outerContainer');
sidebar.click();
ok(outerContainer.classList.contains('sidebarOpen'), 'sidebar opens on click');
//
// Sidebar: close
//
sidebar.click();
ok(!outerContainer.classList.contains('sidebarOpen'), 'sidebar closes on click');
//
// Page change from prev/next buttons
//
var prevPage = document.querySelector('button#previous'),
nextPage = document.querySelector('button#next');
var pageNumber = document.querySelector('input#pageNumber');
is(parseInt(pageNumber.value), 1, 'initial page is 1');
//
// Bookmark button
//
var viewBookmark = document.querySelector('a#viewBookmark');
viewBookmark.click();
ok(viewBookmark.href.length > 0, 'viewBookmark button has href');
callback();
}

View File

@ -0,0 +1,65 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
const RELATIVE_DIR = "browser/extensions/pdfjs/test/";
const TESTROOT = "http://example.com/browser/" + RELATIVE_DIR;
function test() {
var oldAction = changeMimeHandler(Ci.nsIHandlerInfo.useSystemDefault, true);
var tab = gBrowser.addTab(TESTROOT + "file_pdfjs_test.pdf");
//
// Test: "Open with" dialog comes up when pdf.js is not selected as the default
// handler.
//
addWindowListener('chrome://mozapps/content/downloads/unknownContentType.xul', finish);
waitForExplicitFinish();
registerCleanupFunction(function() {
changeMimeHandler(oldAction[0], oldAction[1]);
gBrowser.removeTab(tab);
});
}
function changeMimeHandler(preferredAction, alwaysAskBeforeHandling) {
let handlerService = Cc["@mozilla.org/uriloader/handler-service;1"].getService(Ci.nsIHandlerService);
let mimeService = Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService);
let handlerInfo = mimeService.getFromTypeAndExtension('application/pdf', 'pdf');
var oldAction = [handlerInfo.preferredAction, handlerInfo.alwaysAskBeforeHandling];
// Change and save mime handler settings
handlerInfo.alwaysAskBeforeHandling = alwaysAskBeforeHandling;
handlerInfo.preferredAction = preferredAction;
handlerService.store(handlerInfo);
Services.obs.notifyObservers(null, 'pdfjs:handlerChanged', null);
// Refresh data
handlerInfo = mimeService.getFromTypeAndExtension('application/pdf', 'pdf');
//
// Test: Mime handler was updated
//
is(handlerInfo.alwaysAskBeforeHandling, alwaysAskBeforeHandling, 'always-ask prompt change successful');
is(handlerInfo.preferredAction, preferredAction, 'mime handler change successful');
return oldAction;
}
function addWindowListener(aURL, aCallback) {
Services.wm.addListener({
onOpenWindow: function(aXULWindow) {
info("window opened, waiting for focus");
Services.wm.removeListener(this);
var domwindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindow);
waitForFocus(function() {
is(domwindow.document.location.href, aURL, "should have seen the right window open");
domwindow.close();
aCallback();
}, domwindow);
},
onCloseWindow: function(aXULWindow) { },
onWindowTitleChange: function(aXULWindow, aNewTitle) { }
});
}

View File

@ -0,0 +1,76 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
const RELATIVE_DIR = "browser/extensions/pdfjs/test/";
const TESTROOT = "http://example.com/browser/" + RELATIVE_DIR;
function test() {
var tab;
let handlerService = Cc["@mozilla.org/uriloader/handler-service;1"].getService(Ci.nsIHandlerService);
let mimeService = Cc["@mozilla.org/mime;1"].getService(Ci.nsIMIMEService);
let handlerInfo = mimeService.getFromTypeAndExtension('application/pdf', 'pdf');
// Make sure pdf.js is the default handler.
is(handlerInfo.alwaysAskBeforeHandling, false, 'pdf handler defaults to always-ask is false');
is(handlerInfo.preferredAction, Ci.nsIHandlerInfo.handleInternally, 'pdf handler defaults to internal');
info('Pref action: ' + handlerInfo.preferredAction);
waitForExplicitFinish();
registerCleanupFunction(function() {
gBrowser.removeTab(tab);
});
tab = gBrowser.addTab(TESTROOT + "file_pdfjs_test.pdf");
var newTabBrowser = gBrowser.getBrowserForTab(tab);
newTabBrowser.addEventListener("load", function eventHandler() {
newTabBrowser.removeEventListener("load", eventHandler, true);
var document = newTabBrowser.contentDocument,
window = newTabBrowser.contentWindow;
// Runs tests after all 'load' event handlers have fired off
window.addEventListener("documentload", function() {
runTests(document, window, finish);
}, false, true);
}, true);
}
function runTests(document, window, callback) {
// check that PDF is opened with internal viewer
ok(document.querySelector('div#viewer'), "document content has viewer UI");
ok('PDFJS' in window.wrappedJSObject, "window content has PDFJS object");
//open sidebar
var sidebar = document.querySelector('button#sidebarToggle');
var outerContainer = document.querySelector('div#outerContainer');
sidebar.click();
ok(outerContainer.classList.contains('sidebarOpen'), 'sidebar opens on click');
// check that thumbnail view is open
var thumbnailView = document.querySelector('div#thumbnailView');
var outlineView = document.querySelector('div#outlineView');
is(thumbnailView.getAttribute('class'), null, 'Initial view is thumbnail view');
is(outlineView.getAttribute('class'), 'hidden', 'Outline view is hidden initially');
//switch to outline view
var viewOutlineButton = document.querySelector('button#viewOutline');
viewOutlineButton.click();
is(outlineView.getAttribute('class'), '', 'Outline view is visible when selected');
is(thumbnailView.getAttribute('class'), 'hidden', 'Thumbnail view is hidden when outline is selected');
//switch back to thumbnail view
var viewThumbnailButton = document.querySelector('button#viewThumbnail');
viewThumbnailButton.click();
is(thumbnailView.getAttribute('class'), '', 'Thumbnail view is visible when selected');
is(outlineView.getAttribute('class'), 'hidden', 'Outline view is hidden when thumbnail is selected');
sidebar.click();
callback();
}

Binary file not shown.

7
3rdparty/pdf.js/test/mozcentral/moz.build vendored Executable file
View File

@ -0,0 +1,7 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
BROWSER_CHROME_MANIFESTS += ['browser.ini']

1
3rdparty/pdf.js/test/pdfs/.gitattributes vendored Executable file
View File

@ -0,0 +1 @@
*.pdf binary

141
3rdparty/pdf.js/test/pdfs/.gitignore vendored Executable file
View File

@ -0,0 +1,141 @@
*.pdf
*.error
!tracemonkey.pdf
!franz.pdf
!issue2391-1.pdf
!issue2391-2.pdf
!issue5801.pdf
!issue5972.pdf
!issue5874.pdf
!filled-background.pdf
!ArabicCIDTrueType.pdf
!ThuluthFeatures.pdf
!arial_unicode_ab_cidfont.pdf
!arial_unicode_en_cidfont.pdf
!asciihexdecode.pdf
!bug1050040.pdf
!canvas.pdf
!complex_ttf_font.pdf
!extgstate.pdf
!rotation.pdf
!simpletype3font.pdf
!sizes.pdf
!close-path-bug.pdf
!issue4630.pdf
!issue5202.pdf
!issue5280.pdf
!issue5954.pdf
!alphatrans.pdf
!devicen.pdf
!cmykjpeg.pdf
!issue840.pdf
!issue3438.pdf
!issue2074.pdf
!scan-bad.pdf
!bug847420.pdf
!bug860632.pdf
!bug894572.pdf
!bug911034.pdf
!bug1108301.pdf
!bug1157493.pdf
!pdfjsbad1586.pdf
!freeculture.pdf
!pdfkit_compressed.pdf
!TAMReview.pdf
!bug900822.pdf
!issue918.pdf
!issue1905.pdf
!issue2833.pdf
!issue2931.pdf
!issue3323.pdf
!issue4304.pdf
!issue4379.pdf
!issue4550.pdf
!bug1011159.pdf
!issue5734.pdf
!issue4875.pdf
!issue4881.pdf
!issue5994.pdf
!rotated.pdf
!issue1249.pdf
!issue1171.pdf
!smaskdim.pdf
!endchar.pdf
!type4psfunc.pdf
!issue1350.pdf
!S2.pdf
!glyph_accent.pdf
!personwithdog.pdf
!helloworld-bad.pdf
!zerowidthline.pdf
!bug868745.pdf
!mmtype1.pdf
!issue5704.pdf
!issue5751.pdf
!bug893730.pdf
!bug864847.pdf
!issue1002.pdf
!issue925.pdf
!issue2840.pdf
!issue4061.pdf
!issue4668.pdf
!issue5039.pdf
!issue5070.pdf
!issue5238.pdf
!issue5244.pdf
!issue5291.pdf
!issue5421.pdf
!issue5470.pdf
!issue5501.pdf
!issue5599.pdf
!issue5747.pdf
!issue6099.pdf
!gradientfill.pdf
!bug903856.pdf
!bug850854.pdf
!bug866395.pdf
!bug1027533.pdf
!bug1028735.pdf
!bug1046314.pdf
!bug1065245.pdf
!basicapi.pdf
!mixedfonts.pdf
!shading_extend.pdf
!noembed-identity.pdf
!noembed-identity-2.pdf
!noembed-jis7.pdf
!noembed-eucjp.pdf
!noembed-sjis.pdf
!vertical.pdf
!ZapfDingbats.pdf
!bug878026.pdf
!issue5010.pdf
!issue4934.pdf
!issue4650.pdf
!issue3025.pdf
!issue2099-1.pdf
!issue3371.pdf
!issue2956.pdf
!issue2537r.pdf
!bug946506.pdf
!issue3885.pdf
!bug859204.pdf
!issue4246.pdf
!issue4461.pdf
!issue4573.pdf
!issue4722.pdf
!issue4800.pdf
!issue4801.pdf
!issue5334.pdf
!issue5549.pdf
!issue5475.pdf
!issue5481.pdf
!issue5567.pdf
!issue5701.pdf
!issue5896.pdf
!issue5909.pdf
!issue6010_1.pdf
!issue6010_2.pdf
!issue6068.pdf
!issue6081.pdf

View File

@ -0,0 +1 @@
http://www.courts.go.jp/hanrei/pdf/20130226130259.pdf

Binary file not shown.

View File

@ -0,0 +1 @@
http://oannis.com/DiwanProfile.pdf

View File

@ -0,0 +1 @@
http://kanji.zinbun.kyoto-u.ac.jp/%7Eyasuoka/publications/JST2007-5.pdf

View File

@ -0,0 +1 @@
http://image.haier.com/manual/japan/wash_machine/201211/P020121130574743273239.pdf

2549
3rdparty/pdf.js/test/pdfs/S2.pdf vendored Executable file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
http://www.project2061.org/publications/sfaa/SFAA_Japanese.pdf

BIN
3rdparty/pdf.js/test/pdfs/TAMReview.pdf vendored Executable file

Binary file not shown.

View File

@ -0,0 +1 @@
http://blogs.adobe.com/CCJKType/files/2012/07/TaroUTR50SortedList112.pdf

BIN
3rdparty/pdf.js/test/pdfs/ThuluthFeatures.pdf vendored Executable file

Binary file not shown.

BIN
3rdparty/pdf.js/test/pdfs/ZapfDingbats.pdf vendored Executable file

Binary file not shown.

View File

@ -0,0 +1 @@
http://greenhousechallenge.org/media/item/313/38/About-Stacks.pdf

BIN
3rdparty/pdf.js/test/pdfs/alphatrans.pdf vendored Executable file

Binary file not shown.

View File

@ -0,0 +1 @@
https://bug741239.bugzilla.mozilla.org/attachment.cgi?id=611315

Binary file not shown.

Binary file not shown.

1
3rdparty/pdf.js/test/pdfs/artofwar.pdf.link vendored Executable file
View File

@ -0,0 +1 @@
http://www.puppetpress.com/classics/ArtofWarbySunTzu.pdf

55
3rdparty/pdf.js/test/pdfs/asciihexdecode.pdf vendored Executable file
View File

@ -0,0 +1,55 @@
%PDF-1.0
1 0 obj
<<
/Pages 2 0 R
/Type /Catalog
>>
endobj
2 0 obj
<<
/Count 1
/Kids [ 3 0 R ]
/Type /Pages
>>
endobj
3 0 obj
<<
/MediaBox [ 0 0 795 842 ]
/Parent 2 0 R
/Contents 4 0 R
/Resources <<
/Font <<
/F1 <<
/Name /F1
/BaseFont /Helvetica
/Subtype /Type1
/Type /Font
>>
>>
>>
/Type /Page
>>
endobj
4 0 obj
<<
/Filter /ASCIIHexDecode
/Length 111
>>stream
42540A2F46312033302054660A333530203735302054640A323020544C0A312054720A2848656C6C6F20776F726C642920546A0A45540A>
endstream
endobj
xref
0 5
0000000000 65535 f
0000000010 00000 n
0000000067 00000 n
0000000136 00000 n
0000000373 00000 n
trailer
<<
/Root 1 0 R
/Size 5
>>
startxref
568
%%EOF

BIN
3rdparty/pdf.js/test/pdfs/basicapi.pdf vendored Executable file

Binary file not shown.

1
3rdparty/pdf.js/test/pdfs/bpl13210.pdf.link vendored Executable file
View File

@ -0,0 +1 @@
http://h20000.www2.hp.com/bc/docs/support/SupportManual/bpl13210/bpl13210.pdf

BIN
3rdparty/pdf.js/test/pdfs/bug1011159.pdf vendored Executable file

Binary file not shown.

BIN
3rdparty/pdf.js/test/pdfs/bug1027533.pdf vendored Executable file

Binary file not shown.

BIN
3rdparty/pdf.js/test/pdfs/bug1028735.pdf vendored Executable file

Binary file not shown.

BIN
3rdparty/pdf.js/test/pdfs/bug1046314.pdf vendored Executable file

Binary file not shown.

BIN
3rdparty/pdf.js/test/pdfs/bug1050040.pdf vendored Executable file

Binary file not shown.

View File

@ -0,0 +1 @@
https://bug1064894.bugzilla.mozilla.org/attachment.cgi?id=8486536

BIN
3rdparty/pdf.js/test/pdfs/bug1065245.pdf vendored Executable file

Binary file not shown.

View File

@ -0,0 +1 @@
https://bugzilla.mozilla.org/attachment.cgi?id=8494369

View File

@ -0,0 +1 @@
https://bug1077808.bugzilla.mozilla.org/attachment.cgi?id=8499998

BIN
3rdparty/pdf.js/test/pdfs/bug1108301.pdf vendored Executable file

Binary file not shown.

View File

@ -0,0 +1 @@
https://bug1108753.bugzilla.mozilla.org/attachment.cgi?id=8533311

View File

@ -0,0 +1 @@
https://bugzilla.mozilla.org/attachment.cgi?id=8574416

View File

@ -0,0 +1 @@
https://bug1142033.bugzilla.mozilla.org/attachment.cgi?id=8597714

BIN
3rdparty/pdf.js/test/pdfs/bug1157493.pdf vendored Executable file

Binary file not shown.

View File

@ -0,0 +1 @@
http://www.minneapolismn.gov/www/groups/public/@clerk/documents/webcontent/wcms1p-094235.pdf

View File

@ -0,0 +1,2 @@
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1984.pdf

90
3rdparty/pdf.js/test/pdfs/bug847420.pdf vendored Executable file
View File

@ -0,0 +1,90 @@
%PDF-1.7
52 0 obj
<<
/Type /Catalog
/Pages 53 0 R
>>
endobj
53 0 obj
<<
/Type /Pages
/MediaBox [ 0 0 200 50 ]
/Count 1
/Kids [ 54 0 R ]
>>
endobj
54 0 obj
<<
/Type /Page
/Parent 53 0 R
/Resources <<
/Font <<
/F1 55 0 R
>>
>>
/Contents 56 0 R
>>
endobj
55 0 obj
<<
/Type /Font
/Subtype /TrueType
/Name /F2
/BaseFont /Arial,Italic
/FirstChar 32
/LastChar 255
/Widths [ 277 277 354 556 556 889 666 190 333 333 389 583 277 333 277 277 556 556 556 556 556 556 556 556 556 556 277 277 583 583 583 556 1015 666 666 722 722 666 610 777 722 277 500 666 556 833 722 777 666 777 722 666 610 722 666 943 666 666 610 277 277 277 469 556 333 556 556 500 556 556 277 556 556 222 222 500 222 833 556 556 556 556 333 500 277 556 500 722 500 500 500 333 259 333 583 0 556 0 222 556 333 1000 556 556 333 1000 666 333 1000 0 610 0 0 222 222 333 333 350 556 1000 333 1000 500 333 943 0 500 666 277 333 556 556 556 556 259 556 333 736 370 556 583 0 736 552 399 548 333 333 333 576 537 333 333 333 365 556 833 833 833 610 666 666 666 666 666 666 1000 722 666 666 666 666 277 277 277 277 722 722 777 777 777 777 777 583 777 722 722 722 722 666 666 610 556 556 556 556 556 556 889 500 556 556 556 556 277 277 277 277 556 556 556 556 556 556 556 548 610 556 556 556 556 500 556 500 ]
/Encoding /WinAnsiEncoding
/FontDescriptor 8 0 R
>>
endobj
56 0 obj
<<
/Length 62
>>
stream
BT
10 20 TD
/F1 14 Tf
(Text that should be italicized.) Tj
ET
endstream
endobj
8 0 obj
<<
/Type /FontDescriptor
/FontName /Arial
/Ascent 728
/CapHeight 500
/Descent 208
/Flags 96
/FontBBox [ -517 -325 1359 998 ]
/ItalicAngle -120
/StemV 0
>>
endobj
xref
0 1
0000000000 65535 f
8 1
0000001431 00000 n
52 1
0000000009 00000 n
53 1
0000000060 00000 n
54 1
0000000146 00000 n
55 1
0000000254 00000 n
56 1
0000001319 00000 n
trailer
<<
/Size 6
/Root 52 0 R
>>
startxref
1601
%%EOF

70
3rdparty/pdf.js/test/pdfs/bug850854.pdf vendored Executable file
View File

@ -0,0 +1,70 @@
%PDF-1.7
11 0 obj
<<
/Type /Catalog
/Pages 12 0 R
>>
endobj
12 0 obj
<<
/Type /Pages
/MediaBox [ 0 0 200 50 ]
/Count 1
/Kids [ 13 0 R ]
>>
endobj
13 0 obj
<<
/Type /Page
/Parent 12 0 R
/Resources <<
/Font <<
/F1 14 0 R
>>
>>
/Contents 15 0 R
>>
endobj
14 0 obj
<<
/Type /Font
/BaseFont /Helvetica
/Subtype /Type1
/Encoding /WinAnsiEncoding
>>
endobj
15 0 obj
<<
/Length 52
>>
stream
BT
10 20 TD
/F1 20 Tf
(Bug\240\240\240850854) Tj
ET
endstream
endobj
xref
0 1
0000000000 65535 f
11 1
0000000009 00000 n
12 1
0000000060 00000 n
13 1
0000000146 00000 n
14 1
0000000254 00000 n
15 1
0000000352 00000 n
trailer
<<
/Size 5
/Root 11 0 R
>>
startxref
454
%%EOF

BIN
3rdparty/pdf.js/test/pdfs/bug859204.pdf vendored Executable file

Binary file not shown.

BIN
3rdparty/pdf.js/test/pdfs/bug860632.pdf vendored Executable file

Binary file not shown.

98
3rdparty/pdf.js/test/pdfs/bug864847.pdf vendored Executable file
View File

@ -0,0 +1,98 @@
%PDF-1.7
1 0 obj % entry point
<<
/Type /Catalog
/Pages 2 0 R
>>
endobj
2 0 obj
<<
/Type /Pages
/MediaBox [ 0 0 200 200 ]
/Count 1
/Kids [ 3 0 R ]
>>
endobj
3 0 obj
<<
/Type /Page
/Parent 2 0 R
/Resources <<
/Font <<
/F1 4 0 R
>>
>>
/Contents 5 0 R
>>
endobj
6 0 obj
<<
/Filter /LZWDecode
/Length 192
>>
stream
<EFBFBD> <0B>d<EFBFBD>!$<24>i:<05><03><><EFBFBD>S2<53>LƓq<C693><71>e9<65>Χ#<19>@b2<62><EFBFBD><E280A1>@d4<64><34>2 <11>,<2C>ͦ<13>*M<>'<08><><EFBFBD>e3M<33>s<EFBFBD><73>8<EFBFBD>m2<6D><32>C<EFBFBD>̞<EFBFBD>$<24><>f&<26><><EFBFBD><EFBFBD>a<EFBFBD><61><EFBFBD>&<26>9<EFBFBD>< <07><>1<EFBFBD>|
2<EFBFBD>LuH<EFBFBD>^<5E>[<5B><>&<06><11><>\<5C>V+<2B><><EFBFBD>{<7B><>L<EFBFBD>[<5B><>2<><02>sJ5 @c<><63><EFBFBD><EFBFBD>ID<49><15>8S<38>f<EFBFBD>,^3<1B><><06><>A<>@@
endstream
endobj
7 0 obj
<<
/FontName /Arial-ItalicMT
/StemV 93
/Ascent 625
/Flags 4
/Descent 0
/ItalicAngle 0
/MissingWidth 750
/FontBBox [0 0 625 625]
/Type /FontDescriptor
/CapHeight 625
>>
endobj
4 0 obj
<<
/BaseFont /Arial-ItalicMT
/LastChar 32
/Subtype /TrueType
/ToUnicode 6 0 R
/FontDescriptor 7 0 R
/Widths [278]
/Type /Font
/FirstChar 32
>>
endobj
5 0 obj % page content
<<
/Length 44
>>
stream
BT
70 50 TD
/F1 12 Tf
(Hello, 864847) Tj
ET
endstream
endobj
xref
0 8
0000000000 65535 f
0000000010 00000 n
0000000079 00000 n
0000000173 00000 n
0000000753 00000 n
0000000913 00000 n
0000000300 00000 n
0000000565 00000 n
trailer
<<
/Size 8
/Root 1 0 R
>>
startxref
1025
%%EOF

View File

@ -0,0 +1 @@
https://bug865858.bugzilla.mozilla.org/attachment.cgi?id=742273

BIN
3rdparty/pdf.js/test/pdfs/bug866395.pdf vendored Executable file

Binary file not shown.

View File

@ -0,0 +1 @@
https://bug867484.bugzilla.mozilla.org/attachment.cgi?id=744001

BIN
3rdparty/pdf.js/test/pdfs/bug868745.pdf vendored Executable file

Binary file not shown.

71
3rdparty/pdf.js/test/pdfs/bug878026.pdf vendored Executable file
View File

@ -0,0 +1,71 @@
%PDF-1.7
43 0 obj
<<
/Type /Catalog
/Pages 44 0 R
>>
endobj
44 0 obj
<<
/Type /Pages
/MediaBox [ 0 0 200 50 ]
/Count 1
/Kids [ 45 0 R ]
>>
endobj
45 0 obj
<<
/Type /Page
/Parent 44 0 R
/Resources <<
/Font <<
/F1 46 0 R
>>
>>
/Contents 47 0 R
>>
endobj
46 0 obj
<<
/Type /Font
/Subtype /Type1
/Name /Fcpdf1
/BaseFont /Times-Roman
/Encoding /MacRomanEncoding
>>
endobj
47 0 obj
<<
/Length 44
>>
stream
BT
10 20 TD
/F1 20 Tf
(Bug\312878026) Tj
ET
endstream
endobj
xref
0 1
0000000000 65535 f
43 1
0000000009 00000 n
44 1
0000000060 00000 n
45 1
0000000146 00000 n
46 1
0000000254 00000 n
47 1
0000000369 00000 n
trailer
<<
/Size 5
/Root 43 0 R
>>
startxref
463
%%EOF

View File

@ -0,0 +1 @@
https://bugzilla.mozilla.org/attachment.cgi?id=756735

View File

@ -0,0 +1 @@
http://www.nature.com/news/2010/100721/pdf/466432a.pdf

View File

@ -0,0 +1 @@
https://bug888437.bugzilla.mozilla.org/attachment.cgi?id=770341

View File

@ -0,0 +1 @@
https://bugzilla.mozilla.org/attachment.cgi?id=770134

BIN
3rdparty/pdf.js/test/pdfs/bug893730.pdf vendored Executable file

Binary file not shown.

BIN
3rdparty/pdf.js/test/pdfs/bug894572.pdf vendored Executable file

Binary file not shown.

BIN
3rdparty/pdf.js/test/pdfs/bug900822.pdf vendored Executable file

Binary file not shown.

BIN
3rdparty/pdf.js/test/pdfs/bug903856.pdf vendored Executable file

Binary file not shown.

BIN
3rdparty/pdf.js/test/pdfs/bug911034.pdf vendored Executable file

Binary file not shown.

View File

@ -0,0 +1 @@
https://bugzilla.mozilla.org/attachment.cgi?id=8344035

BIN
3rdparty/pdf.js/test/pdfs/bug946506.pdf vendored Executable file

Binary file not shown.

1
3rdparty/pdf.js/test/pdfs/cable.pdf.link vendored Executable file
View File

@ -0,0 +1 @@
https://wrap-on.com/docs/PIPEHEATCABLE.PDF

BIN
3rdparty/pdf.js/test/pdfs/canvas.pdf vendored Executable file

Binary file not shown.

69
3rdparty/pdf.js/test/pdfs/close-path-bug.pdf vendored Executable file
View File

@ -0,0 +1,69 @@
%PDF-1.4
1 0 obj
<</Type /Catalog/Outlines 2 0 R/Pages 3 0 R>>
endobj
2 0 obj
<</Type /Outlines/Count 0>>
endobj
3 0 obj
<</Type /Pages/Kids [4 0 R]/Count 1>>
endobj
4 0 obj
<</Type /Page/Parent 3 0 R/MediaBox [0 0 612 792]/Contents 5 0 R/Resources << /ProcSet 6 0 R >>>>
endobj
5 0 obj
<< /Length 885 >>
stream
% Draw a black line segment, using the default line width.
150 250 m
150 350 l
S
% Draw a thicker, dashed line segment.
4 w % Set line width to 4 points
[4 6] 0 d % Set dash pattern to 4 units on, 6 units off
150 250 m
400 250 l
S
[] 0 d % Reset dash pattern to a solid line
1 w % Reset line width to 1 unit
% Draw a rectangle with a 1unit red border, filled with light blue.
1.0 0.0 0.0 RG % Red for stroke color
0.5 0.75 1.0 rg % Light blue for fill color
200 300 50 75 re
B
% Draw a curve filled with gray and with a colored border.
0.5 0.1 0.2 RG
0.7 g
300 300 m
300 400 400 400 400 300 c
b
endstream
endobj
6 0 obj
[/PDF]
endobj
xref
0 7
0000000000 65535 f
0000000009 00000 n
0000000074 00000 n
0000000120 00000 n
0000000179 00000 n
0000000300 00000 n
0000001532 00000 n
trailer
<</Size 7/Root 1 0 R>>
startxref
1556
%%EOF

2178
3rdparty/pdf.js/test/pdfs/cmykjpeg.pdf vendored Executable file

File diff suppressed because one or more lines are too long

575
3rdparty/pdf.js/test/pdfs/complex_ttf_font.pdf vendored Executable file

File diff suppressed because one or more lines are too long

BIN
3rdparty/pdf.js/test/pdfs/devicen.pdf vendored Executable file

Binary file not shown.

1
3rdparty/pdf.js/test/pdfs/ecma262.pdf.link vendored Executable file
View File

@ -0,0 +1 @@
http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf

BIN
3rdparty/pdf.js/test/pdfs/endchar.pdf vendored Executable file

Binary file not shown.

116
3rdparty/pdf.js/test/pdfs/extgstate.pdf vendored Executable file
View File

@ -0,0 +1,116 @@
%PDF-1.4
%<25><><EFBFBD><EFBFBD>
1 0 obj
<<
/Type /Catalog
/Version /1.4
/Pages 2 0 R
>>
endobj
2 0 obj
<<
/Type /Pages
/Kids [3 0 R]
/Count 1
>>
endobj
3 0 obj
<<
/Type /Page
/MediaBox [0 0 612 792]
/Resources 4 0 R
/Parent 2 0 R
/Contents 5 0 R
>>
endobj
4 0 obj
<<
/ExtGState 6 0 R
/Font 7 0 R
/XObject <<
>>
>>
endobj
5 0 obj
<<
/Length 8 0 R
>>
stream
/F0 12 Tf
/F1 12 Tf
/GS1 gs
BT
100 700 Td
(I should be courier!) Tj
ET
50 600 m
400 600 l
S
endstream
endobj
6 0 obj
<<
/GS1 9 0 R
>>
endobj
7 0 obj
<<
/F0 10 0 R
/F1 11 0 R
>>
endobj
8 0 obj
93
endobj
9 0 obj
<<
/Type /ExtGState
/LW 10
/LC 1
/LJ 2
/ML 0.3000000119
/D [[0.0917000026 183.3300018311]
0]
/Font [10 0 R 36]
>>
endobj
10 0 obj
<<
/Type /Font
/Subtype /Type1
/BaseFont /Courier
/Encoding /WinAnsiEncoding
>>
endobj
11 0 obj
<<
/Type /Font
/Subtype /Type1
/BaseFont /Times-Italic
/Encoding /WinAnsiEncoding
>>
endobj
xref
0 12
0000000000 65535 f
0000000015 00000 n
0000000078 00000 n
0000000135 00000 n
0000000239 00000 n
0000000304 00000 n
0000000452 00000 n
0000000484 00000 n
0000000527 00000 n
0000000545 00000 n
0000000675 00000 n
0000000771 00000 n
trailer
<<
/Root 1 0 R
/ID [<FCE2529ACCE848A953BDB5D497D71C36> <FCE2529ACCE848A953BDB5D497D71C36>]
/Size 12
>>
startxref
872
%%EOF

1
3rdparty/pdf.js/test/pdfs/f1040.pdf.link vendored Executable file
View File

@ -0,0 +1 @@
http://web.archive.org/web/20110918100215/http://www.irs.gov/pub/irs-pdf/f1040.pdf

File diff suppressed because one or more lines are too long

1
3rdparty/pdf.js/test/pdfs/fips197.pdf.link vendored Executable file
View File

@ -0,0 +1 @@
http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf

View File

@ -0,0 +1 @@
http://www.ccs.neu.edu/home/samth/fit11-talk.pdf

81
3rdparty/pdf.js/test/pdfs/franz.pdf vendored Executable file
View File

@ -0,0 +1,81 @@
%PDF-1.7
%<25><><EFBFBD><EFBFBD>
1 0 obj 128
endobj
2 0 obj 157
endobj
3 0 obj
<<
/Type /Encoding
/Differences [0 /.notdef 1 /dotaccent /fi /fl /fraction /hungarumlaut /Lslash /lslash /ogonek /ring 10 /.notdef 11 /breve /minus 13 /.notdef 14 /Zcaron /zcaron /caron /dotlessi /dotlessj /ff /ffi /ffl 22 /.notdef 30 /grave /quotesingle /space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quoteright /parenleft /parenright /asterisk /plus /comma /hyphen /period /slash /zero /one /two /three /four /five /six /seven /eight /nine /colon /semicolon /less /equal /greater /question /at /A /B /C /D /E /F /G /H /I /J /K /L /M /N /O /P /Q /R /S /T /U /V /W /X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore /quoteleft /a /b /c /d /e /f /g /h /i /j /k /l /m /n /o /p /q /r /s /t /u /v /w /x /y /z /braceleft /bar /braceright /asciitilde 127 /.notdef 1 0 R /Euro 129 /.notdef 130 /quotesinglbase /florin /quotedblbase /ellipsis /dagger /daggerdbl /circumflex /perthousand /Scaron /guilsinglleft /OE 141 /.notdef 147 /quotedblleft /quotedblright /bullet /endash /emdash /tilde /trademark /scaron /guilsinglright /oe 2 0 R /.notdef 159 /Ydieresis 160 /.notdef 161 /exclamdown /cent /sterling /currency /yen /brokenbar /section /dieresis /copyright /ordfeminine /guillemotleft /logicalnot /hyphen /registered /macron /degree /plusminus /twosuperior /threesuperior /acute /mu /paragraph /periodcentered /cedilla /onesuperior /ordmasculine /guillemotright /onequarter /onehalf /threequarters /questiondown /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla /Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis /Eth /Ntilde /Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply /Oslash /Ugrave /Uacute /Ucircumflex /Udieresis /Yacute /Thorn /germandbls /agrave /aacute /acircumflex /atilde /adieresis /aring /ae /ccedilla /egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex /idieresis /eth /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide /oslash /ugrave /uacute /ucircumflex /udieresis /yacute /thorn /ydieresis]
>>
endobj
4 0 obj
<<
/Pages 5 0 R
/Type /Catalog
>>
endobj
5 0 obj
<<
/MediaBox [0 0 200 50]
/Kids [6 0 R]
/Count 1
/Type /Pages
>>
endobj
6 0 obj
<<
/Parent 5 0 R
/MediaBox [0 0 200 50]
/Resources
<<
/Font
<<
/F1 7 0 R
>>
>>
/Contents 8 0 R
/Type /Page
>>
endobj
7 0 obj
<<
/BaseFont /Helvetica-Bold
/Subtype /Type1
/Type /Font
/Encoding 3 0 R
>>
endobj
8 0 obj
<<
/Length 42
>>
stream
BT
10 20 TD
/F1 20 Tf
(Hello World) Tj
ET
endstream
endobj xref
0 9
0000000000 65535 f
0000000015 00000 n
0000000035 00000 n
0000000055 00000 n
0000002111 00000 n
0000002162 00000 n
0000002244 00000 n
0000002373 00000 n
0000002466 00000 n
trailer
<<
/Root 4 0 R
/Size 9
>>
startxref
2560
%%EOF

BIN
3rdparty/pdf.js/test/pdfs/freeculture.pdf vendored Executable file

Binary file not shown.

View File

@ -0,0 +1 @@
http://geothermal.inel.gov/publications/future_of_geothermal_energy.pdf

View File

@ -0,0 +1 @@
https://dok.dkb.de/pdf/aenderung_l_sepa.pdf

1
3rdparty/pdf.js/test/pdfs/gesamt.pdf.link vendored Executable file
View File

@ -0,0 +1 @@
http://web.archive.org/web/20130308055056/http://www.gesetze-im-internet.de/bundesrecht/bgb/gesamt.pdf

BIN
3rdparty/pdf.js/test/pdfs/glyph_accent.pdf vendored Executable file

Binary file not shown.

BIN
3rdparty/pdf.js/test/pdfs/gradientfill.pdf vendored Executable file

Binary file not shown.

68
3rdparty/pdf.js/test/pdfs/helloworld-bad.pdf vendored Executable file
View File

@ -0,0 +1,68 @@
%PDF-1.7
1 0 obj % entry point
<<
/Type /Catalog
/Pages 2 0 R
>>
endobj
2 0 obj
<<
/Type /Pages
/MediaBox [ 0 0 200 200 ]
/Count 1
/Kids [ 3 0 R ]
>>
endobj
3 0 obj
<<
/Type /Page
/Parent 2 0 R
/Resources <<
/Font <<
/F1 4 0 R
>>
>>
/Contents 5 0 R
>>
endobj
4 0 obj
<<
/Type /Font
/Subtype /Type1
/BaseFont /Times-Roman
>>
endobj
5 0 obj % page content
<<
/Length 44
>>
stream
BT
70 50 TD
/F1 12 Tf
(Hello, world!) Tj
ET
endstream
endobj
xref
0 6
0000000000 65535 f
0000000010 00000 n
0000000079 00000 n
0000000173 00000 n
0000000301 00000 n
0000000380 00000 n
trailer
<<
/Size 6
/Root 1 0 R
>>
startxref
492
%%EOF

Some files were not shown because too many files have changed in this diff Show More