Diff
Modified: trunk/LayoutTests/ChangeLog (118348 => 118349)
--- trunk/LayoutTests/ChangeLog 2012-05-24 11:27:01 UTC (rev 118348)
+++ trunk/LayoutTests/ChangeLog 2012-05-24 11:28:50 UTC (rev 118349)
@@ -1,3 +1,16 @@
+2012-05-24 Vivek Galatage <[email protected]>
+
+ Web Inspector: localStorage items are not updated when the storage changes
+ https://bugs.webkit.org/show_bug.cgi?id=83012
+
+ Reviewed by Pavel Feldman.
+
+ Test to verify the storage list is updated in the inspector frontend
+ whenever there is any modifications to dom storage.
+
+ * inspector/storage-panel-dom-storage-update-expected.txt: Added.
+ * inspector/storage-panel-dom-storage-update.html: Added.
+
2012-05-24 Kristóf Kosztyó <[email protected]>
[Qt] REGRESSION(r118291) fast/frames/flattening/iframe-tiny.html fails
Added: trunk/LayoutTests/inspector/storage-panel-dom-storage-update-expected.txt (0 => 118349)
--- trunk/LayoutTests/inspector/storage-panel-dom-storage-update-expected.txt (rev 0)
+++ trunk/LayoutTests/inspector/storage-panel-dom-storage-update-expected.txt 2012-05-24 11:28:50 UTC (rev 118349)
@@ -0,0 +1,31 @@
+Test that storage panel is present and that it contains correct data whenever localStorage is updated.
+
+
+Running: initialize
+Initialized localStorage by clearing entries
+
+Running: updateLocalStorageView
+Resource Panel with localStorage view updated
+
+Running: addItemTest
+addItem('a1','=value1')
+KeyValue pairs: [a1=value1]
+addItem('a2','=value2')
+KeyValue pairs: [a1=value1,a2=value2]
+addItem('a3','=value3')
+KeyValue pairs: [a1=value1,a2=value2,a3=value3]
+addItem('a4','=value4')
+KeyValue pairs: [a1=value1,a2=value2,a3=value3,a4=value4]
+addItem('a5','=value5')
+KeyValue pairs: [a1=value1,a2=value2,a3=value3,a4=value4,a5=value5]
+
+Running: removeItemTest
+removeItem('a5')
+KeyValue pairs: [a1=value1,a2=value2,a3=value3,a4=value4]
+removeItem('a4')
+KeyValue pairs: [a1=value1,a2=value2,a3=value3]
+
+Running: clearTest
+clear()
+KeyValue pairs: []
+
Property changes on: trunk/LayoutTests/inspector/storage-panel-dom-storage-update-expected.txt
___________________________________________________________________
Added: svn:eol-style
Added: trunk/LayoutTests/inspector/storage-panel-dom-storage-update.html (0 => 118349)
--- trunk/LayoutTests/inspector/storage-panel-dom-storage-update.html (rev 0)
+++ trunk/LayoutTests/inspector/storage-panel-dom-storage-update.html 2012-05-24 11:28:50 UTC (rev 118349)
@@ -0,0 +1,150 @@
+<html>
+<head>
+<script src=""
+<script>
+
+function addItem(key,value)
+{
+ localStorage.setItem(key,value);
+}
+
+function removeItem(key)
+{
+ localStorage.removeItem(key);
+}
+
+function clear()
+{
+ localStorage.clear();
+}
+
+function test()
+{
+ var storage = null;
+ var rootNode = null;
+ var count = 1;
+
+ // Resources panel must be visible
+ WebInspector.showPanel("resources");
+
+ function dumpDataGrid()
+ {
+ var nodes = rootNode.children;
+ var rows = [];
+ for (var i = 0; i < nodes.length; ++i) {
+ var node = nodes[i];
+ if (node._data[0].length)
+ rows.push(node._data[0] + node._data[1]);
+ }
+ rows.sort();
+ InspectorTest.addResult("KeyValue pairs: [" + rows.join() + "]");
+ }
+
+ InspectorTest.runTestSuite([
+ function initialize(next)
+ {
+ function initialized(result)
+ {
+ InspectorTest.addResult("Initialized localStorage by clearing entries");
+ next();
+ }
+ InspectorTest.evaluateInPage("clear()", initialized );
+ },
+
+ function updateLocalStorageView(next)
+ {
+ function localStorageViewUpdated()
+ {
+ rootNode = storage._domStorageView._dataGrid.rootNode();
+ InspectorTest.addResult("Resource Panel with localStorage view updated");
+ next();
+ }
+ var storages = WebInspector.panels.resources._domStorage;
+
+ for (var i = 0; i < storages.length; ++i) {
+ storage = storages[i];
+ if (storage.isLocalStorage) {
+ WebInspector.inspectorView.currentPanel().showDOMStorage(storage);
+ InspectorTest.runAfterPendingDispatches(localStorageViewUpdated);
+ break;
+ }
+ }
+ },
+
+ function addItemTest(next)
+ {
+ function viewUpdatedAfterAddition()
+ {
+ InspectorTest.runAfterPendingDispatches(function() {
+ rootNode = storage._domStorageView._dataGrid.rootNode();
+ dumpDataGrid();
+ if (count < 6)
+ addItemTest(next);
+ else
+ next();
+ });
+ }
+
+ function itemAdded(result)
+ {
+ viewUpdatedAfterAddition();
+ }
+
+ InspectorTest.addResult("addItem('a"+count+"','=value"+count+"')");
+ InspectorTest.evaluateInPage("addItem('a"+count+"','=value"+count+"')", itemAdded );
+ count++;
+ },
+
+ function removeItemTest(next)
+ {
+ function viewUpdatedAfterRemoval()
+ {
+ InspectorTest.runAfterPendingDispatches(function() {
+ rootNode = storage._domStorageView._dataGrid.rootNode();
+ dumpDataGrid();
+ if (count > 4)
+ removeItemTest(next);
+ else
+ next();
+ });
+ }
+
+ function itemRemoved(result)
+ {
+ setTimeout(viewUpdatedAfterRemoval, 0 );
+ }
+
+ --count;
+ InspectorTest.addResult("removeItem('a"+count+"')");
+ InspectorTest.evaluateInPage("removeItem('a"+count+"')", itemRemoved );
+ },
+
+ function clearTest(next)
+ {
+ function viewUpdatedAfterClear()
+ {
+ InspectorTest.runAfterPendingDispatches(function() {
+ rootNode = storage._domStorageView._dataGrid.rootNode();
+ dumpDataGrid();
+ next();
+ });
+ }
+
+ function cleared(result)
+ {
+ setTimeout(viewUpdatedAfterClear, 0 );
+ }
+
+ InspectorTest.addResult("clear()");
+ InspectorTest.evaluateInPage("clear()", cleared );
+ }
+ ]);
+}
+</script>
+</head>
+
+<body _onload_="runTest()">
+<p>Test that storage panel is present and that it contains correct data whenever localStorage is updated.</p>
+</body>
+</html>
+
Property changes on: trunk/LayoutTests/inspector/storage-panel-dom-storage-update.html
___________________________________________________________________
Added: svn:eol-style
Modified: trunk/Source/WebCore/ChangeLog (118348 => 118349)
--- trunk/Source/WebCore/ChangeLog 2012-05-24 11:27:01 UTC (rev 118348)
+++ trunk/Source/WebCore/ChangeLog 2012-05-24 11:28:50 UTC (rev 118349)
@@ -1,3 +1,53 @@
+2012-05-24 Vivek Galatage <[email protected]>
+
+ Web Inspector: localStorage items are not updated when the storage changes
+ https://bugs.webkit.org/show_bug.cgi?id=83012
+
+ Reviewed by Pavel Feldman.
+
+ Renamed the inspector protocol UpdateDOMStorage to domStorageUpdated.
+ Instrumented StorageEventDispatcher to send the update event to the
+ front-end. Also removed the way DOM Storage Agent used to listen for
+ the storage events. Added new test to verify the update notifications.
+
+ Test: inspector/storage-panel-dom-storage-update.html
+
+ * dom/EventListener.h:
+ * inspector/Inspector.json:
+ * inspector/InspectorDOMStorageAgent.cpp:
+ (WebCore):
+ (WebCore::InspectorDOMStorageAgent::getDOMStorageEntries):
+ (WebCore::InspectorDOMStorageAgent::storageId):
+ (WebCore::InspectorDOMStorageAgent::didUseDOMStorage):
+ (WebCore::InspectorDOMStorageAgent::didDispatchDOMStorageEvent):
+ * inspector/InspectorDOMStorageAgent.h:
+ (InspectorDOMStorageAgent):
+ * inspector/InspectorDOMStorageResource.cpp:
+ (WebCore::InspectorDOMStorageResource::InspectorDOMStorageResource):
+ (WebCore::InspectorDOMStorageResource::isSameHostAndType):
+ (WebCore::InspectorDOMStorageResource::unbind):
+ * inspector/InspectorDOMStorageResource.h:
+ (WebCore):
+ (InspectorDOMStorageResource):
+ (WebCore::InspectorDOMStorageResource::create):
+ (WebCore::InspectorDOMStorageResource::id):
+ (WebCore::InspectorDOMStorageResource::storageArea):
+ (WebCore::InspectorDOMStorageResource::frame):
+ * inspector/InspectorInstrumentation.cpp:
+ (WebCore::InspectorInstrumentation::didDispatchDOMStorageEventImpl):
+ (WebCore):
+ * inspector/InspectorInstrumentation.h:
+ (InspectorInstrumentation):
+ (WebCore::InspectorInstrumentation::didUseDOMStorage):
+ (WebCore):
+ (WebCore::InspectorInstrumentation::didDispatchDOMStorageEvent):
+ * inspector/front-end/DOMStorage.js:
+ (WebInspector.DOMStorageDispatcher.prototype.domStorageUpdated):
+ * inspector/front-end/ResourcesPanel.js:
+ (WebInspector.ResourcesPanel.prototype.domStorageUpdated):
+ * storage/StorageEventDispatcher.cpp:
+ (WebCore::StorageEventDispatcher::dispatch):
+
2012-05-23 Ilya Tikhonovsky <[email protected]>
Web Inspector: introduce console proxy object for HeapSnapshot worker.
Modified: trunk/Source/WebCore/dom/EventListener.h (118348 => 118349)
--- trunk/Source/WebCore/dom/EventListener.h 2012-05-24 11:27:01 UTC (rev 118348)
+++ trunk/Source/WebCore/dom/EventListener.h 2012-05-24 11:28:50 UTC (rev 118349)
@@ -38,7 +38,6 @@
enum Type {
JSEventListenerType,
ImageEventListenerType,
- InspectorDOMStorageResourceType,
ObjCEventListenerType,
CPPEventListenerType,
ConditionEventListenerType,
Modified: trunk/Source/WebCore/inspector/Inspector.json (118348 => 118349)
--- trunk/Source/WebCore/inspector/Inspector.json 2012-05-24 11:27:01 UTC (rev 118348)
+++ trunk/Source/WebCore/inspector/Inspector.json 2012-05-24 11:28:50 UTC (rev 118349)
@@ -1281,7 +1281,7 @@
]
},
{
- "name": "updateDOMStorage",
+ "name": "domStorageUpdated",
"parameters": [
{ "name": "storageId", "$ref": "StorageId" }
]
Modified: trunk/Source/WebCore/inspector/InspectorDOMStorageAgent.cpp (118348 => 118349)
--- trunk/Source/WebCore/inspector/InspectorDOMStorageAgent.cpp 2012-05-24 11:27:01 UTC (rev 118348)
+++ trunk/Source/WebCore/inspector/InspectorDOMStorageAgent.cpp 2012-05-24 11:28:50 UTC (rev 118349)
@@ -34,6 +34,7 @@
#include "Database.h"
#include "DOMWindow.h"
+#include "Document.h"
#include "ExceptionCode.h"
#include "Frame.h"
#include "InspectorDOMStorageResource.h"
@@ -53,8 +54,6 @@
static const char domStorageAgentEnabled[] = "domStorageAgentEnabled";
};
-typedef HashMap<int, RefPtr<InspectorDOMStorageResource> > DOMStorageResourcesMap;
-
InspectorDOMStorageAgent::InspectorDOMStorageAgent(InstrumentingAgents* instrumentingAgents, InspectorState* state)
: InspectorBaseAgent<InspectorDOMStorageAgent>("DOMStorage", instrumentingAgents, state)
, m_frontend(0)
@@ -120,7 +119,6 @@
if (!frame)
return;
- storageResource->startReportingChangesToFrontend();
StorageArea* storageArea = storageResource->storageArea();
for (unsigned i = 0; i < storageArea->length(frame); ++i) {
String name(storageArea->key(i, frame));
@@ -161,12 +159,23 @@
bool isLocalStorage = (frame->domWindow()->localStorage(ec) == storage && !ec);
DOMStorageResourcesMap::iterator domStorageEnd = m_resources.end();
for (DOMStorageResourcesMap::iterator it = m_resources.begin(); it != domStorageEnd; ++it) {
- if (it->second->isSameHostAndType(frame, isLocalStorage))
+ if (it->second->isSameHostAndType(frame->document()->securityOrigin(), isLocalStorage))
return it->first;
}
return String();
}
+String InspectorDOMStorageAgent::storageId(SecurityOrigin* securityOrigin, bool isLocalStorage)
+{
+ ASSERT(securityOrigin);
+ DOMStorageResourcesMap::iterator domStorageEnd = m_resources.end();
+ for (DOMStorageResourcesMap::iterator it = m_resources.begin(); it != domStorageEnd; ++it) {
+ if (it->second->isSameHostAndType(securityOrigin, isLocalStorage))
+ return it->first;
+ }
+ return String();
+}
+
InspectorDOMStorageResource* InspectorDOMStorageAgent::getDOMStorageResourceForId(const String& storageId)
{
DOMStorageResourcesMap::iterator it = m_resources.find(storageId);
@@ -179,7 +188,7 @@
{
DOMStorageResourcesMap::iterator domStorageEnd = m_resources.end();
for (DOMStorageResourcesMap::iterator it = m_resources.begin(); it != domStorageEnd; ++it) {
- if (it->second->isSameHostAndType(frame, isLocalStorage))
+ if (it->second->isSameHostAndType(frame->document()->securityOrigin(), isLocalStorage))
return;
}
@@ -192,6 +201,19 @@
resource->bind(m_frontend);
}
+void InspectorDOMStorageAgent::didDispatchDOMStorageEvent(const String&, const String&, const String&, StorageType storageType, SecurityOrigin* securityOrigin, Page*)
+{
+ if (!m_frontend || !m_enabled)
+ return;
+
+ String id = storageId(securityOrigin, storageType == LocalStorage);
+
+ if (id.isEmpty())
+ return;
+
+ m_frontend->domstorage()->domStorageUpdated(id);
+}
+
void InspectorDOMStorageAgent::clearResources()
{
m_resources.clear();
Modified: trunk/Source/WebCore/inspector/InspectorDOMStorageAgent.h (118348 => 118349)
--- trunk/Source/WebCore/inspector/InspectorDOMStorageAgent.h 2012-05-24 11:27:01 UTC (rev 118348)
+++ trunk/Source/WebCore/inspector/InspectorDOMStorageAgent.h 2012-05-24 11:28:50 UTC (rev 118349)
@@ -31,6 +31,7 @@
#include "InspectorBaseAgent.h"
#include "PlatformString.h"
+#include "StorageArea.h"
#include <wtf/HashMap.h>
#include <wtf/PassOwnPtr.h>
@@ -42,6 +43,7 @@
class InspectorFrontend;
class InspectorState;
class InstrumentingAgents;
+class Page;
class Storage;
class StorageArea;
@@ -70,9 +72,11 @@
// Called from the injected script.
String storageId(Storage*);
+ String 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*);
private:
InspectorDOMStorageAgent(InstrumentingAgents*, InspectorState*);
Modified: trunk/Source/WebCore/inspector/InspectorDOMStorageResource.cpp (118348 => 118349)
--- trunk/Source/WebCore/inspector/InspectorDOMStorageResource.cpp 2012-05-24 11:27:01 UTC (rev 118348)
+++ trunk/Source/WebCore/inspector/InspectorDOMStorageResource.cpp 2012-05-24 11:28:50 UTC (rev 118349)
@@ -52,8 +52,7 @@
int InspectorDOMStorageResource::s_nextUnusedId = 1;
InspectorDOMStorageResource::InspectorDOMStorageResource(StorageArea* storageArea, bool isLocalStorage, Frame* frame)
- : EventListener(InspectorDOMStorageResourceType)
- , m_storageArea(storageArea)
+ : m_storageArea(storageArea)
, m_isLocalStorage(isLocalStorage)
, m_frame(frame)
, m_frontend(0)
@@ -62,9 +61,9 @@
{
}
-bool InspectorDOMStorageResource::isSameHostAndType(Frame* frame, bool isLocalStorage) const
+bool InspectorDOMStorageResource::isSameHostAndType(SecurityOrigin* securityOrigin, bool isLocalStorage) const
{
- return equalIgnoringCase(m_frame->document()->securityOrigin()->host(), frame->document()->securityOrigin()->host()) && m_isLocalStorage == isLocalStorage;
+ return equalIgnoringCase(m_frame->document()->securityOrigin()->host(), securityOrigin->host()) && m_isLocalStorage == isLocalStorage;
}
void InspectorDOMStorageResource::bind(InspectorFrontend* frontend)
@@ -84,41 +83,9 @@
if (!m_frontend)
return; // Already unbound.
- if (m_reportingChangesToFrontend) {
- m_frame->domWindow()->removeEventListener(eventNames().storageEvent, this, true);
- m_reportingChangesToFrontend = false;
- }
m_frontend = 0;
}
-void InspectorDOMStorageResource::startReportingChangesToFrontend()
-{
- ASSERT(m_frontend);
- if (!m_reportingChangesToFrontend) {
- m_frame->domWindow()->addEventListener(eventNames().storageEvent, this, true);
- m_reportingChangesToFrontend = true;
- }
-}
-
-void InspectorDOMStorageResource::handleEvent(ScriptExecutionContext*, Event* event)
-{
- ASSERT(m_frontend);
- if (event->type() != eventNames().storageEvent || event->hasInterface(eventNames().interfaceForStorageEvent))
- return;
-
- StorageEvent* storageEvent = static_cast<StorageEvent*>(event);
- Storage* storage = storageEvent->storageArea();
- ExceptionCode ec = 0;
- bool isLocalStorage = (storage->frame()->domWindow()->localStorage(ec) == storage && !ec);
- if (isSameHostAndType(storage->frame(), isLocalStorage))
- m_frontend->updateDOMStorage(m_id);
-}
-
-bool InspectorDOMStorageResource::operator==(const EventListener& listener)
-{
- return (this == InspectorDOMStorageResource::cast(&listener));
-}
-
} // namespace WebCore
#endif // ENABLE(INSPECTOR)
Modified: trunk/Source/WebCore/inspector/InspectorDOMStorageResource.h (118348 => 118349)
--- trunk/Source/WebCore/inspector/InspectorDOMStorageResource.h 2012-05-24 11:27:01 UTC (rev 118348)
+++ trunk/Source/WebCore/inspector/InspectorDOMStorageResource.h 2012-05-24 11:28:50 UTC (rev 118349)
@@ -31,7 +31,6 @@
#ifndef InspectorDOMStorageResource_h
#define InspectorDOMStorageResource_h
-#include "EventListener.h"
#include "InspectorFrontend.h"
#include <wtf/PassRefPtr.h>
@@ -39,49 +38,39 @@
#include <wtf/RefPtr.h>
namespace WebCore {
+class SecurityOrigin;
+class StorageArea;
+class Frame;
+class InspectorFrontend;
- 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));
+ }
- class InspectorDOMStorageResource : public EventListener {
- public:
- static PassRefPtr<InspectorDOMStorageResource> create(StorageArea* storageArea, bool isLocalStorage, Frame* frame)
- {
- return adoptRef(new InspectorDOMStorageResource(storageArea, isLocalStorage, frame));
- }
+ void bind(InspectorFrontend*);
+ void unbind();
- static const InspectorDOMStorageResource* cast(const EventListener* listener)
- {
- return listener->type() == InspectorDOMStorageResourceType ? static_cast<const InspectorDOMStorageResource*>(listener) : 0;
- }
+ bool isSameHostAndType(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 bind(InspectorFrontend* frontend);
- void unbind();
- void startReportingChangesToFrontend();
+private:
+ InspectorDOMStorageResource(StorageArea*, bool isLocalStorage, Frame*);
- virtual void handleEvent(ScriptExecutionContext*, Event*);
- virtual bool operator==(const EventListener& listener);
+ RefPtr<StorageArea> m_storageArea;
+ bool m_isLocalStorage;
+ RefPtr<Frame> m_frame;
+ InspectorFrontend::DOMStorage* m_frontend;
+ String m_id;
+ bool m_reportingChangesToFrontend;
- bool isSameHostAndType(Frame*, bool isLocalStorage) const;
- String id() const { return m_id; }
- StorageArea* storageArea() const { return m_storageArea.get(); }
- Frame* frame() const { return m_frame.get(); }
+ static int s_nextUnusedId;
+};
- private:
-
- InspectorDOMStorageResource(StorageArea*, bool isLocalStorage, Frame*);
-
- RefPtr<StorageArea> m_storageArea;
- bool m_isLocalStorage;
- RefPtr<Frame> m_frame;
- InspectorFrontend::DOMStorage* m_frontend;
- String m_id;
- bool m_reportingChangesToFrontend;
-
- static int s_nextUnusedId;
- };
-
} // namespace WebCore
#endif // InspectorDOMStorageResource_h
Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp (118348 => 118349)
--- trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp 2012-05-24 11:27:01 UTC (rev 118348)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp 2012-05-24 11:28:50 UTC (rev 118349)
@@ -926,6 +926,12 @@
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())
+ domStorageAgent->didDispatchDOMStorageEvent(key, oldValue, newValue, storageType, securityOrigin, page);
+}
+
#if ENABLE(WORKERS)
bool InspectorInstrumentation::shouldPauseDedicatedWorkerOnStartImpl(InstrumentingAgents* instrumentingAgents)
{
Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.h (118348 => 118349)
--- trunk/Source/WebCore/inspector/InspectorInstrumentation.h 2012-05-24 11:27:01 UTC (rev 118348)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.h 2012-05-24 11:28:50 UTC (rev 118349)
@@ -38,6 +38,7 @@
#include "Frame.h"
#include "Page.h"
#include "ScriptExecutionContext.h"
+#include "StorageArea.h"
#if USE(JSC)
namespace JSC {
@@ -217,6 +218,7 @@
#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)
static bool shouldPauseDedicatedWorkerOnStart(ScriptExecutionContext*);
@@ -374,6 +376,7 @@
#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)
static bool shouldPauseDedicatedWorkerOnStartImpl(InstrumentingAgents*);
@@ -1175,6 +1178,15 @@
#endif
}
+inline void InspectorInstrumentation::didDispatchDOMStorageEvent(const String& key, const String& oldValue, const String& newValue, StorageType storageType, SecurityOrigin* securityOrigin, Page* page)
+{
+#if ENABLE(INSPECTOR)
+ FAST_RETURN_IF_NO_FRONTENDS(void());
+ if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
+ didDispatchDOMStorageEventImpl(instrumentingAgents, key, oldValue, newValue, storageType, securityOrigin, page);
+#endif // ENABLE(INSPECTOR)
+}
+
#if ENABLE(WORKERS)
inline bool InspectorInstrumentation::shouldPauseDedicatedWorkerOnStart(ScriptExecutionContext* context)
{
Modified: trunk/Source/WebCore/inspector/front-end/DOMStorage.js (118348 => 118349)
--- trunk/Source/WebCore/inspector/front-end/DOMStorage.js 2012-05-24 11:27:01 UTC (rev 118348)
+++ trunk/Source/WebCore/inspector/front-end/DOMStorage.js 2012-05-24 11:28:50 UTC (rev 118349)
@@ -108,8 +108,8 @@
/**
* @param {string} storageId
*/
- updateDOMStorage: function(storageId)
+ domStorageUpdated: function(storageId)
{
- WebInspector.panels.resources.updateDOMStorage(storageId);
+ WebInspector.panels.resources.domStorageUpdated(storageId);
}
}
Modified: trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js (118348 => 118349)
--- trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js 2012-05-24 11:27:01 UTC (rev 118348)
+++ trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js 2012-05-24 11:28:50 UTC (rev 118349)
@@ -521,7 +521,7 @@
database.getTableNames(tableNamesCallback);
},
- updateDOMStorage: function(storageId)
+ domStorageUpdated: function(storageId)
{
var domStorage = this._domStorageForId(storageId);
if (!domStorage)
Modified: trunk/Source/WebCore/storage/StorageEventDispatcher.cpp (118348 => 118349)
--- trunk/Source/WebCore/storage/StorageEventDispatcher.cpp 2012-05-24 11:27:01 UTC (rev 118348)
+++ trunk/Source/WebCore/storage/StorageEventDispatcher.cpp 2012-05-24 11:28:50 UTC (rev 118349)
@@ -30,6 +30,7 @@
#include "DOMWindow.h"
#include "EventNames.h"
#include "Frame.h"
+#include "InspectorInstrumentation.h"
#include "Page.h"
#include "PageGroup.h"
#include "SecurityOrigin.h"
@@ -52,6 +53,7 @@
if (sourceFrame != frame && frame->document()->securityOrigin()->equal(securityOrigin))
frames.append(frame);
}
+ InspectorInstrumentation::didDispatchDOMStorageEvent(key, oldValue, newValue, storageType, securityOrigin, page);
for (unsigned i = 0; i < frames.size(); ++i) {
ExceptionCode ec = 0;
@@ -68,6 +70,7 @@
if (sourceFrame != frame && frame->document()->securityOrigin()->equal(securityOrigin))
frames.append(frame);
}
+ InspectorInstrumentation::didDispatchDOMStorageEvent(key, oldValue, newValue, storageType, securityOrigin, *it);
}
for (unsigned i = 0; i < frames.size(); ++i) {
Modified: trunk/Source/WebKit/chromium/ChangeLog (118348 => 118349)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-05-24 11:27:01 UTC (rev 118348)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-05-24 11:28:50 UTC (rev 118349)
@@ -1,3 +1,16 @@
+2012-05-24 Vivek Galatage <[email protected]>
+
+ Web Inspector: localStorage items are not updated when the storage changes
+ https://bugs.webkit.org/show_bug.cgi?id=83012
+
+ Reviewed by Pavel Feldman.
+
+ Instrumented the DOM Storage Events in order to update the frontend.
+
+ * src/StorageAreaProxy.cpp:
+ (WebCore::StorageAreaProxy::dispatchLocalStorageEvent):
+ (WebCore::StorageAreaProxy::dispatchSessionStorageEvent):
+
2012-05-23 Ojan Vafai <[email protected]>
add back the ability to disable flexbox
Modified: trunk/Source/WebKit/chromium/src/StorageAreaProxy.cpp (118348 => 118349)
--- trunk/Source/WebKit/chromium/src/StorageAreaProxy.cpp 2012-05-24 11:27:01 UTC (rev 118348)
+++ trunk/Source/WebKit/chromium/src/StorageAreaProxy.cpp 2012-05-24 11:28:50 UTC (rev 118349)
@@ -32,6 +32,7 @@
#include "EventNames.h"
#include "ExceptionCode.h"
#include "Frame.h"
+#include "InspectorInstrumentation.h"
#include "Page.h"
#include "PageGroup.h"
#include "SecurityOrigin.h"
@@ -129,6 +130,7 @@
if (storage && frame->document()->securityOrigin()->equal(securityOrigin) && !isEventSource(storage, sourceAreaInstance))
frame->document()->enqueueWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, pageURL, storage));
}
+ InspectorInstrumentation::didDispatchDOMStorageEvent(key, oldValue, newValue, LocalStorage, securityOrigin, *it);
}
}
@@ -157,6 +159,7 @@
if (storage && frame->document()->securityOrigin()->equal(securityOrigin) && !isEventSource(storage, sourceAreaInstance))
frame->document()->enqueueWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, pageURL, storage));
}
+ InspectorInstrumentation::didDispatchDOMStorageEvent(key, oldValue, newValue, SessionStorage, securityOrigin, page);
}
bool StorageAreaProxy::isEventSource(Storage* storage, WebKit::WebStorageArea* sourceAreaInstance)