lighthouse 9.5.0-dev.20220411 → 9.5.0-dev.20220414

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.
@@ -97,6 +97,11 @@ const UIStrings = {
97
97
  'protocol-timeout': `Lighthouse could not determine if there was a service worker. Please try with a newer version of Chrome.`,
98
98
  /** Message logged when the web app has been uninstalled o desktop, signalling that the install banner state is being reset. */
99
99
  'pipeline-restarted': 'PWA has been uninstalled and installability checks resetting.',
100
+ /**
101
+ * @description Error message explaining that the URL of the manifest uses a scheme that is not supported on Android.
102
+ * @example {data:} scheme
103
+ */
104
+ 'scheme-not-supported-for-webapk': 'The manifest URL scheme ({scheme}) is not supported on Android.',
100
105
  };
101
106
  /* eslint-enable max-len */
102
107
 
@@ -156,6 +161,17 @@ class InstallableManifest extends Audit {
156
161
  // @ts-expect-error errorIds from protocol should match up against the strings dict
157
162
  const matchingString = UIStrings[err.errorId];
158
163
 
164
+ if (err.errorId === 'scheme-not-supported-for-webapk') {
165
+ // If there was no manifest, then there will be at lest one other installability error.
166
+ // We can ignore this error if that's the case.
167
+ const manifestUrl = artifacts.WebAppManifest?.url;
168
+ if (!manifestUrl) continue;
169
+
170
+ const scheme = new URL(manifestUrl).protocol;
171
+ i18nErrors.push(str_(matchingString, {scheme}));
172
+ continue;
173
+ }
174
+
159
175
  // Handle an errorId we don't recognize.
160
176
  if (matchingString === undefined) {
161
177
  i18nErrors.push(str_(UIStrings.noErrorId, {errorId: err.errorId}));
@@ -82,11 +82,15 @@ class TraceProcessor {
82
82
  * Returns true if the event is a navigation start event of a document whose URL seems valid.
83
83
  *
84
84
  * @param {LH.TraceEvent} event
85
+ * @return {boolean}
85
86
  */
86
87
  static _isNavigationStartOfInterest(event) {
87
- return event.name === 'navigationStart' &&
88
- (!event.args.data || !event.args.data.documentLoaderURL ||
89
- ACCEPTABLE_NAVIGATION_URL_REGEX.test(event.args.data.documentLoaderURL));
88
+ if (event.name !== 'navigationStart') return false;
89
+ // COMPAT: support pre-m67 test traces before `args.data` added to all navStart events.
90
+ // TODO: remove next line when old test traces (e.g. progressive-app-m60.json) are updated.
91
+ if (event.args.data?.documentLoaderURL === undefined) return true;
92
+ if (!event.args.data?.documentLoaderURL) return false;
93
+ return ACCEPTABLE_NAVIGATION_URL_REGEX.test(event.args.data.documentLoaderURL);
90
94
  }
91
95
 
92
96
  /**
@@ -462,8 +466,9 @@ class TraceProcessor {
462
466
  // If we can't find either TracingStarted event, then we'll fallback to the first navStart that
463
467
  // looks like it was loading the main frame with a real URL. Because the schema for this event
464
468
  // has changed across Chrome versions, we'll be extra defensive about finding this case.
465
- const navStartEvt = events.find(e => Boolean(e.name === 'navigationStart' &&
466
- e.args?.data?.isLoadingMainFrame && e.args.data.documentLoaderURL));
469
+ const navStartEvt = events.find(e =>
470
+ this._isNavigationStartOfInterest(e) && e.args.data?.isLoadingMainFrame
471
+ );
467
472
  // Find the first resource that was requested and make sure it agrees on the id.
468
473
  const firstResourceSendEvt = events.find(e => e.name === 'ResourceSendRequest');
469
474
  // We know that these properties exist if we found the events, but TSC doesn't.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lighthouse",
3
- "version": "9.5.0-dev.20220411",
3
+ "version": "9.5.0-dev.20220414",
4
4
  "description": "Automated auditing, performance metrics, and best practices for the web.",
5
5
  "main": "./lighthouse-core/index.js",
6
6
  "bin": {
@@ -1067,6 +1067,9 @@
1067
1067
  "lighthouse-core/audits/installable-manifest.js | protocol-timeout": {
1068
1068
  "message": "Lighthouse could not determine if there was a service worker. Please try with a newer version of Chrome."
1069
1069
  },
1070
+ "lighthouse-core/audits/installable-manifest.js | scheme-not-supported-for-webapk": {
1071
+ "message": "The manifest URL scheme ({scheme}) is not supported on Android."
1072
+ },
1070
1073
  "lighthouse-core/audits/installable-manifest.js | start-url-not-valid": {
1071
1074
  "message": "Manifest start URL is not valid"
1072
1075
  },
@@ -1067,6 +1067,9 @@
1067
1067
  "lighthouse-core/audits/installable-manifest.js | protocol-timeout": {
1068
1068
  "message": "L̂íĝh́t̂h́ôúŝé ĉóûĺd̂ ńôt́ d̂ét̂ér̂ḿîńê íf̂ t́ĥér̂é ŵáŝ á ŝér̂v́îćê ẃôŕk̂ér̂. Ṕl̂éâśê t́r̂ý ŵít̂h́ â ńêẃêŕ v̂ér̂śîón̂ óf̂ Ćĥŕôḿê."
1069
1069
  },
1070
+ "lighthouse-core/audits/installable-manifest.js | scheme-not-supported-for-webapk": {
1071
+ "message": "T̂h́ê ḿâńîf́êśt̂ ÚR̂Ĺ ŝćĥém̂é ({scheme}) îś n̂ót̂ śûṕp̂ór̂t́êd́ ôń Âńd̂ŕôíd̂."
1072
+ },
1070
1073
  "lighthouse-core/audits/installable-manifest.js | start-url-not-valid": {
1071
1074
  "message": "M̂án̂íf̂éŝt́ ŝt́âŕt̂ ÚR̂Ĺ îś n̂ót̂ v́âĺîd́"
1072
1075
  },
@@ -69,6 +69,7 @@ Array [
69
69
  "platform-not-supported-on-android",
70
70
  "prefer-related-applications",
71
71
  "prefer-related-applications-only-beta-stable",
72
+ "scheme-not-supported-for-webapk",
72
73
  "start-url-not-valid",
73
74
  "url-not-supported-for-webapk",
74
75
  "warn-not-offline-capable",