Source/WebCore: Web Inspector: Local/session storage tree items in the Resources...
authorapavlov@chromium.org <apavlov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Feb 2013 14:08:29 +0000 (14:08 +0000)
committerapavlov@chromium.org <apavlov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Feb 2013 14:08:29 +0000 (14:08 +0000)
commitdb6bb5ccf0f750c0eade79bf7fc1d4efddad06c3
tree222a66406cae07d6de2a781236f5f745ff4872e0
parent3c0aa63b1566171c358758b4203b90ba1259c754
Source/WebCore: Web Inspector: Local/session storage tree items in the Resources panel after page refresh are not shown
Re-landing r143581 with a build fix for Windows.
https://bugs.webkit.org/show_bug.cgi?id=109572

Reviewed by Vsevolod Vlasov.

This is a complete rework of the DOMStorage domain of the Web Inspector protocol. The most notable changes:
- Session and local DOM storages are considered to implicitly exist for each SecurityOrigin in the page
  (previously, only those that were lazily created by DOMWindow would exist).
- Consequently, the addDOMStorage event is gone.
- StorageId is now an object rather than an opaque numeric identifier.
- DOM storage modifiers no longer return a boolean indicating if the operation was successful.
  Clients should rely on the returned error message instead.

Implementation changes:
- InspectorDOMStorageResource would rely on the frame for which it was created throughout its lifetime.
  As such, the frame removal from the page would break the respective DOM storage inspection.
  Since this concept was entirely flawed, InspectorDOMStorageResource has been removed. Instead, a StorageArea
  is retrieved based on the security origin specified by the client.
- DOM storages can now be dynamically removed (upon the respective SecurityOrigin removal) in the frontend.

* CMakeLists.txt: Remove InspectorDOMStorageResource.
* GNUmakefile.list.am: Ditto.
* Target.pri: Ditto.
* WebCore.gypi: Ditto.
* WebCore.order: Ditto.
* WebCore.vcproj/WebCore.vcproj: Ditto.
* WebCore.vcxproj/WebCore.vcxproj: Ditto.
* WebCore.vcxproj/WebCore.vcxproj.filters: Ditto.
* WebCore.xcodeproj/project.pbxproj: Ditto.
* dom/WebCoreMemoryInstrumentation.cpp: Ditto.
* dom/WebCoreMemoryInstrumentation.h: Ditto.
* inspector/InjectedScriptSource.js: Account for the structured StorageId.
* inspector/Inspector.json: Update structures and API methods.
  Do not return boolean success flag and make use of the error message instead.
* inspector/InspectorAllInOne.cpp: Remove InspectorDOMStorageResource.
* inspector/InspectorController.cpp:
(WebCore::InspectorController::InspectorController): Add InspectorPageAgent into InspectorDOMStorageAgent.
* inspector/InspectorDOMStorageAgent.cpp: Mostly remove InspectorDOMStorageResource usages.
(WebCore::InspectorDOMStorageAgent::InspectorDOMStorageAgent):
(WebCore::InspectorDOMStorageAgent::clearFrontend):
(WebCore::InspectorDOMStorageAgent::isEnabled):
(WebCore::InspectorDOMStorageAgent::enable):
(WebCore::InspectorDOMStorageAgent::disable):
(WebCore::InspectorDOMStorageAgent::getDOMStorageItems): Renamed.
(WebCore::toErrorString): Stringify ExceptionCode.
(WebCore::InspectorDOMStorageAgent::setDOMStorageItem):
(WebCore::InspectorDOMStorageAgent::removeDOMStorageItem):
(WebCore::InspectorDOMStorageAgent::storageId): Make it structured rather than a plain string.
(WebCore::InspectorDOMStorageAgent::didDispatchDOMStorageEvent):
(WebCore::InspectorDOMStorageAgent::findStorageArea): Added.
(WebCore::InspectorDOMStorageAgent::reportMemoryUsage): Remove InspectorDOMStorageResource map.
* inspector/InspectorDOMStorageAgent.h:
(WebCore::InspectorDOMStorageAgent::create): Update signature.
(InspectorDOMStorageAgent):
* inspector/InspectorDOMStorageResource.cpp: Removed.
* inspector/InspectorDOMStorageResource.h: Removed.
* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::didCommitLoadImpl): Do not call the removed clearResources().
* inspector/InspectorInstrumentation.h:
* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::findFrameWithSecurityOrigin): Added.
* inspector/InspectorPageAgent.h:
(InspectorPageAgent):
* inspector/front-end/DOMStorage.js: Entirely reworked to use the SecurityOriginAdded/Removed events.
(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: Rename Entries -> Items to avoid confusion.
(WebInspector.DOMStorageItemsView.prototype._update):
(WebInspector.DOMStorageItemsView.prototype._showDOMStorageItems):
(WebInspector.DOMStorageItemsView.prototype._dataGridForDOMStorageItems):
* inspector/front-end/ResourcesPanel.js: Follow the updated DOMStorage model.
(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: Remove instrumentation calls.
(WebCore::DOMWindow::sessionStorage):
(WebCore::DOMWindow::localStorage):

LayoutTests: 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:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@143593 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