DevTools: Network - Request response doesn't render contents with no mimeType

If a network request is blocked or cancelled, the mimeType field remains
'undefined' because the 'responseReceived' event is never raised. If a
user then clicks on this blocked/cancelled network request in the network
tool, any attempt to view the Response will result in a white window,
instead of 'Failed to load response data'.  This occurs because the
RequestResponseView assumes that a mimeType is present, and consequently
throws a JS exception:

  Cannot read property 'startsWith' of undefined
  shell.js:720:43           Function.fromMimeType
  network_module.js:785:114 Function._hasTextContent
  network_module.js:792:97  Function.sourceViewForRequest
  network_module.js:798:91  async Network.RequestResponseView.createPreview
  network_module.js:797:40  async Network.RequestResponseView.showPreview

The fix here is to update _hasTextContent, so that the call into
fromMimeType always has a valid string. I've also updated the JSDoc
comment to indicate that a string is required and not nullable.

Change-Id: Ib6e89ef6f7cc45387cb25a7c10e01432f8855199
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1533052
Auto-Submit: Mike Jackson <mjackson@microsoft.com>
Reviewed-by: Joel Einbinder <einbinder@chromium.org>
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Commit-Queue: Mike Jackson <mjackson@microsoft.com>
Commit-Queue: Dmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#642980}
4 files changed