Diff
Modified: trunk/Source/WebCore/ChangeLog (113012 => 113013)
--- trunk/Source/WebCore/ChangeLog 2012-04-03 12:06:20 UTC (rev 113012)
+++ trunk/Source/WebCore/ChangeLog 2012-04-03 12:07:53 UTC (rev 113013)
@@ -1,3 +1,54 @@
+2012-04-03 Yury Semikhatsky <[email protected]>
+
+ Web Inspector: Database::Database::id field in the protocol should have type integer not string
+ https://bugs.webkit.org/show_bug.cgi?id=83003
+
+ Reviewed by Pavel Feldman.
+
+ Changed DOM storage and database identifier type from int to String. This
+ is aligned with other domains and gives us more flexibility.
+
+ * bindings/js/JSInjectedScriptHostCustom.cpp:
+ (WebCore::JSInjectedScriptHost::databaseId):
+ (WebCore::JSInjectedScriptHost::storageId):
+ * bindings/v8/custom/V8InjectedScriptHostCustom.cpp:
+ (WebCore::V8InjectedScriptHost::databaseIdCallback):
+ (WebCore::V8InjectedScriptHost::storageIdCallback):
+ * inspector/InjectedScriptHost.cpp:
+ (WebCore::InjectedScriptHost::databaseIdImpl):
+ (WebCore::InjectedScriptHost::storageIdImpl):
+ * inspector/InjectedScriptHost.h:
+ (InjectedScriptHost):
+ * inspector/InjectedScriptHost.idl:
+ * inspector/Inspector.json:
+ * inspector/InspectorDOMStorageAgent.cpp:
+ (WebCore::InspectorDOMStorageAgent::getDOMStorageEntries):
+ (WebCore::InspectorDOMStorageAgent::setDOMStorageItem):
+ (WebCore::InspectorDOMStorageAgent::removeDOMStorageItem):
+ (WebCore::InspectorDOMStorageAgent::storageId):
+ (WebCore::InspectorDOMStorageAgent::getDOMStorageResourceForId):
+ * inspector/InspectorDOMStorageAgent.h:
+ (InspectorDOMStorageAgent):
+ * inspector/InspectorDOMStorageResource.cpp:
+ (WebCore::InspectorDOMStorageResource::InspectorDOMStorageResource):
+ (WebCore::InspectorDOMStorageResource::bind):
+ * inspector/InspectorDOMStorageResource.h:
+ (WebCore::InspectorDOMStorageResource::id):
+ (InspectorDOMStorageResource):
+ * inspector/InspectorDatabaseAgent.cpp:
+ (WebCore::InspectorDatabaseAgent::getDatabaseTableNames):
+ (WebCore::InspectorDatabaseAgent::executeSQL):
+ (WebCore::InspectorDatabaseAgent::databaseId):
+ (WebCore::InspectorDatabaseAgent::databaseForId):
+ * inspector/InspectorDatabaseAgent.h:
+ (InspectorDatabaseAgent):
+ * inspector/InspectorDatabaseResource.cpp:
+ (WebCore::InspectorDatabaseResource::InspectorDatabaseResource):
+ (WebCore::InspectorDatabaseResource::bind):
+ * inspector/InspectorDatabaseResource.h:
+ (WebCore::InspectorDatabaseResource::id):
+ (InspectorDatabaseResource):
+
2012-04-03 Nikolas Zimmermann <[email protected]>
Enable animVal support for SVGAnimatedEnumeration
Modified: trunk/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp (113012 => 113013)
--- trunk/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp 2012-04-03 12:06:20 UTC (rev 113012)
+++ trunk/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp 2012-04-03 12:07:53 UTC (rev 113013)
@@ -256,7 +256,7 @@
#if ENABLE(SQL_DATABASE)
Database* database = toDatabase(exec->argument(0));
if (database)
- return jsNumber(impl()->databaseIdImpl(database));
+ return jsString(exec, impl()->databaseIdImpl(database));
#endif
return jsUndefined();
}
@@ -267,7 +267,7 @@
return jsUndefined();
Storage* storage = toStorage(exec->argument(0));
if (storage)
- return jsNumber(impl()->storageIdImpl(storage));
+ return jsString(exec, impl()->storageIdImpl(storage));
return jsUndefined();
}
Modified: trunk/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp (113012 => 113013)
--- trunk/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp 2012-04-03 12:06:20 UTC (rev 113012)
+++ trunk/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp 2012-04-03 12:07:53 UTC (rev 113013)
@@ -268,7 +268,7 @@
InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());
Database* database = V8Database::toNative(v8::Handle<v8::Object>::Cast(args[0]));
if (database)
- return v8::Number::New(host->databaseIdImpl(database));
+ return v8StringOrUndefined(host->databaseIdImpl(database));
#endif
return v8::Undefined();
}
@@ -281,7 +281,7 @@
InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());
Storage* storage = V8Storage::toNative(v8::Handle<v8::Object>::Cast(args[0]));
if (storage)
- return v8::Number::New(host->storageIdImpl(storage));
+ return v8StringOrUndefined(host->storageIdImpl(storage));
return v8::Undefined();
}
Modified: trunk/Source/WebCore/inspector/InjectedScriptHost.cpp (113012 => 113013)
--- trunk/Source/WebCore/inspector/InjectedScriptHost.cpp 2012-04-03 12:06:20 UTC (rev 113012)
+++ trunk/Source/WebCore/inspector/InjectedScriptHost.cpp 2012-04-03 12:07:53 UTC (rev 113013)
@@ -146,19 +146,19 @@
}
#if ENABLE(SQL_DATABASE)
-int InjectedScriptHost::databaseIdImpl(Database* database)
+String InjectedScriptHost::databaseIdImpl(Database* database)
{
if (m_databaseAgent)
return m_databaseAgent->databaseId(database);
- return 0;
+ return String();
}
#endif
-int InjectedScriptHost::storageIdImpl(Storage* storage)
+String InjectedScriptHost::storageIdImpl(Storage* storage)
{
if (m_domStorageAgent)
return m_domStorageAgent->storageId(storage);
- return 0;
+ return String();
}
#if ENABLE(WORKERS)
Modified: trunk/Source/WebCore/inspector/InjectedScriptHost.h (113012 => 113013)
--- trunk/Source/WebCore/inspector/InjectedScriptHost.h 2012-04-03 12:06:20 UTC (rev 113012)
+++ trunk/Source/WebCore/inspector/InjectedScriptHost.h 2012-04-03 12:07:53 UTC (rev 113013)
@@ -98,9 +98,9 @@
void clearConsoleMessages();
void copyText(const String& text);
#if ENABLE(SQL_DATABASE)
- int databaseIdImpl(Database*);
+ String databaseIdImpl(Database*);
#endif
- int storageIdImpl(Storage*);
+ String storageIdImpl(Storage*);
#if ENABLE(WORKERS)
long nextWorkerId();
void didCreateWorker(long id, const String& url, bool isSharedWorker);
Modified: trunk/Source/WebCore/inspector/InjectedScriptHost.idl (113012 => 113013)
--- trunk/Source/WebCore/inspector/InjectedScriptHost.idl 2012-04-03 12:06:20 UTC (rev 113012)
+++ trunk/Source/WebCore/inspector/InjectedScriptHost.idl 2012-04-03 12:07:53 UTC (rev 113013)
@@ -45,8 +45,8 @@
[Custom] DOMObject functionDetails(in DOMObject object);
[Custom] Array getEventListeners(in Node node);
- [Custom] int databaseId(in DOMObject database);
- [Custom] int storageId(in DOMObject storage);
+ [Custom] DOMString databaseId(in DOMObject database);
+ [Custom] DOMString storageId(in DOMObject storage);
#if defined(ENABLE_WORKERS) && ENABLE_WORKERS
void didCreateWorker(in long id, in DOMString url, in boolean isFakeWorker);
Modified: trunk/Source/WebCore/inspector/Inspector.json (113012 => 113013)
--- trunk/Source/WebCore/inspector/Inspector.json 2012-04-03 12:06:20 UTC (rev 113012)
+++ trunk/Source/WebCore/inspector/Inspector.json 2012-04-03 12:07:53 UTC (rev 113013)
@@ -882,12 +882,18 @@
"hidden": true,
"types": [
{
+ "id": "DatabaseId",
+ "type": "string",
+ "description": "Unique identifier of Database object.",
+ "hidden": true
+ },
+ {
"id": "Database",
"type": "object",
"description": "Database object.",
"hidden": true,
"properties": [
- { "name": "id", "type": "string", "description": "Database ID." },
+ { "name": "id", "$ref": "DatabaseId", "description": "Database ID." },
{ "name": "domain", "type": "string", "description": "Database domain." },
{ "name": "name", "type": "string", "description": "Database name." },
{ "name": "version", "type": "string", "description": "Database version." }
@@ -911,7 +917,7 @@
{
"name": "getDatabaseTableNames",
"parameters": [
- { "name": "databaseId", "type": "integer" }
+ { "name": "databaseId", "$ref": "DatabaseId" }
],
"returns": [
{ "name": "tableNames", "type": "array", "items": { "type": "string" } }
@@ -920,7 +926,7 @@
{
"name": "executeSQL",
"parameters": [
- { "name": "databaseId", "type": "integer" },
+ { "name": "databaseId", "$ref": "DatabaseId" },
{ "name": "query", "type": "string" }
],
"returns": [
@@ -1110,6 +1116,12 @@
"hidden": true,
"types": [
{
+ "id": "StorageId",
+ "type": "string",
+ "description": "Unique identifier of DOM storage entry.",
+ "hidden": true
+ },
+ {
"id": "Entry",
"type": "object",
"description": "DOM Storage entry.",
@@ -1117,7 +1129,7 @@
"properties": [
{ "name": "host", "type": "string", "description": "Domain name." },
{ "name": "isLocalStorage", "type": "boolean", "description": "True for local storage." },
- { "name": "id", "type": "number", "description": "Entry id for further reference." }
+ { "name": "id", "$ref": "StorageId", "description": "Entry id for further reference." }
]
}
],
@@ -1133,7 +1145,7 @@
{
"name": "getDOMStorageEntries",
"parameters": [
- { "name": "storageId", "type": "integer" }
+ { "name": "storageId", "$ref": "StorageId" }
],
"returns": [
{ "name": "entries", "type": "array", "items": { "$ref": "Entry"} }
@@ -1142,7 +1154,7 @@
{
"name": "setDOMStorageItem",
"parameters": [
- { "name": "storageId", "type": "integer" },
+ { "name": "storageId", "$ref": "StorageId" },
{ "name": "key", "type": "string" },
{ "name": "value", "type": "string" }
],
@@ -1153,7 +1165,7 @@
{
"name": "removeDOMStorageItem",
"parameters": [
- { "name": "storageId", "type": "integer" },
+ { "name": "storageId", "$ref": "StorageId" },
{ "name": "key", "type": "string" }
],
"returns": [
@@ -1171,7 +1183,7 @@
{
"name": "updateDOMStorage",
"parameters": [
- { "name": "storageId", "type": "integer" }
+ { "name": "storageId", "$ref": "StorageId" }
]
}
]
Modified: trunk/Source/WebCore/inspector/InspectorDOMStorageAgent.cpp (113012 => 113013)
--- trunk/Source/WebCore/inspector/InspectorDOMStorageAgent.cpp 2012-04-03 12:06:20 UTC (rev 113012)
+++ trunk/Source/WebCore/inspector/InspectorDOMStorageAgent.cpp 2012-04-03 12:07:53 UTC (rev 113013)
@@ -108,7 +108,7 @@
m_state->setBoolean(DOMStorageAgentState::domStorageAgentEnabled, m_enabled);
}
-void InspectorDOMStorageAgent::getDOMStorageEntries(ErrorString*, int storageId, RefPtr<InspectorArray>& entries)
+void InspectorDOMStorageAgent::getDOMStorageEntries(ErrorString*, const String& storageId, RefPtr<InspectorArray>& entries)
{
InspectorDOMStorageResource* storageResource = getDOMStorageResourceForId(storageId);
if (!storageResource)
@@ -129,7 +129,7 @@
}
}
-void InspectorDOMStorageAgent::setDOMStorageItem(ErrorString*, int storageId, const String& key, const String& value, bool* success)
+void InspectorDOMStorageAgent::setDOMStorageItem(ErrorString*, const String& storageId, const String& key, const String& value, bool* success)
{
InspectorDOMStorageResource* storageResource = getDOMStorageResourceForId(storageId);
if (storageResource) {
@@ -139,7 +139,7 @@
}
}
-void InspectorDOMStorageAgent::removeDOMStorageItem(ErrorString*, int storageId, const String& key, bool* success)
+void InspectorDOMStorageAgent::removeDOMStorageItem(ErrorString*, const String& storageId, const String& key, bool* success)
{
InspectorDOMStorageResource* storageResource = getDOMStorageResourceForId(storageId);
if (storageResource) {
@@ -148,7 +148,7 @@
}
}
-int InspectorDOMStorageAgent::storageId(Storage* storage)
+String InspectorDOMStorageAgent::storageId(Storage* storage)
{
ASSERT(storage);
Frame* frame = storage->frame();
@@ -159,10 +159,10 @@
if (it->second->isSameHostAndType(frame, isLocalStorage))
return it->first;
}
- return 0;
+ return String();
}
-InspectorDOMStorageResource* InspectorDOMStorageAgent::getDOMStorageResourceForId(int storageId)
+InspectorDOMStorageResource* InspectorDOMStorageAgent::getDOMStorageResourceForId(const String& storageId)
{
DOMStorageResourcesMap::iterator it = m_resources.find(storageId);
if (it == m_resources.end())
Modified: trunk/Source/WebCore/inspector/InspectorDOMStorageAgent.h (113012 => 113013)
--- trunk/Source/WebCore/inspector/InspectorDOMStorageAgent.h 2012-04-03 12:06:20 UTC (rev 113012)
+++ trunk/Source/WebCore/inspector/InspectorDOMStorageAgent.h 2012-04-03 12:07:53 UTC (rev 113013)
@@ -64,12 +64,12 @@
// Called from the front-end.
virtual void enable(ErrorString*);
virtual void disable(ErrorString*);
- virtual void getDOMStorageEntries(ErrorString*, int storageId, RefPtr<InspectorArray>& entries);
- virtual void setDOMStorageItem(ErrorString*, int storageId, const String& key, const String& value, bool* success);
- virtual void removeDOMStorageItem(ErrorString*, int storageId, const String& key, bool* success);
+ virtual void getDOMStorageEntries(ErrorString*, const String& storageId, RefPtr<InspectorArray>& 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);
// Called from the injected script.
- int storageId(Storage*);
+ String storageId(Storage*);
// Called from InspectorInstrumentation
void didUseDOMStorage(StorageArea*, bool isLocalStorage, Frame*);
@@ -77,9 +77,9 @@
private:
InspectorDOMStorageAgent(InstrumentingAgents*, InspectorState*);
- InspectorDOMStorageResource* getDOMStorageResourceForId(int storageId);
+ InspectorDOMStorageResource* getDOMStorageResourceForId(const String& storageId);
- typedef HashMap<int, RefPtr<InspectorDOMStorageResource> > DOMStorageResourcesMap;
+ typedef HashMap<String, RefPtr<InspectorDOMStorageResource> > DOMStorageResourcesMap;
DOMStorageResourcesMap m_resources;
InspectorFrontend* m_frontend;
bool m_enabled;
Modified: trunk/Source/WebCore/inspector/InspectorDOMStorageResource.cpp (113012 => 113013)
--- trunk/Source/WebCore/inspector/InspectorDOMStorageResource.cpp 2012-04-03 12:06:20 UTC (rev 113012)
+++ trunk/Source/WebCore/inspector/InspectorDOMStorageResource.cpp 2012-04-03 12:07:53 UTC (rev 113013)
@@ -57,7 +57,7 @@
, m_isLocalStorage(isLocalStorage)
, m_frame(frame)
, m_frontend(0)
- , m_id(s_nextUnusedId++)
+ , m_id(String::number(s_nextUnusedId++))
, m_reportingChangesToFrontend(false)
{
}
@@ -75,7 +75,7 @@
RefPtr<InspectorObject> jsonObject = InspectorObject::create();
jsonObject->setString("host", m_frame->document()->securityOrigin()->host());
jsonObject->setBoolean("isLocalStorage", m_isLocalStorage);
- jsonObject->setNumber("id", m_id);
+ jsonObject->setString("id", m_id);
m_frontend->addDOMStorage(jsonObject);
}
Modified: trunk/Source/WebCore/inspector/InspectorDOMStorageResource.h (113012 => 113013)
--- trunk/Source/WebCore/inspector/InspectorDOMStorageResource.h 2012-04-03 12:06:20 UTC (rev 113012)
+++ trunk/Source/WebCore/inspector/InspectorDOMStorageResource.h 2012-04-03 12:07:53 UTC (rev 113013)
@@ -64,7 +64,7 @@
virtual bool operator==(const EventListener& listener);
bool isSameHostAndType(Frame*, bool isLocalStorage) const;
- int id() const { return m_id; }
+ String id() const { return m_id; }
StorageArea* storageArea() const { return m_storageArea.get(); }
Frame* frame() const { return m_frame.get(); }
@@ -76,7 +76,7 @@
bool m_isLocalStorage;
RefPtr<Frame> m_frame;
InspectorFrontend::DOMStorage* m_frontend;
- int m_id;
+ String m_id;
bool m_reportingChangesToFrontend;
static int s_nextUnusedId;
Modified: trunk/Source/WebCore/inspector/InspectorDatabaseAgent.cpp (113012 => 113013)
--- trunk/Source/WebCore/inspector/InspectorDatabaseAgent.cpp 2012-04-03 12:06:20 UTC (rev 113012)
+++ trunk/Source/WebCore/inspector/InspectorDatabaseAgent.cpp 2012-04-03 12:07:53 UTC (rev 113013)
@@ -291,7 +291,7 @@
m_enabled = m_state->getBoolean(DatabaseAgentState::databaseAgentEnabled);
}
-void InspectorDatabaseAgent::getDatabaseTableNames(ErrorString* error, int databaseId, RefPtr<InspectorArray>& names)
+void InspectorDatabaseAgent::getDatabaseTableNames(ErrorString* error, const String& databaseId, RefPtr<InspectorArray>& names)
{
if (!m_enabled) {
*error = "Database agent is not enabled";
@@ -307,7 +307,7 @@
}
}
-void InspectorDatabaseAgent::executeSQL(ErrorString* error, int databaseId, const String& query, bool* success, int* transactionId)
+void InspectorDatabaseAgent::executeSQL(ErrorString* error, const String& databaseId, const String& query, bool* success, int* transactionId)
{
if (!m_enabled) {
*error = "Database agent is not enabled";
@@ -328,13 +328,13 @@
*success = true;
}
-int InspectorDatabaseAgent::databaseId(Database* database)
+String InspectorDatabaseAgent::databaseId(Database* database)
{
for (DatabaseResourcesMap::iterator it = m_resources.begin(); it != m_resources.end(); ++it) {
if (it->second->database() == database)
return it->first;
}
- return 0;
+ return String();
}
InspectorDatabaseResource* InspectorDatabaseAgent::findByFileName(const String& fileName)
@@ -346,7 +346,7 @@
return 0;
}
-Database* InspectorDatabaseAgent::databaseForId(int databaseId)
+Database* InspectorDatabaseAgent::databaseForId(const String& databaseId)
{
DatabaseResourcesMap::iterator it = m_resources.find(databaseId);
if (it == m_resources.end())
Modified: trunk/Source/WebCore/inspector/InspectorDatabaseAgent.h (113012 => 113013)
--- trunk/Source/WebCore/inspector/InspectorDatabaseAgent.h 2012-04-03 12:06:20 UTC (rev 113012)
+++ trunk/Source/WebCore/inspector/InspectorDatabaseAgent.h 2012-04-03 12:07:53 UTC (rev 113013)
@@ -66,20 +66,20 @@
// Called from the front-end.
virtual void enable(ErrorString*);
virtual void disable(ErrorString*);
- virtual void getDatabaseTableNames(ErrorString*, int databaseId, RefPtr<InspectorArray>& names);
- virtual void executeSQL(ErrorString*, int databaseId, const String& query, bool* success, int* transactionId);
+ virtual void getDatabaseTableNames(ErrorString*, const String& databaseId, RefPtr<InspectorArray>& names);
+ virtual void executeSQL(ErrorString*, const String& databaseId, const String& query, bool* success, int* transactionId);
// Called from the injected script.
- int databaseId(Database*);
+ String databaseId(Database*);
void didOpenDatabase(PassRefPtr<Database>, const String& domain, const String& name, const String& version);
private:
explicit InspectorDatabaseAgent(InstrumentingAgents*, InspectorState*);
- Database* databaseForId(int databaseId);
+ Database* databaseForId(const String& databaseId);
InspectorDatabaseResource* findByFileName(const String& fileName);
- typedef HashMap<int, RefPtr<InspectorDatabaseResource> > DatabaseResourcesMap;
+ typedef HashMap<String, RefPtr<InspectorDatabaseResource> > DatabaseResourcesMap;
DatabaseResourcesMap m_resources;
RefPtr<FrontendProvider> m_frontendProvider;
bool m_enabled;
Modified: trunk/Source/WebCore/inspector/InspectorDatabaseResource.cpp (113012 => 113013)
--- trunk/Source/WebCore/inspector/InspectorDatabaseResource.cpp 2012-04-03 12:06:20 UTC (rev 113012)
+++ trunk/Source/WebCore/inspector/InspectorDatabaseResource.cpp 2012-04-03 12:07:53 UTC (rev 113013)
@@ -49,7 +49,7 @@
InspectorDatabaseResource::InspectorDatabaseResource(PassRefPtr<Database> database, const String& domain, const String& name, const String& version)
: m_database(database)
- , m_id(nextUnusedId++)
+ , m_id(String::number(nextUnusedId++))
, m_domain(domain)
, m_name(name)
, m_version(version)
@@ -59,7 +59,7 @@
void InspectorDatabaseResource::bind(InspectorFrontend::Database* frontend)
{
RefPtr<InspectorObject> jsonObject = InspectorObject::create();
- jsonObject->setNumber("id", m_id);
+ jsonObject->setString("id", m_id);
jsonObject->setString("domain", m_domain);
jsonObject->setString("name", m_name);
jsonObject->setString("version", m_version);
Modified: trunk/Source/WebCore/inspector/InspectorDatabaseResource.h (113012 => 113013)
--- trunk/Source/WebCore/inspector/InspectorDatabaseResource.h 2012-04-03 12:06:20 UTC (rev 113012)
+++ trunk/Source/WebCore/inspector/InspectorDatabaseResource.h 2012-04-03 12:07:53 UTC (rev 113013)
@@ -49,13 +49,13 @@
void bind(InspectorFrontend::Database*);
Database* database() { return m_database.get(); }
void setDatabase(PassRefPtr<Database> database) { m_database = database; }
- int id() const { return m_id; }
+ String id() const { return m_id; }
private:
InspectorDatabaseResource(PassRefPtr<Database>, const String& domain, const String& name, const String& version);
RefPtr<Database> m_database;
- int m_id;
+ String m_id;
String m_domain;
String m_name;
String m_version;