diff --git a/lighthouse-core/gather/driver.js b/lighthouse-core/gather/driver.js index 693d4b1c925b..a48327b02414 100644 --- a/lighthouse-core/gather/driver.js +++ b/lighthouse-core/gather/driver.js @@ -115,7 +115,7 @@ class Driver { * @return {Promise} */ getBenchmarkIndex() { - return this.evaluateAsync(`(${pageFunctions.ultradumbBenchmark.toString()})()`); + return this.evaluateAsync(`(${pageFunctions.ultradumbBenchmarkString})()`); } /** @@ -302,7 +302,7 @@ class Driver { return new __nativePromise(function (resolve) { return __nativePromise.resolve() .then(_ => ${expression}) - .catch(${pageFunctions.wrapRuntimeEvalErrorInBrowser.toString()}) + .catch(${pageFunctions.wrapRuntimeEvalErrorInBrowserString}) .then(resolve); }); }())`, @@ -513,7 +513,7 @@ class Driver { let lastTimeout; let cancelled = false; - const checkForQuietExpression = `(${pageFunctions.checkTimeSinceLastLongTask.toString()})()`; + const checkForQuietExpression = `(${pageFunctions.checkTimeSinceLastLongTaskString})()`; /** * @param {Driver} driver * @param {() => void} resolve @@ -1137,7 +1137,7 @@ class Driver { * @return {Promise} */ async registerPerformanceObserver() { - const scriptStr = `(${pageFunctions.registerPerformanceObserverInPage.toString()})()`; + const scriptStr = `(${pageFunctions.registerPerformanceObserverInPageString})()`; await this.evaluateScriptOnNewDocument(scriptStr); } diff --git a/lighthouse-core/gather/gatherers/accessibility.js b/lighthouse-core/gather/gatherers/accessibility.js index 8ec0112983d1..452f0d95ee20 100644 --- a/lighthouse-core/gather/gatherers/accessibility.js +++ b/lighthouse-core/gather/gatherers/accessibility.js @@ -96,7 +96,7 @@ class Accessibility extends Gatherer { afterPass(passContext) { const driver = passContext.driver; const expression = `(function () { - ${pageFunctions.getOuterHTMLSnippet.toString()}; + ${pageFunctions.getOuterHTMLSnippetString}; ${axeLibSource}; return (${runA11yChecks.toString()}()); })()`; diff --git a/lighthouse-core/gather/gatherers/dobetterweb/anchors-with-no-rel-noopener.js b/lighthouse-core/gather/gatherers/dobetterweb/anchors-with-no-rel-noopener.js index d2beb9473838..18ff463b91ef 100644 --- a/lighthouse-core/gather/gatherers/dobetterweb/anchors-with-no-rel-noopener.js +++ b/lighthouse-core/gather/gatherers/dobetterweb/anchors-with-no-rel-noopener.js @@ -15,8 +15,8 @@ class AnchorsWithNoRelNoopener extends Gatherer { */ afterPass(passContext) { const expression = `(function() { - ${pageFunctions.getOuterHTMLSnippet.toString()}; - ${pageFunctions.getElementsInDocument.toString()}; // define function on page + ${pageFunctions.getOuterHTMLSnippetString}; + ${pageFunctions.getElementsInDocumentString}; // define function on page const selector = 'a[target="_blank"]:not([rel~="noopener"]):not([rel~="noreferrer"])'; const elements = getElementsInDocument(selector); return elements.map(node => ({ diff --git a/lighthouse-core/gather/gatherers/dobetterweb/domstats.js b/lighthouse-core/gather/gatherers/dobetterweb/domstats.js index 866e7b633563..a949ca90496a 100644 --- a/lighthouse-core/gather/gatherers/dobetterweb/domstats.js +++ b/lighthouse-core/gather/gatherers/dobetterweb/domstats.js @@ -140,7 +140,7 @@ class DOMStats extends Gatherer { */ afterPass(passContext) { const expression = `(function() { - ${pageFunctions.getOuterHTMLSnippet.toString()}; + ${pageFunctions.getOuterHTMLSnippetString}; ${createSelectorsLabel.toString()}; ${elementPathInDOM.toString()}; return (${getDOMStats.toString()}(document.documentElement)); diff --git a/lighthouse-core/gather/gatherers/dobetterweb/password-inputs-with-prevented-paste.js b/lighthouse-core/gather/gatherers/dobetterweb/password-inputs-with-prevented-paste.js index 6b50a0e7b189..f6aecee39f5a 100644 --- a/lighthouse-core/gather/gatherers/dobetterweb/password-inputs-with-prevented-paste.js +++ b/lighthouse-core/gather/gatherers/dobetterweb/password-inputs-with-prevented-paste.js @@ -35,7 +35,7 @@ class PasswordInputsWithPreventedPaste extends Gatherer { */ afterPass(passContext) { return passContext.driver.evaluateAsync(`(() => { - ${pageFunctions.getOuterHTMLSnippet.toString()}; + ${pageFunctions.getOuterHTMLSnippetString}; return (${findPasswordInputsWithPreventedPaste.toString()}()); })()`); } diff --git a/lighthouse-core/gather/gatherers/image-usage.js b/lighthouse-core/gather/gatherers/image-usage.js index c3f89ccbfe1c..0f97537135fd 100644 --- a/lighthouse-core/gather/gatherers/image-usage.js +++ b/lighthouse-core/gather/gatherers/image-usage.js @@ -161,7 +161,7 @@ class ImageUsage extends Gatherer { }, /** @type {Object} */ ({})); const expression = `(function() { - ${pageFunctions.getElementsInDocument.toString()}; // define function on page + ${pageFunctions.getElementsInDocumentString}; // define function on page return (${collectImageElementInfo.toString()})(); })()`; diff --git a/lighthouse-core/gather/gatherers/seo/crawlable-links.js b/lighthouse-core/gather/gatherers/seo/crawlable-links.js index 12354fa4dcb2..e0ead7b60478 100644 --- a/lighthouse-core/gather/gatherers/seo/crawlable-links.js +++ b/lighthouse-core/gather/gatherers/seo/crawlable-links.js @@ -15,7 +15,7 @@ class CrawlableLinks extends Gatherer { */ afterPass(passContext) { const expression = `(function() { - ${pageFunctions.getElementsInDocument.toString()}; // define function on page + ${pageFunctions.getElementsInDocumentString}; // define function on page const selector = 'a[href]:not([rel~="nofollow"])'; const elements = getElementsInDocument(selector); return elements diff --git a/lighthouse-core/gather/gatherers/seo/embedded-content.js b/lighthouse-core/gather/gatherers/seo/embedded-content.js index da87171268e1..281aa1c40438 100644 --- a/lighthouse-core/gather/gatherers/seo/embedded-content.js +++ b/lighthouse-core/gather/gatherers/seo/embedded-content.js @@ -15,7 +15,7 @@ class EmbeddedContent extends Gatherer { */ afterPass(passContext) { const expression = `(function() { - ${pageFunctions.getElementsInDocument.toString()}; // define function on page + ${pageFunctions.getElementsInDocumentString}; // define function on page const selector = 'object, embed, applet'; const elements = getElementsInDocument(selector); return elements diff --git a/lighthouse-core/lib/page-functions.js b/lighthouse-core/lib/page-functions.js index eee83cd9ddf6..f0d05ff0b389 100644 --- a/lighthouse-core/lib/page-functions.js +++ b/lighthouse-core/lib/page-functions.js @@ -145,10 +145,11 @@ function ultradumbBenchmark() { } module.exports = { - wrapRuntimeEvalErrorInBrowser, - registerPerformanceObserverInPage, - checkTimeSinceLastLongTask, - getElementsInDocument, - getOuterHTMLSnippet, - ultradumbBenchmark, + wrapRuntimeEvalErrorInBrowserString: wrapRuntimeEvalErrorInBrowser.toString(), + registerPerformanceObserverInPageString: registerPerformanceObserverInPage.toString(), + checkTimeSinceLastLongTaskString: checkTimeSinceLastLongTask.toString(), + getElementsInDocumentString: getElementsInDocument.toString(), + getOuterHTMLSnippetString: getOuterHTMLSnippet.toString(), + ultradumbBenchmark: ultradumbBenchmark, + ultradumbBenchmarkString: ultradumbBenchmark.toString(), };