Bug 64581 - Web Inspector: ApplicationCache UI is confusing and incorrect.
Summary: Web Inspector: ApplicationCache UI is confusing and incorrect.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Vsevolod Vlasov
URL:
Keywords:
Depends on: 71850
Blocks:
  Show dependency treegraph
 
Reported: 2011-07-14 18:59 PDT by Michael Nordman
Modified: 2011-11-10 10:36 PST (History)
15 users (show)

See Also:


Attachments
Screenshot (78.13 KB, image/png)
2011-11-09 12:23 PST, Vsevolod Vlasov
no flags Details
Patch (52.86 KB, patch)
2011-11-09 12:36 PST, Vsevolod Vlasov
no flags Details | Formatted Diff | Diff
Patch (59.76 KB, patch)
2011-11-10 05:46 PST, Vsevolod Vlasov
pfeldman: review+
webkit.review.bot: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Nordman 2011-07-14 18:59:22 PDT
Click the "Resources" tab at the top.

The tree view along the left-hand-side has a top level node for Application Cache. When opened, it shows a child element for every domain in the frame hierarchy of the page subject to inspection. When clicking any of those elements, the right-hand-side shows you the details of the appcache associated with the topmost document in the frame hierarchy, or indicates there is no appcache if there is no association to one.

It doesn't make much sense to list domains in the frameset under the appcache node (I'm not sure what those node are trying to represent). And it's plainly incorrect to show info about the topmost document regardless of which node is selected.

The display of the details of an individual appcache (the right-hand-side) is reasonable, but the navigation elements on the left-hand-side to bring you to the details just don't make sense.
Comment 1 Michael Nordman 2011-10-21 13:23:33 PDT
Here's an idea about how to make more sense out of the left-hand-side.

Under the appcache node, show a child for each origin represented in page being inspected that contains appcaches. If an origin doesn't have any appcaches, don't put a node there. Then under each origin node, show a child for each manifest in that origin, and indicate visually those that are in-use by the page being inspected (dull vs bright tree node icon maybe).

Click on any manifest node see the entries for that manifest on the right-hand-side (the same display as we have now).
Comment 2 Vsevolod Vlasov 2011-11-03 07:12:41 PDT
I have started working on that.

My current approach is to extract ApplicationCacheModel that will store manifest urls related to current page. For each manifest url I will store a set of identifiers of the frames containing documents that are associated with it. The word associated should be read in the broader sense than the one used in specification though. We should show manifest URLs both for caches that are not yet loaded and for caches which failed to load for some reason because this information is valuable for developers.

Knowing all manifest urls we can now add list items for each of them in the ResourcesPanel's Application Cache node. I don't think that we need to group these manifests by origin, since the number of different manifests on one page/origin should not be big, should it?

Anyway, extracting ApplicationCacheModel and storing manifests is the main thing here, I think this is a good start to make application cache UI usable at all. We can discuss if we need to show other manifests from the page frames origins and the need for highlighting used manifests on UI later.
Comment 3 Michael Nordman 2011-11-03 17:16:17 PDT
That sounds like it'd be an improvement. The set of nodes on the right-hand-side will definitely not be too big (at most one node per frame in the page).

Do you plan on using the manifestUrl as the label for the nodes in the right-hand-side?

There is a detail that you should be aware of. Different frames broadly associated to the same manifest url, can be narrowly associated to different 'versions' of that manifest. The detailed list of entries and timeStamps/size values of the ApplicationCacheHost::CacheInfo structure will be different even though the manifestUrl is the same. The ApplicationCacheHost::fillResourceList() and applicationCacheInfo() method, reflect what the info of the specific version associated with that specific doc/worker context. 

With that in mind, if two frames in the same 'tab' are using the same manifest url, it might be best to go ahead and have the same 'url' listed multiple times in the list on the rhs. When clicked on, query the specific 'host' for the detailed listing and info to populate the lhs.
Comment 4 Vsevolod Vlasov 2011-11-09 12:23:29 PST
Created attachment 114340 [details]
Screenshot
Comment 5 Vsevolod Vlasov 2011-11-09 12:36:15 PST
Created attachment 114343 [details]
Patch
Comment 6 Vsevolod Vlasov 2011-11-09 12:39:34 PST
I have uploaded a patch and a screenshot.
This patch creates manifest url nodes under application cache node in resources panel. Under each manifest url all frames using the relevant application cache are listed.

Please note that application cache status icon, delete button etc. are still set to "display:none" in ApplicationCacheItemsView.js because they don't always work properly yet.
Comment 7 WebKit Review Bot 2011-11-09 12:40:32 PST
Attachment 114343 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/http..." exit_code: 1

Source/WebCore/inspector/InspectorApplicationCacheAgent.cpp:86:  The parameter type should use PassRefPtr instead of RefPtr.  [readability/pass_ptr] [5]
Source/WebCore/inspector/InspectorApplicationCacheAgent.cpp:128:  The parameter type should use PassRefPtr instead of RefPtr.  [readability/pass_ptr] [5]
Source/WebCore/inspector/InspectorApplicationCacheAgent.h:64:  The parameter type should use PassRefPtr instead of RefPtr.  [readability/pass_ptr] [5]
Source/WebCore/inspector/InspectorApplicationCacheAgent.h:66:  The parameter type should use PassRefPtr instead of RefPtr.  [readability/pass_ptr] [5]
Total errors found: 4 in 14 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 8 Michael Nordman 2011-11-09 12:51:51 PST
Comment on attachment 114343 [details]
Patch

