Changeset 99878 in webkit


Ignore:
Timestamp:
Nov 10, 2011 10:36:12 AM (12 years ago)
Author:
vsevik@chromium.org
Message:

Web Inspector: ApplicationCache UI is confusing and incorrect.
https://bugs.webkit.org/show_bug.cgi?id=64581

Reviewed by Pavel Feldman.

Source/WebCore:

Fixed resources panel application cache UI.
Manifest urls are now shown under application cache tree element.
Under each manifest url tree element frames using relevant application
cache are listed. Application cache detailed views could be opened for each
frame.

Test: http/tests/inspector/resource-tree/appcache-iframe-manifests.html

  • English.lproj/localizedStrings.js:
  • inspector/Inspector.json:
  • inspector/InspectorApplicationCacheAgent.cpp:

(WebCore::InspectorApplicationCacheAgent::InspectorApplicationCacheAgent):
(WebCore::InspectorApplicationCacheAgent::setFrontend):
(WebCore::InspectorApplicationCacheAgent::updateApplicationCacheStatus):
(WebCore::InspectorApplicationCacheAgent::networkStateChanged):
(WebCore::InspectorApplicationCacheAgent::enable):
(WebCore::InspectorApplicationCacheAgent::getFramesWithManifests):
(WebCore::InspectorApplicationCacheAgent::assertFrameWithDocumentLoader):
(WebCore::InspectorApplicationCacheAgent::getManifestForFrame):
(WebCore::InspectorApplicationCacheAgent::getApplicationCacheForFrame):
(WebCore::InspectorApplicationCacheAgent::buildObjectForApplicationCache):
(WebCore::InspectorApplicationCacheAgent::buildObjectForApplicationCacheResource):

  • inspector/InspectorApplicationCacheAgent.h:
  • inspector/InspectorController.cpp:

(WebCore::InspectorController::InspectorController):

  • inspector/InspectorPageAgent.cpp:

(WebCore::InspectorPageAgent::resourceContent):
(WebCore::InspectorPageAgent::getResourceContent):
(WebCore::InspectorPageAgent::assertFrame):
(WebCore::InspectorPageAgent::assertDocumentLoader):

  • inspector/InspectorPageAgent.h:
  • inspector/InspectorStyleSheet.cpp:

(WebCore::InspectorStyleSheet::resourceStyleSheetText):

  • inspector/front-end/ApplicationCacheItemsView.js:

(WebInspector.ApplicationCacheItemsView):
(WebInspector.ApplicationCacheItemsView.prototype._update):
(WebInspector.ApplicationCacheItemsView.prototype._updateCallback):
(WebInspector.ApplicationCacheItemsView.prototype._populateDataGrid):

  • inspector/front-end/ApplicationCacheModel.js:

(WebInspector.ApplicationCacheModel):
(WebInspector.ApplicationCacheModel.prototype._frameNavigated):
(WebInspector.ApplicationCacheModel.prototype._frameDetached):
(WebInspector.ApplicationCacheModel.prototype._mainFrameNavigated):
(WebInspector.ApplicationCacheModel.prototype._manifestForFrameLoaded):
(WebInspector.ApplicationCacheModel.prototype._framesWithManifestsLoaded):
(WebInspector.ApplicationCacheModel.prototype._frameManifestUpdated):
(WebInspector.ApplicationCacheModel.prototype._frameManifestRemoved):
(WebInspector.ApplicationCacheModel.prototype.frameManifestURL):
(WebInspector.ApplicationCacheModel.prototype.frameManifestStatus):
(WebInspector.ApplicationCacheModel.prototype._statusUpdated):
(WebInspector.ApplicationCacheModel.prototype.requestApplicationCache):
(WebInspector.ApplicationCacheModel.prototype._networkStateUpdated):
(WebInspector.ApplicationCacheDispatcher.prototype.applicationCacheStatusUpdated):
(WebInspector.ApplicationCacheDispatcher.prototype.networkStateUpdated):

  • inspector/front-end/ResourceTreeModel.js:

(WebInspector.ResourceTreeModel.prototype.frameForId):

  • inspector/front-end/ResourcesPanel.js:

(WebInspector.ResourcesPanel.prototype.wasShown):
(WebInspector.ResourcesPanel.prototype.reset):
(WebInspector.ResourcesPanel.prototype._frameNavigated):
(WebInspector.ResourcesPanel.prototype.addDocumentURL):
(WebInspector.ResourcesPanel.prototype.showApplicationCache):
(WebInspector.ResourcesPanel.prototype._populateApplicationCacheTree):
(WebInspector.ResourcesPanel.prototype._applicationCacheFrameManifestAdded):
(WebInspector.ResourcesPanel.prototype._applicationCacheFrameManifestRemoved):
(WebInspector.ResourcesPanel.prototype._applicationCacheFrameManifestStatusChanged):
(WebInspector.ResourcesPanel.prototype._applicationCacheNetworkStateChanged):
(WebInspector.ApplicationCacheManifestTreeElement):
(WebInspector.ApplicationCacheManifestTreeElement.prototype.get itemURL):
(WebInspector.ApplicationCacheManifestTreeElement.prototype.get manifestURL):
(WebInspector.ApplicationCacheManifestTreeElement.prototype.onselect):
(WebInspector.ApplicationCacheFrameTreeElement):
(WebInspector.ApplicationCacheFrameTreeElement.prototype.get itemURL):
(WebInspector.ApplicationCacheFrameTreeElement.prototype.get frameId):
(WebInspector.ApplicationCacheFrameTreeElement.prototype.get manifestURL):
(WebInspector.ApplicationCacheFrameTreeElement.prototype._refreshTitles):
(WebInspector.ApplicationCacheFrameTreeElement.prototype.frameNavigated):
(WebInspector.ApplicationCacheFrameTreeElement.prototype.onselect):

LayoutTests:

  • http/tests/inspector/resource-tree/appcache-iframe-manifests-expected.txt: Added.
  • http/tests/inspector/resource-tree/appcache-iframe-manifests.html: Added.
  • http/tests/inspector/resource-tree/resources/manifest.php: Added.
  • http/tests/inspector/resource-tree/resources/page-with-manifest.php: Added.
Location:
trunk
Files:
4 added
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r99877 r99878  
     12011-11-10  Vsevolod Vlasov  <vsevik@chromium.org>
     2
     3        Web Inspector: ApplicationCache UI is confusing and incorrect.
     4        https://bugs.webkit.org/show_bug.cgi?id=64581
     5
     6        Reviewed by Pavel Feldman.
     7
     8        * http/tests/inspector/resource-tree/appcache-iframe-manifests-expected.txt: Added.
     9        * http/tests/inspector/resource-tree/appcache-iframe-manifests.html: Added.
     10        * http/tests/inspector/resource-tree/resources/manifest.php: Added.
     11        * http/tests/inspector/resource-tree/resources/page-with-manifest.php: Added.
     12
    1132011-11-10  Tony Gentilcore  <tonyg@chromium.org>
    214
  • trunk/Source/WebCore/ChangeLog

    r99873 r99878  
     12011-11-10  Vsevolod Vlasov  <vsevik@chromium.org>
     2
     3        Web Inspector: ApplicationCache UI is confusing and incorrect.
     4        https://bugs.webkit.org/show_bug.cgi?id=64581
     5
     6        Reviewed by Pavel Feldman.
     7
     8        Fixed resources panel application cache UI.
     9        Manifest urls are now shown under application cache tree element.
     10        Under each manifest url tree element frames using relevant application
     11        cache are listed. Application cache detailed views could be opened for each
     12        frame.
     13
     14        Test: http/tests/inspector/resource-tree/appcache-iframe-manifests.html
     15
     16        * English.lproj/localizedStrings.js:
     17        * inspector/Inspector.json:
     18        * inspector/InspectorApplicationCacheAgent.cpp:
     19        (WebCore::InspectorApplicationCacheAgent::InspectorApplicationCacheAgent):
     20        (WebCore::InspectorApplicationCacheAgent::setFrontend):
     21        (WebCore::InspectorApplicationCacheAgent::updateApplicationCacheStatus):
     22        (WebCore::InspectorApplicationCacheAgent::networkStateChanged):
     23        (WebCore::InspectorApplicationCacheAgent::enable):
     24        (WebCore::InspectorApplicationCacheAgent::getFramesWithManifests):
     25        (WebCore::InspectorApplicationCacheAgent::assertFrameWithDocumentLoader):
     26        (WebCore::InspectorApplicationCacheAgent::getManifestForFrame):
     27        (WebCore::InspectorApplicationCacheAgent::getApplicationCacheForFrame):
     28        (WebCore::InspectorApplicationCacheAgent::buildObjectForApplicationCache):
     29        (WebCore::InspectorApplicationCacheAgent::buildObjectForApplicationCacheResource):
     30        * inspector/InspectorApplicationCacheAgent.h:
     31        * inspector/InspectorController.cpp:
     32        (WebCore::InspectorController::InspectorController):
     33        * inspector/InspectorPageAgent.cpp:
     34        (WebCore::InspectorPageAgent::resourceContent):
     35        (WebCore::InspectorPageAgent::getResourceContent):
     36        (WebCore::InspectorPageAgent::assertFrame):
     37        (WebCore::InspectorPageAgent::assertDocumentLoader):
     38        * inspector/InspectorPageAgent.h:
     39        * inspector/InspectorStyleSheet.cpp:
     40        (WebCore::InspectorStyleSheet::resourceStyleSheetText):
     41        * inspector/front-end/ApplicationCacheItemsView.js:
     42        (WebInspector.ApplicationCacheItemsView):
     43        (WebInspector.ApplicationCacheItemsView.prototype._update):
     44        (WebInspector.ApplicationCacheItemsView.prototype._updateCallback):
     45        (WebInspector.ApplicationCacheItemsView.prototype._populateDataGrid):
     46        * inspector/front-end/ApplicationCacheModel.js:
     47        (WebInspector.ApplicationCacheModel):
     48        (WebInspector.ApplicationCacheModel.prototype._frameNavigated):
     49        (WebInspector.ApplicationCacheModel.prototype._frameDetached):
     50        (WebInspector.ApplicationCacheModel.prototype._mainFrameNavigated):
     51        (WebInspector.ApplicationCacheModel.prototype._manifestForFrameLoaded):
     52        (WebInspector.ApplicationCacheModel.prototype._framesWithManifestsLoaded):
     53        (WebInspector.ApplicationCacheModel.prototype._frameManifestUpdated):
     54        (WebInspector.ApplicationCacheModel.prototype._frameManifestRemoved):
     55        (WebInspector.ApplicationCacheModel.prototype.frameManifestURL):
     56        (WebInspector.ApplicationCacheModel.prototype.frameManifestStatus):
     57        (WebInspector.ApplicationCacheModel.prototype._statusUpdated):
     58        (WebInspector.ApplicationCacheModel.prototype.requestApplicationCache):
     59        (WebInspector.ApplicationCacheModel.prototype._networkStateUpdated):
     60        (WebInspector.ApplicationCacheDispatcher.prototype.applicationCacheStatusUpdated):
     61        (WebInspector.ApplicationCacheDispatcher.prototype.networkStateUpdated):
     62        * inspector/front-end/ResourceTreeModel.js:
     63        (WebInspector.ResourceTreeModel.prototype.frameForId):
     64        * inspector/front-end/ResourcesPanel.js:
     65        (WebInspector.ResourcesPanel.prototype.wasShown):
     66        (WebInspector.ResourcesPanel.prototype.reset):
     67        (WebInspector.ResourcesPanel.prototype._frameNavigated):
     68        (WebInspector.ResourcesPanel.prototype.addDocumentURL):
     69        (WebInspector.ResourcesPanel.prototype.showApplicationCache):
     70        (WebInspector.ResourcesPanel.prototype._populateApplicationCacheTree):
     71        (WebInspector.ResourcesPanel.prototype._applicationCacheFrameManifestAdded):
     72        (WebInspector.ResourcesPanel.prototype._applicationCacheFrameManifestRemoved):
     73        (WebInspector.ResourcesPanel.prototype._applicationCacheFrameManifestStatusChanged):
     74        (WebInspector.ResourcesPanel.prototype._applicationCacheNetworkStateChanged):
     75        (WebInspector.ApplicationCacheManifestTreeElement):
     76        (WebInspector.ApplicationCacheManifestTreeElement.prototype.get itemURL):
     77        (WebInspector.ApplicationCacheManifestTreeElement.prototype.get manifestURL):
     78        (WebInspector.ApplicationCacheManifestTreeElement.prototype.onselect):
     79        (WebInspector.ApplicationCacheFrameTreeElement):
     80        (WebInspector.ApplicationCacheFrameTreeElement.prototype.get itemURL):
     81        (WebInspector.ApplicationCacheFrameTreeElement.prototype.get frameId):
     82        (WebInspector.ApplicationCacheFrameTreeElement.prototype.get manifestURL):
     83        (WebInspector.ApplicationCacheFrameTreeElement.prototype._refreshTitles):
     84        (WebInspector.ApplicationCacheFrameTreeElement.prototype.frameNavigated):
     85        (WebInspector.ApplicationCacheFrameTreeElement.prototype.onselect):
     86
    1872011-11-10  Andreas Kling  <kling@webkit.org>
    288
  • trunk/Source/WebCore/inspector/Inspector.json

    r99849 r99878  
    926926        "types": [
    927927            {
    928                 "id": "AppCache",
    929                 "type": "object",
    930                 "description": "AppCache."
     928                "id": "ApplicationCacheResource",
     929                "type": "object",
     930                "description": "Detailed application cache resource information.",
     931                "properties": [
     932                    { "name": "url", "type": "string", "description": "Resource url." },
     933                    { "name": "size", "type": "string", "description": "Resource size." },
     934                    { "name": "type", "type": "string", "description": "Resource type." }
     935                ]
     936            },
     937            {
     938                "id": "ApplicationCache",
     939                "type": "object",
     940                "description": "Detailed application cache information.",
     941                "properties": [
     942                    { "name": "manifestURL", "type": "string", "description": "Manifest URL." },
     943                    { "name": "size", "type": "number", "description": "Application cache size." },
     944                    { "name": "creationTime", "type": "number", "description": "Application cache creation time." },
     945                    { "name": "updateTime", "type": "number", "description": "Application cache update time." },
     946                    { "name": "resources", "type": "array", "items": { "$ref": "ApplicationCacheResource" }, "description": "Application cache resources." }
     947                ]
     948            },
     949            {
     950                "id": "FrameWithManifest",
     951                "type": "object",
     952                "description": "Frame identifier - manifest URL pair.",
     953                "properties": [
     954                    { "name": "frameId", "type": "string", "description": "Frame identifier." },
     955                    { "name": "manifestURL", "type": "string", "description": "Manifest URL." },
     956                    { "name": "status", "type": "integer", "description": "Application cache status." }
     957                ]
    931958            }
    932959        ],
    933960        "commands": [
    934961            {
    935                 "name": "getApplicationCaches",
    936                 "returns": [
    937                     { "name": "applicationCaches", "$ref": "AppCache" }
    938                 ]
     962                "name": "getFramesWithManifests",
     963                "returns": [
     964                    { "name": "frameIds", "type": "array", "items": { "$ref": "FrameWithManifest" }, "description": "Array of frame identifiers with manifest urls for each frame containing a document associated with some application cache." }
     965                ],
     966                "description": "Returns array of frame identifiers with manifest urls for each frame containing a document associated with some application cache."
     967            },
     968            {
     969                "name": "enable",
     970                "description": "Enables application cache domain notifications."
     971            },
     972            {
     973                "name": "getManifestForFrame",
     974                "parameters": [
     975                    { "name": "frameId", "type": "string", "description": "Identifier of the frame containing document whose manifest is retrieved." }
     976                ],
     977                "returns": [
     978                    { "name": "manifestURL", "type": "string", "description": "Manifest URL for document in the given frame." }
     979                ],
     980                "description": "Returns manifest URL for document in the given frame."
     981            },
     982            {
     983                "name": "getApplicationCacheForFrame",
     984                "parameters": [
     985                    { "name": "frameId", "type": "string", "description": "Identifier of the frame containing document whose application cache is retrieved." }
     986                ],
     987                "returns": [
     988                    { "name": "applicationCache", "$ref": "ApplicationCache", "description": "Relevant application cache data for the document in given frame." }
     989                ],
     990                "description": "Returns relevant application cache data for the document in given frame."
    939991            }
    940992        ],
    941993        "events": [
    942994            {
    943                 "name": "updateApplicationCacheStatus",
    944                 "parameters": [
    945                     { "name": "status", "type": "integer" }
    946                 ]
    947             },
    948             {
    949                 "name": "updateNetworkState",
     995                "name": "applicationCacheStatusUpdated",
     996                "parameters": [
     997                    { "name": "frameId", "type": "string", "description": "Identifier of the frame containing document whose application cache updated status." },
     998                    { "name": "manifestURL", "type": "string", "description": "Manifest URL." },
     999                    { "name": "status", "type": "integer", "description": "Updated application cache status." }
     1000                ]
     1001            },
     1002            {
     1003                "name": "networkStateUpdated",
    9501004                "parameters": [
    9511005                    { "name": "isNowOnline", "type": "boolean" }
  • trunk/Source/WebCore/inspector/InspectorApplicationCacheAgent.cpp

    r95919 r99878  
    3535#include "InspectorAgent.h"
    3636#include "InspectorFrontend.h"
     37#include "InspectorPageAgent.h"
    3738#include "InspectorValues.h"
    3839#include "InstrumentingAgents.h"
     
    4344namespace WebCore {
    4445
    45 InspectorApplicationCacheAgent::InspectorApplicationCacheAgent(InstrumentingAgents* instrumentingAgents, Page* inspectedPage)
     46InspectorApplicationCacheAgent::InspectorApplicationCacheAgent(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent)
    4647    : m_instrumentingAgents(instrumentingAgents)
    47     , m_inspectedPage(inspectedPage)
     48    , m_pageAgent(pageAgent)
    4849    , m_frontend(0)
    4950{
     
    5354{
    5455    m_frontend = frontend->applicationcache();
    55     m_instrumentingAgents->setInspectorApplicationCacheAgent(this);
    5656}
    5757
     
    6464void InspectorApplicationCacheAgent::updateApplicationCacheStatus(Frame* frame)
    6565{
    66     ApplicationCacheHost::Status status = frame->loader()->documentLoader()->applicationCacheHost()->status();
    67     m_frontend->updateApplicationCacheStatus(status);
     66    DocumentLoader* documentLoader = frame->loader()->documentLoader();
     67    if (!documentLoader)
     68        return;
     69
     70    ApplicationCacheHost* host = documentLoader->applicationCacheHost();
     71    ApplicationCacheHost::Status status = host->status();
     72    ApplicationCacheHost::CacheInfo info = host->applicationCacheInfo();
     73
     74    String manifestURL = info.m_manifest.string();
     75    m_frontend->applicationCacheStatusUpdated(m_pageAgent->frameId(frame), manifestURL, status);
    6876}
    6977
     
    7179{
    7280    bool isNowOnline = networkStateNotifier().onLine();
    73     m_frontend->updateNetworkState(isNowOnline);
     81    m_frontend->networkStateUpdated(isNowOnline);
    7482}
    7583
    76 void InspectorApplicationCacheAgent::getApplicationCaches(ErrorString*, RefPtr<InspectorObject>* applicationCaches)
     84void InspectorApplicationCacheAgent::enable(ErrorString*)
    7785{
    78     DocumentLoader* documentLoader = m_inspectedPage->mainFrame()->loader()->documentLoader();
     86    m_instrumentingAgents->setInspectorApplicationCacheAgent(this);
     87}
     88
     89void InspectorApplicationCacheAgent::getFramesWithManifests(ErrorString*, RefPtr<InspectorArray>* result)
     90{
     91    *result = InspectorArray::create();
     92
     93    Frame* mainFrame = m_pageAgent->mainFrame();
     94    for (Frame* frame = mainFrame; frame; frame = frame->tree()->traverseNext(mainFrame)) {
     95        DocumentLoader* documentLoader = frame->loader()->documentLoader();
     96        if (!documentLoader)
     97            continue;
     98
     99        ApplicationCacheHost* host = documentLoader->applicationCacheHost();
     100        ApplicationCacheHost::CacheInfo info = host->applicationCacheInfo();
     101        String manifestURL = info.m_manifest.string();
     102        if (!manifestURL.isEmpty()) {
     103            RefPtr<InspectorObject> value = InspectorObject::create();
     104            value->setString("frameId", m_pageAgent->frameId(frame));
     105            value->setString("manifestURL", manifestURL);
     106            value->setNumber("status", host->status());
     107            (*result)->pushObject(value);
     108        }
     109    }
     110}
     111
     112DocumentLoader* InspectorApplicationCacheAgent::assertFrameWithDocumentLoader(ErrorString* errorString, String frameId)
     113{
     114    Frame* frame = m_pageAgent->assertFrame(errorString, frameId);
     115    if (!frame)
     116        return 0;
     117
     118    return InspectorPageAgent::assertDocumentLoader(errorString, frame);
     119}
     120
     121void InspectorApplicationCacheAgent::getManifestForFrame(ErrorString* errorString, const String& frameId, String* manifestURL)
     122{
     123    DocumentLoader* documentLoader = assertFrameWithDocumentLoader(errorString, frameId);
    79124    if (!documentLoader)
    80125        return;
     126
     127    ApplicationCacheHost::CacheInfo info = documentLoader->applicationCacheHost()->applicationCacheInfo();
     128    *manifestURL = info.m_manifest.string();
     129}
     130
     131void InspectorApplicationCacheAgent::getApplicationCacheForFrame(ErrorString* errorString, const String& frameId, RefPtr<InspectorObject>* applicationCache)
     132{
     133    DocumentLoader* documentLoader = assertFrameWithDocumentLoader(errorString, frameId);
     134    if (!documentLoader)
     135        return;
     136
    81137    ApplicationCacheHost* host = documentLoader->applicationCacheHost();
    82138    ApplicationCacheHost::CacheInfo info = host->applicationCacheInfo();
     
    84140    ApplicationCacheHost::ResourceInfoList resources;
    85141    host->fillResourceList(&resources);
    86     *applicationCaches = buildObjectForApplicationCache(resources, info);
     142
     143    *applicationCache = buildObjectForApplicationCache(resources, info);
    87144}
    88145
     
    91148    RefPtr<InspectorObject> value = InspectorObject::create();
    92149    value->setNumber("size", applicationCacheInfo.m_size);
    93     value->setString("manifest", applicationCacheInfo.m_manifest.string());
    94     value->setString("lastPathComponent", applicationCacheInfo.m_manifest.lastPathComponent());
     150    value->setString("manifestURL", applicationCacheInfo.m_manifest.string());
    95151    value->setNumber("creationTime", applicationCacheInfo.m_creationTime);
    96152    value->setNumber("updateTime", applicationCacheInfo.m_updateTime);
     
    114170{
    115171    RefPtr<InspectorObject> value = InspectorObject::create();
    116     value->setString("name", resourceInfo.m_resource.string());
     172    value->setString("url", resourceInfo.m_resource.string());
    117173    value->setNumber("size", resourceInfo.m_size);
    118174
  • trunk/Source/WebCore/inspector/InspectorApplicationCacheAgent.h

    r95919 r99878  
    4040class InspectorFrontend;
    4141class InspectorObject;
     42class InspectorPageAgent;
    4243class InspectorValue;
    4344class InstrumentingAgents;
     
    5051    WTF_MAKE_NONCOPYABLE(InspectorApplicationCacheAgent); WTF_MAKE_FAST_ALLOCATED;
    5152public:
    52     InspectorApplicationCacheAgent(InstrumentingAgents*, Page*);
     53    InspectorApplicationCacheAgent(InstrumentingAgents*, InspectorPageAgent*);
    5354    ~InspectorApplicationCacheAgent() { }
    5455
     56    // Inspector Controller API
    5557    void setFrontend(InspectorFrontend*);
    5658    void clearFrontend();
    5759
    58     // Backend to Frontend
     60    // InspectorInstrumentation API
    5961    void updateApplicationCacheStatus(Frame*);
    6062    void networkStateChanged();
    6163
    62     // From Frontend
    63     void getApplicationCaches(ErrorString*, RefPtr<InspectorObject>* applicationCaches);
     64    // ApplicationCache API for InspectorFrontend
     65    void enable(ErrorString*);
     66    void getFramesWithManifests(ErrorString*, RefPtr<InspectorArray>* result);
     67    void getManifestForFrame(ErrorString*, const String& frameId, String* manifestURL);
     68    void getApplicationCacheForFrame(ErrorString*, const String& frameId, RefPtr<InspectorObject>* applicationCache);
    6469
    6570private:
     
    6873    PassRefPtr<InspectorObject> buildObjectForApplicationCacheResource(const ApplicationCacheHost::ResourceInfo&);
    6974
     75    DocumentLoader* assertFrameWithDocumentLoader(ErrorString*, String frameId);
     76
    7077    InstrumentingAgents* m_instrumentingAgents;
    71     Page* m_inspectedPage;
     78    InspectorPageAgent* m_pageAgent;
    7279    InspectorFrontend::ApplicationCache* m_frontend;
    7380};
  • trunk/Source/WebCore/inspector/InspectorController.cpp

    r97611 r99878  
    107107    , m_domStorageAgent(InspectorDOMStorageAgent::create(m_instrumentingAgents.get(), m_state.get()))
    108108    , m_timelineAgent(InspectorTimelineAgent::create(m_instrumentingAgents.get(), m_state.get()))
    109     , m_applicationCacheAgent(adoptPtr(new InspectorApplicationCacheAgent(m_instrumentingAgents.get(), page)))
     109    , m_applicationCacheAgent(adoptPtr(new InspectorApplicationCacheAgent(m_instrumentingAgents.get(), m_pageAgent.get())))
    110110    , m_resourceAgent(InspectorResourceAgent::create(m_instrumentingAgents.get(), m_pageAgent.get(), inspectorClient, m_state.get()))
    111111    , m_runtimeAgent(adoptPtr(new PageRuntimeAgent(m_instrumentingAgents.get(), m_injectedScriptManager.get(), page, m_pageAgent.get())))
  • trunk/Source/WebCore/inspector/InspectorPageAgent.cpp

    r98328 r99878  
    187187void InspectorPageAgent::resourceContent(ErrorString* errorString, Frame* frame, const KURL& url, String* result, bool* base64Encoded)
    188188{
    189     if (!frame) {
    190         *errorString = "No frame to get resource content for";
     189    DocumentLoader* loader = assertDocumentLoader(errorString, frame);
     190    if (!loader)
    191191        return;
    192     }
    193 
    194     FrameLoader* frameLoader = frame->loader();
    195     DocumentLoader* loader = frameLoader->documentLoader();
    196 
    197     if (!loader) {
    198         *errorString = "No documentLoader for frame to get resource content for";
    199         return;
    200     }
    201192
    202193    RefPtr<SharedBuffer> buffer;
     
    482473void InspectorPageAgent::getResourceContent(ErrorString* errorString, const String& frameId, const String& url, String* content, bool* base64Encoded)
    483474{
    484     Frame* frame = frameForId(frameId);
    485     if (!frame) {
    486         *errorString = "No frame for given id found";
     475    Frame* frame = assertFrame(errorString, frameId);
     476    if (!frame)
    487477        return;
    488     }
     478
    489479    resourceContent(errorString, frame, KURL(ParsedURLString, url), content, base64Encoded);
    490480}
     
    662652}
    663653
     654Frame* InspectorPageAgent::assertFrame(ErrorString* errorString, String frameId)
     655{
     656    Frame* frame = frameForId(frameId);
     657    if (!frame)
     658        *errorString = "No frame for given id found";
     659
     660    return frame;
     661}
     662
     663// static
     664DocumentLoader* InspectorPageAgent::assertDocumentLoader(ErrorString* errorString, Frame* frame)
     665{
     666    FrameLoader* frameLoader = frame->loader();
     667    DocumentLoader* documentLoader = frameLoader ? frameLoader->documentLoader() : 0;
     668    if (!documentLoader)
     669        *errorString = "No documentLoader for given frame found";
     670
     671    return documentLoader;
     672}
     673
    664674void InspectorPageAgent::loaderDetachedFromFrame(DocumentLoader* loader)
    665675{
  • trunk/Source/WebCore/inspector/InspectorPageAgent.h

    r98328 r99878  
    119119    String frameId(Frame*);
    120120    String loaderId(DocumentLoader*);
     121    Frame* assertFrame(ErrorString*, String frameId);
     122    static DocumentLoader* assertDocumentLoader(ErrorString*, Frame*);
    121123
    122124private:
  • trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp

    r99849 r99878  
    10851085        return false;
    10861086
    1087     if (!m_pageStyleSheet || !ownerDocument())
     1087    if (!m_pageStyleSheet || !ownerDocument() || !ownerDocument()->frame())
    10881088        return false;
    10891089
  • trunk/Source/WebCore/inspector/front-end/ApplicationCacheItemsView.js

    r99689 r99878  
    2828 * @extends {WebInspector.View}
    2929 */
    30 WebInspector.ApplicationCacheItemsView = function(model, treeElement, appcacheDomain)
     30WebInspector.ApplicationCacheItemsView = function(model, frameId, status)
    3131{
    3232    WebInspector.View.call(this);
     
    6565    this.statusMessage.textContent = "";
    6666
    67     this._treeElement = treeElement;
    68     this._appcacheDomain = appcacheDomain;
     67    this._frameId = frameId;
    6968
    7069    this._emptyView = new WebInspector.EmptyView(WebInspector.UIString("No Application Cache information available."));
    7170    this._emptyView.show(this.element);
    7271
    73     this.updateStatus(applicationCache.UNCACHED);
     72    this.updateStatus(status);
    7473
    7574    // FIXME: Status bar items don't work well enough yet, so they are being hidden.
     
    117116    },
    118117
     118    /**
     119     * @param {number} status
     120     */
    119121    updateStatus: function(status)
    120122    {
     
    137139    },
    138140
     141    /**
     142     * @param {boolean} isNowOnline
     143     */
    139144    updateNetworkState: function(isNowOnline)
    140145    {
     
    152157    _update: function()
    153158    {
    154         this._model.getApplicationCachesAsync(this._updateCallback.bind(this));
    155     },
    156 
    157     _updateCallback: function(applicationCaches)
    158     {
    159         // FIXME: applicationCaches is just one cache.
    160         // FIXME: are these variables needed anywhere else?
    161         this._manifest = applicationCaches.manifest;
    162         this._creationTime = applicationCaches.creationTime;
    163         this._updateTime = applicationCaches.updateTime;
    164         this._size = applicationCaches.size;
    165         this._resources = applicationCaches.resources;
    166         var lastPathComponent = applicationCaches.lastPathComponent;
    167 
    168         if (!this._manifest) {
     159        this._model.requestApplicationCache(this._frameId, this._updateCallback.bind(this));
     160    },
     161
     162    /**
     163     * @param {Object} applicationCache
     164     */
     165    _updateCallback: function(applicationCache)
     166    {
     167        if (!applicationCache || !applicationCache.manifestURL) {
    169168            this._emptyView.show(this.element);
    170169            this.deleteButton.visible = false;
     
    174173        }
    175174
     175        // FIXME: applicationCaches is just one cache.
     176        // FIXME: are these variables needed anywhere else?
     177        this._manifest = applicationCache.manifestURL;
     178        this._creationTime = applicationCache.creationTime;
     179        this._updateTime = applicationCache.updateTime;
     180        this._size = applicationCache.size;
     181        this._resources = applicationCache.resources;
     182        var lastPathComponent = applicationCache.lastPathComponent;
     183
    176184        if (!this._dataGrid)
    177185            this._createDataGrid();
     
    182190        this._emptyView.detach();
    183191        this.deleteButton.visible = true;
    184 
    185         var totalSizeString = Number.bytesToString(this._size);
    186         this._treeElement.subtitle = WebInspector.UIString("%s (%s)", lastPathComponent, totalSizeString);
    187192
    188193        // FIXME: For Chrome, put creationTime and updateTime somewhere.
     
    236241            var data = {};
    237242            var resource = this._resources[i];
    238             data[0] = resource.name;
     243            data[0] = resource.url;
    239244            data[1] = resource.type;
    240245            data[2] = Number.bytesToString(resource.size);
     
    249254        }
    250255
    251         if (!nodeToSelect)
     256        if (!nodeToSelect && this._dataGrid.children.length)
    252257            this._dataGrid.children[0].selected = true;
    253258    },
  • trunk/Source/WebCore/inspector/front-end/ApplicationCacheModel.js

    r99689 r99878  
    3333WebInspector.ApplicationCacheModel = function()
    3434{
     35    ApplicationCacheAgent.enable();
    3536    InspectorBackend.registerApplicationCacheDispatcher(new WebInspector.ApplicationCacheDispatcher(this));
     37   
     38    WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameNavigated, this._frameNavigated, this);
     39    WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameDetached, this._frameDetached, this);
     40   
     41    this._statuses = {};
     42    this._manifestURLsByFrame = {};
     43
     44    this._mainFrameNavigated();
     45}
     46
     47WebInspector.ApplicationCacheModel.EventTypes = {
     48    FrameManifestStatusUpdated: "FrameManifestStatusUpdated",
     49    FrameManifestAdded: "FrameManifestAdded",
     50    FrameManifestRemoved: "FrameManifestRemoved",
     51    NetworkStateChanged: "NetworkStateChanged"
    3652}
    3753
    3854WebInspector.ApplicationCacheModel.prototype = {
    39     getApplicationCachesAsync: function(callback)
    40     {
    41         function mycallback(error, applicationCaches)
     55    _frameNavigated: function(event)
     56    {
     57        if (event.data.isMainFrame) {
     58            this._mainFrameNavigated();
     59            return;
     60        }
     61
     62        var frame = /** @type {PageAgent.Frame} */ event.data["frame"];
     63        var frameId = frame.id;
     64        ApplicationCacheAgent.getManifestForFrame(frameId, this._manifestForFrameLoaded.bind(this, frameId));
     65    },
     66   
     67    _frameDetached: function(event)
     68    {
     69        var frameId = event.data;
     70        this._frameManifestRemoved(frameId);
     71    },
     72   
     73    _mainFrameNavigated: function()
     74    {
     75        ApplicationCacheAgent.getFramesWithManifests(this._framesWithManifestsLoaded.bind(this));
     76    },
     77
     78    /**
     79     * @param {string} frameId
     80     * @param {string} error
     81     * @param {string} manifestURL
     82     */
     83    _manifestForFrameLoaded: function(frameId, error, manifestURL)
     84    {
     85        if (error) {
     86            console.error(error);
     87            return;
     88        }
     89       
     90        if (!manifestURL)
     91            this._frameManifestRemoved(frameId);
     92    },
     93   
     94    /**
     95     * @param {string} error
     96     * @param {Array.<ApplicationCacheAgent.FrameWithManifest>} framesWithManifests
     97     */
     98    _framesWithManifestsLoaded: function(error, framesWithManifests)
     99    {
     100        if (error) {
     101            console.error(error);
     102            return;
     103        }
     104
     105        for (var i = 0; i < framesWithManifests.length; ++i)
     106            this._frameManifestUpdated(framesWithManifests[i].frameId, framesWithManifests[i].manifestURL, framesWithManifests[i].status);
     107    },
     108   
     109    /**
     110     * @param {string} frameId
     111     * @param {string} manifestURL
     112     * @param {number} status
     113     */
     114    _frameManifestUpdated: function(frameId, manifestURL, status)
     115    {
     116        if (status === applicationCache.UNCACHED) {
     117            this._frameManifestRemoved(frameId);
     118            return;
     119        }
     120           
     121        if (!manifestURL)
     122            return;
     123           
     124        if (this._manifestURLsByFrame[frameId] && manifestURL !== this._manifestURLsByFrame[frameId])
     125            this._frameManifestRemoved(frameId);
     126       
     127        var statusChanged = this._statuses[frameId] !== status;
     128        this._statuses[frameId] = status;
     129       
     130        if (!this._manifestURLsByFrame[frameId]) {
     131            this._manifestURLsByFrame[frameId] = manifestURL;
     132            this.dispatchEventToListeners(WebInspector.ApplicationCacheModel.EventTypes.FrameManifestAdded, frameId);
     133        }
     134           
     135        if (statusChanged)
     136            this.dispatchEventToListeners(WebInspector.ApplicationCacheModel.EventTypes.FrameManifestStatusUpdated, frameId);
     137    },
     138   
     139    /**
     140     * @param {string} frameId
     141     */
     142    _frameManifestRemoved: function(frameId)
     143    {
     144        if (!this._manifestURLsByFrame[frameId])
     145            return;
     146
     147        var manifestURL = this._manifestURLsByFrame[frameId];
     148        delete this._manifestURLsByFrame[frameId];
     149        delete this._statuses[frameId];
     150       
     151        this.dispatchEventToListeners(WebInspector.ApplicationCacheModel.EventTypes.FrameManifestRemoved, frameId);
     152    },
     153   
     154    /**
     155     * @param {string} frameId
     156     * @return {string}
     157     */
     158    frameManifestURL: function(frameId)
     159    {
     160        return this._manifestURLsByFrame[frameId] || "";
     161    },
     162   
     163    /**
     164     * @param {string} frameId
     165     * @return {number}
     166     */
     167    frameManifestStatus: function(frameId)
     168    {
     169        return this._statuses[frameId] || applicationCache.UNCACHED;
     170    },
     171   
     172    /**
     173     * @param {string} frameId
     174     * @param {string} manifestURL
     175     * @param {number} status
     176     */
     177    _statusUpdated: function(frameId, manifestURL, status)
     178    {
     179        this._frameManifestUpdated(frameId, manifestURL, status);
     180    },
     181   
     182    /**
     183     * @param {string} frameId
     184     * @param {function(Object)} callback
     185     */
     186    requestApplicationCache: function(frameId, callback)
     187    {
     188        function callbackWrapper(error, applicationCache)
    42189        {
    43             // FIXME: Currently, this list only returns a single application cache.
    44             if (!error && applicationCaches)
    45                 callback(applicationCaches);
    46         }
    47 
    48         ApplicationCacheAgent.getApplicationCaches(mycallback);
     190            if (error) {
     191                console.error(error);
     192                callback(null);
     193                return;
     194            }
     195           
     196            callback(applicationCache);
     197        }
     198       
     199        ApplicationCacheAgent.getApplicationCacheForFrame(frameId, callbackWrapper.bind(this));
     200    },
     201   
     202    /**
     203     * @param {boolean} isNowOnline
     204     */
     205    _networkStateUpdated: function(isNowOnline)
     206    {
     207        this.dispatchEventToListeners(WebInspector.ApplicationCacheModel.EventTypes.NetworkStateChanged, isNowOnline);
    49208    }
    50209}
     
    63222WebInspector.ApplicationCacheDispatcher.prototype = {
    64223    /**
     224     * @param {string} frameId
     225     * @param {string} manifestURL
    65226     * @param {number} status
    66227     */
    67     updateApplicationCacheStatus: function(status)
    68     {
    69         WebInspector.panels.resources.updateApplicationCacheStatus(status);
    70     },
    71 
     228    applicationCacheStatusUpdated: function(frameId, manifestURL, status)
     229    {
     230        this._applicationCacheModel._statusUpdated(frameId, manifestURL, status);
     231    },
     232   
    72233    /**
    73234     * @param {boolean} isNowOnline
    74235     */
    75     updateNetworkState: function(isNowOnline)
    76     {
    77         WebInspector.panels.resources.updateNetworkState(isNowOnline);
    78     }
    79 }
     236    networkStateUpdated: function(isNowOnline)
     237    {
     238        this._applicationCacheModel._networkStateUpdated(isNowOnline);
     239    },
     240}
  • trunk/Source/WebCore/inspector/front-end/ResourceTreeModel.js

    r98840 r99878  
    115115    },
    116116
     117    frameForId: function(frameId)
     118    {
     119        return this._frameIds[frameId];
     120    },
     121
    117122    resources: function(frameId)
    118123    {
  • trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js

    r99689 r99878  
    7878    this._domains = {};
    7979
     80
    8081    this.sidebarElement.addEventListener("mousemove", this._onmousemove.bind(this), false);
    8182    this.sidebarElement.addEventListener("mouseout", this._onmouseout.bind(this), false);
     
    111112        if (!this._initialized) {
    112113            this._populateResourceTree();
    113             this._initializeApplicationCacheModel();
    114 
     114            this._populateApplicationCacheTree();
    115115            this._initDefaultSelection();
    116            
     116
    117117            this._initialized = true;
    118118        }
     
    168168        this._cookieViews = {};
    169169
    170         this._applicationCacheView = null;
    171         delete this._cachedApplicationCacheViewStatus;
    172 
    173170        this.databasesListTreeElement.removeChildren();
    174171        this.localStorageListTreeElement.removeChildren();
    175172        this.sessionStorageListTreeElement.removeChildren();
    176173        this.cookieListTreeElement.removeChildren();
    177         this.applicationCacheListTreeElement.removeChildren();
    178174
    179175        if (this.visibleView)
     
    263259        if (frameTreeElement)
    264260            frameTreeElement.frameNavigated(event.data.frame);
     261
     262        var applicationCacheFrameTreeElement = this._applicationCacheFrameElements[frameId];
     263        if (applicationCacheFrameTreeElement)
     264            applicationCacheFrameTreeElement.frameNavigated(event.data.frame);
    265265    },
    266266
     
    291291            var cookieDomainTreeElement = new WebInspector.CookieTreeElement(this, domain);
    292292            this.cookieListTreeElement.appendChild(cookieDomainTreeElement);
    293 
    294             var applicationCacheTreeElement = new WebInspector.ApplicationCacheTreeElement(this, domain);
    295             this.applicationCacheListTreeElement.appendChild(applicationCacheTreeElement);
    296293        }
    297294    },
     
    481478    },
    482479
    483     showApplicationCache: function(treeElement, appcacheDomain)
    484     {
    485         var view = this._applicationCacheView;
    486         if (!view) {
    487             view = new WebInspector.ApplicationCacheItemsView(this._applicationCacheModel, treeElement, appcacheDomain);
    488             this._applicationCacheView = view;
    489         }
    490 
    491         this._innerShowView(view);
    492 
    493         if ("_cachedApplicationCacheViewStatus" in this)
    494             this._applicationCacheView.updateStatus(this._cachedApplicationCacheViewStatus);
     480    showApplicationCache: function(frameId)
     481    {
     482        var status = this._applicationCacheModel.frameManifestStatus(frameId)
     483
     484        if (!this._applicationCacheViews[frameId]) {
     485            this._applicationCacheViews[frameId] = new WebInspector.ApplicationCacheItemsView(this._applicationCacheModel, frameId, status);
     486
     487            // FIXME: Make sure this._cachedApplicationCacheNetworkState is always set and is always up to date.
     488            if (typeof(this._cachedApplicationCacheNetworkState) === "number")
     489                this._applicationCacheViews[frameId].updateNetworkState(this._cachedApplicationCacheNetworkState);
     490        }
     491
     492        this._innerShowView(this._applicationCacheViews[frameId]);
    495493    },
    496494
     
    567565    },
    568566
    569     _initializeApplicationCacheModel: function()
     567    _populateApplicationCacheTree: function()
    570568    {
    571569        this._applicationCacheModel = new WebInspector.ApplicationCacheModel();
    572     },
    573    
    574     updateApplicationCacheStatus: function(status)
    575     {
    576         this._cachedApplicationCacheViewStatus = status;
    577         if (this._applicationCacheView && this._applicationCacheView === this.visibleView)
    578             this._applicationCacheView.updateStatus(status);
    579     },
    580 
    581     updateNetworkState: function(isNowOnline)
    582     {
    583         if (this._applicationCacheView && this._applicationCacheView === this.visibleView)
    584             this._applicationCacheView.updateNetworkState(isNowOnline);
    585     },
    586 
    587     updateManifest: function(manifest)
    588     {
    589         if (this._applicationCacheView && this._applicationCacheView === this.visibleView)
    590             this._applicationCacheView.updateManifest(manifest);
     570       
     571        this._applicationCacheViews = {};
     572        this._applicationCacheFrameElements = {};
     573        this._applicationCacheManifestElements = {};
     574       
     575        this._applicationCacheModel.addEventListener(WebInspector.ApplicationCacheModel.EventTypes.FrameManifestAdded, this._applicationCacheFrameManifestAdded, this);
     576        this._applicationCacheModel.addEventListener(WebInspector.ApplicationCacheModel.EventTypes.FrameManifestRemoved, this._applicationCacheFrameManifestRemoved, this);
     577
     578        this._applicationCacheModel.addEventListener(WebInspector.ApplicationCacheModel.EventTypes.FrameManifestStatusUpdated, this._applicationCacheFrameManifestStatusChanged, this);
     579        this._applicationCacheModel.addEventListener(WebInspector.ApplicationCacheModel.EventTypes.NetworkStateChanged, this._applicationCacheNetworkStateChanged, this);
     580    },
     581
     582    _applicationCacheFrameManifestAdded: function(event)
     583    {
     584        var frameId = event.data;
     585        var manifestURL = this._applicationCacheModel.frameManifestURL(frameId);
     586        var status = this._applicationCacheModel.frameManifestStatus(frameId)
     587
     588        var manifestTreeElement = this._applicationCacheManifestElements[manifestURL]
     589        if (!manifestTreeElement) {
     590            manifestTreeElement = new WebInspector.ApplicationCacheManifestTreeElement(this, manifestURL);
     591            this.applicationCacheListTreeElement.appendChild(manifestTreeElement);
     592            this._applicationCacheManifestElements[manifestURL] = manifestTreeElement;
     593        }
     594
     595        var frameTreeElement = new WebInspector.ApplicationCacheFrameTreeElement(this, frameId, manifestURL);
     596        manifestTreeElement.appendChild(frameTreeElement);
     597        manifestTreeElement.expand();
     598        this._applicationCacheFrameElements[frameId] = frameTreeElement;
     599    },
     600
     601    _applicationCacheFrameManifestRemoved: function(event)
     602    {
     603        var frameId = event.data;
     604        var frameTreeElement = this._applicationCacheFrameElements[frameId];
     605        if (!frameTreeElement)
     606            return;
     607
     608        var manifestURL = frameTreeElement.manifestURL;
     609        delete this._applicationCacheFrameElements[frameId];
     610        delete this._applicationCacheViews[frameId];
     611        frameTreeElement.parent.removeChild(frameTreeElement);
     612
     613        var manifestTreeElement = this._applicationCacheManifestElements[manifestURL];
     614        if (manifestTreeElement.children.length !== 0)
     615            return;
     616
     617        delete this._applicationCacheManifestElements[manifestURL];
     618        manifestTreeElement.parent.removeChild(manifestTreeElement);
     619    },
     620
     621    _applicationCacheFrameManifestStatusChanged: function(event)
     622    {
     623        var frameId = event.data;
     624        var status = this._applicationCacheModel.frameManifestStatus(frameId)
     625
     626        if (this._applicationCacheViews[frameId])
     627            this._applicationCacheViews[frameId].updateStatus(status);
     628    },
     629
     630    _applicationCacheNetworkStateChanged: function(event)
     631    {
     632        var isNowOnline = event.data;
     633
     634        this._cachedApplicationCacheNetworkState = isNowOnline;
     635        for (var manifestURL in this._applicationCacheViews)
     636            this._applicationCacheViews[manifestURL].updateNetworkState(isNowOnline);
    591637    },
    592638
     
    15031549 * @extends {WebInspector.BaseStorageTreeElement}
    15041550 */
    1505 WebInspector.ApplicationCacheTreeElement = function(storagePanel, appcacheDomain)
     1551WebInspector.ApplicationCacheManifestTreeElement = function(storagePanel, manifestURL)
    15061552{
    1507     WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, appcacheDomain ? appcacheDomain : WebInspector.UIString("Local Files"), ["application-cache-storage-tree-item"]);
    1508     this._appcacheDomain = appcacheDomain;
    1509 }
    1510 
    1511 WebInspector.ApplicationCacheTreeElement.prototype = {
     1553    var title = WebInspector.Resource.displayName(manifestURL);
     1554    WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, title, ["application-cache-storage-tree-item"]);
     1555    this.tooltip = manifestURL;
     1556    this._manifestURL = manifestURL;
     1557}
     1558
     1559WebInspector.ApplicationCacheManifestTreeElement.prototype = {
    15121560    get itemURL()
    15131561    {
    1514         return "appcache://" + this._appcacheDomain;
     1562        return "appcache://" + this._manifestURL;
     1563    },
     1564
     1565    get manifestURL()
     1566    {
     1567        return this._manifestURL;
    15151568    },
    15161569
     
    15181571    {
    15191572        WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
    1520         this._storagePanel.showApplicationCache(this, this._appcacheDomain);
     1573        this._storagePanel.showCategoryView(this._manifestURL);
    15211574    }
    15221575}
    1523 WebInspector.ApplicationCacheTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
     1576WebInspector.ApplicationCacheManifestTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
     1577
     1578/**
     1579 * @constructor
     1580 * @extends {WebInspector.BaseStorageTreeElement}
     1581 */
     1582WebInspector.ApplicationCacheFrameTreeElement = function(storagePanel, frameId, manifestURL)
     1583{
     1584    WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, "", ["frame-storage-tree-item"]);
     1585    this._frameId = frameId;
     1586    this._manifestURL = manifestURL;
     1587    this._refreshTitles();
     1588}
     1589
     1590WebInspector.ApplicationCacheFrameTreeElement.prototype = {
     1591    get itemURL()
     1592    {
     1593        return "appcache://" + this._manifestURL + "/" + encodeURI(this.displayName);
     1594    },
     1595
     1596    get frameId()
     1597    {
     1598        return this._frameId;
     1599    },
     1600
     1601    get manifestURL()
     1602    {
     1603        return this._manifestURL;
     1604    },
     1605
     1606    _refreshTitles: function()
     1607    {
     1608        var frame = WebInspector.resourceTreeModel.frameForId(this._frameId);
     1609        if (!frame) {
     1610            this.subtitleText = WebInspector.UIString("new frame");
     1611            return;
     1612        }
     1613        this.titleText = frame.name;
     1614        this.subtitleText = WebInspector.Resource.displayName(frame.url);
     1615    },
     1616
     1617    frameNavigated: function()
     1618    {
     1619        this._refreshTitles();
     1620    },
     1621
     1622    onselect: function()
     1623    {
     1624        WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
     1625        this._storagePanel.showApplicationCache(this._frameId);
     1626    }
     1627}
     1628WebInspector.ApplicationCacheFrameTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
    15241629
    15251630/**
Note: See TracChangeset for help on using the changeset viewer.