Bug 144662

Summary: Web Inspector: SourceCodeTextEditor shows "undefined" instead of resource content when pausing during resource load
Product: WebKit Reporter: Joseph Pecoraro <joepeck>
Component: Web InspectorAssignee: Joseph Pecoraro <joepeck>
Status: RESOLVED FIXED    
Severity: Normal CC: burg, commit-queue, graouts, joepeck, jonowells, mattbaker, nvasilyev, timothy, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
[PATCH] Proposed Fix none

Description Joseph Pecoraro 2015-05-05 21:12:02 PDT
* SUMMARY
SourceCodeTextEditor shows "undefined" instead of resource content when pausing during resource load

* STEPS TO REPRODUCE
1. Inspect <http://bogojoker.com/shell/>
2. Set a breakpoint on easySlider.min.js:2
3. Reload the page
  => Script content loads, then goes undefined
Comment 1 Radar WebKit Bug Importer 2015-05-05 21:12:16 PDT
<rdar://problem/20831216>
Comment 2 Joseph Pecoraro 2015-05-05 21:14:43 PDT
There are a few issues at play here.

This is the "pause during load" scenario. The frontend doesn't yet have the Resource, but it has the Script.

1. The Frontend successfully loads the Script contents. But the Resource content load overwrites the editor with a fail message.

2. ResourceContentView.js does:
> resource.requestContent().then(this._contentAvailable.bind(this)).catch(this._contentError.bind(this));

  - The promise can succeed with an error in which case it calls _contentError with an object.
  - The promise can fail with an error in which case it calls _contentError with a string.

This inconsistency results in the "undefined" message instead of the expected "No data found for resource with given identifier" message here.
Comment 3 Joseph Pecoraro 2015-05-05 21:33:59 PDT
Created attachment 252445 [details]
[PATCH] Proposed Fix
Comment 4 WebKit Commit Bot 2015-05-06 00:08:16 PDT
Comment on attachment 252445 [details]
[PATCH] Proposed Fix

Clearing flags on attachment: 252445

Committed r183863: <http://trac.webkit.org/changeset/183863>
Comment 5 WebKit Commit Bot 2015-05-06 00:08:20 PDT
All reviewed patches have been landed.  Closing bug.