bug 839193 - test for corresponding bug r=bent

This commit is contained in:
David Keeler 2013-02-07 17:11:46 -08:00
parent 5ace77102d
commit a2b6d33d88
4 changed files with 83 additions and 0 deletions

View File

@ -138,6 +138,9 @@ MOCHITEST_BROWSER_FILES = \
browser_quotaPromptDatabases.js \
browser_quotaPromptDelete.html \
browser_quotaPromptDelete.js \
browser_bug839193.js \
bug839193.js \
bug839193.xul \
head.js \
$(NULL)

View File

@ -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");
}

View File

@ -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);
}

View File

@ -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>