lighthouse 9.5.0-dev.20230206 → 9.5.0-dev.20230207

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,6 +7,8 @@
7
7
  import {Audit} from './audit.js';
8
8
  import {EntityClassification} from '../computed/entity-classification.js';
9
9
  import * as i18n from '../lib/i18n/i18n.js';
10
+ import {Util} from '../../shared/util.js';
11
+ import UrlUtils from '../lib/url-utils.js';
10
12
 
11
13
  const UIStrings = {
12
14
  /** Title of a Lighthouse audit that provides detail on HTTP to HTTPS redirects. This descriptive title is shown to users when HTTP traffic is redirected to HTTPS. */
@@ -54,11 +56,13 @@ class ValidSourceMaps extends Audit {
54
56
  * @return {boolean}
55
57
  */
56
58
  static isLargeFirstPartyJS(script, classifiedEntities) {
57
- if (!script.length) return false;
59
+ const url = script.url;
60
+ if (!script.length || !url) return false;
61
+ if (!UrlUtils.isValid(url)) return false;
62
+ if (!Util.createOrReturnURL(url).protocol.startsWith('http')) return false;
58
63
 
59
64
  const isLargeJS = script.length >= LARGE_JS_BYTE_THRESHOLD;
60
- const isFirstPartyJS = script.url ? classifiedEntities.isFirstParty(script.url) : false;
61
- return isLargeJS && isFirstPartyJS;
65
+ return classifiedEntities.isFirstParty(url) && isLargeJS;
62
66
  }
63
67
 
64
68
  /**
@@ -59,7 +59,7 @@ function getElementsInDocument(selector) {
59
59
 
60
60
  /** @param {NodeListOf<Element>} nodes */
61
61
  const _findAllElements = nodes => {
62
- for (let i = 0, el; el = nodes[i]; ++i) {
62
+ for (const el of nodes) {
63
63
  if (!selector || realMatchesFn.call(el, selector)) {
64
64
  /** @type {ParseSelector<T>} */
65
65
  // @ts-expect-error - el is verified as matching above, tsc just can't verify it through the .call().
@@ -265,7 +265,7 @@ function getNodePath(node) {
265
265
  }
266
266
  let index = 0;
267
267
  let prevNode;
268
- while (prevNode = node.previousSibling) {
268
+ while (prevNode = node.previousSibling) { // eslint-disable-line no-cond-assign
269
269
  node = prevNode;
270
270
  // skip empty text nodes
271
271
  if (node.nodeType === Node.TEXT_NODE && (node.nodeValue || '').trim().length === 0) continue;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "lighthouse",
3
3
  "type": "module",
4
- "version": "9.5.0-dev.20230206",
4
+ "version": "9.5.0-dev.20230207",
5
5
  "description": "Automated auditing, performance metrics, and best practices for the web.",
6
6
  "main": "./core/index.js",
7
7
  "bin": {