Skip to content

Commit

Permalink
fine-tune choosing fetch type
Browse files Browse the repository at this point in the history
  • Loading branch information
StigNygaard committed May 9, 2024
1 parent f9e5629 commit 4d8f666
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions WebExtension/contentscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,10 +387,10 @@

context.debug(' *** fetchMode: ' + imgrequest.fetchMode + ' ***');

const pageHostname = (new URL(imgrequest.baseURI))?.hostname; // TODO ideally check against window.location instead of Node.baseURI ?!?
const imgHostname = (new URL(imgrequest.imageURL))?.hostname;
const pageOrigin = (new URL(window.location))?.origin;
const imgOrigin = (new URL(propertiesObj.URL))?.origin;
if ( imgrequest.fetchMode === 'devFrontendFetch' ||
imgrequest.fetchMode === 'devAutoFetch' && ((pageHostname === imgHostname) || propertiesObj.URL.startsWith('data:') || propertiesObj.URL.startsWith('blob:') || propertiesObj.URL.startsWith('file:')) ) { // Do frontend fetch...
imgrequest.fetchMode === 'devAutoFetch' && ((pageOrigin === imgOrigin) || imgOrigin.startsWith('data:') || imgOrigin.startsWith('blob:') || imgOrigin.startsWith('file:')) ) { // Do frontend fetch...
if (imgrequest.fetchMode !== 'devAutoFetch') {
console.warn(`xIFr: Forced FRONTEND fetch (${imgrequest.fetchMode})`);
}
Expand Down

0 comments on commit 4d8f666

Please sign in to comment.