-
Notifications
You must be signed in to change notification settings - Fork 245
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add parameters and content script * Fixes * lint * Fix tests * lint * PR changes * Update browsers/chrome/manifest.json Co-authored-by: Sam Macbeth <[email protected]> --------- Co-authored-by: Sam Macbeth <[email protected]>
- Loading branch information
1 parent
f875594
commit a58a481
Showing
14 changed files
with
182 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
let pageReloaded = false | ||
let jsPerformance = [] | ||
|
||
function notifyPageReloaded () { | ||
(async () => { | ||
await chrome.runtime.sendMessage({ pageReloaded: true }) | ||
})() | ||
} | ||
|
||
new PerformanceObserver((entryList) => { | ||
for (const entry of entryList.getEntriesByName('first-contentful-paint')) { | ||
jsPerformance = [entry.startTime] | ||
} | ||
}).observe({ type: 'paint', buffered: true }) | ||
|
||
document.addEventListener('DOMContentLoaded', function (event) { | ||
pageReloaded = ( | ||
(window.performance.navigation && window.performance.navigation.type === 1) || | ||
window.performance | ||
.getEntriesByType('navigation') | ||
.map((nav) => nav.type) | ||
.includes('reload') | ||
) | ||
if (pageReloaded) { | ||
notifyPageReloaded() | ||
} | ||
}) | ||
|
||
chrome.runtime.onMessage.addListener( | ||
function (req, sender, sendResponse) { | ||
if (!req.getBreakagePageParams) return | ||
|
||
sendResponse({ | ||
jsPerformance, | ||
docReferrer: document.referrer, | ||
opener: !!window.opener | ||
}) | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters