Web Inspector: Local/session storage tree items in the Resources panel after page...
authorapavlov@chromium.org <apavlov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Feb 2013 11:57:00 +0000 (11:57 +0000)
committerapavlov@chromium.org <apavlov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Feb 2013 11:57:00 +0000 (11:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=109572

Reviewed by Vsevolod Vlasov.

Source/WebCore:

* CMakeLists.txt:
* GNUmakefile.list.am:
* Target.pri:
* WebCore.gypi:
* WebCore.order:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* dom/WebCoreMemoryInstrumentation.cpp:
(WebCore):
* dom/WebCoreMemoryInstrumentation.h:
(WebCoreMemoryTypes):
* inspector/InjectedScriptSource.js:
(.):
* inspector/Inspector.json:
* inspector/InspectorAllInOne.cpp:
* inspector/InspectorController.cpp:
(WebCore::InspectorController::InspectorController):
* inspector/InspectorDOMStorageAgent.cpp:
(WebCore::InspectorDOMStorageAgent::InspectorDOMStorageAgent):
(WebCore::InspectorDOMStorageAgent::clearFrontend):
(WebCore::InspectorDOMStorageAgent::isEnabled):
(WebCore::InspectorDOMStorageAgent::enable):
(WebCore::InspectorDOMStorageAgent::disable):
(WebCore::InspectorDOMStorageAgent::getDOMStorageItems):
(WebCore::toErrorString):
(WebCore::InspectorDOMStorageAgent::setDOMStorageItem):
(WebCore::InspectorDOMStorageAgent::removeDOMStorageItem):
(WebCore::InspectorDOMStorageAgent::storageId):
(WebCore::InspectorDOMStorageAgent::didDispatchDOMStorageEvent):
(WebCore::InspectorDOMStorageAgent::findStorageArea):
(WebCore::InspectorDOMStorageAgent::reportMemoryUsage):
* inspector/InspectorDOMStorageAgent.h:
(WebCore):
(WebCore::InspectorDOMStorageAgent::create):
(InspectorDOMStorageAgent):
* inspector/InspectorDOMStorageResource.cpp: Removed.
* inspector/InspectorDOMStorageResource.h: Removed.
* inspector/InspectorInstrumentation.cpp:
(WebCore):
(WebCore::InspectorInstrumentation::didCommitLoadImpl):
* inspector/InspectorInstrumentation.h:
(InspectorInstrumentation):
* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::findFrameWithSecurityOrigin):
(WebCore):
* inspector/InspectorPageAgent.h:
(InspectorPageAgent):
* inspector/front-end/DOMStorage.js:
(WebInspector.DOMStorage):
(WebInspector.DOMStorage.storageId):
(WebInspector.DOMStorage.prototype.get id):
(WebInspector.DOMStorage.prototype.get securityOrigin):
(WebInspector.DOMStorage.prototype.getItems):
(WebInspector.DOMStorage.prototype.setItem):
(WebInspector.DOMStorage.prototype.removeItem):
(WebInspector.DOMStorageModel):
(WebInspector.DOMStorageModel.prototype._securityOriginAdded):
(WebInspector.DOMStorageModel.prototype._securityOriginRemoved):
(WebInspector.DOMStorageModel.prototype._storageKey):
(WebInspector.DOMStorageModel.prototype._domStorageItemsCleared):
(WebInspector.DOMStorageModel.prototype._domStorageItemRemoved):
(WebInspector.DOMStorageModel.prototype._domStorageItemAdded):
(WebInspector.DOMStorageModel.prototype.storageForId):
(WebInspector.DOMStorageModel.prototype.storages):
* inspector/front-end/DOMStorageItemsView.js:
(WebInspector.DOMStorageItemsView.prototype._update):
(WebInspector.DOMStorageItemsView.prototype._showDOMStorageItems):
(WebInspector.DOMStorageItemsView.prototype._dataGridForDOMStorageItems):
* inspector/front-end/ResourcesPanel.js:
(WebInspector.ResourcesPanel):
(WebInspector.ResourcesPanel.prototype._initialize):
(WebInspector.ResourcesPanel.prototype._domStorageAdded):
(WebInspector.ResourcesPanel.prototype._domStorageRemoved):
(WebInspector.ResourcesPanel.prototype._populateDOMStorageTree):
(WebInspector.DOMStorageTreeElement):
(WebInspector.DOMStorageTreeElement.prototype.get itemURL):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::sessionStorage):
(WebCore::DOMWindow::localStorage):

LayoutTests:

* http/tests/inspector-enabled/dom-storage-open-expected.txt:
* http/tests/inspector-enabled/dom-storage-open.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@143581 268f45cc-cd09-0410-ab3c-d52691b4dbfc

31 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/inspector-enabled/dom-storage-open-expected.txt
LayoutTests/http/tests/inspector-enabled/dom-storage-open.html
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/Target.pri
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.order
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/dom/WebCoreMemoryInstrumentation.cpp
Source/WebCore/dom/WebCoreMemoryInstrumentation.h
Source/WebCore/inspector/InjectedScriptSource.js
Source/WebCore/inspector/Inspector.json
Source/WebCore/inspector/InspectorAllInOne.cpp
Source/WebCore/inspector/InspectorController.cpp
Source/WebCore/inspector/InspectorDOMStorageAgent.cpp
Source/WebCore/inspector/InspectorDOMStorageAgent.h
Source/WebCore/inspector/InspectorDOMStorageResource.cpp [deleted file]
Source/WebCore/inspector/InspectorDOMStorageResource.h [deleted file]
Source/WebCore/inspector/InspectorInstrumentation.cpp
Source/WebCore/inspector/InspectorInstrumentation.h
Source/WebCore/inspector/InspectorPageAgent.cpp
Source/WebCore/inspector/InspectorPageAgent.h
Source/WebCore/inspector/front-end/DOMStorage.js
Source/WebCore/inspector/front-end/DOMStorageItemsView.js
Source/WebCore/inspector/front-end/ResourcesPanel.js
Source/WebCore/page/DOMWindow.cpp

index 7838634..4d82ab6 100644 (file)
@@ -1,3 +1,13 @@
+2013-02-21  Alexander Pavlov  <apavlov@chromium.org>
+
+        Web Inspector: Local/session storage tree items in the Resources panel after page refresh are not shown
+        https://bugs.webkit.org/show_bug.cgi?id=109572
+
+        Reviewed by Vsevolod Vlasov.
+
+        * http/tests/inspector-enabled/dom-storage-open-expected.txt:
+        * http/tests/inspector-enabled/dom-storage-open.html:
+
 2013-02-21  Zoltan Arvai  <zarvai@inf.u-szeged.hu>
 
         [Qt] Unreviewed gardening.
index cbedf70..a468211 100644 (file)
@@ -1,5 +1,7 @@
-Tests that Web Inspector gets populated with DOM storages that were opened before inspector is shown.
+Tests that Web Inspector gets populated with DOM storages according to security origins found in the page.
 
-Domain: http://127.0.0.1:8000
+SecurityOrigin: http://127.0.0.1:8000
+IsLocalStorage: true
+SecurityOrigin: http://127.0.0.1:8000
 IsLocalStorage: false
 
index 20181c6..1302007 100644 (file)
@@ -22,7 +22,7 @@ function test()
     {
         var storages = WebInspector.domStorageModel.storages();
         for (var i = 0; i < storages.length; ++i) {
-            InspectorTest.addResult("Domain: " + storages[i].domain);
+            InspectorTest.addResult("SecurityOrigin: " + storages[i].securityOrigin);
             InspectorTest.addResult("IsLocalStorage: " + storages[i].isLocalStorage);
         }
         InspectorTest.completeTest();
@@ -34,6 +34,6 @@ function test()
 
 </head>
 <body onload="onload()">
-<p>Tests that Web Inspector gets populated with DOM storages that were opened before inspector is shown.</p>
+<p>Tests that Web Inspector gets populated with DOM storages according to security origins found in the page.</p>
 </body>
 </html>
index 3f89a0e..45017b4 100644 (file)
@@ -1623,7 +1623,6 @@ set(WebCore_SOURCES
     inspector/InspectorDOMAgent.cpp
     inspector/InspectorDOMDebuggerAgent.cpp
     inspector/InspectorDOMStorageAgent.cpp
-    inspector/InspectorDOMStorageResource.cpp
     inspector/InspectorDatabaseAgent.cpp
     inspector/InspectorDatabaseResource.cpp
     inspector/InspectorDebuggerAgent.cpp
index 1b4d31d..4273e31 100644 (file)
@@ -1,3 +1,92 @@
+2013-02-21  Alexander Pavlov  <apavlov@chromium.org>
+
+        Web Inspector: Local/session storage tree items in the Resources panel after page refresh are not shown
+        https://bugs.webkit.org/show_bug.cgi?id=109572
+
+        Reviewed by Vsevolod Vlasov.
+
+        * CMakeLists.txt:
+        * GNUmakefile.list.am:
+        * Target.pri:
+        * WebCore.gypi:
+        * WebCore.order:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.vcxproj/WebCore.vcxproj:
+        * WebCore.vcxproj/WebCore.vcxproj.filters:
+        * WebCore.xcodeproj/project.pbxproj:
+        * dom/WebCoreMemoryInstrumentation.cpp:
+        (WebCore):
+        * dom/WebCoreMemoryInstrumentation.h:
+        (WebCoreMemoryTypes):
+        * inspector/InjectedScriptSource.js:
+        (.):
+        * inspector/Inspector.json:
+        * inspector/InspectorAllInOne.cpp:
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::InspectorController):
+        * inspector/InspectorDOMStorageAgent.cpp:
+        (WebCore::InspectorDOMStorageAgent::InspectorDOMStorageAgent):
+        (WebCore::InspectorDOMStorageAgent::clearFrontend):
+        (WebCore::InspectorDOMStorageAgent::isEnabled):
+        (WebCore::InspectorDOMStorageAgent::enable):
+        (WebCore::InspectorDOMStorageAgent::disable):
+        (WebCore::InspectorDOMStorageAgent::getDOMStorageItems):
+        (WebCore::toErrorString):
+        (WebCore::InspectorDOMStorageAgent::setDOMStorageItem):
+        (WebCore::InspectorDOMStorageAgent::removeDOMStorageItem):
+        (WebCore::InspectorDOMStorageAgent::storageId):
+        (WebCore::InspectorDOMStorageAgent::didDispatchDOMStorageEvent):
+        (WebCore::InspectorDOMStorageAgent::findStorageArea):
+        (WebCore::InspectorDOMStorageAgent::reportMemoryUsage):
+        * inspector/InspectorDOMStorageAgent.h:
+        (WebCore):
+        (WebCore::InspectorDOMStorageAgent::create):
+        (InspectorDOMStorageAgent):
+        * inspector/InspectorDOMStorageResource.cpp: Removed.
+        * inspector/InspectorDOMStorageResource.h: Removed.
+        * inspector/InspectorInstrumentation.cpp:
+        (WebCore):
+        (WebCore::InspectorInstrumentation::didCommitLoadImpl):
+        * inspector/InspectorInstrumentation.h:
+        (InspectorInstrumentation):
+        * inspector/InspectorPageAgent.cpp:
+        (WebCore::InspectorPageAgent::findFrameWithSecurityOrigin):
+        (WebCore):
+        * inspector/InspectorPageAgent.h:
+        (InspectorPageAgent):
+        * inspector/front-end/DOMStorage.js:
+        (WebInspector.DOMStorage):
+        (WebInspector.DOMStorage.storageId):
+        (WebInspector.DOMStorage.prototype.get id):
+        (WebInspector.DOMStorage.prototype.get securityOrigin):
+        (WebInspector.DOMStorage.prototype.getItems):
+        (WebInspector.DOMStorage.prototype.setItem):
+        (WebInspector.DOMStorage.prototype.removeItem):
+        (WebInspector.DOMStorageModel):
+        (WebInspector.DOMStorageModel.prototype._securityOriginAdded):
+        (WebInspector.DOMStorageModel.prototype._securityOriginRemoved):
+        (WebInspector.DOMStorageModel.prototype._storageKey):
+        (WebInspector.DOMStorageModel.prototype._domStorageItemsCleared):
+        (WebInspector.DOMStorageModel.prototype._domStorageItemRemoved):
+        (WebInspector.DOMStorageModel.prototype._domStorageItemAdded):
+        (WebInspector.DOMStorageModel.prototype.storageForId):
+        (WebInspector.DOMStorageModel.prototype.storages):
+        * inspector/front-end/DOMStorageItemsView.js:
+        (WebInspector.DOMStorageItemsView.prototype._update):
+        (WebInspector.DOMStorageItemsView.prototype._showDOMStorageItems):
+        (WebInspector.DOMStorageItemsView.prototype._dataGridForDOMStorageItems):
+        * inspector/front-end/ResourcesPanel.js:
+        (WebInspector.ResourcesPanel):
+        (WebInspector.ResourcesPanel.prototype._initialize):
+        (WebInspector.ResourcesPanel.prototype._domStorageAdded):
+        (WebInspector.ResourcesPanel.prototype._domStorageRemoved):
+        (WebInspector.ResourcesPanel.prototype._populateDOMStorageTree):
+        (WebInspector.DOMStorageTreeElement):
+        (WebInspector.DOMStorageTreeElement.prototype.get itemURL):
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::sessionStorage):
+        (WebCore::DOMWindow::localStorage):
+
 2013-02-19  Eugene Klyuchnikov  <eustas@chromium.org>
 
         Web Inspector: [Console] Add console API message types for profile/profileEnd.
index 61f41bc..1172b66 100644 (file)
@@ -3838,8 +3838,6 @@ webcore_sources += \
        Source/WebCore/inspector/InspectorDOMDebuggerAgent.h \
        Source/WebCore/inspector/InspectorDOMStorageAgent.cpp \
        Source/WebCore/inspector/InspectorDOMStorageAgent.h \
-       Source/WebCore/inspector/InspectorDOMStorageResource.cpp \
-       Source/WebCore/inspector/InspectorDOMStorageResource.h \
        Source/WebCore/inspector/InspectorFileSystemAgent.cpp \
        Source/WebCore/inspector/InspectorFileSystemAgent.h \
        Source/WebCore/inspector/InspectorFrontendChannel.h \
index c9f6d2f..ff7fa73 100644 (file)
@@ -798,7 +798,6 @@ SOURCES += \
     inspector/InspectorDOMAgent.cpp \
     inspector/InspectorDOMDebuggerAgent.cpp \
     inspector/InspectorDOMStorageAgent.cpp \
-    inspector/InspectorDOMStorageResource.cpp \
     inspector/InspectorFrontendClientLocal.cpp \
     inspector/InspectorFrontendHost.cpp \
     inspector/InspectorHeapProfilerAgent.cpp \
@@ -1999,7 +1998,6 @@ HEADERS += \
     inspector/InspectorDebuggerAgent.h \
     inspector/InspectorDOMDebuggerAgent.h \
     inspector/InspectorDOMStorageAgent.h \
-    inspector/InspectorDOMStorageResource.h \
     inspector/InspectorFrontendChannel.h \
     inspector/InspectorFrontendClient.h \
     inspector/InspectorFrontendClientLocal.h \
index f774445..ba56bcb 100644 (file)
             'inspector/InspectorDOMDebuggerAgent.h',
             'inspector/InspectorDOMStorageAgent.cpp',
             'inspector/InspectorDOMStorageAgent.h',
-            'inspector/InspectorDOMStorageResource.cpp',
-            'inspector/InspectorDOMStorageResource.h',
             'inspector/InspectorDatabaseAgent.cpp',
             'inspector/InspectorDatabaseAgent.h',
             'inspector/InspectorDatabaseInstrumentation.h',
index 633b0f4..c163a8e 100644 (file)
@@ -19182,7 +19182,6 @@ __ZN3WTF17HashMapTranslatorISt4pairINS_6RefPtrIN7WebCore14SecurityOriginEEENS2_I
 __ZN7WebCore24InspectorInstrumentation20didUseDOMStorageImplEPNS_19InstrumentingAgentsEPNS_11StorageAreaEbPNS_5FrameE
 __ZN7WebCore24InspectorDOMStorageAgent16didUseDOMStorageEPNS_11StorageAreaEbPNS_5FrameE
 __ZN7WebCore7Storage6createEPNS_5FrameEN3WTF10PassRefPtrINS_11StorageAreaEEE
-__ZN7WebCore27InspectorDOMStorageResourceC1EPNS_7StorageEbPNS_5FrameE
 __ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_7StorageE
 __ZN7WebCore4wrapINS_9JSStorageENS_7StorageEEEN3JSC7JSValueEPNS3_9ExecStateEPNS_17JSDOMGlobalObjectEPT0_
 __ZN7WebCore15getDOMStructureINS_9JSStorageEEEPN3JSC9StructureEPNS2_9ExecStateEPNS_17JSDOMGlobalObjectE
@@ -19205,7 +19204,6 @@ __ZN7WebCore14JSStorageOwner26isReachableFromOpaqueRootsEN3JSC6HandleINS1_7Unkno
 __ZN7WebCore14JSStorageOwner8finalizeEN3JSC6HandleINS1_7UnknownEEEPv
 __ZN7WebCore9JSStorageD1Ev
 __ZN7WebCore7StorageD1Ev
-__ZN7WebCore27InspectorDOMStorageResourceD0Ev
 __ZNK7WebCore14SecurityOrigin5equalEPKS0_
 __ZN7WebCore9JSStorage10nameGetterEPN3JSC9ExecStateENS1_7JSValueERKNS1_10IdentifierE
 __ZNK7WebCore7Storage7getItemERKN3WTF6StringE
@@ -20374,7 +20372,6 @@ __ZN7WebCore17getDOMConstructorINS_25JSCSSValueListConstructorEEEPN3JSC8JSObject
 __ZN7WebCore30jsDOMWindowFileListConstructorEPN3JSC9ExecStateENS0_7JSValueERKNS0_10IdentifierE
 __ZN7WebCore10JSFileList14getConstructorEPN3JSC9ExecStateEPNS1_14JSGlobalObjectE
 __ZN7WebCore17getDOMConstructorINS_21JSFileListConstructorEEEPN3JSC8JSObjectEPNS2_9ExecStateEPKNS_17JSDOMGlobalObjectE
-__ZNK7WebCore27InspectorDOMStorageResource17isSameHostAndTypeEPNS_5FrameEb
 __ZN7WebCore53jsDOMWindowSVGPathSegCurvetoCubicSmoothRelConstructorEPN3JSC9ExecStateENS0_7JSValueERKNS0_10IdentifierE
 __ZN7WebCore33JSSVGPathSegCurvetoCubicSmoothRel14getConstructorEPN3JSC9ExecStateEPNS1_14JSGlobalObjectE
 __ZN7WebCore17getDOMConstructorINS_44JSSVGPathSegCurvetoCubicSmoothRelConstructorEEEPN3JSC8JSObjectEPNS2_9ExecStateEPKNS_17JSDOMGlobalObjectE
@@ -27401,23 +27398,14 @@ __ZN7WebCore18InspectorPageAgent10frameForIdERKN3WTF6StringE
 __ZN7WebCore18InspectorPageAgent15resourceContentEPN3WTF6StringEPNS_5FrameERKNS_4KURLES3_
 __ZN7WebCoreL18decodeMainResourceEPNS_5FrameEPN3WTF6StringE
 __ZN7WebCoreL18decodeSharedBufferEN3WTF10PassRefPtrINS_12SharedBufferEEERKNS0_6StringEPS4_
-__ZN7WebCore27InspectorDOMStorageResource4bindEPNS_17InspectorFrontendE
 __ZN7WebCore17InspectorFrontend10DOMStorage13addDOMStorageEN3WTF10PassRefPtrINS_15InspectorObjectEEE
 __ZN7WebCore15StorageAreaSync13scheduleClearEv
 __ZN7WebCore26InspectorBackendDispatcher31DOMStorage_getDOMStorageEntriesElPNS_15InspectorObjectE
 __ZN7WebCore24InspectorDOMStorageAgent20getDOMStorageEntriesEPN3WTF6StringEiPNS1_6RefPtrINS_14InspectorArrayEEE
-__ZN3WTF9HashTableIiSt4pairIiNS_6RefPtrIN7WebCore27InspectorDOMStorageResourceEEEENS_18PairFirstExtractorIS6_EENS_7IntHashIjEENS_14PairHashTraitsINS_10HashTraitsIiEENSC_IS5_EEEESD_E16lookupForWritingERKi
-__ZN3WTF9HashTableIiSt4pairIiNS_6RefPtrIN7WebCore27InspectorDOMStorageResourceEEEENS_18PairFirstExtractorIS6_EENS_7IntHashIjEENS_14PairHashTraitsINS_10HashTraitsIiEENSC_IS5_EEEESD_E3addIiS5_NS_17HashMapTranslatorIS6_SF_SA_EEEES1_INS_17HashTableIteratorIiS6_S8_SA_SF_SD_EEbERKT_RKT0_
-__ZN3WTF9HashTableIiSt4pairIiNS_6RefPtrIN7WebCore27InspectorDOMStorageResourceEEEENS_18PairFirstExtractorIS6_EENS_7IntHashIjEENS_14PairHashTraitsINS_10HashTraitsIiEENSC_IS5_EEEESD_E4findIiNS_22IdentityHashTranslatorIiS6_SA_EEEENS_17HashTableIteratorIiS6_S8_SA_SF_SD_EERKT_
-__ZN3WTF9HashTableIiSt4pairIiNS_6RefPtrIN7WebCore27InspectorDOMStorageResourceEEEENS_18PairFirstExtractorIS6_EENS_7IntHashIjEENS_14PairHashTraitsINS_10HashTraitsIiEENSC_IS5_EEEESD_E5clearEv
-__ZN3WTF9HashTableIiSt4pairIiNS_6RefPtrIN7WebCore27InspectorDOMStorageResourceEEEENS_18PairFirstExtractorIS6_EENS_7IntHashIjEENS_14PairHashTraitsINS_10HashTraitsIiEENSC_IS5_EEEESD_E6rehashEi
-__ZN7WebCore27InspectorDOMStorageResource31startReportingChangesToFrontendEv
 __ZNK7WebCore7Storage3keyEj
 __ZNK7WebCore15StorageAreaImpl3keyEj
 __ZN7WebCore10StorageMap3keyEj
 __ZN7WebCore10StorageMap18setIteratorToIndexEj
-__ZN7WebCore27InspectorDOMStorageResourceeqERKNS_13EventListenerE
-__ZN7WebCore27InspectorDOMStorageResource6unbindEv
 __ZN7WebCore14ConsoleMessage13addToFrontendEPNS_17InspectorFrontend7ConsoleEPNS_21InjectedScriptManagerE
 __ZN7WebCore17InspectorFrontend7Console12messageAddedEN3WTF10PassRefPtrINS_15InspectorObjectEEE
 __ZN7WebCore26InspectorBackendDispatcher11Page_reloadElPNS_15InspectorObjectE
@@ -36405,10 +36393,8 @@ __ZTVN7WebCore11TypeBuilder5ArrayINS0_3DOM4NodeEEE
 __ZTVN7WebCore18InspectorBaseAgentINS_17InspectorDOMAgentEEE
 __ZTVN7WebCore5TimerINS_28RevalidateStyleAttributeTaskEEE
 __ZTVN7WebCore18InspectorBaseAgentINS_25InspectorDOMDebuggerAgentEEE
-__ZTVN3WTF21MemoryInstrumentation7WrapperIN7WebCore27InspectorDOMStorageResourceEEE
 __ZTVN7WebCore11TypeBuilder5ArrayINS1_IN3WTF6StringEEEEE
 __ZTVN7WebCore18InspectorBaseAgentINS_24InspectorDOMStorageAgentEEE
-__ZN7WebCore27InspectorDOMStorageResource14s_nextUnusedIdE
 __ZTVN3WTF21MemoryInstrumentation7WrapperIN7WebCore11StorageAreaEEE
 __ZTVN7WebCore5TimerINS_28InspectorBackendDispatchTaskEEE
 __ZTVN7WebCore20FrontendMenuProviderE
@@ -38454,7 +38440,6 @@ __ZN7WebCore18WebCoreMemoryTypes9InspectorE
 __ZN7WebCore18WebCoreMemoryTypes19InspectorControllerE
 __ZN7WebCore18WebCoreMemoryTypes20InspectorMemoryAgentE
 __ZN7WebCore18WebCoreMemoryTypes24InspectorDOMStorageAgentE
-__ZN7WebCore18WebCoreMemoryTypes28InspectorDOMStorageResourcesE
 __ZN7WebCore18WebCoreMemoryTypes16InspectorOverlayE
 __ZN7WebCore18WebCoreMemoryTypes22InspectorProfilerAgentE
 __ZN7WebCore18WebCoreMemoryTypes22InspectorDebuggerAgentE
index 674e945..bd95d38 100755 (executable)
                                >
                        </File>
                        <File
-                               RelativePath="..\inspector\InspectorDOMStorageResource.cpp"
-                               >
-                               <FileConfiguration
-                                       Name="Release|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                       />
-                               </FileConfiguration>
-                               <FileConfiguration
-                                       Name="Production|Win32"
-                                       ExcludedFromBuild="true"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                       />
-                               </FileConfiguration>
-                       </File>
-                       <File
-                               RelativePath="..\inspector\InspectorDOMStorageResource.h"
-                               >
-                       </File>
-                       <File
                                RelativePath="..\inspector\InspectorFileSystemAgent.cpp"
                                >
                                <FileConfiguration
index 8a3cc54..e6b877a 100644 (file)
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
     </ClCompile>
-    <ClCompile Include="..\inspector\InspectorDOMStorageResource.cpp">
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
-    </ClCompile>
     <ClCompile Include="..\inspector\InspectorFileSystemAgent.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
     <ClInclude Include="..\inspector\InspectorDOMAgent.h" />
     <ClInclude Include="..\inspector\InspectorDOMDebuggerAgent.h" />
     <ClInclude Include="..\inspector\InspectorDOMStorageAgent.h" />
-    <ClInclude Include="..\inspector\InspectorDOMStorageResource.h" />
     <ClInclude Include="..\inspector\InspectorFileSystemAgent.h" />
     <ClInclude Include="..\inspector\InspectorFrontendChannel.h" />
     <ClInclude Include="..\inspector\InspectorFrontendClient.h" />
index 1dafa68..c6438a2 100644 (file)
     <ClCompile Include="..\inspector\InspectorDOMStorageAgent.cpp">
       <Filter>inspector</Filter>
     </ClCompile>
-    <ClCompile Include="..\inspector\InspectorDOMStorageResource.cpp">
-      <Filter>inspector</Filter>
-    </ClCompile>
     <ClCompile Include="..\inspector\InspectorFileSystemAgent.cpp">
       <Filter>inspector</Filter>
     </ClCompile>
     <ClInclude Include="..\inspector\InspectorDOMStorageAgent.h">
       <Filter>inspector</Filter>
     </ClInclude>
-    <ClInclude Include="..\inspector\InspectorDOMStorageResource.h">
-      <Filter>inspector</Filter>
-    </ClInclude>
     <ClInclude Include="..\inspector\InspectorFileSystemAgent.h">
       <Filter>inspector</Filter>
     </ClInclude>
index ff7f491..0fee4bc 100644 (file)
                41E1B1D10FF5986900576B3B /* AbstractWorker.h in Headers */ = {isa = PBXBuildFile; fileRef = 41E1B1CB0FF5986900576B3B /* AbstractWorker.h */; };
                41E1B1D30FF5986900576B3B /* SharedWorker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41E1B1CD0FF5986900576B3B /* SharedWorker.cpp */; };
                41E1B1D40FF5986900576B3B /* SharedWorker.h in Headers */ = {isa = PBXBuildFile; fileRef = 41E1B1CE0FF5986900576B3B /* SharedWorker.h */; };
-               41F061740F5F00AC00A07EAC /* InspectorDOMStorageResource.h in Headers */ = {isa = PBXBuildFile; fileRef = 41F061720F5F00AC00A07EAC /* InspectorDOMStorageResource.h */; };
-               41F061750F5F00AC00A07EAC /* InspectorDOMStorageResource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41F061730F5F00AC00A07EAC /* InspectorDOMStorageResource.cpp */; };
                41F0618E0F5F069800A07EAC /* ConsoleMessage.h in Headers */ = {isa = PBXBuildFile; fileRef = 41F0618C0F5F069800A07EAC /* ConsoleMessage.h */; };
                41F0618F0F5F069800A07EAC /* ConsoleMessage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41F0618D0F5F069800A07EAC /* ConsoleMessage.cpp */; };
                41F062140F5F192600A07EAC /* InspectorDatabaseResource.h in Headers */ = {isa = PBXBuildFile; fileRef = 41F062120F5F192600A07EAC /* InspectorDatabaseResource.h */; };
                41E1B1CD0FF5986900576B3B /* SharedWorker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SharedWorker.cpp; path = workers/SharedWorker.cpp; sourceTree = "<group>"; };
                41E1B1CE0FF5986900576B3B /* SharedWorker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SharedWorker.h; path = workers/SharedWorker.h; sourceTree = "<group>"; };
                41E1B1CF0FF5986900576B3B /* SharedWorker.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = SharedWorker.idl; path = workers/SharedWorker.idl; sourceTree = "<group>"; };
-               41F061720F5F00AC00A07EAC /* InspectorDOMStorageResource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorDOMStorageResource.h; sourceTree = "<group>"; };
-               41F061730F5F00AC00A07EAC /* InspectorDOMStorageResource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorDOMStorageResource.cpp; sourceTree = "<group>"; };
                41F0618C0F5F069800A07EAC /* ConsoleMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConsoleMessage.h; sourceTree = "<group>"; };
                41F0618D0F5F069800A07EAC /* ConsoleMessage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConsoleMessage.cpp; sourceTree = "<group>"; };
                41F062120F5F192600A07EAC /* InspectorDatabaseResource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorDatabaseResource.h; sourceTree = "<group>"; };
                                F3D4C47712E07663003DA150 /* InspectorDOMDebuggerAgent.h */,
                                7A74ECB8101839A500BF939E /* InspectorDOMStorageAgent.cpp */,
                                7A74ECB9101839A600BF939E /* InspectorDOMStorageAgent.h */,
-                               41F061730F5F00AC00A07EAC /* InspectorDOMStorageResource.cpp */,
-                               41F061720F5F00AC00A07EAC /* InspectorDOMStorageResource.h */,
                                15D17D1E147231EB005EBCA6 /* InspectorFileSystemAgent.cpp */,
                                15D17D1F147231EB005EBCA6 /* InspectorFileSystemAgent.h */,
                                2277775F1345DEA9008EA455 /* InspectorFrontendChannel.h */,
                                7A24587C1021EAF4000A00AA /* InspectorDOMAgent.h in Headers */,
                                F3D4C47912E07663003DA150 /* InspectorDOMDebuggerAgent.h in Headers */,
                                7A74ECBB101839A600BF939E /* InspectorDOMStorageAgent.h in Headers */,
-                               41F061740F5F00AC00A07EAC /* InspectorDOMStorageResource.h in Headers */,
                                15D17D22147231EB005EBCA6 /* InspectorFileSystemAgent.h in Headers */,
                                578DA20E1520EB8C006141C1 /* InspectorFrontend.h in Headers */,
                                227777601345DEA9008EA455 /* InspectorFrontendChannel.h in Headers */,
                                7A24587B1021EAF4000A00AA /* InspectorDOMAgent.cpp in Sources */,
                                F3D4C47812E07663003DA150 /* InspectorDOMDebuggerAgent.cpp in Sources */,
                                7A74ECBA101839A600BF939E /* InspectorDOMStorageAgent.cpp in Sources */,
-                               41F061750F5F00AC00A07EAC /* InspectorDOMStorageResource.cpp in Sources */,
                                15D17D21147231EB005EBCA6 /* InspectorFileSystemAgent.cpp in Sources */,
                                4F4F5FFB11CBD2E100A186BF /* InspectorFrontend.cpp in Sources */,
                                F344C75811294FF600F26EEE /* InspectorFrontendClientLocal.cpp in Sources */,
index 41593ea..2d851a2 100644 (file)
@@ -60,7 +60,6 @@ MemoryObjectType WebCoreMemoryTypes::Inspector = "WebInspector";
 MemoryObjectType WebCoreMemoryTypes::InspectorController = "WebInspector";
 MemoryObjectType WebCoreMemoryTypes::InspectorMemoryAgent = "WebInspector";
 MemoryObjectType WebCoreMemoryTypes::InspectorDOMStorageAgent = "WebInspector";
-MemoryObjectType WebCoreMemoryTypes::InspectorDOMStorageResources = "WebInspector";
 MemoryObjectType WebCoreMemoryTypes::InspectorOverlay = "WebInspector";
 MemoryObjectType WebCoreMemoryTypes::InspectorProfilerAgent = "WebInspector";
 MemoryObjectType WebCoreMemoryTypes::InspectorDebuggerAgent = "WebInspector";
index abcf176..136419f 100644 (file)
@@ -65,7 +65,6 @@ public:
     static MemoryObjectType InspectorController;
     static MemoryObjectType InspectorMemoryAgent;
     static MemoryObjectType InspectorDOMStorageAgent;
-    static MemoryObjectType InspectorDOMStorageResources;
     static MemoryObjectType InspectorOverlay;
     static MemoryObjectType InspectorProfilerAgent;
     static MemoryObjectType InspectorDebuggerAgent;
index c9e63ef..7000967 100644 (file)
@@ -185,7 +185,7 @@ InjectedScript.prototype = {
             case "Storage":
                 var storageId = InjectedScriptHost.storageId(object)
                 if (storageId)
-                    hints.domStorageId = storageId;
+                    hints.domStorageId = InjectedScriptHost.evaluate("(" + storageId + ")");
                 break;
         }
         InjectedScriptHost.inspect(objectId, hints);
