mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 17:55:37 +02:00
Merge pull request #8128 from timvandermeij/csp-headers
Network: use the current location to prevent errors when using CSP headers
This commit is contained in:
commit
1eb96d7ca9
1 changed files with 3 additions and 1 deletions
|
@ -31,6 +31,8 @@ if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('FIREFOX || MOZCENTRAL')) {
|
||||||
'be used with FIREFOX or MOZCENTRAL build.');
|
'be used with FIREFOX or MOZCENTRAL build.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var globalScope = sharedUtil.globalScope;
|
||||||
|
|
||||||
var OK_RESPONSE = 200;
|
var OK_RESPONSE = 200;
|
||||||
var PARTIAL_CONTENT_RESPONSE = 206;
|
var PARTIAL_CONTENT_RESPONSE = 206;
|
||||||
|
|
||||||
|
@ -74,7 +76,7 @@ if (typeof PDFJSDev !== 'undefined' && PDFJSDev.test('FIREFOX || MOZCENTRAL')) {
|
||||||
// blocked, e.g. via the connect-src CSP directive or the NoScript addon.
|
// blocked, e.g. via the connect-src CSP directive or the NoScript addon.
|
||||||
// When this error occurs, this feature detection method will mistakenly
|
// When this error occurs, this feature detection method will mistakenly
|
||||||
// report that moz-chunked-arraybuffer is not supported in Firefox 37-.
|
// report that moz-chunked-arraybuffer is not supported in Firefox 37-.
|
||||||
x.open('GET', 'https://example.com');
|
x.open('GET', globalScope.location.href);
|
||||||
x.responseType = 'moz-chunked-arraybuffer';
|
x.responseType = 'moz-chunked-arraybuffer';
|
||||||
return x.responseType === 'moz-chunked-arraybuffer';
|
return x.responseType === 'moz-chunked-arraybuffer';
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue