-
Notifications
You must be signed in to change notification settings - Fork 0
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
Added chrome.debugger to monitor network requests #44
Merged
juskek
merged 9 commits into
main
from
2023/07/18-Amount-of-data-transferred-in-DevTools-is-different-from-amount-recorded-by-extension
Jul 21, 2023
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
3df16da
Added chrome.debugger to monitor network requests
juskek eb579ae
refactor: Record bytes transferred using Network.loadingFinished event
juskek e9f6c69
refactor: record bytes using on a request by request basis (does not …
juskek a1da0aa
revert: use loadingFinished instead, removed unnecessary functions
juskek 7de7b2d
fix(chrome.debugger): Error: Debugger is not attached to the tab with…
juskek 315e91f
Removed chrome.webRequest permissions
juskek 75dc4e1
refactor:Added typing
juskek 2d42293
fix: stop throwing error "Debugger is not attached" when calculation …
juskek 69b6924
refactor: type cast error instead of conditional check
juskek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { IBytesRepository } from "../data/bytes/IBytesRepository"; | ||
|
||
export const addBytesTransferred = async (bytes: number) => { | ||
IBytesRepository.instance.addBytesTransferred(bytes); | ||
|
||
try { | ||
await chrome.runtime.sendMessage({ | ||
command: { | ||
bytesTransferredChanged: | ||
IBytesRepository.instance.getBytesTransferred(), | ||
}, | ||
}); | ||
} catch (e: unknown) { | ||
if ( | ||
(e as Error).message === | ||
"Could not establish connection. Receiving end does not exist." | ||
) { | ||
console.warn( | ||
`Error Caught: ${e}\nIf popup is open and this error is seen in the console, debugging is required.` | ||
); | ||
} else { | ||
throw e; | ||
} | ||
} | ||
}; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When is
e
not an Error?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is always going to be an error -
It's typed as unknown because I don't think typing in catch clauses are allowed yet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case, I'd probably remove the if condition and just type cast it as an Error