mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-06 14:44:26 +00:00
Bug 903452 - Update pdf.js to version 0.8.423. r=bdahl
This commit is contained in:
parent
e9543c8fef
commit
8572159fdb
@ -1,4 +1,4 @@
|
||||
This is the pdf.js project output, https://github.com/mozilla/pdf.js
|
||||
|
||||
Current extension version is: 0.8.377
|
||||
Current extension version is: 0.8.423
|
||||
|
||||
|
@ -720,6 +720,15 @@ PdfStreamConverter.prototype = {
|
||||
// Change the content type so we don't get stuck in a loop.
|
||||
aRequest.setProperty('contentType', aRequest.contentType);
|
||||
aRequest.contentType = 'text/html';
|
||||
if (isHttpRequest) {
|
||||
// We trust PDF viewer, using no CSP
|
||||
aRequest.setResponseHeader('Content-Security-Policy', '', false);
|
||||
aRequest.setResponseHeader('Content-Security-Policy-Report-Only', '',
|
||||
false);
|
||||
aRequest.setResponseHeader('X-Content-Security-Policy', '', false);
|
||||
aRequest.setResponseHeader('X-Content-Security-Policy-Report-Only', '',
|
||||
false);
|
||||
}
|
||||
|
||||
if (!rangeRequest) {
|
||||
// Creating storage for PDF data
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -220,26 +220,26 @@ var StepperManager = (function StepperManagerClosure() {
|
||||
|
||||
// The stepper for each page's IRQueue.
|
||||
var Stepper = (function StepperClosure() {
|
||||
// Shorter way to create element and optionally set textContent.
|
||||
function c(tag, textContent) {
|
||||
var d = document.createElement(tag);
|
||||
if (textContent)
|
||||
d.textContent = textContent;
|
||||
return d;
|
||||
}
|
||||
|
||||
function Stepper(panel, pageIndex, initialBreakPoints) {
|
||||
this.panel = panel;
|
||||
this.len = 0;
|
||||
this.breakPoint = 0;
|
||||
this.nextBreakPoint = null;
|
||||
this.pageIndex = pageIndex;
|
||||
this.breakPoints = initialBreakPoints;
|
||||
this.currentIdx = -1;
|
||||
this.operatorListIdx = 0;
|
||||
}
|
||||
Stepper.prototype = {
|
||||
init: function init(IRQueue) {
|
||||
// Shorter way to create element and optionally set textContent.
|
||||
function c(tag, textContent) {
|
||||
var d = document.createElement(tag);
|
||||
if (textContent)
|
||||
d.textContent = textContent;
|
||||
return d;
|
||||
}
|
||||
init: function init() {
|
||||
var panel = this.panel;
|
||||
this.len = IRQueue.fnArray.length;
|
||||
var content = c('div', 'c=continue, s=step');
|
||||
var table = c('table');
|
||||
content.appendChild(table);
|
||||
@ -250,15 +250,18 @@ var Stepper = (function StepperClosure() {
|
||||
headerRow.appendChild(c('th', 'Idx'));
|
||||
headerRow.appendChild(c('th', 'fn'));
|
||||
headerRow.appendChild(c('th', 'args'));
|
||||
|
||||
panel.appendChild(content);
|
||||
this.table = table;
|
||||
},
|
||||
updateOperatorList: function updateOperatorList(operatorList) {
|
||||
var self = this;
|
||||
for (var i = 0; i < IRQueue.fnArray.length; i++) {
|
||||
for (var i = this.operatorListIdx; i < operatorList.fnArray.length; i++) {
|
||||
var line = c('tr');
|
||||
line.className = 'line';
|
||||
line.dataset.idx = i;
|
||||
table.appendChild(line);
|
||||
this.table.appendChild(line);
|
||||
var checked = this.breakPoints.indexOf(i) != -1;
|
||||
var args = IRQueue.argsArray[i] ? IRQueue.argsArray[i] : [];
|
||||
var args = operatorList.argsArray[i] ? operatorList.argsArray[i] : [];
|
||||
|
||||
var breakCell = c('td');
|
||||
var cbox = c('input');
|
||||
@ -278,11 +281,9 @@ var Stepper = (function StepperClosure() {
|
||||
breakCell.appendChild(cbox);
|
||||
line.appendChild(breakCell);
|
||||
line.appendChild(c('td', i.toString()));
|
||||
line.appendChild(c('td', IRQueue.fnArray[i]));
|
||||
line.appendChild(c('td', operatorList.fnArray[i]));
|
||||
line.appendChild(c('td', args.join(', ')));
|
||||
}
|
||||
panel.appendChild(content);
|
||||
var self = this;
|
||||
},
|
||||
getNextBreakPoint: function getNextBreakPoint() {
|
||||
this.breakPoints.sort(function(a, b) { return a - b; });
|
||||
|
@ -105,8 +105,6 @@ limitations under the License.
|
||||
<span id="numPages" class="toolbarLabel"></span>
|
||||
</div>
|
||||
<div id="toolbarViewerRight">
|
||||
<input id="fileInput" class="fileInput" type="file" oncontextmenu="return false;" style="visibility: hidden; position: fixed; right: 0; top: 0" />
|
||||
|
||||
<button id="presentationMode" class="toolbarButton presentationMode hiddenSmallView" title="Switch to Presentation Mode" tabindex="12" data-l10n-id="presentation_mode">
|
||||
<span data-l10n-id="presentation_mode_label">Presentation Mode</span>
|
||||
</button>
|
||||
@ -137,7 +135,7 @@ limitations under the License.
|
||||
</button>
|
||||
</div>
|
||||
<span id="scaleSelectContainer" class="dropdownToolbarButton">
|
||||
<select id="scaleSelect" title="Zoom" oncontextmenu="return false;" tabindex="11" data-l10n-id="zoom">
|
||||
<select id="scaleSelect" title="Zoom" tabindex="11" data-l10n-id="zoom">
|
||||
<option id="pageAutoOption" value="auto" selected="selected" data-l10n-id="page_scale_auto">Automatic Zoom</option>
|
||||
<option id="pageActualOption" value="page-actual" data-l10n-id="page_scale_actual">Actual Size</option>
|
||||
<option id="pageFitOption" value="page-fit" data-l10n-id="page_scale_fit">Fit Page</option>
|
||||
|
@ -17,7 +17,7 @@
|
||||
/* globals PDFJS, PDFBug, FirefoxCom, Stats, Cache, PDFFindBar, CustomStyle,
|
||||
PDFFindController, ProgressBar, TextLayerBuilder, DownloadManager,
|
||||
getFileName, getOutputScale, scrollIntoView, getPDFFileNameFromURL,
|
||||
PDFHistory */
|
||||
PDFHistory, noContextMenuHandler */
|
||||
|
||||
'use strict';
|
||||
|
||||
@ -154,6 +154,13 @@ function scrollIntoView(element, spot) {
|
||||
parent.scrollTop = offsetY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Event handler to suppress context menu.
|
||||
*/
|
||||
function noContextMenuHandler(e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the filename or guessed filename from the url (see issue 3455).
|
||||
* url {String} The original PDF location.
|
||||
@ -920,9 +927,9 @@ var PDFHistory = {
|
||||
initialDestination: null,
|
||||
|
||||
initialize: function pdfHistoryInitialize(fingerprint) {
|
||||
if (PDFJS.disableHistory || window.parent !== window) {
|
||||
if (PDFJS.disableHistory || PDFView.isViewerEmbedded) {
|
||||
// The browsing history is only enabled when the viewer is standalone,
|
||||
// i.e. not when it is embedded in a page.
|
||||
// i.e. not when it is embedded in a web page.
|
||||
return;
|
||||
}
|
||||
this.initialized = true;
|
||||
@ -1258,6 +1265,7 @@ var PDFView = {
|
||||
mouseScrollDelta: 0,
|
||||
lastScroll: 0,
|
||||
previousPageNumber: 1,
|
||||
isViewerEmbedded: (window.parent !== window),
|
||||
|
||||
// called once when the document is loaded
|
||||
initialize: function pdfViewInitialize() {
|
||||
@ -1950,10 +1958,10 @@ var PDFView = {
|
||||
self.setInitialView(storedHash, scale);
|
||||
|
||||
// Make all navigation keys work on document load,
|
||||
// unless the viewer is embedded in another page.
|
||||
if (window.parent === window) {
|
||||
PDFView.container.focus();
|
||||
PDFView.container.blur();
|
||||
// unless the viewer is embedded in a web page.
|
||||
if (!self.isViewerEmbedded) {
|
||||
self.container.focus();
|
||||
self.container.blur();
|
||||
}
|
||||
});
|
||||
|
||||
@ -2030,6 +2038,11 @@ var PDFView = {
|
||||
// updated if the zoom level stayed the same.
|
||||
this.currentScale = 0;
|
||||
this.currentScaleValue = null;
|
||||
// When opening a new file (when one is already loaded in the viewer):
|
||||
// Reset 'currentPageNumber', since otherwise the page's scale will be wrong
|
||||
// if 'currentPageNumber' is larger than the number of pages in the file.
|
||||
document.getElementById('pageNumber').value = currentPageNumber = 1;
|
||||
|
||||
if (PDFHistory.initialDestination) {
|
||||
this.navigateTo(PDFHistory.initialDestination);
|
||||
PDFHistory.initialDestination = null;
|
||||
@ -2553,8 +2566,11 @@ var PageView = function pageView(container, id, scale,
|
||||
};
|
||||
|
||||
this.update = function pageViewUpdate(scale, rotation) {
|
||||
this.renderingState = RenderingStates.INITIAL;
|
||||
if (this.renderTask) {
|
||||
this.renderTask.cancel();
|
||||
}
|
||||
this.resume = null;
|
||||
this.renderingState = RenderingStates.INITIAL;
|
||||
|
||||
if (typeof rotation !== 'undefined') {
|
||||
this.rotation = rotation;
|
||||
@ -2816,9 +2832,15 @@ var PageView = function pageView(container, id, scale,
|
||||
// Rendering area
|
||||
|
||||
var self = this;
|
||||
var renderingWasReset = false;
|
||||
function pageViewDrawCallback(error) {
|
||||
if (renderingWasReset) {
|
||||
// The renderTask may have been replaced by a new one, so only remove the
|
||||
// reference to the renderTask if it matches the one that is triggering
|
||||
// this callback.
|
||||
if (renderTask === self.renderTask) {
|
||||
self.renderTask = null;
|
||||
}
|
||||
|
||||
if (error === 'cancelled') {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2870,12 +2892,6 @@ var PageView = function pageView(container, id, scale,
|
||||
viewport: this.viewport,
|
||||
textLayer: textLayer,
|
||||
continueCallback: function pdfViewcContinueCallback(cont) {
|
||||
if (self.renderingState === RenderingStates.INITIAL) {
|
||||
// The page update() was called, we just need to abort any rendering.
|
||||
renderingWasReset = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (PDFView.highestPriorityPage !== 'page' + self.id) {
|
||||
self.renderingState = RenderingStates.PAUSED;
|
||||
self.resume = function resumeCallback() {
|
||||
@ -2887,7 +2903,9 @@ var PageView = function pageView(container, id, scale,
|
||||
cont();
|
||||
}
|
||||
};
|
||||
this.pdfPage.render(renderContext).then(
|
||||
var renderTask = this.renderTask = this.pdfPage.render(renderContext);
|
||||
|
||||
this.renderTask.then(
|
||||
function pdfPageRenderCallback() {
|
||||
pageViewDrawCallback(null);
|
||||
},
|
||||
@ -3553,9 +3571,8 @@ var DocumentOutlineView = function documentOutlineView(outline) {
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function webViewerLoad(evt) {
|
||||
PDFView.initialize();
|
||||
var params = PDFView.parseQueryString(document.location.search.substring(1));
|
||||
|
||||
var file = window.location.toString()
|
||||
var file = window.location.href.split('#')[0];
|
||||
|
||||
document.getElementById('openFile').setAttribute('hidden', 'true');
|
||||
|
||||
@ -3629,6 +3646,9 @@ document.addEventListener('DOMContentLoaded', function webViewerLoad(evt) {
|
||||
}
|
||||
});
|
||||
|
||||
// Suppress context menus for some controls
|
||||
document.getElementById('scaleSelect').oncontextmenu = noContextMenuHandler;
|
||||
|
||||
var mainContainer = document.getElementById('mainContainer');
|
||||
var outerContainer = document.getElementById('outerContainer');
|
||||
mainContainer.addEventListener('transitionend', function(e) {
|
||||
@ -3684,10 +3704,6 @@ document.addEventListener('DOMContentLoaded', function webViewerLoad(evt) {
|
||||
PDFView.presentationMode();
|
||||
});
|
||||
|
||||
document.getElementById('openFile').addEventListener('click',
|
||||
function() {
|
||||
document.getElementById('fileInput').click();
|
||||
});
|
||||
|
||||
document.getElementById('print').addEventListener('click',
|
||||
function() {
|
||||
@ -3815,9 +3831,10 @@ function updateViewarea() {
|
||||
window.addEventListener('resize', function webViewerResize(evt) {
|
||||
if (PDFView.initialized &&
|
||||
(document.getElementById('pageWidthOption').selected ||
|
||||
document.getElementById('pageFitOption').selected ||
|
||||
document.getElementById('pageAutoOption').selected))
|
||||
PDFView.parseScale(document.getElementById('scaleSelect').value);
|
||||
document.getElementById('pageFitOption').selected ||
|
||||
document.getElementById('pageAutoOption').selected)) {
|
||||
PDFView.parseScale(document.getElementById('scaleSelect').value);
|
||||
}
|
||||
updateViewarea();
|
||||
});
|
||||
|
||||
@ -3892,11 +3909,11 @@ window.addEventListener('scalechange', function scalechange(evt) {
|
||||
customScaleOption.selected = false;
|
||||
|
||||
if (!evt.resetAutoSettings &&
|
||||
(document.getElementById('pageWidthOption').selected ||
|
||||
document.getElementById('pageFitOption').selected ||
|
||||
document.getElementById('pageAutoOption').selected)) {
|
||||
updateViewarea();
|
||||
return;
|
||||
(document.getElementById('pageWidthOption').selected ||
|
||||
document.getElementById('pageFitOption').selected ||
|
||||
document.getElementById('pageAutoOption').selected)) {
|
||||
updateViewarea();
|
||||
return;
|
||||
}
|
||||
|
||||
var predefinedValueFound = selectScaleOption('' + evt.scale);
|
||||
|
Loading…
x
Reference in New Issue
Block a user