From 9c22e8b5f4fe6fe9800491d463b177725b40a828 Mon Sep 17 00:00:00 2001 From: Jon Burger Date: Mon, 8 May 2023 22:38:20 +0000 Subject: [PATCH] Update `isGptImplTag` regex to reflect real world url changes. --- .../test/utils/resource-classification_test.js | 14 ++++++++++++-- .../utils/resource-classification.js | 4 ++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/lighthouse-plugin-publisher-ads/test/utils/resource-classification_test.js b/lighthouse-plugin-publisher-ads/test/utils/resource-classification_test.js index e0af58af..8a1f50f6 100644 --- a/lighthouse-plugin-publisher-ads/test/utils/resource-classification_test.js +++ b/lighthouse-plugin-publisher-ads/test/utils/resource-classification_test.js @@ -230,15 +230,25 @@ describe('resource-classification.js', () => { describe('#isGptImplTag', () => { const testCases = [ { - description: 'Standard tag matches', + description: 'Legacy tag matches', url: new URL('https://securepubads.g.doubleclick.net/gpt/pubads_impl_19700101.js?1234'), expectation: true, }, { - description: 'Standard tag matches on pagead2', + description: 'Legacy tag matches on pagead2', url: new URL('https://pagead2.googlesyndication.com/gpt/pubads_impl_19700101.js?1234'), expectation: true, }, + { + description: 'Standard tag matches', + url: new URL('https://securepubads.g.doubleclick.net/pagead/managed/js/gpt/m123/pubads_impl.js'), + expectation: true, + }, + { + description: 'Suffixed tag matches', + url: new URL('https://securepubads.g.doubleclick.net/pagead/managed/js/gpt/m123/pubads_impl_t123.js'), + expectation: true, + }, { description: 'Non-standard tag matches', url: new URL('https://securepubads.g.doubleclick.net/gpt/pubads_impl_modern_19700101.js'), diff --git a/lighthouse-plugin-publisher-ads/utils/resource-classification.js b/lighthouse-plugin-publisher-ads/utils/resource-classification.js index bdd1b5f7..24108f4c 100644 --- a/lighthouse-plugin-publisher-ads/utils/resource-classification.js +++ b/lighthouse-plugin-publisher-ads/utils/resource-classification.js @@ -159,8 +159,8 @@ function isAMPTag(url) { */ function isGptImplTag(url) { return isGoogleAds(url) && - /(^\/gpt\/pubads_impl([a-z_]*)((?