[Webkit-unassigned] [Bug 27899] [Gtk] Expose a database API
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu Aug 13 20:22:45 PDT 2009
https://bugs.webkit.org/show_bug.cgi?id=27899
--- Comment #4 from Jan Alonzo <jmalonzo at gmail.com> 2009-08-13 20:22:43 PDT ---
(From update of attachment 34675)
> +#include "config.h"
> +#include "webkitwebdatabase.h"
> +#include "webkitprivate.h"
There should be a space between webdatabase and private.
> +
> +#include <glib/gi18n-lib.h>
Third-party includes go after the WebCore ones.
> +#include "CString.h"
> +#include "PlatformString.h"
> +#include "DatabaseTracker.h"
> +
> +/**
> + * SECTION:webkitwebdatabase
> + * @short_description: A security boundary for web sites
What does security boundary mean? Not sure if it's describing database or
securityOrigin.
> + *
> + * Database quotas and usages are also defined per security origin. The
> + * cumulative disk usage of an origin's databases may be retrieved with
> + * #webkit_security_origin_get_database_usage. An origin's quota can be
> + * adjusted with #webkit_security_origin_set_database_quota.
I think it's best if we move the database stuff out of SecurityOrigin and move
them to WebDatabase. Is that more realistic or developers really should expect
that SecurityOrigin should know about database quotas and such?
> +
> +static void webkit_security_origin_finalize(GObject* object)
> +{
> + WebKitSecurityOrigin* securityOrigin = WEBKIT_SECURITY_ORIGIN(object);
> + WebKitSecurityOriginPrivate* priv = securityOrigin->priv;
> +
> + if (!priv->disposed) {
> + priv->coreOrigin->deref();
> + g_hash_table_destroy(priv->webDatabases);
> + priv->disposed = true;
> + }
I think this should go to webkit_security_origin_dispose.
Also I'm not sure if we should copy WebHistoryItem here. WebHistoryItem was
meant to be shared between the WebBackForwardList and a future WebHistory. Does
WebDatabase/WebSecurityOrigin have the same semantics?
> +GHashTable* webkit_security_origins()
> +{
> + static GHashTable* securityOrigins = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, g_object_unref);
> + return securityOrigins;
> +}
> +
> +void webkit_security_origin_add(WebKitSecurityOrigin* origin, WebCore::SecurityOrigin* coreOrigin)
> +{
> + g_return_if_fail(WEBKIT_IS_SECURITY_ORIGIN(origin));
> +
> + GHashTable* table = webkit_security_origins();
> + g_hash_table_insert(table, coreOrigin, origin);
> +}
> +
> + g_object_class_install_property(gobject_class, PROP_PORT,
> + g_param_spec_uint("port",
> + _("Port"),
> + _("The port of the security origin"),
> + 0, G_MAXUINT, 0,
> + WEBKIT_PARAM_READABLE));
port can just be a gushort. So this should be G_MAXUSHORT.
> + g_param_spec_uint64(
> + "database-quota",
No need for the linebreak.
> +G_CONST_RETURN gchar* webkit_security_origin_get_protocol(WebKitSecurityOrigin* security_origin)
> +{
> + g_return_val_if_fail(WEBKIT_IS_SECURITY_ORIGIN(security_origin), NULL);
> +
> + WebKitSecurityOriginPrivate* priv = security_origin->priv;
> + WebCore::String protocol = priv->coreOrigin->protocol();
> +
> + if (!protocol.isEmpty()) {
> + g_free(priv->protocol);
> + priv->protocol = g_strdup(protocol.utf8().data());
> + return priv->protocol;
> + } else {
> + return "";
> + }
We usually do early exits so this would become: if protocol.isEmpty return "".
> + if (!host.isEmpty()) {
> + g_free(priv->host);
> + priv->host = g_strdup(host.utf8().data());
> + return priv->host;
> + } else {
> + return "";
> + }
Same here.
> +WebKitWebDatabase* webkit_security_origin_get_database(WebKitSecurityOrigin* security_origin, const gchar* database_name)
> +{
> + g_return_val_if_fail(WEBKIT_IS_SECURITY_ORIGIN(security_origin), NULL);
> +
> + WebKitSecurityOriginPrivate* priv = security_origin->priv;
> + GHashTable* databaseHash = priv->webDatabases;
> + WebKitWebDatabase* database = (WebKitWebDatabase*) g_hash_table_lookup(databaseHash, database_name);
> +
> + if (!database) {
> + database = WEBKIT_WEB_DATABASE(g_object_new(WEBKIT_TYPE_WEB_DATABASE,
> + "origin", security_origin,
> + "name", database_name,
> + NULL));
> + g_hash_table_insert(databaseHash, g_strdup(database_name), database);
> + }
This getter should return NULL if no WebDatabase exist for the security origin.
> +GList* webkit_security_origin_get_databases(WebKitSecurityOrigin* security_origin)
> +{
> + g_return_val_if_fail(WEBKIT_IS_SECURITY_ORIGIN(security_origin), NULL);
> + GList* databases = NULL;
> +
> +#if ENABLE(DATABASE)
> + WebCore::SecurityOrigin* coreOrigin = core(security_origin);
> + Vector<WebCore::String> databaseNames;
> +
> + if (!WebCore::DatabaseTracker::tracker().databaseNamesForOrigin(coreOrigin, databaseNames))
> + return databases;
Please be more explicit by just returning NULL.
> + for (unsigned i = 0; i < databaseNames.size(); ++i) {
> + WebKitWebDatabase* database = webkit_security_origin_get_database(security_origin, databaseNames[i].utf8().data());
> + databases = g_list_append(databases, database);
I'm not sure if we should be creating databases if they don't exist in security
origin. Is it ok to create databases if they're not in origin?
> +
> +#ifndef __WEBKIT_SECURITY_ORIGIN_H__
> +#define __WEBKIT_SECURITY_ORIGIN_H__
> +
We don't usually add double underscores to the name.
> +WEBKIT_API guint64
> +webkit_security_origin_get_database_usage (WebKitSecurityOrigin* security_origin);
> +
> +WEBKIT_API guint64
> +webkit_security_origin_get_database_quota (WebKitSecurityOrigin* security_origin);
> +
> +WEBKIT_API void
> +webkit_security_origin_set_database_quota (WebKitSecurityOrigin* security_origin, guint64 quota);
> +
> +WEBKIT_API WebKitWebDatabase*
> +webkit_security_origin_get_database (WebKitSecurityOrigin* security_origin, const char* database_name);
> +
> +WEBKIT_API GList*
> +webkit_security_origin_get_databases (WebKitSecurityOrigin* security_origin);
Not sure if these database methods should be here. Would it make sense to move
the webkitwebdatabase?
> +#include "config.h"
> +#include "webkitwebdatabase.h"
> +#include "webkitprivate.h"
Please separate this two.
> +#include <glib/gi18n-lib.h>
Move this after the WebCore includes.
> + * SECTION:webkitwebdatabase
> + * @short_description: A WebKit web application database
> + *
> + * #WebKitWebDatabase is a representation of a Web Database database. The
> + * upcoming Web Database standard introduces support for SQL databases that web
> + * sites can create and access on a local computer through JavaScript.
Is it a standard or a proposed standard? Also it might be helpful to provide a
link so devs can read more if they want to.
> + * To get access to all databases defined by a security origin, use
> + * #webkit_security_origin_get_databases. Each database has an internal
> + * name, as well as a user-friendly display name.
webkit_security_origin_get_databases -> webkit_database_from_security_origin?
Also, we currently don't provide an API for the internal name so I'm not sure
if it's worth mentioning here.
> + *
> + * WebKit uses SQLite to create and access the local SQL databases. The location
> + * of a #WebKitWebDatabase can be accessed wth #webkit_web_database_get_path.
> + * You can configure the location of all databases with
> + * #webkit_set_database_directory_path.
> + *
> + * For each database the web site can define an esimated size which can be
esimated -> estimated.
> + * accessed with #webkit_web_database_get_expected_size. The current size of the
> + * database in bytes is returned by #webkit_web_database_get_size.
> + *
> + * For more information refer to the Web Database specification proposal at
> + * http://dev.w3.org/html5/webdatabase
> + */
> +
> +using namespace WebKit;
> +
> +enum {
> + PROP_0,
> +
> + PROP_ORIGIN,
> + PROP_NAME,
> + PROP_DISPLAY_NAME,
> + PROP_EXPECTED_SIZE,
> + PROP_SIZE,
> + PROP_PATH
> +};
> +
> +G_DEFINE_TYPE(WebKitWebDatabase, webkit_web_database, G_TYPE_OBJECT)
> +
> +struct _WebKitWebDatabasePrivate {
> + WebKitSecurityOrigin* origin;
> + gchar* name;
> + gchar* display_name;
> + gchar* path;
> +};
> +
> +static gchar* webkit_database_directory_path = NULL;
> +static guint64 webkit_default_database_quota = 5 * 1024 * 1024;
> +
> +#define WEBKIT_WEB_DATABASE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_WEB_DATABASE, WebKitWebDatabasePrivate))
> +
> +static void webkit_web_database_set_origin(WebKitWebDatabase* web_database, WebKitSecurityOrigin* security_origin);
> +
> +static void webkit_web_database_set_name(WebKitWebDatabase* web_database, const gchar* name);
> +
> +static void webkit_web_database_finalize(GObject* object)
> +{
> + WebKitWebDatabase* webDatabase = WEBKIT_WEB_DATABASE(object);
> + WebKitWebDatabasePrivate* priv = webDatabase->priv;
> +
> + if (priv->origin)
> + g_object_unref(priv->origin);
> +
> + G_OBJECT_CLASS(webkit_web_database_parent_class)->finalize(object);
> +}
> +
> +static void webkit_web_database_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec)
> +{
> + WebKitWebDatabase* web_database = WEBKIT_WEB_DATABASE(object);
> +
> + switch (prop_id) {
> + case PROP_ORIGIN:
> + webkit_web_database_set_origin(web_database, WEBKIT_SECURITY_ORIGIN(g_value_get_object(value)));
> + break;
> + case PROP_NAME:
> + webkit_web_database_set_name(web_database, g_value_get_string(value));
> + break;
> + default:
> + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
> + break;
> + }
> +}
> +
> +static void webkit_web_database_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec)
> +{
> + WebKitWebDatabase* webDatabase = WEBKIT_WEB_DATABASE(object);
> + WebKitWebDatabasePrivate* priv = webDatabase->priv;
> +
> + switch (prop_id) {
> + case PROP_ORIGIN:
> + g_value_set_object(value, priv->origin);
> + break;
> + case PROP_NAME:
> + g_value_set_string(value, webkit_web_database_get_name(webDatabase));
> + break;
> + case PROP_DISPLAY_NAME:
> + g_value_set_string(value, webkit_web_database_get_display_name(webDatabase));
> + break;
> + case PROP_EXPECTED_SIZE:
> + g_value_set_uint64(value, webkit_web_database_get_expected_size(webDatabase));
> + break;
> + case PROP_SIZE:
> + g_value_set_uint64(value, webkit_web_database_get_size(webDatabase));
> + break;
> + case PROP_PATH:
> + g_value_set_string(value, webkit_web_database_get_path(webDatabase));
> + break;
> + default:
> + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
> + break;
> + }
> +}
> +
> +static void webkit_web_database_class_init(WebKitWebDatabaseClass* klass)
> +{
> + GObjectClass* gobject_class = G_OBJECT_CLASS(klass);
> + gobject_class->finalize = webkit_web_database_finalize;
> + gobject_class->set_property = webkit_web_database_set_property;
> + gobject_class->get_property = webkit_web_database_get_property;
> +
> + /**
> + * WebKitWebDatabase:origin:
> + *
> + * The security origin of the database.
> + *
> + * Since: 1.1.13
> + */
> + g_object_class_install_property(gobject_class, PROP_ORIGIN,
> + g_param_spec_object("origin",
> + _("Origin"),
> + _("The security origin of the database"),
> + WEBKIT_TYPE_SECURITY_ORIGIN,
> + (GParamFlags) (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)));
> +
> + /**
> + * WebKitWebDatabase:name:
> + *
> + * The name of the Web Database database.
> + *
> + * Since: 1.1.13
> + */
> + g_object_class_install_property(gobject_class, PROP_NAME,
> + g_param_spec_string("name",
> + _("Name"),
> + _("The name of the Web Database database"),
> + NULL,
> + (GParamFlags) (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)));
> +
> + /**
> + * WebKitWebDatabase:display-name:
> + *
> + * The display name of the Web Database database.
> + *
> + * Since: 1.1.13
> + */
> + g_object_class_install_property(gobject_class, PROP_DISPLAY_NAME,
> + g_param_spec_string("display-name",
> + _("Display Name"),
> + _("The display name of the Web Stroage database"),
> + NULL,
> + WEBKIT_PARAM_READABLE));
> +
> + /**
> + * WebKitWebDatabase:expected-size:
> + *
> + * The expected size of the database in bytes as defined by the web author.
> + *
> + * Since: 1.1.13
> + */
> + g_object_class_install_property(gobject_class, PROP_EXPECTED_SIZE,
> + g_param_spec_uint64(
> + "expected-size",
> + _("Expected Size"),
> + _("The expected size of the Web Database database"),
> + 0, G_MAXUINT64, 0,
> + WEBKIT_PARAM_READABLE));
> + /**
> + * WebKitWebDatabase:size:
> + *
> + * The current size of the database in bytes.
> + *
> + * Since: 1.1.13
> + */
> + g_object_class_install_property(gobject_class, PROP_SIZE,
> + g_param_spec_uint64(
> + "size",
> + _("Size"),
> + _("The current size of the Web Database database"),
> + 0, G_MAXUINT64, 0,
> + WEBKIT_PARAM_READABLE));
> + /**
> + * WebKitWebDatabase:path:
> + *
> + * The filesystem path of the Web Database database.
> + *
> + * Since: 1.1.13
> + */
> + g_object_class_install_property(gobject_class, PROP_PATH,
> + g_param_spec_string("path",
> + _("Path"),
> + _("The filesystem path of the Web Stroage database"),
> + NULL,
> + WEBKIT_PARAM_READABLE));
> +
> + g_type_class_add_private(klass, sizeof(WebKitWebDatabasePrivate));
> +}
> +
> +static void webkit_web_database_init(WebKitWebDatabase* web_database)
> +{
> + web_database->priv = WEBKIT_WEB_DATABASE_GET_PRIVATE(web_database);
> +}
> +
> +// Internal use only
> +static void webkit_web_database_set_origin(WebKitWebDatabase *web_database, WebKitSecurityOrigin *security_origin)
> +{
> + g_return_if_fail(WEBKIT_IS_WEB_DATABASE(web_database));
> + g_return_if_fail(WEBKIT_IS_SECURITY_ORIGIN(security_origin));
> +
> + WebKitWebDatabasePrivate* priv = web_database->priv;
> +
> + if (priv->origin)
> + g_object_unref(priv->origin);
> +
> + g_object_ref(security_origin);
> + priv->origin = security_origin;
> +}
> +
> +static void webkit_web_database_set_name(WebKitWebDatabase* web_database, const gchar* name)
> +{
> + g_return_if_fail(WEBKIT_IS_WEB_DATABASE(web_database));
> +
> + WebKitWebDatabasePrivate* priv = web_database->priv;
> + g_free(priv->name);
> + priv->name = g_strdup(name);
> +}
> +
> +/**
> + * webkit_web_database_get_origin:
> + * @web_database: a #WebKitWebDatabase
> + *
> + * Returns the security origin of the #WebKitWebDatabase.
> + *
> + * Returns: the security origin of the database
> + *
> + * Since: 1.1.13
> + **/
> +WebKitSecurityOrigin* webkit_web_database_get_origin(WebKitWebDatabase* web_database)
> +{
> + g_return_val_if_fail(WEBKIT_IS_WEB_DATABASE(web_database), NULL);
> + WebKitWebDatabasePrivate* priv = web_database->priv;
> +
> + return priv->origin;
> +}
> +
> +/**
> + * webkit_web_database_get_name:
> + * @web_database: a #WebKitWebDatabase
> + *
> + * Returns the canonical name of the #WebKitWebDatabase.
> + *
> + * Returns: the name of the database
> + *
> + * Since: 1.1.13
> + **/
> +G_CONST_RETURN gchar* webkit_web_database_get_name(WebKitWebDatabase* web_database)
> +{
> + g_return_val_if_fail(WEBKIT_IS_WEB_DATABASE(web_database), NULL);
> + WebKitWebDatabasePrivate* priv = web_database->priv;
> +
> + return priv->name;
> +}
> +
> +/**
> + * webkit_web_database_get_display_name:
> + * @web_database: a #WebKitWebDatabase
> + *
> + * Returns the name of the #WebKitWebDatabase as seen by the user.
> + *
> + * Returns: the name of the database as seen by the user.
> + *
> + * Since: 1.1.13
> + **/
> +G_CONST_RETURN gchar* webkit_web_database_get_display_name(WebKitWebDatabase* web_database)
> +{
> + g_return_val_if_fail(WEBKIT_IS_WEB_DATABASE(web_database), NULL);
> +
> +#if ENABLE(DATABASE)
> + WebKitWebDatabasePrivate* priv = web_database->priv;
> + WebCore::DatabaseDetails details = WebCore::DatabaseTracker::tracker().detailsForNameAndOrigin(priv->name, core(priv->origin));
> + WebCore::String displayName = details.displayName();
> +
> + if (!displayName.isEmpty()) {
> + g_free(priv->display_name);
> + priv->display_name = g_strdup(displayName.utf8().data());
> + return priv->display_name;
> + } else {
> + return "";
> + }
> +#else
> + return "";
> +#endif
> +}
> +
> +/**
> + * webkit_web_database_get_expected_size:
> + * @web_database: a #WebKitWebDatabase
> + *
> + * Returns the expected size of the #WebKitWebDatabase in bytes as defined by the
> + * web author. The Web Database standard allows web authors to specify an expected
> + * size of the database to optimize the user experience.
> + *
> + * Returns: the expected size of the database in bytes
> + *
> + * Since: 1.1.13
> + **/
> +guint64 webkit_web_database_get_expected_size(WebKitWebDatabase* web_database)
> +{
> + g_return_val_if_fail(WEBKIT_IS_WEB_DATABASE(web_database), 0);
> +
> +#if ENABLE(DATABASE)
> + WebKitWebDatabasePrivate* priv = web_database->priv;
> + WebCore::DatabaseDetails details = WebCore::DatabaseTracker::tracker().detailsForNameAndOrigin(priv->name, core(priv->origin));
> + return details.expectedUsage();
> +#else
> + return 0;
> +#endif
> +}
> +
> +/**
> + * webkit_web_database_get_size:
> + * @web_database: a #WebKitWebDatabase
> + *
> + * Returns the actual size of the #WebKitWebDatabase space on disk in bytes.
> + *
> + * Returns: the actual size of the database in bytes
> + *
> + * Since: 1.1.13
> + **/
> +guint64 webkit_web_database_get_size(WebKitWebDatabase* web_database)
> +{
> + g_return_val_if_fail(WEBKIT_IS_WEB_DATABASE(web_database), 0);
> +
> +#if ENABLE(DATABASE)
> + WebKitWebDatabasePrivate* priv = web_database->priv;
> + WebCore::DatabaseDetails details = WebCore::DatabaseTracker::tracker().detailsForNameAndOrigin(priv->name, core(priv->origin));
> + return details.currentUsage();
> +#else
> + return 0;
> +#endif
> +}
> +
> +/**
> + * webkit_web_database_get_path:
> + * @web_database: a #WebKitWebDatabase
> + *
> + * Returns the path to the #WebKitWebDatabase file on disk.
> + *
> + * Returns: the filesystem path of the database
> + *
> + * Since: 1.1.13
> + **/
> +G_CONST_RETURN gchar* webkit_web_database_get_path(WebKitWebDatabase* web_database)
> +{
> + g_return_val_if_fail(WEBKIT_IS_WEB_DATABASE(web_database), NULL);
> +
> +#if ENABLE(DATABASE)
> + WebKitWebDatabasePrivate* priv = web_database->priv;
> + WebCore::String coreName = WebCore::String::fromUTF8(priv->name);
> + WebCore::String corePath = WebCore::DatabaseTracker::tracker().fullPathForDatabase(core(priv->origin), coreName);
> +
> + if (!corePath.isEmpty()) {
> + g_free(priv->path);
> + priv->path = g_strdup(corePath.utf8().data());
> + return priv->path;
> + } else {
> + return "";
> + }
> +#else
> + return "";
> +#endif
> +}
> +
> +/**
> + * webkit_web_database_remove:
> + * @web_database: a #WebKitWebDatabase
> + *
> + * Removes the #WebKitWebDatabase from its security origin and destroys all data
> + * stored in the database.
> + *
> + * Since: 1.1.13
> + **/
> +void webkit_web_database_remove(WebKitWebDatabase* web_database)
> +{
> + g_return_if_fail(WEBKIT_IS_WEB_DATABASE(web_database));
> +
> +#if ENABLE(DATABASE)
> + WebKitWebDatabasePrivate* priv = web_database->priv;
> + WebCore::DatabaseTracker::tracker().deleteDatabase(core(priv->origin), priv->name);
> +#endif
> +}
> +
> +/**
> + * webkit_remove_all_web_databases:
> + *
> + * Removes all web databases from the current database directory path.
> + *
> + * Since: 1.1.13
> + **/
> +void webkit_remove_all_web_databases()
> +{
> +#if ENABLE(DATABASE)
> + WebCore::DatabaseTracker::tracker().deleteAllDatabases();
> +#endif
> +}
> +
> +/**
> + * webkit_get_database_directory_path:
> + *
> + * Returns the current path to the directory WebKit will write Web
> + * Database databases. By default this path will be in the user data
> + * directory.
> + *
> + * Returns: the current database directory path
> + *
> + * Since: 1.1.13
> + **/
> +G_CONST_RETURN gchar* webkit_get_database_directory_path()
> +{
> +#if ENABLE(DATABASE)
> + WebCore::String path = WebCore::DatabaseTracker::tracker().databaseDirectoryPath();
> + if (!path.isEmpty()) {
> + g_free(webkit_database_directory_path);
> + webkit_database_directory_path = g_strdup(path.utf8().data());
> + return webkit_database_directory_path;
> + } else {
> + return "";
> + }
> +#else
> + return "";
> +#endif
> +}
> +
> +/**
> + * webkit_set_database_directory_path:
> + * @path: the new database directory path
> + *
> + * Sets the current path to the directory WebKit will write Web
> + * Database databases.
> + *
> + * Since: 1.1.13
> + **/
> +void webkit_set_database_directory_path(const gchar* path)
> +{
> +#if ENABLE(DATABASE)
> + WebCore::String corePath = WebCore::String::fromUTF8(path);
> + WebCore::DatabaseTracker::tracker().setDatabaseDirectoryPath(corePath);
> +
> + g_free(webkit_database_directory_path);
> + webkit_database_directory_path = g_strdup(corePath.utf8().data());
> +#endif
> +}
> +
> +/**
> + * webkit_get_default_database_quota:
> + *
> + * Returns the default quota for Web Database databases. By default
> + * this value is 5MB.
> +
> + * Returns: the current default database quota in bytes
> + *
> + * Since: 1.1.13
> + **/
> +guint64 webkit_get_default_database_quota()
> +{
> + return webkit_default_database_quota;
> +}
> +
> +/**
> + * webkit_set_default_database_quota:
> + * @default_quota: the new defaulta database quota
default is mispelled here.
> + *
> + * Sets the current path to the directory WebKit will write Web
> + * Database databases.
> + *
> + * Since: 1.1.13
> + **/
> +void webkit_set_default_database_quota(guint64 default_quota)
> +{
> + webkit_default_database_quota = default_quota;
> +}
> +
> +WEBKIT_API GType
> +webkit_web_database_get_type (void);
> +
> +WEBKIT_API WebKitSecurityOrigin*
> +webkit_web_database_get_origin (WebKitWebDatabase* web_database);
There should be a space between the type and the asterisk.
> +
> +WEBKIT_API void
> +webkit_web_database_remove (WebKitWebDatabase* web_database);
> +
I think we need to distinguish between web_database and just database. Or maybe
just rename database to databases (or something like that) to signify multiple
databases?
> +WebKitSecurityOrigin* webkit_web_frame_get_origin(WebKitWebFrame* frame)
> +{
> + WebKitWebFramePrivate* priv = frame->priv;
> + if (!priv->coreFrame || !priv->coreFrame->document())
> + return NULL;
> +
> + WebKitSecurityOrigin* origin = kit(priv->coreFrame->document()->securityOrigin());
> + return origin;
No need for the intermediate local variable here.
> + /**
> + * WebKitWebView::database-quota-exceeded
> + * @web_view: the object which received the signal
> + * @frame: the relevant frame
> + * @database: the #WebKitWebDatabase which exceeded the quota of its #WebKitSecurityOrigin
> + * @param: a #GHashTable with additional attributes (strings)
> + *
What's the @param for? Also, I think it would be good nice if the signal
handler can return a boolean stating that either it actioned the exceeded-quota
event or not. This way, if the signal wasn't handled we can fallback to the
default of setting a quota. If they handled the signal then maybe we don't need
to reset the quota?
> + * The #WebKitWebView::database-exceeded-quota signal will be emitted when
> + * a Web Database exceeds the quota of its security origin. This signal
> + * may be used to increase the size of the quota before the originating
> + * operation fails.
> + *
> + * Since: 1.1.13
> + */
> + webkit_web_view_signals[PLUGIN_WIDGET] = g_signal_new("database-quota-exceeded",
Why PLUGIN_WIDGET?
Other parts look fine to me. Need some stakeholders to look into this as well.
Thanks for finishing the patch!
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list