@applitools/dom-capture
Advanced tools
Comparing version 6.0.2 to 6.0.3
@@ -228,20 +228,25 @@ | ||
function doProcessResource(url) { | ||
return fetchUrl(url).then(({url, type, value}) => { | ||
const result = {blobsObj: {[url]: {type, value}}}; | ||
if (/text\/css/.test(type)) { | ||
const styleSheet = findStyleSheetByUrl(url, doc); | ||
if (!styleSheet) { | ||
return fetchUrl(url) | ||
.then(({url, type, value}) => { | ||
const result = {blobsObj: {[url]: {type, value}}}; | ||
if (/text\/css/.test(type)) { | ||
const styleSheet = findStyleSheetByUrl(url, doc); | ||
if (!styleSheet) { | ||
return result; | ||
} | ||
const resourceUrls = extractResourcesFromStyleSheet(styleSheet, doc.defaultView).map( | ||
resourceUrl => absolutizeUrl(resourceUrl, url.replace(/^blob:/, '')), | ||
); | ||
return getResourceUrlsAndBlobs(resourceUrls).then(({resourceUrls, blobsObj}) => ({ | ||
resourceUrls, | ||
blobsObj: Object.assign(blobsObj, {[url]: {type, value}}), | ||
})); | ||
} else { | ||
return result; | ||
} | ||
const resourceUrls = extractResourcesFromStyleSheet(styleSheet, doc.defaultView).map( | ||
resourceUrl => absolutizeUrl(resourceUrl, url.replace(/^blob:/, '')), | ||
); | ||
return getResourceUrlsAndBlobs(resourceUrls).then(({resourceUrls, blobsObj}) => ({ | ||
resourceUrls, | ||
blobsObj: Object.assign(blobsObj, {[url]: {type, value}}), | ||
})); | ||
} else { | ||
return result; | ||
} | ||
}); | ||
}) | ||
.catch(err => { | ||
console.log('[dom-capture] error while fetching', url, err); | ||
return {}; | ||
}); | ||
} | ||
@@ -248,0 +253,0 @@ }; |
@@ -280,20 +280,25 @@ | ||
function doProcessResource(url) { | ||
return fetchUrl(url).then(({url, type, value}) => { | ||
const result = {blobsObj: {[url]: {type, value}}}; | ||
if (/text\/css/.test(type)) { | ||
const styleSheet = findStyleSheetByUrl(url, doc); | ||
if (!styleSheet) { | ||
return fetchUrl(url) | ||
.then(({url, type, value}) => { | ||
const result = {blobsObj: {[url]: {type, value}}}; | ||
if (/text\/css/.test(type)) { | ||
const styleSheet = findStyleSheetByUrl(url, doc); | ||
if (!styleSheet) { | ||
return result; | ||
} | ||
const resourceUrls = extractResourcesFromStyleSheet(styleSheet, doc.defaultView).map( | ||
resourceUrl => absolutizeUrl(resourceUrl, url.replace(/^blob:/, '')), | ||
); | ||
return getResourceUrlsAndBlobs(resourceUrls).then(({resourceUrls, blobsObj}) => ({ | ||
resourceUrls, | ||
blobsObj: Object.assign(blobsObj, {[url]: {type, value}}), | ||
})); | ||
} else { | ||
return result; | ||
} | ||
const resourceUrls = extractResourcesFromStyleSheet(styleSheet, doc.defaultView).map( | ||
resourceUrl => absolutizeUrl(resourceUrl, url.replace(/^blob:/, '')), | ||
); | ||
return getResourceUrlsAndBlobs(resourceUrls).then(({resourceUrls, blobsObj}) => ({ | ||
resourceUrls, | ||
blobsObj: Object.assign(blobsObj, {[url]: {type, value}}), | ||
})); | ||
} else { | ||
return result; | ||
} | ||
}); | ||
}) | ||
.catch(err => { | ||
console.log('[dom-capture] error while fetching', url, err); | ||
return {}; | ||
}); | ||
} | ||
@@ -300,0 +305,0 @@ }; |
{ | ||
"name": "@applitools/dom-capture", | ||
"version": "6.0.2", | ||
"version": "6.0.3", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -14,20 +14,25 @@ 'use strict'; | ||
function doProcessResource(url) { | ||
return fetchUrl(url).then(({url, type, value}) => { | ||
const result = {blobsObj: {[url]: {type, value}}}; | ||
if (/text\/css/.test(type)) { | ||
const styleSheet = findStyleSheetByUrl(url, doc); | ||
if (!styleSheet) { | ||
return fetchUrl(url) | ||
.then(({url, type, value}) => { | ||
const result = {blobsObj: {[url]: {type, value}}}; | ||
if (/text\/css/.test(type)) { | ||
const styleSheet = findStyleSheetByUrl(url, doc); | ||
if (!styleSheet) { | ||
return result; | ||
} | ||
const resourceUrls = extractResourcesFromStyleSheet(styleSheet, doc.defaultView).map( | ||
resourceUrl => absolutizeUrl(resourceUrl, url.replace(/^blob:/, '')), | ||
); | ||
return getResourceUrlsAndBlobs(resourceUrls).then(({resourceUrls, blobsObj}) => ({ | ||
resourceUrls, | ||
blobsObj: Object.assign(blobsObj, {[url]: {type, value}}), | ||
})); | ||
} else { | ||
return result; | ||
} | ||
const resourceUrls = extractResourcesFromStyleSheet(styleSheet, doc.defaultView).map( | ||
resourceUrl => absolutizeUrl(resourceUrl, url.replace(/^blob:/, '')), | ||
); | ||
return getResourceUrlsAndBlobs(resourceUrls).then(({resourceUrls, blobsObj}) => ({ | ||
resourceUrls, | ||
blobsObj: Object.assign(blobsObj, {[url]: {type, value}}), | ||
})); | ||
} else { | ||
return result; | ||
} | ||
}); | ||
}) | ||
.catch(err => { | ||
console.log('[dom-capture] error while fetching', url, err); | ||
return {}; | ||
}); | ||
} | ||
@@ -34,0 +39,0 @@ }; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
72441
2004