@applitools/dom-capture
Advanced tools
Comparing version 6.1.4 to 6.1.5
@@ -91,3 +91,3 @@ | ||
if (/^blob:/.test(value)) { | ||
value = value.replace(/^blob:http:\/\/localhost:\d+\/(.+)/, '$1'); // TODO don't replace localhost once render-grid implements absolute urls | ||
value = value.replace(/^blob:/, ''); | ||
} | ||
@@ -137,3 +137,3 @@ | ||
function extractFrames(doc = document) { | ||
return [...doc.querySelectorAll('iframe[src]:not([src=""]):not([src^="about:"]')] | ||
return [...doc.querySelectorAll('iframe[src]:not([src=""])')] | ||
.map(srcEl => { | ||
@@ -143,3 +143,7 @@ try { | ||
return ( | ||
contentDoc && contentDoc.defaultView && contentDoc.defaultView.frameElement && contentDoc | ||
contentDoc && | ||
/^https?:$/.test(contentDoc.location.protocol) && | ||
contentDoc.defaultView && | ||
contentDoc.defaultView.frameElement && | ||
contentDoc | ||
); | ||
@@ -220,7 +224,7 @@ } catch (err) { | ||
function filterDataUrl(url) { | ||
return !/^data:/.test(url); | ||
function filterInlineUrl(absoluteUrl) { | ||
return /^(blob|https?):/.test(absoluteUrl); | ||
} | ||
var filterDataUrl_1 = filterDataUrl; | ||
var filterInlineUrl_1 = filterInlineUrl; | ||
@@ -252,4 +256,4 @@ function absolutizeUrl(url, absoluteUrl) { | ||
const resourceUrls = extractResourcesFromStyleSheet(styleSheet, doc.defaultView) | ||
.filter(filterDataUrl_1) | ||
.map(resourceUrl => absolutizeUrl_1(resourceUrl, url.replace(/^blob:/, ''))); | ||
.map(resourceUrl => absolutizeUrl_1(resourceUrl, url.replace(/^blob:/, ''))) | ||
.filter(filterInlineUrl_1); | ||
return getResourceUrlsAndBlobs(resourceUrls).then(({resourceUrls, blobsObj}) => ({ | ||
@@ -393,7 +397,7 @@ resourceUrls, | ||
.concat(extractResourceUrlsFromStyleAttrs_1(cdt)) | ||
.concat(extractResourceUrlsFromStyleTags$$1(doc)) | ||
.filter(filterDataUrl_1), | ||
.concat(extractResourceUrlsFromStyleTags$$1(doc)), | ||
) | ||
.map(absolutizeThisUrl) | ||
.filter(x => !!x); | ||
.filter(filterInlineUrlsIfExisting); | ||
const resourceUrlsAndBlobsPromise = getResourceUrlsAndBlobs$$1(doc, url, links); | ||
@@ -436,2 +440,6 @@ | ||
function filterInlineUrlsIfExisting(absoluteUrl) { | ||
return absoluteUrl && filterInlineUrl_1(absoluteUrl); | ||
} | ||
var processPage_1 = processPage; | ||
@@ -438,0 +446,0 @@ |
@@ -143,3 +143,3 @@ | ||
if (/^blob:/.test(value)) { | ||
value = value.replace(/^blob:http:\/\/localhost:\d+\/(.+)/, '$1'); // TODO don't replace localhost once render-grid implements absolute urls | ||
value = value.replace(/^blob:/, ''); | ||
} | ||
@@ -189,3 +189,3 @@ | ||
function extractFrames(doc = document) { | ||
return [...doc.querySelectorAll('iframe[src]:not([src=""]):not([src^="about:"]')] | ||
return [...doc.querySelectorAll('iframe[src]:not([src=""])')] | ||
.map(srcEl => { | ||
@@ -195,3 +195,7 @@ try { | ||
return ( | ||
contentDoc && contentDoc.defaultView && contentDoc.defaultView.frameElement && contentDoc | ||
contentDoc && | ||
/^https?:$/.test(contentDoc.location.protocol) && | ||
contentDoc.defaultView && | ||
contentDoc.defaultView.frameElement && | ||
contentDoc | ||
); | ||
@@ -272,7 +276,7 @@ } catch (err) { | ||
function filterDataUrl(url) { | ||
return !/^data:/.test(url); | ||
function filterInlineUrl(absoluteUrl) { | ||
return /^(blob|https?):/.test(absoluteUrl); | ||
} | ||
var filterDataUrl_1 = filterDataUrl; | ||
var filterInlineUrl_1 = filterInlineUrl; | ||
@@ -304,4 +308,4 @@ function absolutizeUrl(url, absoluteUrl) { | ||
const resourceUrls = extractResourcesFromStyleSheet(styleSheet, doc.defaultView) | ||
.filter(filterDataUrl_1) | ||
.map(resourceUrl => absolutizeUrl_1(resourceUrl, url.replace(/^blob:/, ''))); | ||
.map(resourceUrl => absolutizeUrl_1(resourceUrl, url.replace(/^blob:/, ''))) | ||
.filter(filterInlineUrl_1); | ||
return getResourceUrlsAndBlobs(resourceUrls).then(({resourceUrls, blobsObj}) => ({ | ||
@@ -445,7 +449,7 @@ resourceUrls, | ||
.concat(extractResourceUrlsFromStyleAttrs_1(cdt)) | ||
.concat(extractResourceUrlsFromStyleTags$$1(doc)) | ||
.filter(filterDataUrl_1), | ||
.concat(extractResourceUrlsFromStyleTags$$1(doc)), | ||
) | ||
.map(absolutizeThisUrl) | ||
.filter(x => !!x); | ||
.filter(filterInlineUrlsIfExisting); | ||
const resourceUrlsAndBlobsPromise = getResourceUrlsAndBlobs$$1(doc, url, links); | ||
@@ -488,2 +492,6 @@ | ||
function filterInlineUrlsIfExisting(absoluteUrl) { | ||
return absoluteUrl && filterInlineUrl_1(absoluteUrl); | ||
} | ||
var processPage_1 = processPage; | ||
@@ -490,0 +498,0 @@ |
{ | ||
"name": "@applitools/dom-capture", | ||
"version": "6.1.4", | ||
"version": "6.1.5", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -60,3 +60,3 @@ /* eslint-disable no-use-before-define */ | ||
if (/^blob:/.test(value)) { | ||
value = value.replace(/^blob:http:\/\/localhost:\d+\/(.+)/, '$1'); // TODO don't replace localhost once render-grid implements absolute urls | ||
value = value.replace(/^blob:/, ''); | ||
} | ||
@@ -63,0 +63,0 @@ |
'use strict'; | ||
function extractFrames(doc = document) { | ||
return [...doc.querySelectorAll('iframe[src]:not([src=""]):not([src^="about:"]')] | ||
return [...doc.querySelectorAll('iframe[src]:not([src=""])')] | ||
.map(srcEl => { | ||
@@ -9,3 +9,7 @@ try { | ||
return ( | ||
contentDoc && contentDoc.defaultView && contentDoc.defaultView.frameElement && contentDoc | ||
contentDoc && | ||
/^https?:$/.test(contentDoc.location.protocol) && | ||
contentDoc.defaultView && | ||
contentDoc.defaultView.frameElement && | ||
contentDoc | ||
); | ||
@@ -12,0 +16,0 @@ } catch (err) { |
@@ -15,3 +15,3 @@ 'use strict'; | ||
const uniq = require('./uniq'); | ||
const filterDataUrl = require('./filterDataUrl'); | ||
const filterInlineUrl = require('./filterInlineUrl'); | ||
@@ -49,7 +49,7 @@ function processPage(doc = document) { | ||
.concat(extractResourceUrlsFromStyleAttrs(cdt)) | ||
.concat(extractResourceUrlsFromStyleTags(doc)) | ||
.filter(filterDataUrl), | ||
.concat(extractResourceUrlsFromStyleTags(doc)), | ||
) | ||
.map(absolutizeThisUrl) | ||
.filter(x => !!x); | ||
.filter(filterInlineUrlsIfExisting); | ||
const resourceUrlsAndBlobsPromise = getResourceUrlsAndBlobs(doc, url, links); | ||
@@ -92,2 +92,6 @@ | ||
function filterInlineUrlsIfExisting(absoluteUrl) { | ||
return absoluteUrl && filterInlineUrl(absoluteUrl); | ||
} | ||
module.exports = processPage; |
'use strict'; | ||
const filterDataUrl = require('./filterDataUrl'); | ||
const filterInlineUrl = require('./filterInlineUrl'); | ||
const absolutizeUrl = require('../shared/absolutizeUrl'); | ||
@@ -24,4 +24,4 @@ | ||
const resourceUrls = extractResourcesFromStyleSheet(styleSheet, doc.defaultView) | ||
.filter(filterDataUrl) | ||
.map(resourceUrl => absolutizeUrl(resourceUrl, url.replace(/^blob:/, ''))); | ||
.map(resourceUrl => absolutizeUrl(resourceUrl, url.replace(/^blob:/, ''))) | ||
.filter(filterInlineUrl); | ||
return getResourceUrlsAndBlobs(resourceUrls).then(({resourceUrls, blobsObj}) => ({ | ||
@@ -28,0 +28,0 @@ resourceUrls, |
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
75561
2068