bug 839193 - test for corresponding bug r=bent a=lsblakk
authorDavid Keeler <dkeeler@mozilla.com>
Thu, 07 Feb 2013 17:11:46 -0800
changeset 127508 e841c66bde34489552a78cc38829d55a7468c668
parent 127507 9b6f9b97e938e2cd4e7fe910231c85d743c38d51
child 127509 a12a304c16aff0a9f9dfd12b775c947a8bb7b84f
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbent, lsblakk
bugs839193
milestone20.0a2
bug 839193 - test for corresponding bug r=bent a=lsblakk
dom/indexedDB/test/Makefile.in
dom/indexedDB/test/browser_bug839193.js
dom/indexedDB/test/bug839193.js
dom/indexedDB/test/bug839193.xul
--- a/dom/indexedDB/test/Makefile.in
+++ b/dom/indexedDB/test/Makefile.in
@@ -132,16 +132,19 @@ MOCHITEST_BROWSER_FILES = \
   browser_permissionsPromptDeny.js \
   browser_quotaPrompt.html \
   browser_quotaPromptAllow.js \
   browser_quotaPromptDeny.js \
   browser_quotaPromptDatabases.html \
   browser_quotaPromptDatabases.js \
   browser_quotaPromptDelete.html \
   browser_quotaPromptDelete.js \
+  browser_bug839193.js \
+  bug839193.js \
+  bug839193.xul \
   head.js \
   $(NULL)
 
 ifdef MOZ_PER_WINDOW_PRIVATE_BROWSING
 MOCHITEST_BROWSER_FILES += \
   browser_perwindow_privateBrowsing.js \
   $(NULL)
 else
new file mode 100644
--- /dev/null
+++ b/dom/indexedDB/test/browser_bug839193.js
@@ -0,0 +1,35 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+let gTestRoot = getRootDirectory(gTestPath);
+let gBugWindow = null;
+let gIterations = 5;
+
+function onLoad() {
+  gBugWindow.close();
+}
+
+function onUnload() {
+  if (!gIterations) {
+    finish();
+  } else {
+    gBugWindow = window.openDialog(gTestRoot + "bug839193.xul");
+    gIterations--;
+  }
+}
+
+// This test is about leaks, which are handled by the test harness, so
+// there are no actual checks here. Whether or not this test passes or fails
+// will be apparent by the checks the harness performs.
+function test() {
+  waitForExplicitFinish();
+  Components.classes["@mozilla.org/observer-service;1"]
+            .getService(Components.interfaces.nsIObserverService)
+            .addObserver(onLoad, "bug839193-loaded", false);
+  Components.classes["@mozilla.org/observer-service;1"]
+            .getService(Components.interfaces.nsIObserverService)
+            .addObserver(onUnload, "bug839193-unloaded", false);
+
+  gBugWindow = window.openDialog(gTestRoot + "bug839193.xul");
+}
new file mode 100644
--- /dev/null
+++ b/dom/indexedDB/test/bug839193.js
@@ -0,0 +1,28 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+const nsIIndexedDatabaseManager =
+  Components.interfaces.nsIIndexedDatabaseManager;
+
+let gURI = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService).newURI("http://localhost", null, null);
+
+function onIndexedDBUsageCallback(uri, usage, fileUsage) {}
+
+function onLoad()
+{
+  var dbManager = Components.classes["@mozilla.org/dom/indexeddb/manager;1"]
+                            .getService(nsIIndexedDatabaseManager);
+  dbManager.getUsageForURI(gURI, onIndexedDBUsageCallback);
+  dbManager.cancelGetUsageForURI(gURI, onIndexedDBUsageCallback);
+  Components.classes["@mozilla.org/observer-service;1"]
+            .getService(Components.interfaces.nsIObserverService)
+            .notifyObservers(window, "bug839193-loaded", null);
+}
+
+function onUnload()
+{
+  Components.classes["@mozilla.org/observer-service;1"]
+            .getService(Components.interfaces.nsIObserverService)
+            .notifyObservers(window, "bug839193-unloaded", null);
+}
new file mode 100644
--- /dev/null
+++ b/dom/indexedDB/test/bug839193.xul
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+   - License, v. 2.0. If a copy of the MPL was not distributed with this
+   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+<window id="main-window"
+  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+  windowtype="Browser:bug839193"
+  onload="onLoad()"
+  onunload="onUnload()"
+  align="stretch"
+  screenX="10" screenY="10"
+  width="600" height="600"
+  persist="screenX screenY width height sizemode">
+
+  <script type="application/javascript" src="chrome://mochitests/content/browser/dom/indexedDB/test/bug839193.js"/>
+</window>