-
Notifications
You must be signed in to change notification settings - Fork 47k
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
[DevTools] Handle case when cached network requests have null content in response #22282
Conversation
Ooh good catch! |
Let's go ahead and merge this so main isn't broken. I was temporarily able to reproduce the problem but now I can't again, so my attempts at logging or exploring different fixes isn't working. Long term, I'd like to avoid us having to pre-cache anything. Maybe this means using Edit Mozilla says getHAR returns a promise: Chrome says it accepts a callback: Yuck :) |
Actually let's hold off landing this and compare it to an alternate approach using |
yeah, i noticed it’s the same difference between Chrome and Mozill for getContent() :( |
Oh shoot! That might be why my code wasn't working for Mozilla and I had to add the Maybe we can fix that 😁 |
Update, testing memory impact when attempting to load the content for requests eagerly:
|
abandoning in favor of #22285 |
Summary
In #22198 we added support for listening for network requests for JavaScript source files and caching those requests, using the
network.onRequestFinished
api, in order to speed up downloading source files when attempting to extract hook names for an inspected element.However, the cached requests might sometimes return null content for the network response (e.g. here), which we weren't handling correctly. When the content was null, we'd end up with a runtime error by trying to access a property on the null object.
This commit makes it so we never use response content that is null by making sure to fall back to fetching the file normally if we are unable to obtain non-null content for a cached request.
Test Plan