Skip to content

report(third party): filter out third party urls #6351

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 53 commits into from
Apr 30, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
28cc931
core(jsdom): upgrade jsdom to support closest
wardpeet Oct 26, 2018
d99057e
remove lh extension
wardpeet Oct 26, 2018
9885704
fix eslint
wardpeet Oct 27, 2018
0c7d01b
remove jsdom from lighthouse-viewer
wardpeet Oct 27, 2018
9dd3047
add filter 3p logic to report
wardpeet Oct 21, 2018
bc9b131
Show 3p table
wardpeet Oct 26, 2018
7e23d46
fix eslint
wardpeet Oct 26, 2018
1dac41b
Merge branch 'master' into feat/report-3p
wardpeet Oct 31, 2018
52253b3
update 3rd party
wardpeet Oct 31, 2018
350bf5d
fix unit test
wardpeet Oct 31, 2018
787f649
fix eslint
wardpeet Oct 31, 2018
6ccbc88
fix typescript
wardpeet Nov 1, 2018
32f0832
fix eslint
wardpeet Nov 5, 2018
745b4cf
Merge branch 'master' into feat/report-3p
wardpeet Dec 18, 2018
be2627e
Merge branch 'master' into feat/report-3p
wardpeet Jan 21, 2019
60c1081
review changes
wardpeet Jan 21, 2019
7a17378
fix urlshim & reviews
wardpeet Jan 22, 2019
fa071b1
fix lint
wardpeet Jan 28, 2019
274bc47
fix type-check..
wardpeet Jan 29, 2019
7d4cb53
review changes
wardpeet Feb 9, 2019
be6d8fb
Update lighthouse-core/lib/url-shim.js
paulirish Apr 2, 2019
2149757
Apply suggestions from code review
paulirish Apr 2, 2019
e20dae9
move getrootdomain to util from report render
wardpeet Apr 2, 2019
bfb3b56
Enable UIstrings in report for third party label
wardpeet Apr 3, 2019
960139f
review changes
wardpeet Apr 3, 2019
78403fc
Merge branch 'master' into feat/report-3p
wardpeet Apr 3, 2019
f9605d4
fix tests
wardpeet Apr 3, 2019
4b117b1
fix eslint
wardpeet Apr 3, 2019
8b3b814
fix tsc
wardpeet Apr 4, 2019
3823b51
update golden lhr
wardpeet Apr 4, 2019
bf66efe
fix tests & lint
wardpeet Apr 4, 2019
1888642
AAAAAAhhhh please work
wardpeet Apr 4, 2019
9c018f8
fix proto test
wardpeet Apr 4, 2019
045eb9d
Merge branch 'master' into feat/report-3p
wardpeet Apr 15, 2019
9d17141
update description of label message
wardpeet Apr 16, 2019
f2d8fb5
add localhost test
wardpeet Apr 16, 2019
9a3f617
fix i18n lhr check
wardpeet Apr 16, 2019
a410185
Fix third paryt check for domains with port
wardpeet Apr 16, 2019
2380a04
fix eslint
wardpeet Apr 16, 2019
34f1790
Merge branch 'master' into feat/report-3p
connorjclark Apr 23, 2019
d8c7ba0
fix merge
connorjclark Apr 23, 2019
75c6ef5
URL cleanup
brendankenny Apr 23, 2019
5b8e948
comment
connorjclark Apr 25, 2019
87d5e14
comment
connorjclark Apr 25, 2019
b52ab91
Merge remote-tracking branch 'origin/master' into feat/report-3p
connorjclark Apr 25, 2019
3ff478e
empty commit to trigger CI
connorjclark Apr 27, 2019
341bd5d
add render test
connorjclark Apr 29, 2019
99b0b13
fix edge case
connorjclark Apr 29, 2019
c9a1b72
use dom.find
connorjclark Apr 29, 2019
2b90b66
empty commit to trigger CI
connorjclark Apr 29, 2019
a29cd61
Merge remote-tracking branch 'origin/master' into feat/report-3p
connorjclark Apr 29, 2019
a99422a
updates
brendankenny Apr 29, 2019
56e5551
strings
paulirish Apr 29, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions lighthouse-core/report/html/renderer/report-ui-features.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,9 @@ class ReportUIFeatures {
/** @type {Map<number, HTMLTableRowElement>} */
const thirdPartyRows = new Map();
for (const urlItem of urlItems) {
const datasetUrl = (urlItem.dataset.url || '');
// the : check is used for domains that specify a port (google.com:8080/index.html)
const isThirdParty = !datasetUrl.includes(`${rootDomain}/`) &&
!datasetUrl.includes(`${rootDomain}:`);
if (!isThirdParty) {
continue;
}
const datasetUrl = urlItem.dataset.url || '';
const isThirdParty = Util.getRootDomain(datasetUrl) !== rootDomain;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wardpeet this ok?

if (!isThirdParty) continue;

const urlRowEl = urlItem.closest('tr');
if (urlRowEl) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,10 @@ describe('ReportUIFeatures', () => {
...webpAuditItemTemplate,
url: 'http://www.cdn.com/img2.jpg',
},
// TODO
// {
// ...webpAuditItemTemplate,
// url: "http://www.notexample.com/img3.jpg",
// },
{
...webpAuditItemTemplate,
url: 'http://www.notexample.com/img3.jpg',
},
];

// render a report onto the UIFeature dom
Expand All @@ -139,11 +138,11 @@ describe('ReportUIFeatures', () => {
.map(el => el.textContent);
}

expect(getUrls()).toEqual(['/img1.jpg', '/img2.jpg']);
expect(getUrls()).toEqual(['/img1.jpg', '/img2.jpg', '/img3.jpg']);
filterToggle.click();
expect(getUrls()).toEqual(['/img1.jpg']);
filterToggle.click();
expect(getUrls()).toEqual(['/img1.jpg', '/img2.jpg']);
expect(getUrls()).toEqual(['/img1.jpg', '/img2.jpg', '/img3.jpg']);
});
});
});