index 489c1e6..3380345 100644 (file)
     {
         "domain": "DOMStorage",
         "hidden": true,
+        "description": "Query and modify DOM storage.",
         "types": [
             {
                 "id": "StorageId",
-                "type": "string",
-                "description": "Unique identifier of DOM storage entry.",
-                "hidden": true
-            },
-            {
-                "id": "Entry",
                 "type": "object",
-                "description": "DOM Storage entry.",
+                "description": "DOM Storage identifier.",
                 "hidden": true,
                 "properties": [
-                    { "name": "origin", "type": "string", "description": "Document origin." },
-                    { "name": "isLocalStorage", "type": "boolean", "description": "True for local storage." },
-                    { "name": "id", "$ref": "StorageId", "description": "Entry id for further reference." }
+                    { "name": "securityOrigin", "type": "string", "description": "Security origin for the storage." },
+                    { "name": "isLocalStorage", "type": "boolean", "description": "Whether the storage is local storage (not session storage)." }
                 ]
             },
             {
                 "description": "Disables storage tracking, prevents storage events from being sent to the client."
             },
             {
-                "name": "getDOMStorageEntries",
+                "name": "getDOMStorageItems",
                 "parameters": [
                     { "name": "storageId", "$ref": "StorageId" }
                 ],
                     { "name": "storageId", "$ref": "StorageId" },
                     { "name": "key", "type": "string" },
                     { "name": "value", "type": "string" }
-                ],
-                "returns": [
-                    { "name": "success", "type": "boolean" }
                 ]
             },
             {
                 "parameters": [
                     { "name": "storageId", "$ref": "StorageId" },
                     { "name": "key", "type": "string" }
-                ],
-                "returns": [
-                    { "name": "success", "type": "boolean" }
                 ]
             }
         ],
         "events": [
             {
-                "name": "addDOMStorage",
-                "parameters": [
-                    { "name": "storage", "$ref": "Entry" }
-                ]
-            },
-            {
                 "name": "domStorageItemsCleared",
                 "parameters": [
                     { "name": "storageId",  "$ref": "StorageId" }
index 67cea46..1eb8e21 100644 (file)
@@ -49,7 +49,6 @@
 #include "InspectorDOMAgent.cpp"
 #include "InspectorDOMDebuggerAgent.cpp"
 #include "InspectorDOMStorageAgent.cpp"
-#include "InspectorDOMStorageResource.cpp"
 #include "InspectorDatabaseAgent.cpp"
 #include "InspectorDatabaseResource.cpp"
 #include "InspectorDebuggerAgent.cpp"
index 0b6588d..9168883 100644 (file)
@@ -117,7 +117,7 @@ InspectorController::InspectorController(Page* page, InspectorClient* inspectorC
 #if ENABLE(FILE_SYSTEM)
     m_agents.append(InspectorFileSystemAgent::create(m_instrumentingAgents.get(), pageAgent, m_state.get()));
 #endif
-    OwnPtr<InspectorDOMStorageAgent> domStorageAgentPtr(InspectorDOMStorageAgent::create(m_instrumentingAgents.get(), m_state.get()));
+    OwnPtr<InspectorDOMStorageAgent> domStorageAgentPtr(InspectorDOMStorageAgent::create(m_instrumentingAgents.get(), m_pageAgent, m_state.get()));
     InspectorDOMStorageAgent* domStorageAgent = domStorageAgentPtr.get();
     m_agents.append(domStorageAgentPtr.release());
 
index 06c4270..df0748e 100644 (file)
 #include "DOMWindow.h"
 #include "Document.h"
 #include "ExceptionCode.h"
+#include "ExceptionCodeDescription.h"
 #include "Frame.h"
-#include "InspectorDOMStorageResource.h"
 #include "InspectorFrontend.h"
+#include "InspectorPageAgent.h"
 #include "InspectorState.h"
 #include "InspectorValues.h"
 #include "InstrumentingAgents.h"
+#include "Page.h"
+#include "PageGroup.h"
+#include "SecurityOrigin.h"
 #include "Storage.h"
 #include "StorageArea.h"
+#include "StorageNamespace.h"
 #include "VoidCallback.h"
 #include "WebCoreMemoryInstrumentation.h"
 
@@ -71,10 +76,10 @@ static bool hadException(ExceptionCode ec, ErrorString* errorString)
     }
 }
 
-InspectorDOMStorageAgent::InspectorDOMStorageAgent(InstrumentingAgents* instrumentingAgents, InspectorCompositeState* state)
+InspectorDOMStorageAgent::InspectorDOMStorageAgent(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InspectorCompositeState* state)
     : InspectorBaseAgent<InspectorDOMStorageAgent>("DOMStorage", instrumentingAgents, state)
+    , m_pageAgent(pageAgent)
     , m_frontend(0)
-    , m_enabled(false)
 {
     m_instrumentingAgents->setInspectorDOMStorageAgent(this);
 }
@@ -92,55 +97,35 @@ void InspectorDOMStorageAgent::setFrontend(InspectorFrontend* frontend)
 
 void InspectorDOMStorageAgent::clearFrontend()
 {
-    DOMStorageResourcesMap::iterator domStorageEnd = m_resources.end();
-    for (DOMStorageResourcesMap::iterator it = m_resources.begin(); it != domStorageEnd; ++it)
-        it->value->unbind();
     m_frontend = 0;
     disable(0);
 }
 
-void InspectorDOMStorageAgent::restore()
+bool InspectorDOMStorageAgent::isEnabled() const
 {
-    m_enabled =  m_state->getBoolean(DOMStorageAgentState::domStorageAgentEnabled);
+    return m_state->getBoolean(DOMStorageAgentState::domStorageAgentEnabled);
 }
 
 void InspectorDOMStorageAgent::enable(ErrorString*)
 {
-    if (m_enabled)
-        return;
-    m_enabled = true;
-    m_state->setBoolean(DOMStorageAgentState::domStorageAgentEnabled, m_enabled);
-
-    DOMStorageResourcesMap::iterator resourcesEnd = m_resources.end();
-    for (DOMStorageResourcesMap::iterator it = m_resources.begin(); it != resourcesEnd; ++it)
-        it->value->bind(m_frontend);
+    m_state->setBoolean(DOMStorageAgentState::domStorageAgentEnabled, true);
 }
 
 void InspectorDOMStorageAgent::disable(ErrorString*)
 {
-    if (!m_enabled)
-        return;
-    m_enabled = false;
-    m_state->setBoolean(DOMStorageAgentState::domStorageAgentEnabled, m_enabled);
+    m_state->setBoolean(DOMStorageAgentState::domStorageAgentEnabled, false);
 }
 
-void InspectorDOMStorageAgent::getDOMStorageEntries(ErrorString* errorString, const String& storageId, RefPtr<TypeBuilder::Array<TypeBuilder::Array<String> > >& entries)
+void InspectorDOMStorageAgent::getDOMStorageItems(ErrorString* errorString, const RefPtr<InspectorObject>& storageId, RefPtr<TypeBuilder::Array<TypeBuilder::Array<String> > >& items)
 {
-    InspectorDOMStorageResource* storageResource = getDOMStorageResourceForId(storageId);
-    if (!storageResource) {
-        *errorString = "Storage resource not found for the given storage identifier";
+    Frame* frame;
+    RefPtr<StorageArea> storageArea = findStorageArea(errorString, storageId, frame);
+    if (!storageArea)
         return;
-    }
-    Frame* frame = storageResource->frame();
-    if (!frame) {
-        *errorString = "Frame not found";
-        return;
-    }
 
-    RefPtr<TypeBuilder::Array<TypeBuilder::Array<String> > > storageEntries = TypeBuilder::Array<TypeBuilder::Array<String> >::create();
+    RefPtr<TypeBuilder::Array<TypeBuilder::Array<String> > > storageItems = TypeBuilder::Array<TypeBuilder::Array<String> >::create();
 
     ExceptionCode ec = 0;
-    StorageArea* storageArea = storageResource->storageArea();
     for (unsigned i = 0; i < storageArea->length(ec, frame); ++i) {
         String name(storageArea->key(i, ec, frame));
         if (hadException(ec, errorString))
@@ -151,87 +136,73 @@ void InspectorDOMStorageAgent::getDOMStorageEntries(ErrorString* errorString, co
         RefPtr<TypeBuilder::Array<String> > entry = TypeBuilder::Array<String>::create();
         entry->addItem(name);
         entry->addItem(value);
-        storageEntries->addItem(entry);
+        storageItems->addItem(entry);
     }
-    entries = storageEntries.release();
+    items = storageItems.release();
 }
 
-void InspectorDOMStorageAgent::setDOMStorageItem(ErrorString*, const String& storageId, const String& key, const String& value, bool* success)
+static String toErrorString(const ExceptionCode& ec)
 {
-    InspectorDOMStorageResource* storageResource = getDOMStorageResourceForId(storageId);
-    if (storageResource) {
-        ExceptionCode exception = 0;
-        storageResource->storageArea()->setItem(key, value, exception, storageResource->frame());
-        *success = !exception;
-    } else
-        *success = false;
+    if (ec) {
+        ExceptionCodeDescription description(ec);
+        return description.name;
+    }
+    return "";
 }
 
-void InspectorDOMStorageAgent::removeDOMStorageItem(ErrorString*, const String& storageId, const String& key, bool* success)
+void InspectorDOMStorageAgent::setDOMStorageItem(ErrorString* errorString, const RefPtr<InspectorObject>& storageId, const String& key, const String& value)
 {
-    InspectorDOMStorageResource* storageResource = getDOMStorageResourceForId(storageId);
-    if (storageResource) {
-        ExceptionCode exception = 0;
-        storageResource->storageArea()->removeItem(key, exception, storageResource->frame());
-        *success = !exception;
-    } else
-        *success = false;
-}
+    Frame* frame;
+    RefPtr<StorageArea> storageArea = findStorageArea(0, storageId, frame);
+    if (!storageArea) {
+        *errorString = "Storage not found";
+        return;
+    }
 
-String InspectorDOMStorageAgent::storageId(Storage* storage)
-{
-    ASSERT(storage);
-    Frame* frame = storage->frame();
-    ExceptionCode ec = 0;
-    bool isLocalStorage = (frame->document()->domWindow()->localStorage(ec) == storage && !ec);
-    return storageId(frame->document()->securityOrigin(), isLocalStorage);
+    ExceptionCode exception = 0;
+    storageArea->setItem(key, value, exception, frame);
+    *errorString = toErrorString(exception);
 }
 
-String InspectorDOMStorageAgent::storageId(SecurityOrigin* securityOrigin, bool isLocalStorage)
+void InspectorDOMStorageAgent::removeDOMStorageItem(ErrorString* errorString, const RefPtr<InspectorObject>& storageId, const String& key)
 {
-    ASSERT(securityOrigin);
-    DOMStorageResourcesMap::iterator domStorageEnd = m_resources.end();
-    for (DOMStorageResourcesMap::iterator it = m_resources.begin(); it != domStorageEnd; ++it) {
-        if (it->value->isSameOriginAndType(securityOrigin, isLocalStorage))
-            return it->key;
+    Frame* frame;
+    RefPtr<StorageArea> storageArea = findStorageArea(0, storageId, frame);
+    if (!storageArea) {
+        *errorString = "Storage not found";
+        return;
     }
-    return String();
+
+    ExceptionCode exception = 0;
+    storageArea->removeItem(key, exception, frame);
+    *errorString = toErrorString(exception);
 }
 
-InspectorDOMStorageResource* InspectorDOMStorageAgent::getDOMStorageResourceForId(const String& storageId)
+String InspectorDOMStorageAgent::storageId(Storage* storage)
 {
-    DOMStorageResourcesMap::iterator it = m_resources.find(storageId);
-    if (it == m_resources.end())
-        return 0;
-    return it->value.get();
+    ASSERT(storage);
+    Document* document = storage->frame()->document();
+    ASSERT(document);
+    DOMWindow* window = document->domWindow();
+    ASSERT(window);
+    RefPtr<SecurityOrigin> securityOrigin = document->securityOrigin();
+    bool isLocalStorage = window->optionalLocalStorage() == storage;
+    return storageId(securityOrigin.get(), isLocalStorage)->toJSONString();
 }
 
-void InspectorDOMStorageAgent::didUseDOMStorage(StorageArea* storageArea, bool isLocalStorage, Frame* frame)
+PassRefPtr<TypeBuilder::DOMStorage::StorageId> InspectorDOMStorageAgent::storageId(SecurityOrigin* securityOrigin, bool isLocalStorage)
 {
-    DOMStorageResourcesMap::iterator domStorageEnd = m_resources.end();
-    for (DOMStorageResourcesMap::iterator it = m_resources.begin(); it != domStorageEnd; ++it) {
-        if (it->value->isSameOriginAndType(frame->document()->securityOrigin(), isLocalStorage))
-            return;
-    }
-
-    RefPtr<InspectorDOMStorageResource> resource = InspectorDOMStorageResource::create(storageArea, isLocalStorage, frame);
-
-    m_resources.set(resource->id(), resource);
-
-    // Resources are only bound while visible.
-    if (m_enabled)
-        resource->bind(m_frontend);
+    return TypeBuilder::DOMStorage::StorageId::create()
+        .setSecurityOrigin(securityOrigin->toRawString())
+        .setIsLocalStorage(isLocalStorage).release();
 }
 
 void InspectorDOMStorageAgent::didDispatchDOMStorageEvent(const String& key, const String& oldValue, const String& newValue, StorageType storageType, SecurityOrigin* securityOrigin, Page*)
 {
-    if (!m_frontend || !m_enabled)
+    if (!m_frontend || !isEnabled())
         return;
 
-    String id = storageId(securityOrigin, storageType == LocalStorage);
-
-    if (id.isEmpty())
-        return;
+    RefPtr<TypeBuilder::DOMStorage::StorageId> id = storageId(securityOrigin, storageType == LocalStorage);
 
     if (key.isNull())
         m_frontend->domstorage()->domStorageItemsCleared(id);
@@ -243,16 +214,37 @@ void InspectorDOMStorageAgent::didDispatchDOMStorageEvent(const String& key, con
         m_frontend->domstorage()->domStorageItemUpdated(id, key, oldValue, newValue);
 }
 
-void InspectorDOMStorageAgent::clearResources()
+PassRefPtr<StorageArea> InspectorDOMStorageAgent::findStorageArea(ErrorString* errorString, const RefPtr<InspectorObject>& storageId, Frame*& targetFrame)
 {
-    m_resources.clear();
+    String securityOrigin;
+    bool isLocalStorage;
+    bool success = storageId->getString("securityOrigin", &securityOrigin);
+    if (success)
+        success = storageId->getBoolean("isLocalStorage", &isLocalStorage);
+    if (!success) {
+        if (errorString)
+            *errorString = "Invalid storageId format";
+        return 0;
+    }
+
+    Frame* frame = m_pageAgent->findFrameWithSecurityOrigin(securityOrigin);
+    if (!frame) {
+        if (errorString)
+            *errorString = "Frame not found for the given security origin";
+        return 0;
+    }
+    targetFrame = frame;
+
+    Page* page = m_pageAgent->page();
+    if (isLocalStorage)
+        return page->group().localStorage()->storageArea(frame->document()->securityOrigin());
+    return page->sessionStorage()->storageArea(frame->document()->securityOrigin());
 }
 
 void InspectorDOMStorageAgent::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::InspectorDOMStorageAgent);
     InspectorBaseAgent<InspectorDOMStorageAgent>::reportMemoryUsage(memoryObjectInfo);
-    info.addMember(m_resources, "resources");
     info.addWeakPointer(m_frontend);
 }
 
index e98e392..6a0c7b7 100644 (file)
@@ -39,8 +39,8 @@ namespace WebCore {
 
 class Frame;
 class InspectorArray;
-class InspectorDOMStorageResource;
 class InspectorFrontend;
+class InspectorPageAgent;
 class InspectorState;
 class InstrumentingAgents;
 class Page;
@@ -51,44 +51,40 @@ typedef String ErrorString;
 
 class InspectorDOMStorageAgent : public InspectorBaseAgent<InspectorDOMStorageAgent>, public InspectorBackendDispatcher::DOMStorageCommandHandler {
 public:
-    static PassOwnPtr<InspectorDOMStorageAgent> create(InstrumentingAgents* instrumentingAgents, InspectorCompositeState* state)
+    static PassOwnPtr<InspectorDOMStorageAgent> create(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InspectorCompositeState* state)
     {
-        return adoptPtr(new InspectorDOMStorageAgent(instrumentingAgents, state));
+        return adoptPtr(new InspectorDOMStorageAgent(instrumentingAgents, pageAgent, state));
     }
     ~InspectorDOMStorageAgent();
 
     virtual void setFrontend(InspectorFrontend*);
     virtual void clearFrontend();
-    void restore();
-
-    void clearResources();
 
     // Called from the front-end.
     virtual void enable(ErrorString*);
     virtual void disable(ErrorString*);
-    virtual void getDOMStorageEntries(ErrorString*, const String& storageId, RefPtr<TypeBuilder::Array<TypeBuilder::Array<String> > >& entries);
-    virtual void setDOMStorageItem(ErrorString*, const String& storageId, const String& key, const String& value, bool* success);
-    virtual void removeDOMStorageItem(ErrorString*, const String& storageId, const String& key, bool* success);
+    virtual void getDOMStorageItems(ErrorString*, const RefPtr<InspectorObject>& storageId, RefPtr<TypeBuilder::Array<TypeBuilder::Array<String> > >& items);
+    virtual void setDOMStorageItem(ErrorString*, const RefPtr<InspectorObject>& storageId, const String& key, const String& value);
+    virtual void removeDOMStorageItem(ErrorString*, const RefPtr<InspectorObject>& storageId, const String& key);
 
     // Called from the injected script.
     String storageId(Storage*);
-    String storageId(SecurityOrigin*, bool isLocalStorage);
+    PassRefPtr<TypeBuilder::DOMStorage::StorageId> storageId(SecurityOrigin*, bool isLocalStorage);
 
     // Called from InspectorInstrumentation
-    void didUseDOMStorage(StorageArea*, bool isLocalStorage, Frame*);
     void didDispatchDOMStorageEvent(const String& key, const String& oldValue, const String& newValue, StorageType, SecurityOrigin*, Page*);
 
     virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE;
 
 private:
-    InspectorDOMStorageAgent(InstrumentingAgents*, InspectorCompositeState*);
 
-    InspectorDOMStorageResource* getDOMStorageResourceForId(const String& storageId);
+    InspectorDOMStorageAgent(InstrumentingAgents*, InspectorPageAgent*, InspectorCompositeState*);
+
+    bool isEnabled() const;
+    PassRefPtr<StorageArea> findStorageArea(ErrorString*, const RefPtr<InspectorObject>&, Frame*&);
 
-    typedef HashMap<String, RefPtr<InspectorDOMStorageResource> > DOMStorageResourcesMap;
-    DOMStorageResourcesMap m_resources;
+    InspectorPageAgent* m_pageAgent;
     InspectorFrontend* m_frontend;
-    bool m_enabled;
 };
 
 } // namespace WebCore
diff --git a/Source/WebCore/inspector/InspectorDOMStorageResource.cpp b/Source/WebCore/inspector/InspectorDOMStorageResource.cpp
deleted file mode 100644 (file)
index 9f3cfe1..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
- * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if ENABLE(INSPECTOR)
-
-#include "InspectorDOMStorageResource.h"
-
-#include "DOMWindow.h"
-#include "Document.h"
-#include "EventNames.h"
-#include "Frame.h"
-#include "InspectorFrontend.h"
-#include "InspectorValues.h"
-#include "SecurityOrigin.h"
-#include "Storage.h"
-#include "StorageArea.h"
-#include "StorageEvent.h"
-
-using namespace JSC;
-
-namespace WebCore {
-
-int InspectorDOMStorageResource::s_nextUnusedId = 1;
-
-InspectorDOMStorageResource::InspectorDOMStorageResource(StorageArea* storageArea, bool isLocalStorage, Frame* frame)
-    : m_storageArea(storageArea)
-    , m_isLocalStorage(isLocalStorage)
-    , m_frame(frame)
-    , m_frontend(0)
-    , m_id(String::number(s_nextUnusedId++))
-{
-}
-
-bool InspectorDOMStorageResource::isSameOriginAndType(SecurityOrigin* securityOrigin, bool isLocalStorage) const
-{
-    return m_frame->document()->securityOrigin()->equal(securityOrigin) && m_isLocalStorage == isLocalStorage;
-}
-
-void InspectorDOMStorageResource::bind(InspectorFrontend* frontend)
-{
-    ASSERT(!m_frontend);
-    m_frontend = frontend->domstorage();
-
-    RefPtr<TypeBuilder::DOMStorage::Entry> jsonObject = TypeBuilder::DOMStorage::Entry::create()
-        .setOrigin(m_frame->document()->securityOrigin()->toRawString())
-        .setIsLocalStorage(m_isLocalStorage)
-        .setId(m_id);
-    m_frontend->addDOMStorage(jsonObject);
-}
-
-void InspectorDOMStorageResource::unbind()
-{
-    if (!m_frontend)
-        return;  // Already unbound.
-
-    m_frontend = 0;
-}
-
-void InspectorDOMStorageResource::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
-{
-    MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::InspectorDOMStorageResources);
-    info.addMember(m_storageArea, "storageArea");
-    info.addMember(m_frame, "frame");
-    info.addWeakPointer(m_frontend);
-    info.addMember(m_id, "id");
-    info.addPrivateBuffer(m_storageArea->memoryBytesUsedByCache(), 0, "StorageAreaCache", "cache");
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(INSPECTOR)
-
diff --git a/Source/WebCore/inspector/InspectorDOMStorageResource.h b/Source/WebCore/inspector/InspectorDOMStorageResource.h
deleted file mode 100644 (file)
index 10d46d7..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
- * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef InspectorDOMStorageResource_h
-#define InspectorDOMStorageResource_h
-
-#include "InspectorFrontend.h"
-
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-class SecurityOrigin;
-class StorageArea;
-class Frame;
-class InspectorFrontend;
-
-class InspectorDOMStorageResource : public RefCounted<InspectorDOMStorageResource> {
-public:
-    static PassRefPtr<InspectorDOMStorageResource> create(StorageArea* storageArea, bool isLocalStorage, Frame* frame)
-    {
-        return adoptRef(new InspectorDOMStorageResource(storageArea, isLocalStorage, frame));
-    }
-
-    void bind(InspectorFrontend*);
-    void unbind();
-
-    bool isSameOriginAndType(SecurityOrigin*, bool isLocalStorage) const;
-    String id() const { return m_id; }
-    StorageArea* storageArea() const { return m_storageArea.get(); }
-    Frame* frame() const { return m_frame.get(); }
-
-    void reportMemoryUsage(MemoryObjectInfo*) const;
-
-private:
-    InspectorDOMStorageResource(StorageArea*, bool isLocalStorage, Frame*);
-
-    RefPtr<StorageArea> m_storageArea;
-    bool m_isLocalStorage;
-    RefPtr<Frame> m_frame;
-    InspectorFrontend::DOMStorage* m_frontend;
-    String m_id;
-
-    static int s_nextUnusedId;
-};
-
-} // namespace WebCore
-
-#endif // InspectorDOMStorageResource_h
index bb4d84d..37a865a 100644 (file)
@@ -915,8 +915,6 @@ void InspectorInstrumentation::didCommitLoadImpl(InstrumentingAgents* instrument
         if (InspectorDatabaseAgent* databaseAgent = instrumentingAgents->inspectorDatabaseAgent())
             databaseAgent->clearResources();
 #endif
-        if (InspectorDOMStorageAgent* domStorageAgent = instrumentingAgents->inspectorDOMStorageAgent())
-            domStorageAgent->clearResources();
         if (InspectorDOMAgent* domAgent = instrumentingAgents->inspectorDOMAgent())
             domAgent->setDocument(mainFrame->document());
 #if USE(ACCELERATED_COMPOSITING)
@@ -1101,15 +1099,6 @@ void InspectorInstrumentation::didOpenDatabaseImpl(InstrumentingAgents* instrume
 }
 #endif
 
-void InspectorInstrumentation::didUseDOMStorageImpl(InstrumentingAgents* instrumentingAgents, StorageArea* storageArea, bool isLocalStorage, Frame* frame)
-{
-    InspectorAgent* inspectorAgent = instrumentingAgents->inspectorAgent();
-    if (!inspectorAgent || !inspectorAgent->developerExtrasEnabled())
-        return;
-    if (InspectorDOMStorageAgent* domStorageAgent = instrumentingAgents->inspectorDOMStorageAgent())
-        domStorageAgent->didUseDOMStorage(storageArea, isLocalStorage, frame);
-}
-
 void InspectorInstrumentation::didDispatchDOMStorageEventImpl(InstrumentingAgents* instrumentingAgents, const String& key, const String& oldValue, const String& newValue, StorageType storageType, SecurityOrigin* securityOrigin, Page* page)
 {
     if (InspectorDOMStorageAgent* domStorageAgent = instrumentingAgents->inspectorDOMStorageAgent())
index e23357f..992db0a 100644 (file)
@@ -252,7 +252,6 @@ public:
     static void didOpenDatabase(ScriptExecutionContext*, PassRefPtr<Database>, const String& domain, const String& name, const String& version);
 #endif
 
-    static void didUseDOMStorage(Page*, StorageArea*, bool isLocalStorage, Frame*);
     static void didDispatchDOMStorageEvent(const String& key, const String& oldValue, const String& newValue, StorageType, SecurityOrigin*, Page*);
 
 #if ENABLE(WORKERS)
@@ -451,7 +450,6 @@ private:
     static void didOpenDatabaseImpl(InstrumentingAgents*, PassRefPtr<Database>, const String& domain, const String& name, const String& version);
 #endif
 
-    static void didUseDOMStorageImpl(InstrumentingAgents*, StorageArea*, bool isLocalStorage, Frame*);
     static void didDispatchDOMStorageEventImpl(InstrumentingAgents*, const String& key, const String& oldValue, const String& newValue, StorageType, SecurityOrigin*, Page*);
 
 #if ENABLE(WORKERS)
@@ -1750,19 +1748,6 @@ inline void InspectorInstrumentation::didWriteHTML(const InspectorInstrumentatio
 #endif
 }
 
-inline void InspectorInstrumentation::didUseDOMStorage(Page* page, StorageArea* storageArea, bool isLocalStorage, Frame* frame)
-{
-#if ENABLE(INSPECTOR)
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
-        didUseDOMStorageImpl(instrumentingAgents, storageArea, isLocalStorage, frame);
-#else
-    UNUSED_PARAM(page);
-    UNUSED_PARAM(storageArea);
-    UNUSED_PARAM(isLocalStorage);
-    UNUSED_PARAM(frame);
-#endif
-}
-
 inline void InspectorInstrumentation::didDispatchDOMStorageEvent(const String& key, const String& oldValue, const String& newValue, StorageType storageType, SecurityOrigin* securityOrigin, Page* page)
 {
 #if ENABLE(INSPECTOR)
index 4af8abd..7a1eb14 100644 (file)
@@ -916,6 +916,22 @@ String InspectorPageAgent::loaderId(DocumentLoader* loader)
     return identifier;
 }
 
+Frame* InspectorPageAgent::findFrameWithSecurityOrigin(const String& originRawString)
+{
+    RefPtr<SecurityOrigin> securityOriginPtr = SecurityOrigin::createFromString(originRawString);
+    SecurityOrigin* securityOrigin = securityOriginPtr.get();
+    bool isLocal = securityOrigin->isLocal();
+    for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
+        RefPtr<SecurityOrigin> documentOrigin = frame->document()->securityOrigin();
+        // Emulate the !enforceFilePathSeparation for security origins.
+        if (isLocal && documentOrigin->isLocal())
+            return frame;
+        if (documentOrigin->equal(securityOrigin))
+            return frame;
+    }
+    return 0;
+}
+
 Frame* InspectorPageAgent::assertFrame(ErrorString* errorString, const String& frameId)
 {
     Frame* frame = frameForId(frameId);
index d5c5b90..de24fc4 100644 (file)
@@ -173,6 +173,7 @@ public:
     String frameId(Frame*);
     bool hasIdForFrame(Frame*) const;
     String loaderId(DocumentLoader*);
+    Frame* findFrameWithSecurityOrigin(const String& originRawString);
     Frame* assertFrame(ErrorString*, const String& frameId);
     String scriptPreprocessor() { return m_scriptPreprocessor; }
     static DocumentLoader* assertDocumentLoader(ErrorString*, Frame*);
index b134419..b209f72 100644 (file)
 
 /**
  * @constructor
+ * @param {string} securityOrigin
+ * @param {boolean} isLocalStorage
  */
-WebInspector.DOMStorage = function(id, domain, isLocalStorage)
+WebInspector.DOMStorage = function(securityOrigin, isLocalStorage)
 {
-    this._id = id;
-    this._domain = domain;
+    this._securityOrigin = securityOrigin;
     this._isLocalStorage = isLocalStorage;
 }
 
+/**
+ * @param {string} securityOrigin
+ * @param {boolean} isLocalStorage
+ * @return {DOMStorageAgent.StorageId}
+ */
+WebInspector.DOMStorage.storageId = function(securityOrigin, isLocalStorage)
+{
+    return { securityOrigin: securityOrigin, isLocalStorage: isLocalStorage };
+}
+
 WebInspector.DOMStorage.prototype = {
-    /** @return {string} */
+
+    /** @return {DOMStorageAgent.StorageId} */
     get id()
     {
-        return this._id;
+        return WebInspector.DOMStorage.storageId(this._securityOrigin, this._isLocalStorage);
     },
 
     /** @return {string} */
-    get domain()
+    get securityOrigin()
     {
-        return this._domain;
+        return this._securityOrigin;
     },
 
     /** @return {boolean} */
@@ -57,30 +69,30 @@ WebInspector.DOMStorage.prototype = {
     },
 
     /**
-     * @param {function(?Protocol.Error, Array.<DOMStorageAgent.Entry>):void=} callback
+     * @param {function(?Protocol.Error, Array.<DOMStorageAgent.Item>):void=} callback
      */
-    getEntries: function(callback)
+    getItems: function(callback)
     {
-        DOMStorageAgent.getDOMStorageEntries(this._id, callback);
+        DOMStorageAgent.getDOMStorageItems(this.id, callback);
     },
 
     /**
      * @param {string} key
      * @param {string} value
-     * @param {function(?Protocol.Error, boolean):void=} callback
+     * @param {function(?Protocol.Error):void=} callback
      */
     setItem: function(key, value, callback)
     {
-        DOMStorageAgent.setDOMStorageItem(this._id, key, value, callback);
+        DOMStorageAgent.setDOMStorageItem(this.id, key, value, callback);
     },
 
     /**
      * @param {string} key
-     * @param {function(?Protocol.Error, boolean):void=} callback
+     * @param {function(?Protocol.Error):void=} callback
      */
     removeItem: function(key, callback)
     {
-        DOMStorageAgent.removeDOMStorageItem(this._id, key, callback);
+        DOMStorageAgent.removeDOMStorageItem(this.id, key, callback);
     }
 }
 
@@ -93,10 +105,13 @@ WebInspector.DOMStorageModel = function()
     this._storages = {};
     InspectorBackend.registerDOMStorageDispatcher(new WebInspector.DOMStorageDispatcher(this));
     DOMStorageAgent.enable();
+    WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginAdded, this._securityOriginAdded, this);
+    WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.SecurityOriginRemoved, this._securityOriginRemoved, this);
 }
 
 WebInspector.DOMStorageModel.Events = {
     DOMStorageAdded: "DOMStorageAdded",
+    DOMStorageRemoved: "DOMStorageRemoved",
     DOMStorageItemsCleared: "DOMStorageItemsCleared",
     DOMStorageItemRemoved: "DOMStorageItemRemoved",
     DOMStorageItemAdded: "DOMStorageItemAdded",
@@ -104,13 +119,53 @@ WebInspector.DOMStorageModel.Events = {
 }
 
 WebInspector.DOMStorageModel.prototype = {
+
+    /**
+     * @param {WebInspector.Event} event
+     */
+    _securityOriginAdded: function(event)
+    {
+        var securityOrigin = /** @type {string} */ (event.data);
+        var localStorageKey = this._storageKey(securityOrigin, true);
+        console.assert(!this._storages[localStorageKey]);
+        var localStorage = new WebInspector.DOMStorage(securityOrigin, true);
+        this._storages[localStorageKey] = localStorage;
+        this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMStorageAdded, localStorage);
+
+        var sessionStorageKey = this._storageKey(securityOrigin, false);
+        console.assert(!this._storages[sessionStorageKey]);
+        var sessionStorage = new WebInspector.DOMStorage(securityOrigin, false);
+        this._storages[sessionStorageKey] = sessionStorage;
+        this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMStorageAdded, sessionStorage);
+    },
+
+    /**
+     * @param {WebInspector.Event} event
+     */
+    _securityOriginRemoved: function(event)
+    {
+        var securityOrigin = /** @type {string} */ (event.data);
+        var localStorageKey = this._storageKey(securityOrigin, true);
+        var localStorage = this._storages[localStorageKey];
+        console.assert(localStorage);
+        delete this._storages[localStorageKey];
+        this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMStorageRemoved, localStorage);
+
+        var sessionStorageKey = this._storageKey(securityOrigin, false);
+        var sessionStorage = this._storages[sessionStorageKey];
+        console.assert(sessionStorage);
+        delete this._storages[sessionStorageKey];
+        this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMStorageRemoved, sessionStorage);
+    },
+
     /**
-     * @param {WebInspector.DOMStorage} domStorage
+     * @param {string} securityOrigin
+     * @param {boolean} isLocalStorage
+     * @return {string}
      */
-    _addDOMStorage: function(domStorage)
+    _storageKey: function(securityOrigin, isLocalStorage)
     {
-        this._storages[domStorage.id] = domStorage;
-        this.dispatchEventToListeners(WebInspector.DOMStorageModel.Events.DOMStorageAdded, domStorage);
+        return JSON.stringify(WebInspector.DOMStorage.storageId(securityOrigin, isLocalStorage));
     },
 
     /**
@@ -118,7 +173,7 @@ WebInspector.DOMStorageModel.prototype = {
      */
     _domStorageItemsCleared: function(storageId)
     {
-        var domStorage = this._storages[storageId];
+        var domStorage = this.storageForId(storageId);
         var storageData = {
             storage: domStorage
         };
@@ -131,7 +186,7 @@ WebInspector.DOMStorageModel.prototype = {
      */
     _domStorageItemRemoved: function(storageId, key)
     {
-        var domStorage = this._storages[storageId];
+        var domStorage = this.storageForId(storageId);
         var storageData = {
             storage: domStorage,
             key: key
@@ -146,7 +201,7 @@ WebInspector.DOMStorageModel.prototype = {
      */
     _domStorageItemAdded: function(storageId, key, newValue)
     {
-        var domStorage = this._storages[storageId];
+        var domStorage = this.storageForId(storageId);
         var storageData = {
             storage: domStorage,
             key: key,
@@ -179,7 +234,7 @@ WebInspector.DOMStorageModel.prototype = {
      */
     storageForId: function(storageId)
     {
-        return this._storages[storageId];
+        return this._storages[JSON.stringify(storageId)];
     },
 
     /**
@@ -188,8 +243,8 @@ WebInspector.DOMStorageModel.prototype = {
     storages: function()
     {
         var result = [];
-        for (var storageId in this._storages)
-            result.push(this._storages[storageId]);
+        for (var id in this._storages)
+            result.push(this._storages[id]);
         return result;
     },
 
@@ -209,18 +264,7 @@ WebInspector.DOMStorageDispatcher = function(model)
 WebInspector.DOMStorageDispatcher.prototype = {
 
     /**
-     * @param {DOMStorageAgent.Entry} payload
-     */
-    addDOMStorage: function(payload)
-    {
-        this._model._addDOMStorage(new WebInspector.DOMStorage(
-            payload.id,
-            payload.origin,
-            payload.isLocalStorage));
-    },
-
-    /**
-     * @param {string} storageId
+     * @param {DOMStorageAgent.StorageId} storageId
      */
     domStorageItemsCleared: function(storageId)
     {
@@ -228,7 +272,7 @@ WebInspector.DOMStorageDispatcher.prototype = {
     },
 
     /**
-     * @param {string} storageId
+     * @param {DOMStorageAgent.StorageId} storageId
      * @param {string} key
      */
     domStorageItemRemoved: function(storageId, key)
@@ -237,7 +281,7 @@ WebInspector.DOMStorageDispatcher.prototype = {
     },
 
     /**
-     * @param {string} storageId
+     * @param {DOMStorageAgent.StorageId} storageId
      * @param {string} key
      * @param {string} newValue
      */
@@ -247,7 +291,7 @@ WebInspector.DOMStorageDispatcher.prototype = {
     },
 
     /**
-     * @param {string} storageId
+     * @param {DOMStorageAgent.StorageId} storageId
      * @param {string} key
      * @param {string} oldValue
      * @param {string} newValue
index 535da12..f5db1e9 100644 (file)
@@ -156,21 +156,21 @@ WebInspector.DOMStorageItemsView.prototype = {
     _update: function()
     {
         this.detachChildViews();
-        this.domStorage.getEntries(this._showDOMStorageEntries.bind(this));
+        this.domStorage.getItems(this._showDOMStorageItems.bind(this));
     },
 
-    _showDOMStorageEntries: function(error, entries)
+    _showDOMStorageItems: function(error, items)
     {
         if (error)
             return;
 
-        this._dataGrid = this._dataGridForDOMStorageEntries(entries);
+        this._dataGrid = this._dataGridForDOMStorageItems(items);
         this._dataGrid.show(this.element);
         this._dataGrid.autoSizeColumns(10);
         this.deleteButton.visible = (this._dataGrid.rootNode().children.length > 1);
     },
 
-    _dataGridForDOMStorageEntries: function(entries)
+    _dataGridForDOMStorageItems: function(items)
     {
         var columns = {key: {}, value: {}};
 
@@ -183,10 +183,10 @@ WebInspector.DOMStorageItemsView.prototype = {
         var nodes = [];
 
         var keys = [];
-        var length = entries.length;
-        for (var i = 0; i < entries.length; i++) {
-            var key = entries[i][0];
-            var value = entries[i][1];
+        var length = items.length;
+        for (var i = 0; i < items.length; i++) {
+            var key = items[i][0];
+            var value = items[i][1];
             var node = new WebInspector.DataGridNode({key: key, value: value}, false);
             node.selectable = true;
             nodes.push(node);
index eaaa1a2..8806269 100644 (file)
@@ -115,9 +115,6 @@ WebInspector.ResourcesPanel = function(database)
 
     WebInspector.databaseModel.databases().forEach(this._addDatabase.bind(this));
     WebInspector.databaseModel.addEventListener(WebInspector.DatabaseModel.Events.DatabaseAdded, this._databaseAdded, this);
-
-    WebInspector.domStorageModel.storages().forEach(this._addDOMStorage.bind(this));
-    WebInspector.domStorageModel.addEventListener(WebInspector.DOMStorageModel.Events.DOMStorageAdded, this._domStorageAdded, this);
 }
 
 WebInspector.ResourcesPanel.prototype = {
@@ -136,6 +133,7 @@ WebInspector.ResourcesPanel.prototype = {
     {
         if (!this._initialized && this.isShowing() && this._cachedResourcesWereLoaded) {
             this._populateResourceTree();
+            this._populateDOMStorageTree();
             this._populateApplicationCacheTree();
             this._initDefaultSelection();
             this._initialized = true;
@@ -331,7 +329,7 @@ WebInspector.ResourcesPanel.prototype = {
      */
     _domStorageAdded: function(event)
     {
-        var domStorage = /** @type {WebInspector.DOMStorage}*/ (event.data);
+        var domStorage = /** @type {WebInspector.DOMStorage} */ (event.data);
         this._addDOMStorage(domStorage);
     },
 
@@ -340,6 +338,8 @@ WebInspector.ResourcesPanel.prototype = {
      */
     _addDOMStorage: function(domStorage)
     {
+        console.assert(!this._domStorageTreeElements.get(domStorage));
+
         var domStorageTreeElement = new WebInspector.DOMStorageTreeElement(this, domStorage, (domStorage.isLocalStorage ? "local-storage" : "session-storage"));
         this._domStorageTreeElements.put(domStorage, domStorageTreeElement);
         if (domStorage.isLocalStorage)
@@ -349,6 +349,32 @@ WebInspector.ResourcesPanel.prototype = {
     },
 
     /**
+     * @param {WebInspector.Event} event
+     */
+    _domStorageRemoved: function(event)
+    {
+        var domStorage = /** @type {WebInspector.DOMStorage} */ (event.data);
+        this._removeDOMStorage(domStorage);
+    },
+
+    /**
+     * @param {WebInspector.DOMStorage} domStorage
+     */
+    _removeDOMStorage: function(domStorage)
+    {
+        var treeElement = this._domStorageTreeElements.get(domStorage);
+        if (!treeElement)
+            return;
+        var wasSelected = treeElement.selected;
+        var parentListTreeElement = treeElement.parent;
+        parentListTreeElement.removeChild(treeElement);
+        if (wasSelected)
+            parentListTreeElement.select();
+        this._domStorageTreeElements.remove(treeElement);
+        this._domStorageViews.remove(domStorage);
+    },
+
+    /**
      * @param {WebInspector.Database} database
      */
     selectDatabase: function(database)
@@ -572,6 +598,13 @@ WebInspector.ResourcesPanel.prototype = {
         database.getTableNames(tableNamesCallback);
     },
 
+    _populateDOMStorageTree: function()
+    {
+        WebInspector.domStorageModel.storages().forEach(this._addDOMStorage.bind(this));
+        WebInspector.domStorageModel.addEventListener(WebInspector.DOMStorageModel.Events.DOMStorageAdded, this._domStorageAdded, this);
+        WebInspector.domStorageModel.addEventListener(WebInspector.DOMStorageModel.Events.DOMStorageRemoved, this._domStorageRemoved, this);
+    },
+
     _populateApplicationCacheTree: function()
     {
         this._applicationCacheModel = new WebInspector.ApplicationCacheModel();
@@ -1850,14 +1883,14 @@ WebInspector.IDBIndexTreeElement.prototype = {
  */
 WebInspector.DOMStorageTreeElement = function(storagePanel, domStorage, className)
 {
-    WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, domStorage.domain ? domStorage.domain : WebInspector.UIString("Local Files"), ["domstorage-storage-tree-item", className]);
+    WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, domStorage.securityOrigin ? domStorage.securityOrigin : WebInspector.UIString("Local Files"), ["domstorage-storage-tree-item", className]);
     this._domStorage = domStorage;
 }
 
 WebInspector.DOMStorageTreeElement.prototype = {
     get itemURL()
     {
-        return "storage://" + this._domStorage.domain + "/" + (this._domStorage.isLocalStorage ? "local" : "session");
+        return "storage://" + this._domStorage.securityOrigin + "/" + (this._domStorage.isLocalStorage ? "local" : "session");
     },
 
     onselect: function(selectedByUser)
index eadd3d8..3f26b11 100644 (file)
@@ -762,7 +762,6 @@ Storage* DOMWindow::sessionStorage(ExceptionCode& ec) const
         ec = SECURITY_ERR;
         return 0;
     }
-    InspectorInstrumentation::didUseDOMStorage(page, storageArea.get(), false, m_frame);
 
     m_sessionStorage = Storage::create(m_frame, storageArea.release());
     return m_sessionStorage.get();
@@ -802,7 +801,6 @@ Storage* DOMWindow::localStorage(ExceptionCode& ec) const
         ec = SECURITY_ERR;
         return 0;
     }
-    InspectorInstrumentation::didUseDOMStorage(page, storageArea.get(), true, m_frame);
 
     m_localStorage = Storage::create(m_frame, storageArea.release());
     return m_localStorage.get();