[Bug 22540] Fire event when database connection is closed without explicit close() call

https://www.w3.org/Bugs/Public/show_bug.cgi?id=22540

Chris Mumford <cmumford@google.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |cmumford@google.com

--- Comment #4 from Chris Mumford <cmumford@google.com> ---
Regarding Josh's suggestion for a closure reason, here's my proposal.

== Scenarios ==

Use case #1 - Normal closure caused by page

In this case the web page will:

1. Open a connection to database.
2. Register a close event handler.
3. Optionally read/write data from/to the database.
4. Script calls close() on the IDBDatabase connection object.

Use case #2 - Normal closure caused by browser

In this case the web page will:

1. Open a connection to database.
2. Register a close event handler.
3. Optionally read/write data from/to the database.

When the database is open the user will then:

1. Display browser settings.
2. Choose to clear client data (like "Clear cookies and other site data").

In this use case the page did not initiate the closure.

Use case #3 - Error in backing store forced closure.

In this case the web page will:

1. Open a connection to database.
2. Register a close event handler.
3. Read/write data from/to the database.

During the execution of the reads/writes in step #3 the backing store
encountered an error which requires the connection to be closed.

== Proposal ==

The proposed solution is to fire a "close" event at the IDBDatabase object, as
previously suggested, but the event will implement the new
IDBConnectionCloseEvent interface

interface IDBConnectionCloseEvent : Event {
    readonly    attribute DOMString      reason;
    readonly    attribute DOMString      message;
};

The values for these attributes are as follows.

reason:
-------
"closed"
"user"
"error"

message:
--------
This would contain any additional information the browser may want to supply.
Some examples might be:

  "Closed by page"
  "Deleted all user data"
  "Database corrupt: Checksum mismatch"

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Tuesday, 18 February 2014 23:01:12 UTC