Skip to content

Instantly share code, notes, and snippets.

@codeout
Created May 22, 2014 11:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codeout/6835610480bbe5c6b981 to your computer and use it in GitHub Desktop.
Save codeout/6835610480bbe5c6b981 to your computer and use it in GitHub Desktop.
chrome.webRequest patch for autopagerize
diff --git a/src/background.js b/src/background.js
index 9c0b369..e406ec8 100644
--- a/src/background.js
+++ b/src/background.js
@@ -213,11 +213,11 @@ chrome.webRequest.onHeadersReceived.addListener(
details.responseHeaders,
xhrHeaderFinalURL, details.url
)
- return {
- cancel: !isSameOrigin(
- details.url, checkReqs[details.requestId]
- ),
- responseHeaders: headers
+
+ if(isSameOrigin(details.url, checkReqs[details.requestId])) {
+ return {responseHeaders: headers}
+ } else {
+ return {cancel: true}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment