Added withCredentials parameter and passing it to xhr requests
This commit is contained in:
parent
4d01ff4079
commit
08737375f8
@ -242,7 +242,8 @@ var ChunkedStreamManager = (function ChunkedStreamManagerClosure() {
|
|||||||
};
|
};
|
||||||
this.networkManager = new NetworkManager(this.url, {
|
this.networkManager = new NetworkManager(this.url, {
|
||||||
getXhr: getXhr,
|
getXhr: getXhr,
|
||||||
httpHeaders: args.httpHeaders
|
httpHeaders: args.httpHeaders,
|
||||||
|
withCredentials: args.withCredentials
|
||||||
});
|
});
|
||||||
this.sendRequest = function ChunkedStreamManager_sendRequest(begin, end) {
|
this.sendRequest = function ChunkedStreamManager_sendRequest(begin, end) {
|
||||||
this.networkManager.requestRange(begin, end, {
|
this.networkManager.requestRange(begin, end, {
|
||||||
|
@ -44,6 +44,7 @@ var NetworkManager = (function NetworkManagerClosure() {
|
|||||||
this.url = url;
|
this.url = url;
|
||||||
args = args || {};
|
args = args || {};
|
||||||
this.httpHeaders = args.httpHeaders || {};
|
this.httpHeaders = args.httpHeaders || {};
|
||||||
|
this.withCredentials = args.withCredentials || false;
|
||||||
this.getXhr = args.getXhr ||
|
this.getXhr = args.getXhr ||
|
||||||
function NetworkManager_getXhr() {
|
function NetworkManager_getXhr() {
|
||||||
//#if B2G
|
//#if B2G
|
||||||
@ -96,6 +97,7 @@ var NetworkManager = (function NetworkManagerClosure() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
xhr.open('GET', this.url);
|
xhr.open('GET', this.url);
|
||||||
|
xhr.withCredentials = this.withCredentials;
|
||||||
for (var property in this.httpHeaders) {
|
for (var property in this.httpHeaders) {
|
||||||
var value = this.httpHeaders[property];
|
var value = this.httpHeaders[property];
|
||||||
if (typeof value === 'undefined') {
|
if (typeof value === 'undefined') {
|
||||||
|
@ -142,6 +142,7 @@ var NetworkPdfManager = (function NetworkPdfManagerClosure() {
|
|||||||
var params = {
|
var params = {
|
||||||
msgHandler: msgHandler,
|
msgHandler: msgHandler,
|
||||||
httpHeaders: args.httpHeaders,
|
httpHeaders: args.httpHeaders,
|
||||||
|
withCredentials: args.withCredentials,
|
||||||
chunkedViewerLoading: args.chunkedViewerLoading,
|
chunkedViewerLoading: args.chunkedViewerLoading,
|
||||||
disableAutoFetch: args.disableAutoFetch,
|
disableAutoFetch: args.disableAutoFetch,
|
||||||
initialData: args.initialData
|
initialData: args.initialData
|
||||||
|
@ -94,7 +94,8 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var networkManager = new NetworkManager(source.url, {
|
var networkManager = new NetworkManager(source.url, {
|
||||||
httpHeaders: source.httpHeaders
|
httpHeaders: source.httpHeaders,
|
||||||
|
withCredentials: source.withCredentials
|
||||||
});
|
});
|
||||||
var fullRequestXhrId = networkManager.requestFull({
|
var fullRequestXhrId = networkManager.requestFull({
|
||||||
onHeadersReceived: function onHeadersReceived() {
|
onHeadersReceived: function onHeadersReceived() {
|
||||||
|
@ -117,6 +117,9 @@ PDFJS.verbosity = PDFJS.verbosity === undefined ?
|
|||||||
* - url - The URL of the PDF.
|
* - url - The URL of the PDF.
|
||||||
* - data - A typed array with PDF data.
|
* - data - A typed array with PDF data.
|
||||||
* - httpHeaders - Basic authentication headers.
|
* - httpHeaders - Basic authentication headers.
|
||||||
|
* - withCredentials - Indicates whether or not cross-site Access-Control
|
||||||
|
* requests should be made using credentials such as
|
||||||
|
* cookies or authorization headers. The default is false.
|
||||||
* - password - For decrypting password-protected PDFs.
|
* - password - For decrypting password-protected PDFs.
|
||||||
* - initialData - A typed array with the first portion or all of the pdf data.
|
* - initialData - A typed array with the first portion or all of the pdf data.
|
||||||
* Used by the extension since some data is already loaded
|
* Used by the extension since some data is already loaded
|
||||||
|
Loading…
Reference in New Issue
Block a user