mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-26 02:17:34 +09:00
[Basilisk] Update pdf.js to version 1.6.467 from Firefox 53.0.2
This commit is contained in:
parent
1eca5a03c2
commit
328408759a
15 changed files with 63242 additions and 69243 deletions
|
|
@ -1,3 +1,3 @@
|
||||||
This is the pdf.js project output, https://github.com/mozilla/pdf.js
|
This is the pdf.js project output, https://github.com/mozilla/pdf.js
|
||||||
|
|
||||||
Current extension version is: 1.6.315
|
Current extension version is: 1.6.467
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
/* jshint esnext:true */
|
|
||||||
/* globals Components, Services, XPCOMUtils, PdfjsChromeUtils,
|
/* globals Components, Services, XPCOMUtils, PdfjsChromeUtils,
|
||||||
PdfjsContentUtils, PdfStreamConverter */
|
PdfjsContentUtils, PdfStreamConverter */
|
||||||
|
|
||||||
|
|
@ -52,6 +51,23 @@ XPCOMUtils.defineLazyModuleGetter(this, 'PdfjsChromeUtils',
|
||||||
'resource://pdf.js/PdfjsChromeUtils.jsm');
|
'resource://pdf.js/PdfjsChromeUtils.jsm');
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, 'PdfjsContentUtils',
|
XPCOMUtils.defineLazyModuleGetter(this, 'PdfjsContentUtils',
|
||||||
'resource://pdf.js/PdfjsContentUtils.jsm');
|
'resource://pdf.js/PdfjsContentUtils.jsm');
|
||||||
|
|
||||||
|
function getBoolPref(aPref, aDefaultValue) {
|
||||||
|
try {
|
||||||
|
return Services.prefs.getBoolPref(aPref);
|
||||||
|
} catch (ex) {
|
||||||
|
return aDefaultValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getIntPref(aPref, aDefaultValue) {
|
||||||
|
try {
|
||||||
|
return Services.prefs.getIntPref(aPref);
|
||||||
|
} catch (ex) {
|
||||||
|
return aDefaultValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function isDefaultHandler() {
|
function isDefaultHandler() {
|
||||||
if (Services.appinfo.processType === Services.appinfo.PROCESS_TYPE_CONTENT) {
|
if (Services.appinfo.processType === Services.appinfo.PROCESS_TYPE_CONTENT) {
|
||||||
return PdfjsContentUtils.isDefaultHandlerApp();
|
return PdfjsContentUtils.isDefaultHandlerApp();
|
||||||
|
|
@ -76,6 +92,7 @@ function initializeDefaultPreferences() {
|
||||||
"useOnlyCssZoom": false,
|
"useOnlyCssZoom": false,
|
||||||
"externalLinkTarget": 0,
|
"externalLinkTarget": 0,
|
||||||
"enhanceTextSelection": false,
|
"enhanceTextSelection": false,
|
||||||
|
"renderer": "canvas",
|
||||||
"renderInteractiveForms": false,
|
"renderInteractiveForms": false,
|
||||||
"disablePageLabels": false
|
"disablePageLabels": false
|
||||||
}
|
}
|
||||||
|
|
@ -155,7 +172,7 @@ var PdfJs = {
|
||||||
}
|
}
|
||||||
this._initialized = true;
|
this._initialized = true;
|
||||||
|
|
||||||
if (!Services.prefs.getBoolPref(PREF_DISABLED, true)) {
|
if (!getBoolPref(PREF_DISABLED, true)) {
|
||||||
this._migrate();
|
this._migrate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -180,11 +197,11 @@ var PdfJs = {
|
||||||
|
|
||||||
uninit: function uninit() {
|
uninit: function uninit() {
|
||||||
if (this._initialized) {
|
if (this._initialized) {
|
||||||
Services.prefs.removeObserver(PREF_DISABLED, this, false);
|
Services.prefs.removeObserver(PREF_DISABLED, this);
|
||||||
Services.prefs.removeObserver(PREF_DISABLED_PLUGIN_TYPES, this, false);
|
Services.prefs.removeObserver(PREF_DISABLED_PLUGIN_TYPES, this);
|
||||||
Services.obs.removeObserver(this, TOPIC_PDFJS_HANDLER_CHANGED, false);
|
Services.obs.removeObserver(this, TOPIC_PDFJS_HANDLER_CHANGED);
|
||||||
Services.obs.removeObserver(this, TOPIC_PLUGINS_LIST_UPDATED, false);
|
Services.obs.removeObserver(this, TOPIC_PLUGINS_LIST_UPDATED);
|
||||||
Services.obs.removeObserver(this, TOPIC_PLUGIN_INFO_UPDATED, false);
|
Services.obs.removeObserver(this, TOPIC_PLUGIN_INFO_UPDATED);
|
||||||
this._initialized = false;
|
this._initialized = false;
|
||||||
}
|
}
|
||||||
this._ensureUnregistered();
|
this._ensureUnregistered();
|
||||||
|
|
@ -192,7 +209,7 @@ var PdfJs = {
|
||||||
|
|
||||||
_migrate: function migrate() {
|
_migrate: function migrate() {
|
||||||
const VERSION = 2;
|
const VERSION = 2;
|
||||||
var currentVersion = Services.prefs.getIntPref(PREF_MIGRATION_VERSION, 0);
|
var currentVersion = getIntPref(PREF_MIGRATION_VERSION, 0);
|
||||||
if (currentVersion >= VERSION) {
|
if (currentVersion >= VERSION) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -267,7 +284,7 @@ var PdfJs = {
|
||||||
* @return {boolean} Whether or not it's enabled.
|
* @return {boolean} Whether or not it's enabled.
|
||||||
*/
|
*/
|
||||||
get enabled() {
|
get enabled() {
|
||||||
var disabled = Services.prefs.getBoolPref(PREF_DISABLED, true);
|
var disabled = getBoolPref(PREF_DISABLED, true);
|
||||||
if (disabled) {
|
if (disabled) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,6 @@ var NetworkManager = (function NetworkManagerClosure() {
|
||||||
var rangeStr = args.begin + '-' + (args.end - 1);
|
var rangeStr = args.begin + '-' + (args.end - 1);
|
||||||
xhr.setRequestHeader('Range', 'bytes=' + rangeStr);
|
xhr.setRequestHeader('Range', 'bytes=' + rangeStr);
|
||||||
pendingRequest.expectedStatus = 206;
|
pendingRequest.expectedStatus = 206;
|
||||||
xhr.channel.QueryInterface(Ci.nsIHttpChannel).redirectionLimit = 0;
|
|
||||||
} else {
|
} else {
|
||||||
pendingRequest.expectedStatus = 200;
|
pendingRequest.expectedStatus = 200;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
/* jshint esnext:true */
|
|
||||||
/* globals Components, Services, XPCOMUtils, NetUtil, PrivateBrowsingUtils,
|
/* globals Components, Services, XPCOMUtils, NetUtil, PrivateBrowsingUtils,
|
||||||
dump, NetworkManager, PdfjsContentUtils */
|
dump, NetworkManager, PdfjsContentUtils */
|
||||||
|
|
||||||
|
|
@ -29,8 +28,7 @@ const MOZ_CENTRAL = JSON.parse('true');
|
||||||
const PDFJS_EVENT_ID = 'pdf.js.message';
|
const PDFJS_EVENT_ID = 'pdf.js.message';
|
||||||
const PDF_CONTENT_TYPE = 'application/pdf';
|
const PDF_CONTENT_TYPE = 'application/pdf';
|
||||||
const PREF_PREFIX = 'pdfjs';
|
const PREF_PREFIX = 'pdfjs';
|
||||||
const PDF_VIEWER_ORIGIN = "resource://pdf.js";
|
const PDF_VIEWER_WEB_PAGE = 'resource://pdf.js/web/viewer.html';
|
||||||
const PDF_VIEWER_WEB_PAGE = "resource://pdf.js/web/viewer.html";
|
|
||||||
const MAX_NUMBER_OF_PREFS = 50;
|
const MAX_NUMBER_OF_PREFS = 50;
|
||||||
const MAX_STRING_PREF_LENGTH = 128;
|
const MAX_STRING_PREF_LENGTH = 128;
|
||||||
|
|
||||||
|
|
@ -75,6 +73,22 @@ function getFindBar(domWindow) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getBoolPref(pref, def) {
|
||||||
|
try {
|
||||||
|
return Services.prefs.getBoolPref(pref);
|
||||||
|
} catch (ex) {
|
||||||
|
return def;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getIntPref(pref, def) {
|
||||||
|
try {
|
||||||
|
return Services.prefs.getIntPref(pref);
|
||||||
|
} catch (ex) {
|
||||||
|
return def;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function getStringPref(pref, def) {
|
function getStringPref(pref, def) {
|
||||||
try {
|
try {
|
||||||
return Services.prefs.getComplexValue(pref, Ci.nsISupportsString).data;
|
return Services.prefs.getComplexValue(pref, Ci.nsISupportsString).data;
|
||||||
|
|
@ -84,7 +98,7 @@ function getStringPref(pref, def) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function log(aMsg) {
|
function log(aMsg) {
|
||||||
if (!Services.prefs.getBoolPref(PREF_PREFIX + '.pdfBugEnabled', false)) {
|
if (!getBoolPref(PREF_PREFIX + '.pdfBugEnabled', false)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var msg = 'PdfStreamConverter.js: ' + (aMsg.join ? aMsg.join('') : aMsg);
|
var msg = 'PdfStreamConverter.js: ' + (aMsg.join ? aMsg.join('') : aMsg);
|
||||||
|
|
@ -92,15 +106,11 @@ function log(aMsg) {
|
||||||
dump(msg + '\n');
|
dump(msg + '\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDOMWindow(aChannel, aPrincipal) {
|
function getDOMWindow(aChannel) {
|
||||||
var requestor = aChannel.notificationCallbacks ?
|
var requestor = aChannel.notificationCallbacks ?
|
||||||
aChannel.notificationCallbacks :
|
aChannel.notificationCallbacks :
|
||||||
aChannel.loadGroup.notificationCallbacks;
|
aChannel.loadGroup.notificationCallbacks;
|
||||||
var win = requestor.getInterface(Components.interfaces.nsIDOMWindow);
|
var win = requestor.getInterface(Components.interfaces.nsIDOMWindow);
|
||||||
// Ensure the window wasn't navigated to something that is not PDF.js.
|
|
||||||
if (!win.document.nodePrincipal.equals(aPrincipal)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return win;
|
return win;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -134,21 +144,6 @@ function getLocalizedString(strings, id, property) {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
function createNewChannel(uri, node) {
|
|
||||||
return NetUtil.newChannel({
|
|
||||||
uri: uri,
|
|
||||||
loadUsingSystemPrincipal: true,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function asyncOpenChannel(channel, listener, context) {
|
|
||||||
return channel.asyncOpen2(listener);
|
|
||||||
}
|
|
||||||
|
|
||||||
function asyncFetchChannel(channel, callback) {
|
|
||||||
return NetUtil.asyncFetch(channel, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
// PDF data storage
|
// PDF data storage
|
||||||
function PdfDataListener(length) {
|
function PdfDataListener(length) {
|
||||||
this.length = length; // less than 0, if length is unknown
|
this.length = length; // less than 0, if length is unknown
|
||||||
|
|
@ -173,7 +168,7 @@ PdfDataListener.prototype = {
|
||||||
if (this.length >= 0 && this.length < this.loaded) {
|
if (this.length >= 0 && this.length < this.loaded) {
|
||||||
this.length = -1; // reset the length, server is giving incorrect one
|
this.length = -1; // reset the length, server is giving incorrect one
|
||||||
}
|
}
|
||||||
this.onprogress(this.loaded, this.length >= 0 ? this.length : void(0));
|
this.onprogress(this.loaded, this.length >= 0 ? this.length : void 0);
|
||||||
},
|
},
|
||||||
readData: function PdfDataListener_readData() {
|
readData: function PdfDataListener_readData() {
|
||||||
var result = this.buffer;
|
var result = this.buffer;
|
||||||
|
|
@ -235,12 +230,15 @@ ChromeActions.prototype = {
|
||||||
getService(Ci.nsIExternalHelperAppService);
|
getService(Ci.nsIExternalHelperAppService);
|
||||||
|
|
||||||
var docIsPrivate = this.isInPrivateBrowsing();
|
var docIsPrivate = this.isInPrivateBrowsing();
|
||||||
var netChannel = createNewChannel(blobUri, this.domWindow.document);
|
var netChannel = NetUtil.newChannel({
|
||||||
|
uri: blobUri,
|
||||||
|
loadUsingSystemPrincipal: true,
|
||||||
|
});
|
||||||
if ('nsIPrivateBrowsingChannel' in Ci &&
|
if ('nsIPrivateBrowsingChannel' in Ci &&
|
||||||
netChannel instanceof Ci.nsIPrivateBrowsingChannel) {
|
netChannel instanceof Ci.nsIPrivateBrowsingChannel) {
|
||||||
netChannel.setPrivate(docIsPrivate);
|
netChannel.setPrivate(docIsPrivate);
|
||||||
}
|
}
|
||||||
asyncFetchChannel(netChannel, function(aInputStream, aResult) {
|
NetUtil.asyncFetch(netChannel, function(aInputStream, aResult) {
|
||||||
if (!Components.isSuccessCode(aResult)) {
|
if (!Components.isSuccessCode(aResult)) {
|
||||||
if (sendResponse) {
|
if (sendResponse) {
|
||||||
sendResponse(true);
|
sendResponse(true);
|
||||||
|
|
@ -298,7 +296,7 @@ ChromeActions.prototype = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
asyncOpenChannel(channel, listener, null);
|
channel.asyncOpen2(listener);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getLocale: function() {
|
getLocale: function() {
|
||||||
|
|
@ -333,17 +331,17 @@ ChromeActions.prototype = {
|
||||||
return !!findBar && ('updateControlState' in findBar);
|
return !!findBar && ('updateControlState' in findBar);
|
||||||
},
|
},
|
||||||
supportsDocumentFonts: function() {
|
supportsDocumentFonts: function() {
|
||||||
var prefBrowser = Services.prefs.getIntPref('browser.display.use_document_fonts', 1);
|
var prefBrowser = getIntPref('browser.display.use_document_fonts', 1);
|
||||||
var prefGfx = Services.prefs.getBoolPref('gfx.downloadable_fonts.enabled', true);
|
var prefGfx = getBoolPref('gfx.downloadable_fonts.enabled', true);
|
||||||
return (!!prefBrowser && prefGfx);
|
return (!!prefBrowser && prefGfx);
|
||||||
},
|
},
|
||||||
supportsDocumentColors: function() {
|
supportsDocumentColors: function() {
|
||||||
return Services.prefs.getIntPref('browser.display.document_color_use', 0) !== 2;
|
return getIntPref('browser.display.document_color_use', 0) !== 2;
|
||||||
},
|
},
|
||||||
supportedMouseWheelZoomModifierKeys: function() {
|
supportedMouseWheelZoomModifierKeys: function() {
|
||||||
return {
|
return {
|
||||||
ctrlKey: Services.prefs.getIntPref('mousewheel.with_control.action', 3) === 3,
|
ctrlKey: getIntPref('mousewheel.with_control.action', 3) === 3,
|
||||||
metaKey: Services.prefs.getIntPref('mousewheel.with_meta.action', 1) === 3,
|
metaKey: getIntPref('mousewheel.with_meta.action', 1) === 3,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
fallback: function(args, sendResponse) {
|
fallback: function(args, sendResponse) {
|
||||||
|
|
@ -448,10 +446,10 @@ ChromeActions.prototype = {
|
||||||
prefName = (PREF_PREFIX + '.' + key);
|
prefName = (PREF_PREFIX + '.' + key);
|
||||||
switch (typeof prefValue) {
|
switch (typeof prefValue) {
|
||||||
case 'boolean':
|
case 'boolean':
|
||||||
currentPrefs[key] = Services.prefs.getBoolPref(prefName, prefValue);
|
currentPrefs[key] = getBoolPref(prefName, prefValue);
|
||||||
break;
|
break;
|
||||||
case 'number':
|
case 'number':
|
||||||
currentPrefs[key] = Services.prefs.getIntPref(prefName, prefValue);
|
currentPrefs[key] = getIntPref(prefName, prefValue);
|
||||||
break;
|
break;
|
||||||
case 'string':
|
case 'string':
|
||||||
currentPrefs[key] = getStringPref(prefName, prefValue);
|
currentPrefs[key] = getStringPref(prefName, prefValue);
|
||||||
|
|
@ -554,7 +552,7 @@ var RangedChromeActions = (function RangedChromeActionsClosure() {
|
||||||
loaded: loaded,
|
loaded: loaded,
|
||||||
total: total,
|
total: total,
|
||||||
chunk: self.dataListener.readData()
|
chunk: self.dataListener.readData()
|
||||||
}, PDF_VIEWER_ORIGIN);
|
}, '*');
|
||||||
};
|
};
|
||||||
this.dataListener.oncomplete = function () {
|
this.dataListener.oncomplete = function () {
|
||||||
self.dataListener = null;
|
self.dataListener = null;
|
||||||
|
|
@ -568,7 +566,7 @@ var RangedChromeActions = (function RangedChromeActionsClosure() {
|
||||||
pdfUrl: this.pdfUrl,
|
pdfUrl: this.pdfUrl,
|
||||||
length: this.contentLength,
|
length: this.contentLength,
|
||||||
data: data
|
data: data
|
||||||
}, PDF_VIEWER_ORIGIN);
|
}, '*');
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
@ -590,13 +588,13 @@ var RangedChromeActions = (function RangedChromeActionsClosure() {
|
||||||
pdfjsLoadAction: 'range',
|
pdfjsLoadAction: 'range',
|
||||||
begin: args.begin,
|
begin: args.begin,
|
||||||
chunk: args.chunk
|
chunk: args.chunk
|
||||||
}, PDF_VIEWER_ORIGIN);
|
}, '*');
|
||||||
},
|
},
|
||||||
onProgress: function RangedChromeActions_onProgress(evt) {
|
onProgress: function RangedChromeActions_onProgress(evt) {
|
||||||
domWindow.postMessage({
|
domWindow.postMessage({
|
||||||
pdfjsLoadAction: 'rangeProgress',
|
pdfjsLoadAction: 'rangeProgress',
|
||||||
loaded: evt.loaded,
|
loaded: evt.loaded,
|
||||||
}, PDF_VIEWER_ORIGIN);
|
}, '*');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
@ -645,7 +643,7 @@ var StandardChromeActions = (function StandardChromeActionsClosure() {
|
||||||
pdfjsLoadAction: 'progress',
|
pdfjsLoadAction: 'progress',
|
||||||
loaded: loaded,
|
loaded: loaded,
|
||||||
total: total
|
total: total
|
||||||
}, PDF_VIEWER_ORIGIN);
|
}, '*');
|
||||||
};
|
};
|
||||||
|
|
||||||
this.dataListener.oncomplete =
|
this.dataListener.oncomplete =
|
||||||
|
|
@ -654,7 +652,7 @@ var StandardChromeActions = (function StandardChromeActionsClosure() {
|
||||||
pdfjsLoadAction: 'complete',
|
pdfjsLoadAction: 'complete',
|
||||||
data: data,
|
data: data,
|
||||||
errorCode: errorCode
|
errorCode: errorCode
|
||||||
}, PDF_VIEWER_ORIGIN);
|
}, '*');
|
||||||
|
|
||||||
self.dataListener = null;
|
self.dataListener = null;
|
||||||
self.originalRequest = null;
|
self.originalRequest = null;
|
||||||
|
|
@ -838,16 +836,16 @@ PdfStreamConverter.prototype = {
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
|
||||||
var hash = aRequest.URI.ref;
|
var hash = aRequest.URI.ref;
|
||||||
var isPDFBugEnabled = Services.prefs.getBoolPref(PREF_PREFIX + '.pdfBugEnabled', false);
|
var isPDFBugEnabled = getBoolPref(PREF_PREFIX + '.pdfBugEnabled', false);
|
||||||
rangeRequest = contentEncoding === 'identity' &&
|
rangeRequest = contentEncoding === 'identity' &&
|
||||||
acceptRanges === 'bytes' &&
|
acceptRanges === 'bytes' &&
|
||||||
aRequest.contentLength >= 0 &&
|
aRequest.contentLength >= 0 &&
|
||||||
!Services.prefs.getBoolPref(PREF_PREFIX + '.disableRange', false) &&
|
!getBoolPref(PREF_PREFIX + '.disableRange', false) &&
|
||||||
(!isPDFBugEnabled ||
|
(!isPDFBugEnabled ||
|
||||||
hash.toLowerCase().indexOf('disablerange=true') < 0);
|
hash.toLowerCase().indexOf('disablerange=true') < 0);
|
||||||
streamRequest = contentEncoding === 'identity' &&
|
streamRequest = contentEncoding === 'identity' &&
|
||||||
aRequest.contentLength >= 0 &&
|
aRequest.contentLength >= 0 &&
|
||||||
!Services.prefs.getBoolPref(PREF_PREFIX + '.disableStream', false) &&
|
!getBoolPref(PREF_PREFIX + '.disableStream', false) &&
|
||||||
(!isPDFBugEnabled ||
|
(!isPDFBugEnabled ||
|
||||||
hash.toLowerCase().indexOf('disablestream=true') < 0);
|
hash.toLowerCase().indexOf('disablestream=true') < 0);
|
||||||
}
|
}
|
||||||
|
|
@ -880,7 +878,10 @@ PdfStreamConverter.prototype = {
|
||||||
.createInstance(Ci.nsIBinaryInputStream);
|
.createInstance(Ci.nsIBinaryInputStream);
|
||||||
|
|
||||||
// Create a new channel that is viewer loaded as a resource.
|
// Create a new channel that is viewer loaded as a resource.
|
||||||
var channel = createNewChannel(PDF_VIEWER_WEB_PAGE, null);
|
var channel = NetUtil.newChannel({
|
||||||
|
uri: PDF_VIEWER_WEB_PAGE,
|
||||||
|
loadUsingSystemPrincipal: true,
|
||||||
|
});
|
||||||
|
|
||||||
var listener = this.listener;
|
var listener = this.listener;
|
||||||
var dataListener = this.dataListener;
|
var dataListener = this.dataListener;
|
||||||
|
|
@ -896,14 +897,10 @@ PdfStreamConverter.prototype = {
|
||||||
listener.onDataAvailable(aRequest, aContext, inputStream,
|
listener.onDataAvailable(aRequest, aContext, inputStream,
|
||||||
offset, count);
|
offset, count);
|
||||||
},
|
},
|
||||||
onStopRequest(request, context, statusCode) {
|
onStopRequest: function(request, context, statusCode) {
|
||||||
var domWindow = getDOMWindow(channel, resourcePrincipal);
|
// We get the DOM window here instead of before the request since it
|
||||||
if (!Components.isSuccessCode(statusCode) || !domWindow) {
|
// may have changed during a redirect.
|
||||||
// The request may have been aborted and the document may have been
|
var domWindow = getDOMWindow(channel);
|
||||||
// replaced with something that is not PDF.js, abort attaching.
|
|
||||||
listener.onStopRequest(aRequest, context, statusCode);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var actions;
|
var actions;
|
||||||
if (rangeRequest || streamRequest) {
|
if (rangeRequest || streamRequest) {
|
||||||
actions = new RangedChromeActions(
|
actions = new RangedChromeActions(
|
||||||
|
|
@ -914,7 +911,7 @@ PdfStreamConverter.prototype = {
|
||||||
domWindow, contentDispositionFilename, aRequest, dataListener);
|
domWindow, contentDispositionFilename, aRequest, dataListener);
|
||||||
}
|
}
|
||||||
var requestListener = new RequestListener(actions);
|
var requestListener = new RequestListener(actions);
|
||||||
domWindow.document.addEventListener(PDFJS_EVENT_ID, function(event) {
|
domWindow.addEventListener(PDFJS_EVENT_ID, function(event) {
|
||||||
requestListener.receive(event);
|
requestListener.receive(event);
|
||||||
}, false, true);
|
}, false, true);
|
||||||
if (actions.supportsIntegratedFind()) {
|
if (actions.supportsIntegratedFind()) {
|
||||||
|
|
@ -940,12 +937,12 @@ PdfStreamConverter.prototype = {
|
||||||
// from the request channel to keep isolation consistent.
|
// from the request channel to keep isolation consistent.
|
||||||
var ssm = Cc['@mozilla.org/scriptsecuritymanager;1']
|
var ssm = Cc['@mozilla.org/scriptsecuritymanager;1']
|
||||||
.getService(Ci.nsIScriptSecurityManager);
|
.getService(Ci.nsIScriptSecurityManager);
|
||||||
var uri = NetUtil.newURI(PDF_VIEWER_WEB_PAGE, null, null);
|
var uri = NetUtil.newURI(PDF_VIEWER_WEB_PAGE);
|
||||||
var resourcePrincipal;
|
var resourcePrincipal =
|
||||||
resourcePrincipal =
|
|
||||||
ssm.createCodebasePrincipal(uri, aRequest.loadInfo.originAttributes);
|
ssm.createCodebasePrincipal(uri, aRequest.loadInfo.originAttributes);
|
||||||
aRequest.owner = resourcePrincipal;
|
aRequest.owner = resourcePrincipal;
|
||||||
asyncOpenChannel(channel, proxy, aContext);
|
|
||||||
|
channel.asyncOpen2(proxy);
|
||||||
},
|
},
|
||||||
|
|
||||||
// nsIRequestObserver::onStopRequest
|
// nsIRequestObserver::onStopRequest
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
/* jshint esnext:true */
|
|
||||||
/* globals Components, Services, XPCOMUtils */
|
/* globals Components, Services, XPCOMUtils */
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
@ -51,6 +50,7 @@ var DEFAULT_PREFERENCES =
|
||||||
"useOnlyCssZoom": false,
|
"useOnlyCssZoom": false,
|
||||||
"externalLinkTarget": 0,
|
"externalLinkTarget": 0,
|
||||||
"enhanceTextSelection": false,
|
"enhanceTextSelection": false,
|
||||||
|
"renderer": "canvas",
|
||||||
"renderInteractiveForms": false,
|
"renderInteractiveForms": false,
|
||||||
"disablePageLabels": false
|
"disablePageLabels": false
|
||||||
}
|
}
|
||||||
|
|
@ -110,7 +110,7 @@ var PdfjsChromeUtils = {
|
||||||
this._mmg.removeMessageListener('PDFJS:Parent:removeEventListener', this);
|
this._mmg.removeMessageListener('PDFJS:Parent:removeEventListener', this);
|
||||||
this._mmg.removeMessageListener('PDFJS:Parent:updateControlState', this);
|
this._mmg.removeMessageListener('PDFJS:Parent:updateControlState', this);
|
||||||
|
|
||||||
Services.obs.removeObserver(this, 'quit-application', false);
|
Services.obs.removeObserver(this, 'quit-application');
|
||||||
|
|
||||||
this._mmg = null;
|
this._mmg = null;
|
||||||
this._ppmm = null;
|
this._ppmm = null;
|
||||||
|
|
@ -354,4 +354,3 @@ var PdfjsChromeUtils = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
/* jshint esnext:true */
|
|
||||||
/* globals Components, Services, XPCOMUtils */
|
/* globals Components, Services, XPCOMUtils */
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -375,6 +375,9 @@ if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('FIREFOX || MOZCENTRAL')) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var networkManager = this._manager;
|
var networkManager = this._manager;
|
||||||
|
if (!networkManager.isHttp) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
var fullRequestXhrId = this._fullRequestId;
|
var fullRequestXhrId = this._fullRequestId;
|
||||||
var fullRequestXhr = networkManager.getRequestXhr(fullRequestXhrId);
|
var fullRequestXhr = networkManager.getRequestXhr(fullRequestXhrId);
|
||||||
if (fullRequestXhr.getResponseHeader('Accept-Ranges') !== 'bytes') {
|
if (fullRequestXhr.getResponseHeader('Accept-Ranges') !== 'bytes') {
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
/* jshint esnext:true */
|
|
||||||
/* globals Components, PdfjsContentUtils, PdfJs, Services */
|
/* globals Components, PdfjsContentUtils, PdfJs, Services */
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
|
||||||
|
|
@ -403,13 +403,13 @@ var Stepper = (function StepperClosure() {
|
||||||
var listener = function(e) {
|
var listener = function(e) {
|
||||||
switch (e.keyCode) {
|
switch (e.keyCode) {
|
||||||
case 83: // step
|
case 83: // step
|
||||||
dom.removeEventListener('keydown', listener, false);
|
dom.removeEventListener('keydown', listener);
|
||||||
self.nextBreakPoint = self.currentIdx + 1;
|
self.nextBreakPoint = self.currentIdx + 1;
|
||||||
self.goTo(-1);
|
self.goTo(-1);
|
||||||
callback();
|
callback();
|
||||||
break;
|
break;
|
||||||
case 67: // continue
|
case 67: // continue
|
||||||
dom.removeEventListener('keydown', listener, false);
|
dom.removeEventListener('keydown', listener);
|
||||||
var breakPoint = self.getNextBreakPoint();
|
var breakPoint = self.getNextBreakPoint();
|
||||||
self.nextBreakPoint = breakPoint;
|
self.nextBreakPoint = breakPoint;
|
||||||
self.goTo(-1);
|
self.goTo(-1);
|
||||||
|
|
@ -417,7 +417,7 @@ var Stepper = (function StepperClosure() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
dom.addEventListener('keydown', listener, false);
|
dom.addEventListener('keydown', listener);
|
||||||
self.goTo(idx);
|
self.goTo(idx);
|
||||||
},
|
},
|
||||||
goTo: function goTo(idx) {
|
goTo: function goTo(idx) {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// Small subset of the webL10n API by Fabien Cazenave for pdf.js extension.
|
// Small subset of the webL10n API by Fabien Cazenave for pdf.js extension.
|
||||||
(function(window) {
|
(function(window) {
|
||||||
var gLanguage = '';
|
var gLanguage = '';
|
||||||
var gExternalLocalizerServices = null;
|
var gExternalLocalizerServices = null;
|
||||||
|
var gReadyState = 'loading';
|
||||||
|
|
||||||
// fetch an l10n objects
|
// fetch an l10n objects
|
||||||
function getL10nData(key) {
|
function getL10nData(key) {
|
||||||
|
|
@ -99,6 +99,8 @@
|
||||||
|
|
||||||
translateFragment();
|
translateFragment();
|
||||||
|
|
||||||
|
gReadyState = 'complete';
|
||||||
|
|
||||||
// fire a 'localized' DOM event
|
// fire a 'localized' DOM event
|
||||||
var evtObject = document.createEvent('Event');
|
var evtObject = document.createEvent('Event');
|
||||||
evtObject.initEvent('localized', false, false);
|
evtObject.initEvent('localized', false, false);
|
||||||
|
|
@ -135,6 +137,8 @@
|
||||||
return (rtlList.indexOf(shortCode) >= 0) ? 'rtl' : 'ltr';
|
return (rtlList.indexOf(shortCode) >= 0) ? 'rtl' : 'ltr';
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getReadyState: function() { return gReadyState; },
|
||||||
|
|
||||||
setExternalLocalizerServices: function (externalLocalizerServices) {
|
setExternalLocalizerServices: function (externalLocalizerServices) {
|
||||||
gExternalLocalizerServices = externalLocalizerServices;
|
gExternalLocalizerServices = externalLocalizerServices;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,9 @@
|
||||||
|
|
||||||
.annotationLayer .textWidgetAnnotation input,
|
.annotationLayer .textWidgetAnnotation input,
|
||||||
.annotationLayer .textWidgetAnnotation textarea,
|
.annotationLayer .textWidgetAnnotation textarea,
|
||||||
.annotationLayer .choiceWidgetAnnotation select {
|
.annotationLayer .choiceWidgetAnnotation select,
|
||||||
|
.annotationLayer .buttonWidgetAnnotation.checkBox input,
|
||||||
|
.annotationLayer .buttonWidgetAnnotation.radioButton input {
|
||||||
background-color: rgba(0, 54, 255, 0.13);
|
background-color: rgba(0, 54, 255, 0.13);
|
||||||
border: 1px solid transparent;
|
border: 1px solid transparent;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|
@ -122,7 +124,9 @@
|
||||||
|
|
||||||
.annotationLayer .textWidgetAnnotation input[disabled],
|
.annotationLayer .textWidgetAnnotation input[disabled],
|
||||||
.annotationLayer .textWidgetAnnotation textarea[disabled],
|
.annotationLayer .textWidgetAnnotation textarea[disabled],
|
||||||
.annotationLayer .choiceWidgetAnnotation select[disabled] {
|
.annotationLayer .choiceWidgetAnnotation select[disabled],
|
||||||
|
.annotationLayer .buttonWidgetAnnotation.checkBox input[disabled],
|
||||||
|
.annotationLayer .buttonWidgetAnnotation.radioButton input[disabled] {
|
||||||
background: none;
|
background: none;
|
||||||
border: 1px solid transparent;
|
border: 1px solid transparent;
|
||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
|
|
@ -130,7 +134,9 @@
|
||||||
|
|
||||||
.annotationLayer .textWidgetAnnotation input:hover,
|
.annotationLayer .textWidgetAnnotation input:hover,
|
||||||
.annotationLayer .textWidgetAnnotation textarea:hover,
|
.annotationLayer .textWidgetAnnotation textarea:hover,
|
||||||
.annotationLayer .choiceWidgetAnnotation select:hover {
|
.annotationLayer .choiceWidgetAnnotation select:hover,
|
||||||
|
.annotationLayer .buttonWidgetAnnotation.checkBox input:hover,
|
||||||
|
.annotationLayer .buttonWidgetAnnotation.radioButton input:hover {
|
||||||
border: 1px solid #000;
|
border: 1px solid #000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -157,6 +163,12 @@
|
||||||
width: 115%;
|
width: 115%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.annotationLayer .buttonWidgetAnnotation.checkBox input,
|
||||||
|
.annotationLayer .buttonWidgetAnnotation.radioButton input {
|
||||||
|
-moz-appearance: none;
|
||||||
|
appearance: none;
|
||||||
|
}
|
||||||
|
|
||||||
.annotationLayer .popupWrapper {
|
.annotationLayer .popupWrapper {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 20em;
|
width: 20em;
|
||||||
|
|
@ -931,11 +943,6 @@ html[dir='rtl'] .toolbarButton:first-child {
|
||||||
height: 1px;
|
height: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.toolbarButtonFlexibleSpacer {
|
|
||||||
-moz-box-flex: 1;
|
|
||||||
min-width: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
html[dir='ltr'] #findPrevious {
|
html[dir='ltr'] #findPrevious {
|
||||||
margin-left: 3px;
|
margin-left: 3px;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,6 @@ See https://github.com/adobe-type-tools/cmap-resources
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<script src="viewer.js"></script>
|
<script src="viewer.js"></script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue