[CRX] Add Referer request header if needed

This patch adds the Referer request header to PDF requests if
the original PDF request included the Referer header.
This commit is contained in:
Rob Wu 2015-03-10 15:22:32 +01:00
parent d95b4e475e
commit adb2f8ae21
6 changed files with 223 additions and 3 deletions

View file

@ -135,6 +135,10 @@ var PDFHistory = (function () {
});
},
clearHistoryState: function pdfHistory_clearHistoryState() {
this._pushOrReplaceState(null, true);
},
_isStateObjectDefined: function pdfHistory_isStateObjectDefined(state) {
return (state && state.uid >= 0 &&
state.fingerprint && this.fingerprint === state.fingerprint &&
@ -143,6 +147,13 @@ var PDFHistory = (function () {
_pushOrReplaceState: function pdfHistory_pushOrReplaceState(stateObj,
replace) {
//#if CHROME
// history.state.chromecomState is managed by chromecom.js.
if (window.history.state && 'chromecomState' in window.history.state) {
stateObj = stateObj || {};
stateObj.chromecomState = window.history.state.chromecomState;
}
//#endif
if (replace) {
//#if (GENERIC || CHROME)
window.history.replaceState(stateObj, '', document.URL);