Skip to content

Commit

Permalink
fix some cases where reading meta-data failed
Browse files Browse the repository at this point in the history
  • Loading branch information
StigNygaard committed Apr 3, 2024
1 parent 5dcf3cc commit 1c26553
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions WebExtension/contentscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +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;
if ( imgrequest.fetchMode === 'devFrontendFetch' ||
imgrequest.fetchMode === 'devAutoFetch' && (propertiesObj.URL.startsWith('blob:') || propertiesObj.URL.startsWith('file:')) ) { // Do frontend fetch...
imgrequest.fetchMode === 'devAutoFetch' && ((pageHostname === imgHostname) || propertiesObj.URL.startsWith('data:') || propertiesObj.URL.startsWith('blob:') || propertiesObj.URL.startsWith('file:')) ) { // Do frontend fetch...
if (imgrequest.fetchMode !== 'devAutoFetch') {
console.warn(`xIFr: Forced FRONTEND fetch (${imgrequest.fetchMode})`);
}
Expand Down Expand Up @@ -542,7 +544,7 @@
image.srcset = candidate.srcset;
image.crossOrigin = candidate.crossOrigin;
image.referrerPolicy = candidate.referrerPolicy; // https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement
image.baseURI = candidate.baseURI;
image.baseURI = candidate.baseURI; // base URL of the document containing the node (might be set by <base>)
image.x = candidate.x;
image.y = candidate.y;

Expand Down

0 comments on commit 1c26553

Please sign in to comment.