drive-by comment... screenshot looks great and the 'agent' c++ code lgtm too

View in context: https://bugs.webkit.org/attachment.cgi?id=114343&action=review

> Source/WebCore/inspector/InspectorApplicationCacheAgent.cpp:125
> +    *manifestURL = info.m_manifest.string();

There's some overalap between getManifestForFrame() and getApplicationCacheForFrame(), maybe define a private helper method to do much of the overlapping parts (ApplicationCacheHost* getApplicationCacheHostFrame(errString, frameId)).
Comment 9 WebKit Review Bot 2011-11-09 13:33:41 PST
Comment on attachment 114343 [details]
Patch

Attachment 114343 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/10403049

New failing tests:
http/tests/inspector/resource-tree/appcache-iframe-manifests.html
Comment 10 Pavel Feldman 2011-11-10 00:35:56 PST
Comment on attachment 114343 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=114343&action=review

A bunch of nits.

> Source/WebCore/inspector/InspectorApplicationCacheAgent.cpp:76
> +    m_frontend->updateApplicationCacheStatus(m_pageAgent->frameId(frame), manifestURL, status);

"applicationCacheStatusUpdated"

> Source/WebCore/inspector/InspectorApplicationCacheAgent.cpp:130
> +    Frame* frame = m_pageAgent->frameForId(frameId);

As Michael suggests, you should introduce:

DocumentLoader* documentLoader = assertFrameWithDocumentLoader(frameId);
if (!documentLoader)
    return;

As in DOM agent.

> Source/WebCore/inspector/front-end/ApplicationCacheModel.js:58
> +        var frameId = event.data.frame.id;

Please use following notation for compilation:

var frame = /** @type {<frame type here>} */ event.data["frame"];

i.e. you should do event.data[] instead of event.data.

> Source/WebCore/inspector/front-end/ApplicationCacheModel.js:70
> +        this._reset();

It took me few seconds to figure out that this._statuses is initialized from constructor. Avoid this indirection and declare variables in the constructor explicitly.

> Source/WebCore/inspector/front-end/ApplicationCacheModel.js:88
> +            console.error(error);

return; ?

> Source/WebCore/inspector/front-end/ApplicationCacheModel.js:96
> +        if (error)

ditto

> Source/WebCore/inspector/front-end/ApplicationCacheModel.js:100
> +            this._frameManifestUpdated(framesWithManifests[i].frameId, framesWithManifests[i].manifestURL, framesWithManifests[i].status);

I would pass framesWithManifests[i] here...

> Source/WebCore/inspector/front-end/ApplicationCacheModel.js:104
> +     * @param {string} frameId

... and declare parameter type as {ApplicationCacheAgent.FramesWithManifest}. It has been generated for you.
Comment 11 Vsevolod Vlasov 2011-11-10 05:45:05 PST
All done except for this one.

> > Source/WebCore/inspector/front-end/ApplicationCacheModel.js:100
> > +            this._frameManifestUpdated(framesWithManifests[i].frameId, framesWithManifests[i].manifestURL, framesWithManifests[i].status);
> 
> I would pass framesWithManifests[i] here...
> 
> > Source/WebCore/inspector/front-end/ApplicationCacheModel.js:104
> > +     * @param {string} frameId
> 
> ... and declare parameter type as {ApplicationCacheAgent.FramesWithManifest}. It has been generated for you.
This method is also called from applicationCacheStatusUpdated. I added @param {Array.<ApplicationCacheAgent.FrameWithManifest>} to _framesWithManifestsLoaded() though.
Comment 12 Vsevolod Vlasov 2011-11-10 05:46:03 PST
Created attachment 114479 [details]
Patch
Comment 13 WebKit Review Bot 2011-11-10 05:47:57 PST
Attachment 114479 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/http..." exit_code: 1

Source/WebCore/inspector/InspectorApplicationCacheAgent.cpp:89:  The parameter type should use PassRefPtr instead of RefPtr.  [readability/pass_ptr] [5]
Source/WebCore/inspector/InspectorApplicationCacheAgent.cpp:131:  The parameter type should use PassRefPtr instead of RefPtr.  [readability/pass_ptr] [5]
Source/WebCore/inspector/InspectorApplicationCacheAgent.h:66:  The parameter type should use PassRefPtr instead of RefPtr.  [readability/pass_ptr] [5]
Source/WebCore/inspector/InspectorApplicationCacheAgent.h:68:  The parameter type should use PassRefPtr instead of RefPtr.  [readability/pass_ptr] [5]
Total errors found: 4 in 19 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 14 WebKit Review Bot 2011-11-10 06:05:00 PST
Comment on attachment 114479 [details]
Patch

Attachment 114479 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/10394324
Comment 15 Vsevolod Vlasov 2011-11-10 10:36:30 PST
Committed r99878: <http://trac.webkit.org/changeset/99878>