summaryrefslogtreecommitdiffstats
path: root/content/browser/resources
diff options
context:
space:
mode:
authoralecflett@chromium.org <alecflett@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-18 11:14:37 +0000
committeralecflett@chromium.org <alecflett@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-18 11:14:37 +0000
commit6bb703b219208ded26cf494ca9a2f2eb7238a9fe (patch)
tree25cac94f41a24366e94918785a9abb6096631898 /content/browser/resources
parent8bbf61998ab30c1cec463611d16ebf83e3050d02 (diff)
downloadchromium_src-6bb703b219208ded26cf494ca9a2f2eb7238a9fe.zip
chromium_src-6bb703b219208ded26cf494ca9a2f2eb7238a9fe.tar.gz
chromium_src-6bb703b219208ded26cf494ca9a2f2eb7238a9fe.tar.bz2
Add a "Force Close" link and connection count to indexeddb-interanals.
Previously you could force close by downloading, but it wasn't even obvious that this was happening. Now there is a separate force close link, as well as an updating connection count to give visual feedback that the close succeeded *and* that it reached 0. BUG=259873 TBR=jam@chromium.org,michaeln@chromium.org,bauerb@chromium.org Review URL: https://chromiumcodereview.appspot.com/19019005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212325 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/resources')
-rw-r--r--content/browser/resources/indexed_db/indexeddb_internals.html8
-rw-r--r--content/browser/resources/indexed_db/indexeddb_internals.js44
2 files changed, 45 insertions, 7 deletions
diff --git a/content/browser/resources/indexed_db/indexeddb_internals.html b/content/browser/resources/indexed_db/indexeddb_internals.html
index a3621f6..0625079 100644
--- a/content/browser/resources/indexed_db/indexeddb_internals.html
+++ b/content/browser/resources/indexed_db/indexeddb_internals.html
@@ -28,11 +28,19 @@
<span>Last modified:</span>
<span jscontent="new Date(last_modified)"></span>
</div>
+ <div>
+ <span>Open connections:</span>
+ <span class="connection-count"
+ jsvalues=".idb_origin_url:url;.idb_partition_path:$partition_path"
+ jscontent="connection_count">
+ </div>
<div class="indexeddb-last-modified">
<span>Path:</span>
<span jscontent="path"></span>
</div>
<div class="controls">
+ <a href="#" class="force-close"
+ jsvalues=".idb_origin_url:url;.idb_partition_path:$partition_path">Force close</a>
<a href="#" class="download"
jsvalues=".idb_origin_url:url;.idb_partition_path:$partition_path">Download</a>
<span class="download-status" style="display: none">Loading...</span>
diff --git a/content/browser/resources/indexed_db/indexeddb_internals.js b/content/browser/resources/indexed_db/indexeddb_internals.js
index 378b9ad..fc80a25 100644
--- a/content/browser/resources/indexed_db/indexeddb_internals.js
+++ b/content/browser/resources/indexed_db/indexeddb_internals.js
@@ -21,18 +21,43 @@ cr.define('indexeddb', function() {
return false;
}
- // Fired from the backend after the data has been zipped up, and the
- // download manager has begun downloading the file.
- function onOriginDownloadReady(partition_path, origin_url) {
- var downloadLinks = document.querySelectorAll('a.download');
- for (var i = 0; i < downloadLinks.length; ++i) {
- var link = downloadLinks[i];
+ function forceClose(event) {
+ var link = event.target;
+ progressNodeFor(link).style.display = 'inline';
+ chrome.send('forceClose', [link.idb_partition_path,
+ link.idb_origin_url]);
+ return false;
+ }
+
+ function withNode(selector, partition_path, origin_url, callback) {
+ var links = document.querySelectorAll(selector);
+ for (var i = 0; i < links.length; ++i) {
+ var link = links[i];
if (partition_path == link.idb_partition_path &&
origin_url == link.idb_origin_url) {
- progressNodeFor(link).style.display = 'none';
+ callback(link);
}
}
}
+ // Fired from the backend after the data has been zipped up, and the
+ // download manager has begun downloading the file.
+ function onOriginDownloadReady(partition_path, origin_url, connection_count) {
+ withNode('a.download', partition_path, origin_url, function(link) {
+ progressNodeFor(link).style.display = 'none';
+ });
+ withNode('.connection-count', partition_path, origin_url, function(span) {
+ span.innerText = connection_count;
+ });
+ }
+
+ function onForcedClose(partition_path, origin_url, connection_count) {
+ withNode('a.force-close', partition_path, origin_url, function(link) {
+ progressNodeFor(link).style.display = 'none';
+ });
+ withNode('.connection-count', partition_path, origin_url, function(span) {
+ span.innerText = connection_count;
+ });
+ }
// Fired from the backend with a single partition's worth of
// IndexedDB metadata.
@@ -47,10 +72,15 @@ cr.define('indexeddb', function() {
for (var i = 0; i < downloadLinks.length; ++i) {
downloadLinks[i].addEventListener('click', downloadOriginData, false);
}
+ var forceCloseLinks = container.querySelectorAll('a.force-close');
+ for (i = 0; i < forceCloseLinks.length; ++i) {
+ forceCloseLinks[i].addEventListener('click', forceClose, false);
+ }
}
return {
initialize: initialize,
+ onForcedClose: onForcedClose,
onOriginDownloadReady: onOriginDownloadReady,
onOriginsReady: onOriginsReady,
};