Skip to content

Commit

Permalink
use idb for report instead of window.open
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirish committed May 16, 2018
1 parent b19a7b5 commit 5881613
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions lighthouse-viewer/app/src/lighthouse-report-viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
'use strict';

/* global DOM, ViewerUIFeatures, ReportRenderer, DragAndDrop, GithubApi, logger */
/* global DOM, ViewerUIFeatures, ReportRenderer, DragAndDrop, GithubApi, logger, idbKeyval */

/**
* Class that manages viewing Lighthouse reports.
Expand Down Expand Up @@ -180,14 +180,12 @@ class LighthouseReportViewer {
* @private
*/
_loadInLegacyViewerVersion(json) {
const warnMsg = `Version mismatch between viewer and JSON.
Opening new tab with compatible viewer.`;
const viewerPath = '/lighthouse/viewer2x/';

const warnMsg = `Version mismatch between viewer and JSON. Opening compatible viewer...`;
logger.log(warnMsg, false);
ViewerUIFeatures.openTabAndSendJsonReport(json, viewerPath).then(_ => {
window.close();
logger.log(`${warnMsg} You can close this tab.`, false);

const viewerPath = new URL('../viewer2x/', location.href);
idbKeyval.set('2xreport', json).then(_ => {
window.location.href = viewerPath;
});
}

Expand Down

0 comments on commit 5881613

Please sign in to comment.