Commit 28fe0111 authored by eric@webkit.org's avatar eric@webkit.org

2009-09-22 Yury Semikhatsky <yurys@chromium.org>

        Reviewed by Timothy Hatcher.

        WebInspector: Migrate Databases tab to InjectedScript /
        serialized interaction.

        DOMStorage interaction is now serialized into JSON messages
        and doesn't require quarantined objects.

        https://bugs.webkit.org/show_bug.cgi?id=28873

        * dom/EventListener.h:
        (WebCore::EventListener::):
        * inspector/InspectorBackend.cpp:
        (WebCore::InspectorBackend::selectDOMStorage):
        (WebCore::InspectorBackend::getDOMStorageEntries):
        (WebCore::InspectorBackend::setDOMStorageItem):
        (WebCore::InspectorBackend::removeDOMStorageItem):
        * inspector/InspectorBackend.h:
        * inspector/InspectorBackend.idl:
        * inspector/InspectorController.cpp:
        (WebCore::InspectorController::didCommitLoad):
        (WebCore::InspectorController::selectDOMStorage):
        (WebCore::InspectorController::getDOMStorageEntries):
        (WebCore::InspectorController::setDOMStorageItem):
        (WebCore::InspectorController::removeDOMStorageItem):
        (WebCore::InspectorController::getDOMStorageResourceForId):
        * inspector/InspectorController.h:
        * inspector/InspectorDOMStorageResource.cpp:
        (WebCore::InspectorDOMStorageResource::InspectorDOMStorageResource):
        (WebCore::InspectorDOMStorageResource::bind):
        (WebCore::InspectorDOMStorageResource::unbind):
        (WebCore::InspectorDOMStorageResource::startReportingChangesToFrontend):
        (WebCore::InspectorDOMStorageResource::handleEvent):
        (WebCore::InspectorDOMStorageResource::operator==):
        * inspector/InspectorDOMStorageResource.h:
        (WebCore::InspectorDOMStorageResource::cast):
        (WebCore::InspectorDOMStorageResource::id):
        (WebCore::InspectorDOMStorageResource::domStorage):
        * inspector/InspectorFrontend.cpp:
        (WebCore::InspectorFrontend::selectDOMStorage):
        (WebCore::InspectorFrontend::didGetDOMStorageEntries):
        (WebCore::InspectorFrontend::didSetDOMStorageItem):
        (WebCore::InspectorFrontend::didRemoveDOMStorageItem):
        (WebCore::InspectorFrontend::updateDOMStorage):
        * inspector/InspectorFrontend.h:
        * inspector/front-end/DOMStorage.js:
        (WebInspector.DOMStorage):
        (WebInspector.DOMStorage.prototype.get id):
        (WebInspector.DOMStorage.prototype.get domStorage):
        (WebInspector.DOMStorage.prototype.get isLocalStorage):
        (WebInspector.DOMStorage.prototype.getEntriesAsync):
        (WebInspector.DOMStorage.prototype.setItemAsync):
        (WebInspector.DOMStorage.prototype.removeItemAsync):
        * inspector/front-end/DOMStorageDataGrid.js:
        (WebInspector.DOMStorageDataGrid):
        (WebInspector.DOMStorageDataGrid.prototype._startEditingColumnOfDataGridNode):
        (WebInspector.DOMStorageDataGrid.prototype._startEditing):
        (WebInspector.DOMStorageDataGrid.prototype._editingCommitted):
        (WebInspector.DOMStorageDataGrid.prototype._editingCancelled):
        (WebInspector.DOMStorageDataGrid.prototype.deleteSelectedRow):
        * inspector/front-end/DOMStorageItemsView.js:
        (WebInspector.DOMStorageItemsView.prototype.update):
        (WebInspector.DOMStorageItemsView.prototype._showDOMStorageEntries):
        (WebInspector.DOMStorageItemsView.prototype._dataGridForDOMStorageEntries):
        * inspector/front-end/StoragePanel.js:
        (WebInspector.StoragePanel.prototype.show):
        (WebInspector.StoragePanel.prototype.reset):
        (WebInspector.StoragePanel.prototype.selectDOMStorage):
        (WebInspector.StoragePanel.prototype.updateDOMStorage):
        (WebInspector.StoragePanel.prototype._domStorageForId):
        * inspector/front-end/inspector.js:
        (WebInspector.addDOMStorage):
        (WebInspector.updateDOMStorage):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48659 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 4704ab46
2009-09-22 Yury Semikhatsky <yurys@chromium.org>
Reviewed by Timothy Hatcher.
WebInspector: Migrate Databases tab to InjectedScript /
serialized interaction.
DOMStorage interaction is now serialized into JSON messages
and doesn't require quarantined objects.
https://bugs.webkit.org/show_bug.cgi?id=28873
* dom/EventListener.h:
(WebCore::EventListener::):
* inspector/InspectorBackend.cpp:
(WebCore::InspectorBackend::selectDOMStorage):
(WebCore::InspectorBackend::getDOMStorageEntries):
(WebCore::InspectorBackend::setDOMStorageItem):
(WebCore::InspectorBackend::removeDOMStorageItem):
* inspector/InspectorBackend.h:
* inspector/InspectorBackend.idl:
* inspector/InspectorController.cpp:
(WebCore::InspectorController::didCommitLoad):
(WebCore::InspectorController::selectDOMStorage):
(WebCore::InspectorController::getDOMStorageEntries):
(WebCore::InspectorController::setDOMStorageItem):
(WebCore::InspectorController::removeDOMStorageItem):
(WebCore::InspectorController::getDOMStorageResourceForId):
* inspector/InspectorController.h:
* inspector/InspectorDOMStorageResource.cpp:
(WebCore::InspectorDOMStorageResource::InspectorDOMStorageResource):
(WebCore::InspectorDOMStorageResource::bind):
(WebCore::InspectorDOMStorageResource::unbind):
(WebCore::InspectorDOMStorageResource::startReportingChangesToFrontend):
(WebCore::InspectorDOMStorageResource::handleEvent):
(WebCore::InspectorDOMStorageResource::operator==):
* inspector/InspectorDOMStorageResource.h:
(WebCore::InspectorDOMStorageResource::cast):
(WebCore::InspectorDOMStorageResource::id):
(WebCore::InspectorDOMStorageResource::domStorage):
* inspector/InspectorFrontend.cpp:
(WebCore::InspectorFrontend::selectDOMStorage):
(WebCore::InspectorFrontend::didGetDOMStorageEntries):
(WebCore::InspectorFrontend::didSetDOMStorageItem):
(WebCore::InspectorFrontend::didRemoveDOMStorageItem):
(WebCore::InspectorFrontend::updateDOMStorage):
* inspector/InspectorFrontend.h:
* inspector/front-end/DOMStorage.js:
(WebInspector.DOMStorage):
(WebInspector.DOMStorage.prototype.get id):
(WebInspector.DOMStorage.prototype.get domStorage):
(WebInspector.DOMStorage.prototype.get isLocalStorage):
(WebInspector.DOMStorage.prototype.getEntriesAsync):
(WebInspector.DOMStorage.prototype.setItemAsync):
(WebInspector.DOMStorage.prototype.removeItemAsync):
* inspector/front-end/DOMStorageDataGrid.js:
(WebInspector.DOMStorageDataGrid):
(WebInspector.DOMStorageDataGrid.prototype._startEditingColumnOfDataGridNode):
(WebInspector.DOMStorageDataGrid.prototype._startEditing):
(WebInspector.DOMStorageDataGrid.prototype._editingCommitted):
(WebInspector.DOMStorageDataGrid.prototype._editingCancelled):
(WebInspector.DOMStorageDataGrid.prototype.deleteSelectedRow):
* inspector/front-end/DOMStorageItemsView.js:
(WebInspector.DOMStorageItemsView.prototype.update):
(WebInspector.DOMStorageItemsView.prototype._showDOMStorageEntries):
(WebInspector.DOMStorageItemsView.prototype._dataGridForDOMStorageEntries):
* inspector/front-end/StoragePanel.js:
(WebInspector.StoragePanel.prototype.show):
(WebInspector.StoragePanel.prototype.reset):
(WebInspector.StoragePanel.prototype.selectDOMStorage):
(WebInspector.StoragePanel.prototype.updateDOMStorage):
(WebInspector.StoragePanel.prototype._domStorageForId):
* inspector/front-end/inspector.js:
(WebInspector.addDOMStorage):
(WebInspector.updateDOMStorage):
2009-09-22 Sam Weinig <sam@webkit.org>
Reviewed by Alexey Proskuryakov.
......@@ -37,7 +37,8 @@ namespace WebCore {
public:
enum Type { JSEventListenerType,
ImageEventListenerType,
InspectorDOMAgentType,
InspectorDOMAgentType,
InspectorDOMStorageResourceType,
ObjCEventListenerType,
ConditionEventListenerType };
......
......@@ -502,8 +502,26 @@ void InspectorBackend::selectDatabase(Database* database)
#if ENABLE(DOM_STORAGE)
void InspectorBackend::selectDOMStorage(Storage* storage)
{
if (InspectorFrontend* frontend = inspectorFrontend())
frontend->selectDOMStorage(storage);
if (m_inspectorController)
m_inspectorController->selectDOMStorage(storage);
}
void InspectorBackend::getDOMStorageEntries(long callId, long storageId)
{
if (m_inspectorController)
m_inspectorController->getDOMStorageEntries(callId, storageId);
}
void InspectorBackend::setDOMStorageItem(long callId, long storageId, const String& key, const String& value)
{
if (m_inspectorController)
m_inspectorController->setDOMStorageItem(callId, storageId, key, value);
}
void InspectorBackend::removeDOMStorageItem(long callId, long storageId, const String& key)
{
if (m_inspectorController)
m_inspectorController->removeDOMStorageItem(callId, storageId, key);
}
#endif
......
......@@ -151,6 +151,9 @@ public:
#endif
#if ENABLE(DOM_STORAGE)
void selectDOMStorage(Storage* storage);
void getDOMStorageEntries(long callId, long storageId);
void setDOMStorageItem(long callId, long storageId, const String& key, const String& value);
void removeDOMStorageItem(long callId, long storageId, const String& key);
#endif
private:
......
......@@ -121,6 +121,9 @@ module core {
#endif
#if defined(ENABLE_DOM_STORAGE) && ENABLE_DOM_STORAGE
[Custom] void selectDOMStorage(in DOMObject storage);
void getDOMStorageEntries(in long callId, in long storageId);
void setDOMStorageItem(in long callId, in long storageId, in DOMString key, in DOMString value);
void removeDOMStorageItem(in long callId, in long storageId, in DOMString key);
#endif
};
}
......@@ -733,6 +733,9 @@ void InspectorController::didCommitLoad(DocumentLoader* loader)
m_currentUserInitiatedProfileNumber = 1;
m_nextUserInitiatedProfileNumber = 1;
#endif
// resetScriptObjects should be called before database and DOM storage
// resources are cleared so that it has a chance to unbind them.
resetScriptObjects();
#if ENABLE(DATABASE)
m_databaseResources.clear();
#endif
......@@ -741,8 +744,6 @@ void InspectorController::didCommitLoad(DocumentLoader* loader)
#endif
if (m_frontend) {
resetScriptObjects();
if (!loader->frameLoader()->isLoadingFromCachedPage()) {
ASSERT(m_mainResource && m_mainResource->isSameLoader(loader));
// We don't add the main resource until its load is committed. This is
......@@ -1110,6 +1111,86 @@ void InspectorController::didUseDOMStorage(StorageArea* storageArea, bool isLoca
if (m_frontend)
resource->bind(m_frontend.get());
}
void InspectorController::selectDOMStorage(Storage* storage)
{
ASSERT(storage);
if (!m_frontend)
return;
Frame* frame = storage->frame();
bool isLocalStorage = (frame->domWindow()->localStorage() == storage);
int storageResourceId = 0;
DOMStorageResourcesSet::iterator domStorageEnd = m_domStorageResources.end();
for (DOMStorageResourcesSet::iterator it = m_domStorageResources.begin(); it != domStorageEnd; ++it) {
if ((*it)->isSameHostAndType(frame, isLocalStorage)) {
storageResourceId = (*it)->id();
break;
}
}
if (storageResourceId)
m_frontend->selectDOMStorage(storageResourceId);
}
void InspectorController::getDOMStorageEntries(int callId, int storageId)
{
if (!m_frontend)
return;
ScriptArray jsonArray = m_frontend->newScriptArray();
InspectorDOMStorageResource* storageResource = getDOMStorageResourceForId(storageId);
if (storageResource) {
storageResource->startReportingChangesToFrontend();
Storage* domStorage = storageResource->domStorage();
for (unsigned i = 0; i < domStorage->length(); ++i) {
String name(domStorage->key(i));
String value(domStorage->getItem(name));
ScriptArray entry = m_frontend->newScriptArray();
entry.set(0, name);
entry.set(1, value);
jsonArray.set(i, entry);
}
}
m_frontend->didGetDOMStorageEntries(callId, jsonArray);
}
void InspectorController::setDOMStorageItem(long callId, long storageId, const String& key, const String& value)
{
if (!m_frontend)
return;
bool success = false;
InspectorDOMStorageResource* storageResource = getDOMStorageResourceForId(storageId);
if (storageResource) {
ExceptionCode exception = 0;
storageResource->domStorage()->setItem(key, value, exception);
success = (exception == 0);
}
m_frontend->didSetDOMStorageItem(callId, success);
}
void InspectorController::removeDOMStorageItem(long callId, long storageId, const String& key)
{
if (!m_frontend)
return;
bool success = false;
InspectorDOMStorageResource* storageResource = getDOMStorageResourceForId(storageId);
if (storageResource) {
storageResource->domStorage()->removeItem(key);
success = true;
}
m_frontend->didRemoveDOMStorageItem(callId, success);
}
InspectorDOMStorageResource* InspectorController::getDOMStorageResourceForId(int storageId)
{
DOMStorageResourcesSet::iterator domStorageEnd = m_domStorageResources.end();
for (DOMStorageResourcesSet::iterator it = m_domStorageResources.begin(); it != domStorageEnd; ++it)
if ((*it)->id() == storageId)
return it->get();
return 0;
}
#endif
void InspectorController::moveWindowBy(float x, float y) const
......
......@@ -74,6 +74,7 @@ class ResourceError;
class ScriptCallStack;
class ScriptString;
class SharedBuffer;
class Storage;
class StorageArea;
class ConsoleMessage;
......@@ -232,6 +233,10 @@ public:
#endif
#if ENABLE(DOM_STORAGE)
void didUseDOMStorage(StorageArea* storageArea, bool isLocalStorage, Frame* frame);
void selectDOMStorage(Storage* storage);
void getDOMStorageEntries(int callId, int storageId);
void setDOMStorageItem(long callId, long storageId, const String& key, const String& value);
void removeDOMStorageItem(long callId, long storageId, const String& key);
#endif
const ResourcesMap& resources() const { return m_resources; }
......@@ -301,6 +306,9 @@ private:
void toggleRecordButton(bool);
void enableDebuggerFromFrontend(bool always);
#endif
#if ENABLE(DOM_STORAGE)
InspectorDOMStorageResource* getDOMStorageResourceForId(int storageId);
#endif
void focusNode();
......
......@@ -35,21 +35,27 @@
#include "InspectorDOMStorageResource.h"
#include "Document.h"
#include "EventNames.h"
#include "Frame.h"
#include "InspectorFrontend.h"
#include "ScriptObject.h"
#include "ScriptObjectQuarantine.h"
#include "Storage.h"
#include "StorageEvent.h"
using namespace JSC;
namespace WebCore {
int InspectorDOMStorageResource::s_nextUnusedId = 1;
InspectorDOMStorageResource::InspectorDOMStorageResource(Storage* domStorage, bool isLocalStorage, Frame* frame)
: m_domStorage(domStorage)
: EventListener(InspectorDOMStorageResourceType)
, m_domStorage(domStorage)
, m_isLocalStorage(isLocalStorage)
, m_frame(frame)
, m_scriptObjectCreated(false)
, m_frontend(0)
, m_id(s_nextUnusedId++)
, m_reportingChangesToFrontend(false)
{
}
......@@ -60,23 +66,49 @@ bool InspectorDOMStorageResource::isSameHostAndType(Frame* frame, bool isLocalSt
void InspectorDOMStorageResource::bind(InspectorFrontend* frontend)
{
if (m_scriptObjectCreated)
return;
ASSERT(!m_frontend);
m_frontend = frontend;
ScriptObject jsonObject = frontend->newScriptObject();
ScriptObject domStorage;
if (!getQuarantinedScriptObject(m_domStorage.get(), domStorage))
return;
jsonObject.set("domStorage", domStorage);
jsonObject.set("host", m_frame->document()->securityOrigin()->host());
jsonObject.set("isLocalStorage", m_isLocalStorage);
if (frontend->addDOMStorage(jsonObject))
m_scriptObjectCreated = true;
jsonObject.set("id", m_id);
frontend->addDOMStorage(jsonObject);
}
void InspectorDOMStorageResource::unbind()
{
m_scriptObjectCreated = false;
ASSERT(m_frontend);
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(Event* event, bool)
{
ASSERT(m_frontend);
ASSERT(eventNames().storageEvent == event->type());
StorageEvent* storageEvent = static_cast<StorageEvent*>(event);
Storage* storage = storageEvent->storageArea();
bool isLocalStorage = storageEvent->source()->localStorage() == storage;
if (isSameHostAndType(storage->frame(), isLocalStorage))
m_frontend->updateDOMStorage(m_id);
}
bool InspectorDOMStorageResource::operator==(const EventListener& listener)
{
return (this == InspectorDOMStorageResource::cast(&listener));
}
} // namespace WebCore
......
......@@ -33,6 +33,7 @@
#if ENABLE(DOM_STORAGE)
#include "EventListener.h"
#include "ScriptObject.h"
#include "ScriptState.h"
......@@ -46,17 +47,27 @@ namespace WebCore {
class Frame;
class InspectorFrontend;
class InspectorDOMStorageResource : public RefCounted<InspectorDOMStorageResource> {
class InspectorDOMStorageResource : public EventListener {
public:
static PassRefPtr<InspectorDOMStorageResource> create(Storage* domStorage, bool isLocalStorage, Frame* frame)
{
return adoptRef(new InspectorDOMStorageResource(domStorage, isLocalStorage, frame));
}
static const InspectorDOMStorageResource* cast(const EventListener* listener)
{
return listener->type() == InspectorDOMStorageResourceType ? static_cast<const InspectorDOMStorageResource*>(listener) : 0;
}
void bind(InspectorFrontend* frontend);
void unbind();
void startReportingChangesToFrontend();
virtual void handleEvent(Event*, bool isWindowEvent);
virtual bool operator==(const EventListener& listener);
bool isSameHostAndType(Frame*, bool isLocalStorage) const;
long id() const { return m_id; }
Storage* domStorage() const { return m_domStorage.get(); }
private:
......@@ -65,8 +76,11 @@ namespace WebCore {
RefPtr<Storage> m_domStorage;
bool m_isLocalStorage;
RefPtr<Frame> m_frame;
bool m_scriptObjectCreated;
InspectorFrontend* m_frontend;
int m_id;
bool m_reportingChangesToFrontend;
static int s_nextUnusedId;
};
} // namespace WebCore
......
......@@ -404,13 +404,41 @@ void InspectorFrontend::selectDatabase(Database* database)
#endif
#if ENABLE(DOM_STORAGE)
void InspectorFrontend::selectDOMStorage(Storage* storage)
void InspectorFrontend::selectDOMStorage(int storageId)
{
OwnPtr<ScriptFunctionCall> function(newFunctionCall("selectDOMStorage"));
ScriptObject quarantinedObject;
if (!getQuarantinedScriptObject(storage, quarantinedObject))
return;
function->appendArgument(quarantinedObject);
function->appendArgument(storageId);
function->call();
}
void InspectorFrontend::didGetDOMStorageEntries(int callId, const ScriptArray& entries)
{
OwnPtr<ScriptFunctionCall> function(newFunctionCall("didGetDOMStorageEntries"));
function->appendArgument(callId);
function->appendArgument(entries);
function->call();
}
void InspectorFrontend::didSetDOMStorageItem(int callId, bool success)
{
OwnPtr<ScriptFunctionCall> function(newFunctionCall("didSetDOMStorageItem"));
function->appendArgument(callId);
function->appendArgument(success);
function->call();
}
void InspectorFrontend::didRemoveDOMStorageItem(int callId, bool success)
{
OwnPtr<ScriptFunctionCall> function(newFunctionCall("didRemoveDOMStorageItem"));
function->appendArgument(callId);
function->appendArgument(success);
function->call();
}
void InspectorFrontend::updateDOMStorage(int storageId)
{
OwnPtr<ScriptFunctionCall> function(newFunctionCall("updateDOMStorage"));
function->appendArgument(storageId);
function->call();
}
#endif
......
......@@ -99,7 +99,11 @@ namespace WebCore {
#if ENABLE(DOM_STORAGE)
bool addDOMStorage(const ScriptObject& domStorageObj);
void selectDOMStorage(Storage* storage);
void selectDOMStorage(int storageId);
void didGetDOMStorageEntries(int callId, const ScriptArray& entries);
void didSetDOMStorageItem(int callId, bool success);
void didRemoveDOMStorageItem(int callId, bool success);
void updateDOMStorage(int storageId);
#endif
void setDocument(const ScriptObject& root);
......
......@@ -26,24 +26,22 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
WebInspector.DOMStorage = function(domStorage, domain, isLocalStorage)
WebInspector.DOMStorage = function(id, domain, isLocalStorage)
{
this.domStorage = domStorage;
this.domain = domain;
this.isLocalStorage = isLocalStorage;
this._id = id;
this._domain = domain;
this._isLocalStorage = isLocalStorage;
}
WebInspector.DOMStorage.prototype = {
get domStorage()
get id()
{
return this._domStorage;
return this._id;
},
set domStorage(x)
get domStorage()
{
if (this._domStorage === x)
return;
this._domStorage = x;
return this._domStorage;
},
get domain()
......@@ -51,22 +49,30 @@ WebInspector.DOMStorage.prototype = {
return this._domain;
},
set domain(x)
get isLocalStorage()
{
return this._isLocalStorage;
},
getEntries: function(callback)
{
if (this._domain === x)
return;
this._domain = x;
var callId = WebInspector.Callback.wrap(callback);
InspectorController.getDOMStorageEntries(callId, this._id);
},
get isLocalStorage()
setItem: function(key, value, callback)
{
return this._isLocalStorage;
var callId = WebInspector.Callback.wrap(callback);
InspectorController.setDOMStorageItem(callId, this._id, key, value);
},
set isLocalStorage(x)
removeItem: function(key, callback)
{
if (this._isLocalStorage === x)
return;
this._isLocalStorage = x;
var callId = WebInspector.Callback.wrap(callback);
InspectorController.removeDOMStorageItem(callId, this._id, key);
}
}
WebInspector.didGetDOMStorageEntries = WebInspector.Callback.processCallback;
WebInspector.didSetDOMStorageItem = WebInspector.Callback.processCallback;
WebInspector.didRemoveDOMStorageItem = WebInspector.Callback.processCallback;
......@@ -23,10 +23,12 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
WebInspector.DOMStorageDataGrid = function(columns)
WebInspector.DOMStorageDataGrid = function(columns, domStorage, keys)
{
WebInspector.DataGrid.call(this, columns);
this.dataTableBody.addEventListener("dblclick", this._ondblclick.bind(this), false);
this._domStorage = domStorage;
this._keys = keys;
}
WebInspector.DOMStorageDataGrid.prototype = {
......@@ -44,7 +46,6 @@ WebInspector.DOMStorageDataGrid.prototype = {
this._editing = true;
this._editingNode = node;
this._editingNode.select();
WebInspector.panels.storage._unregisterStorageEventListener();
var element = this._editingNode._element.children[column];
WebInspector.startEditing(element, this._editingCommitted.bind(this), this._editingCancelled.bind(this), element.textContent);
......@@ -69,7 +70,6 @@ WebInspector.DOMStorageDataGrid.prototype = {
return this._startEditingColumnOfDataGridNode(this._editingNode, 0);
this._editing = true;
WebInspector.panels.storage._unregisterStorageEventListener();
WebInspector.startEditing(element, this._editingCommitted.bind(this), this._editingCancelled.bind(this), element.textContent);
window.getSelection().setBaseAndExtent(element, 0, element, 1);
},
......@@ -118,22 +118,20 @@ WebInspector.DOMStorageDataGrid.prototype = {
return;
}
var domStorage = WebInspector.panels.storage.visibleView.domStorage.domStorage;
if (domStorage) {
if (columnIdentifier == 0) {
if (domStorage.getItem(newText) != null) {
element.textContent = this._editingNode.data[0];
this._editingCancelled(element);
moveToNextIfNeeded.call(this, false);
return;
}
domStorage.removeItem(this._editingNode.data[0]);
domStorage.setItem(newText, this._editingNode.data[1]);
this._editingNode.data[0] = newText;
} else {
domStorage.setItem(this._editingNode.data[0], newText);
this._editingNode.data[1] = newText;
var domStorage = this._domStorage;
if (columnIdentifier === 0) {
if (this._keys.indexOf(newText) !== -1) {
element.textContent = this._editingNode.data[0];
this._editingCancelled(element);
moveToNextIfNeeded.call(this, false);
return;
}
domStorage.removeItem(this._editingNode.data[0]);
domStorage.setItem(newText, this._editingNode.data[1]);
this._editingNode.data[0] = newText;
} else {
domStorage.setItem(this._editingNode.data[0], newText);
this._editingNode.data[1] = newText;
}
if (this._editingNode.isCreationNode)
......@@ -147,18 +145,16 @@ WebInspector.DOMStorageDataGrid.prototype = {
{
delete this._editing;
this._editingNode = null;
WebInspector.panels