summaryrefslogtreecommitdiffstats
path: root/dom
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-11-08 10:49:46 +0100
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-11-08 10:49:46 +0100
commiteb35cd10852cde613e6047220835cfa61eef6e01 (patch)
tree8bbc9e1d3ef8b676ea6efe99ba5ed26fe9c06716 /dom
parent60c83971fb19dea49beab3a02c8913f75f62ad09 (diff)
downloadUXP-eb35cd10852cde613e6047220835cfa61eef6e01.tar
UXP-eb35cd10852cde613e6047220835cfa61eef6e01.tar.gz
UXP-eb35cd10852cde613e6047220835cfa61eef6e01.tar.lz
UXP-eb35cd10852cde613e6047220835cfa61eef6e01.tar.xz
UXP-eb35cd10852cde613e6047220835cfa61eef6e01.zip
Issue #1263 - Part 2: Remove DiskSpaceWatcher tests
Diffstat (limited to 'dom')
-rw-r--r--dom/indexedDB/test/helpers.js4
-rw-r--r--dom/indexedDB/test/mochitest.ini2
-rw-r--r--dom/indexedDB/test/test_lowDiskSpace.html19
-rw-r--r--dom/indexedDB/test/unit/test_lowDiskSpace.js754
-rw-r--r--dom/indexedDB/test/unit/xpcshell-head-parent-process.js3
-rw-r--r--dom/indexedDB/test/unit/xpcshell-parent-process.ini1
-rw-r--r--dom/tests/mochitest/ajax/offline/mochitest.ini2
-rw-r--r--dom/tests/mochitest/ajax/offline/test_lowDeviceStorage.html91
-rw-r--r--dom/tests/mochitest/ajax/offline/test_lowDeviceStorageDuringUpdate.html58
-rw-r--r--dom/tests/mochitest/localstorage/mochitest.ini1
-rw-r--r--dom/tests/mochitest/localstorage/test_lowDeviceStorage.html76
11 files changed, 0 insertions, 1011 deletions
diff --git a/dom/indexedDB/test/helpers.js b/dom/indexedDB/test/helpers.js
index e6e27f3f3..ffe66ebcd 100644
--- a/dom/indexedDB/test/helpers.js
+++ b/dom/indexedDB/test/helpers.js
@@ -217,10 +217,6 @@ if (!window.runTest) {
function finishTest()
{
- SpecialPowers.notifyObserversInParentProcess(null,
- "disk-space-watcher",
- "free");
-
SimpleTest.executeSoon(function() {
testGenerator.close();
testHarnessGenerator.close();
diff --git a/dom/indexedDB/test/mochitest.ini b/dom/indexedDB/test/mochitest.ini
index 4ab55a9dc..ca65ea8b6 100644
--- a/dom/indexedDB/test/mochitest.ini
+++ b/dom/indexedDB/test/mochitest.ini
@@ -66,7 +66,6 @@ support-files =
unit/test_locale_aware_indexes.js
unit/test_locale_aware_index_getAll.js
unit/test_locale_aware_index_getAllObjects.js
- unit/test_lowDiskSpace.js
unit/test_maximal_serialized_object_size.js
unit/test_multientry.js
unit/test_names_sorted.js
@@ -214,7 +213,6 @@ skip-if = true
[test_key_requirements.html]
[test_keys.html]
[test_leaving_page.html]
-[test_lowDiskSpace.html]
[test_maximal_serialized_object_size.html]
[test_message_manager_ipc.html]
# This test is only supposed to run in the main process.
diff --git a/dom/indexedDB/test/test_lowDiskSpace.html b/dom/indexedDB/test/test_lowDiskSpace.html
deleted file mode 100644
index cffd46549..000000000
--- a/dom/indexedDB/test/test_lowDiskSpace.html
+++ /dev/null
@@ -1,19 +0,0 @@
-<!--
- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/
--->
-<html>
-<head>
- <title>Indexed Database Low Disk Space Test</title>
-
- <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-
- <script type="text/javascript;version=1.7" src="unit/test_lowDiskSpace.js"></script>
- <script type="text/javascript;version=1.7" src="helpers.js"></script>
-
-</head>
-
-<body onload="runTest();"></body>
-
-</html>
diff --git a/dom/indexedDB/test/unit/test_lowDiskSpace.js b/dom/indexedDB/test/unit/test_lowDiskSpace.js
deleted file mode 100644
index eaea5797d..000000000
--- a/dom/indexedDB/test/unit/test_lowDiskSpace.js
+++ /dev/null
@@ -1,754 +0,0 @@
-/**
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-"use strict";
-
-var disableWorkerTest = "This test uses SpecialPowers";
-
-var self = this;
-
-var testGenerator = testSteps();
-
-function testSteps()
-{
- const dbName = self.window ? window.location.pathname : "test_lowDiskSpace";
- const dbVersion = 1;
-
- const objectStoreName = "foo";
- const objectStoreOptions = { keyPath: "foo" };
-
- const indexName = "bar";
- const indexOptions = { unique: true };
-
- const dbData = [
- { foo: 0, bar: 0 },
- { foo: 1, bar: 10 },
- { foo: 2, bar: 20 },
- { foo: 3, bar: 30 },
- { foo: 4, bar: 40 },
- { foo: 5, bar: 50 },
- { foo: 6, bar: 60 },
- { foo: 7, bar: 70 },
- { foo: 8, bar: 80 },
- { foo: 9, bar: 90 }
- ];
-
- let lowDiskMode = false;
- function setLowDiskMode(val) {
- let data = val ? "full" : "free";
-
- if (val == lowDiskMode) {
- info("Low disk mode is: " + data);
- }
- else {
- info("Changing low disk mode to: " + data);
- SpecialPowers.notifyObserversInParentProcess(null, "disk-space-watcher",
- data);
- lowDiskMode = val;
- }
- }
-
- { // Make sure opening works from the beginning.
- info("Test 1");
-
- setLowDiskMode(false);
-
- let request = indexedDB.open(dbName, dbVersion);
- request.onerror = errorHandler;
- request.onsuccess = grabEventAndContinueHandler;
- let event = yield undefined;
-
- is(event.type, "success", "Opened database without setting low disk mode");
-
- let db = event.target.result;
- db.close();
- }
-
- { // Make sure delete works in low disk mode.
- info("Test 2");
-
- setLowDiskMode(true);
-
- let request = indexedDB.deleteDatabase(dbName);
- request.onerror = errorHandler;
- request.onsuccess = grabEventAndContinueHandler;
- let event = yield undefined;
-
- is(event.type, "success", "Deleted database after setting low disk mode");
- }
-
- { // Make sure creating a db in low disk mode fails.
- info("Test 3");
-
- setLowDiskMode(true);
-
- let request = indexedDB.open(dbName, dbVersion);
- request.onerror = expectedErrorHandler("QuotaExceededError");
- request.onupgradeneeded = unexpectedSuccessHandler;
- request.onsuccess = unexpectedSuccessHandler;
- let event = yield undefined;
-
- is(event.type, "error", "Didn't create new database in low disk mode");
- }
-
- { // Make sure opening an already-existing db in low disk mode succeeds.
- info("Test 4");
-
- setLowDiskMode(false);
-
- let request = indexedDB.open(dbName, dbVersion);
- request.onerror = errorHandler;
- request.onupgradeneeded = grabEventAndContinueHandler;
- request.onsuccess = unexpectedSuccessHandler;
- let event = yield undefined;
-
- is(event.type, "upgradeneeded", "Upgrading database");
-
- let db = event.target.result;
- db.onerror = errorHandler;
-
- request.onupgradeneeded = unexpectedSuccessHandler;
- request.onsuccess = grabEventAndContinueHandler;
- event = yield undefined;
-
- is(event.type, "success", "Created database");
- ok(event.target.result === db, "Got the same database");
-
- db.close();
-
- setLowDiskMode(true);
-
- request = indexedDB.open(dbName);
- request.onerror = errorHandler;
- request.onupgradeneeded = unexpectedSuccessHandler;
- request.onsuccess = grabEventAndContinueHandler;
- event = yield undefined;
-
- is(event.type, "success", "Opened existing database in low disk mode");
-
- db = event.target.result;
- db.close();
- }
-
- { // Make sure upgrading an already-existing db in low disk mode succeeds.
- info("Test 5");
-
- setLowDiskMode(true);
-
- let request = indexedDB.open(dbName, dbVersion + 1);
- request.onerror = errorHandler;
- request.onupgradeneeded = grabEventAndContinueHandler;
- request.onsuccess = unexpectedSuccessHandler;
-
- let event = yield undefined;
-
- is(event.type, "upgradeneeded", "Upgrading database");
-
- let db = event.target.result;
- db.onerror = errorHandler;
-
- request.onupgradeneeded = unexpectedSuccessHandler;
- request.onsuccess = grabEventAndContinueHandler;
- event = yield undefined;
-
- is(event.type, "success", "Created database");
- ok(event.target.result === db, "Got the same database");
-
- db.close();
- }
-
- { // Make sure creating objectStores in low disk mode fails.
- info("Test 6");
-
- setLowDiskMode(true);
-
- let request = indexedDB.open(dbName, dbVersion + 2);
- request.onerror = errorHandler;
- request.onupgradeneeded = grabEventAndContinueHandler;
- request.onsuccess = unexpectedSuccessHandler;
-
- let event = yield undefined;
-
- is(event.type, "upgradeneeded", "Upgrading database");
-
- let db = event.target.result;
- db.onerror = errorHandler;
-
- let txn = event.target.transaction;
- txn.onerror = expectedErrorHandler("AbortError");
- txn.onabort = grabEventAndContinueHandler;
-
- let objectStore = db.createObjectStore(objectStoreName, objectStoreOptions);
-
- request.onupgradeneeded = unexpectedSuccessHandler;
- event = yield undefined;
-
- is(event.type, "abort", "Got correct event type");
- is(event.target.error.name, "QuotaExceededError", "Got correct error type");
-
- request.onerror = expectedErrorHandler("AbortError");
- event = yield undefined;
- }
-
- { // Make sure creating indexes in low disk mode fails.
- info("Test 7");
-
- setLowDiskMode(false);
-
- let request = indexedDB.open(dbName, dbVersion + 2);
- request.onerror = errorHandler;
- request.onupgradeneeded = grabEventAndContinueHandler;
- request.onsuccess = unexpectedSuccessHandler;
-
- let event = yield undefined;
-
- is(event.type, "upgradeneeded", "Upgrading database");
-
- let db = event.target.result;
- db.onerror = errorHandler;
-
- let objectStore = db.createObjectStore(objectStoreName, objectStoreOptions);
-
- request.onupgradeneeded = unexpectedSuccessHandler;
- request.onsuccess = grabEventAndContinueHandler;
- event = yield undefined;
-
- is(event.type, "success", "Upgraded database");
- ok(event.target.result === db, "Got the same database");
-
- db.close();
-
- setLowDiskMode(true);
-
- request = indexedDB.open(dbName, dbVersion + 3);
- request.onerror = errorHandler;
- request.onupgradeneeded = grabEventAndContinueHandler;
- request.onsuccess = unexpectedSuccessHandler;
- event = yield undefined;
-
- is(event.type, "upgradeneeded", "Upgrading database");
-
- db = event.target.result;
- db.onerror = errorHandler;
- let txn = event.target.transaction;
- txn.onerror = expectedErrorHandler("AbortError");
- txn.onabort = grabEventAndContinueHandler;
-
- objectStore = event.target.transaction.objectStore(objectStoreName);
- let index = objectStore.createIndex(indexName, indexName, indexOptions);
-
- request.onupgradeneeded = unexpectedSuccessHandler;
- event = yield undefined;
-
- is(event.type, "abort", "Got correct event type");
- is(event.target.error.name, "QuotaExceededError", "Got correct error type");
-
- request.onerror = expectedErrorHandler("AbortError");
- event = yield undefined;
- }
-
- { // Make sure deleting indexes in low disk mode succeeds.
- info("Test 8");
-
- setLowDiskMode(false);
-
- let request = indexedDB.open(dbName, dbVersion + 3);
- request.onerror = errorHandler;
- request.onupgradeneeded = grabEventAndContinueHandler;
- request.onsuccess = unexpectedSuccessHandler;
-
- let event = yield undefined;
-
- is(event.type, "upgradeneeded", "Upgrading database");
-
- let db = event.target.result;
- db.onerror = errorHandler;
-
- let objectStore = event.target.transaction.objectStore(objectStoreName);
- let index = objectStore.createIndex(indexName, indexName, indexOptions);
-
- request.onupgradeneeded = unexpectedSuccessHandler;
- request.onsuccess = grabEventAndContinueHandler;
- event = yield undefined;
-
- is(event.type, "success", "Upgraded database");
- ok(event.target.result === db, "Got the same database");
-
- db.close();
-
- setLowDiskMode(true);
-
- request = indexedDB.open(dbName, dbVersion + 4);
- request.onerror = errorHandler;
- request.onupgradeneeded = grabEventAndContinueHandler;
- request.onsuccess = unexpectedSuccessHandler;
- event = yield undefined;
-
- is(event.type, "upgradeneeded", "Upgrading database");
-
- db = event.target.result;
- db.onerror = errorHandler;
-
- objectStore = event.target.transaction.objectStore(objectStoreName);
- objectStore.deleteIndex(indexName);
-
- request.onupgradeneeded = unexpectedSuccessHandler;
- request.onsuccess = grabEventAndContinueHandler;
- event = yield undefined;
-
- is(event.type, "success", "Upgraded database");
- ok(event.target.result === db, "Got the same database");
-
- db.close();
- }
-
- { // Make sure deleting objectStores in low disk mode succeeds.
- info("Test 9");
-
- setLowDiskMode(true);
-
- let request = indexedDB.open(dbName, dbVersion + 5);
- request.onerror = errorHandler;
- request.onupgradeneeded = grabEventAndContinueHandler;
- request.onsuccess = unexpectedSuccessHandler;
-
- let event = yield undefined;
-
- is(event.type, "upgradeneeded", "Upgrading database");
-
- let db = event.target.result;
- db.onerror = errorHandler;
-
- db.deleteObjectStore(objectStoreName);
-
- request.onupgradeneeded = unexpectedSuccessHandler;
- request.onsuccess = grabEventAndContinueHandler;
- event = yield undefined;
-
- is(event.type, "success", "Upgraded database");
- ok(event.target.result === db, "Got the same database");
-
- db.close();
-
- // Reset everything.
- indexedDB.deleteDatabase(dbName);
- }
-
-
- { // Add data that the rest of the tests will use.
- info("Adding test data");
-
- setLowDiskMode(false);
-
- let request = indexedDB.open(dbName, dbVersion);
- request.onerror = errorHandler;
- request.onupgradeneeded = grabEventAndContinueHandler;
- request.onsuccess = unexpectedSuccessHandler;
- let event = yield undefined;
-
- is(event.type, "upgradeneeded", "Upgrading database");
-
- let db = event.target.result;
- db.onerror = errorHandler;
-
- let objectStore = db.createObjectStore(objectStoreName, objectStoreOptions);
- let index = objectStore.createIndex(indexName, indexName, indexOptions);
-
- for (let data of dbData) {
- objectStore.add(data);
- }
-
- request.onupgradeneeded = unexpectedSuccessHandler;
- request.onsuccess = grabEventAndContinueHandler;
- event = yield undefined;
-
- is(event.type, "success", "Upgraded database");
- ok(event.target.result === db, "Got the same database");
-
- db.close();
- }
-
- { // Make sure read operations in readonly transactions succeed in low disk
- // mode.
- info("Test 10");
-
- setLowDiskMode(true);
-
- let request = indexedDB.open(dbName, dbVersion);
- request.onerror = errorHandler;
- request.onupgradeneeded = unexpectedSuccessHandler;
- request.onsuccess = grabEventAndContinueHandler;
- let event = yield undefined;
-
- let db = event.target.result;
- db.onerror = errorHandler;
-
- let transaction = db.transaction(objectStoreName);
- let objectStore = transaction.objectStore(objectStoreName);
- let index = objectStore.index(indexName);
-
- let data = dbData[0];
-
- let requestCounter = new RequestCounter();
-
- objectStore.get(data.foo).onsuccess = requestCounter.handler();
- objectStore.mozGetAll().onsuccess = requestCounter.handler();
- objectStore.count().onsuccess = requestCounter.handler();
- index.get(data.bar).onsuccess = requestCounter.handler();
- index.mozGetAll().onsuccess = requestCounter.handler();
- index.getKey(data.bar).onsuccess = requestCounter.handler();
- index.mozGetAllKeys().onsuccess = requestCounter.handler();
- index.count().onsuccess = requestCounter.handler();
-
- let objectStoreDataCount = 0;
-
- request = objectStore.openCursor();
- request.onsuccess = function(event) {
- let cursor = event.target.result;
- if (cursor) {
- objectStoreDataCount++;
- objectStoreDataCount % 2 ? cursor.continue() : cursor.advance(1);
- }
- else {
- is(objectStoreDataCount, dbData.length, "Saw all data");
- requestCounter.decr();
- }
- };
- requestCounter.incr();
-
- let indexDataCount = 0;
-
- request = index.openCursor();
- request.onsuccess = function(event) {
- let cursor = event.target.result;
- if (cursor) {
- indexDataCount++;
- indexDataCount % 2 ? cursor.continue() : cursor.advance(1);
- }
- else {
- is(indexDataCount, dbData.length, "Saw all data");
- requestCounter.decr();
- }
- };
- requestCounter.incr();
-
- let indexKeyDataCount = 0;
-
- request = index.openCursor();
- request.onsuccess = function(event) {
- let cursor = event.target.result;
- if (cursor) {
- indexKeyDataCount++;
- indexKeyDataCount % 2 ? cursor.continue() : cursor.advance(1);
- }
- else {
- is(indexKeyDataCount, dbData.length, "Saw all data");
- requestCounter.decr();
- }
- };
- requestCounter.incr();
-
- // Wait for all requests.
- yield undefined;
-
- transaction.oncomplete = grabEventAndContinueHandler;
- event = yield undefined;
-
- is(event.type, "complete", "Transaction succeeded");
-
- db.close();
- }
-
- { // Make sure read operations in readwrite transactions succeed in low disk
- // mode.
- info("Test 11");
-
- setLowDiskMode(true);
-
- let request = indexedDB.open(dbName, dbVersion);
- request.onerror = errorHandler;
- request.onupgradeneeded = unexpectedSuccessHandler;
- request.onsuccess = grabEventAndContinueHandler;
- let event = yield undefined;
-
- let db = event.target.result;
- db.onerror = errorHandler;
-
- let transaction = db.transaction(objectStoreName, "readwrite");
- let objectStore = transaction.objectStore(objectStoreName);
- let index = objectStore.index(indexName);
-
- let data = dbData[0];
-
- let requestCounter = new RequestCounter();
-
- objectStore.get(data.foo).onsuccess = requestCounter.handler();
- objectStore.mozGetAll().onsuccess = requestCounter.handler();
- objectStore.count().onsuccess = requestCounter.handler();
- index.get(data.bar).onsuccess = requestCounter.handler();
- index.mozGetAll().onsuccess = requestCounter.handler();
- index.getKey(data.bar).onsuccess = requestCounter.handler();
- index.mozGetAllKeys().onsuccess = requestCounter.handler();
- index.count().onsuccess = requestCounter.handler();
-
- let objectStoreDataCount = 0;
-
- request = objectStore.openCursor();
- request.onsuccess = function(event) {
- let cursor = event.target.result;
- if (cursor) {
- objectStoreDataCount++;
- objectStoreDataCount % 2 ? cursor.continue() : cursor.advance(1);
- }
- else {
- is(objectStoreDataCount, dbData.length, "Saw all data");
- requestCounter.decr();
- }
- };
- requestCounter.incr();
-
- let indexDataCount = 0;
-
- request = index.openCursor();
- request.onsuccess = function(event) {
- let cursor = event.target.result;
- if (cursor) {
- indexDataCount++;
- indexDataCount % 2 ? cursor.continue() : cursor.advance(1);
- }
- else {
- is(indexDataCount, dbData.length, "Saw all data");
- requestCounter.decr();
- }
- };
- requestCounter.incr();
-
- let indexKeyDataCount = 0;
-
- request = index.openCursor();
- request.onsuccess = function(event) {
- let cursor = event.target.result;
- if (cursor) {
- indexKeyDataCount++;
- indexKeyDataCount % 2 ? cursor.continue() : cursor.advance(1);
- }
- else {
- is(indexKeyDataCount, dbData.length, "Saw all data");
- requestCounter.decr();
- }
- };
- requestCounter.incr();
-
- // Wait for all requests.
- yield undefined;
-
- transaction.oncomplete = grabEventAndContinueHandler;
- event = yield undefined;
-
- is(event.type, "complete", "Transaction succeeded");
-
- db.close();
- }
-
- { // Make sure write operations in readwrite transactions fail in low disk
- // mode.
- info("Test 12");
-
- setLowDiskMode(true);
-
- let request = indexedDB.open(dbName, dbVersion);
- request.onerror = errorHandler;
- request.onupgradeneeded = unexpectedSuccessHandler;
- request.onsuccess = grabEventAndContinueHandler;
- let event = yield undefined;
-
- let db = event.target.result;
- db.onerror = errorHandler;
-
- let transaction = db.transaction(objectStoreName, "readwrite");
- let objectStore = transaction.objectStore(objectStoreName);
- let index = objectStore.index(indexName);
-
- let data = dbData[0];
- let newData = { foo: 999, bar: 999 };
-
- let requestCounter = new RequestCounter();
-
- objectStore.add(newData).onerror = requestCounter.errorHandler();
- objectStore.put(newData).onerror = requestCounter.errorHandler();
-
- objectStore.get(data.foo).onsuccess = requestCounter.handler();
- objectStore.mozGetAll().onsuccess = requestCounter.handler();
- objectStore.count().onsuccess = requestCounter.handler();
- index.get(data.bar).onsuccess = requestCounter.handler();
- index.mozGetAll().onsuccess = requestCounter.handler();
- index.getKey(data.bar).onsuccess = requestCounter.handler();
- index.mozGetAllKeys().onsuccess = requestCounter.handler();
- index.count().onsuccess = requestCounter.handler();
-
- let objectStoreDataCount = 0;
-
- request = objectStore.openCursor();
- request.onsuccess = function(event) {
- let cursor = event.target.result;
- if (cursor) {
- objectStoreDataCount++;
- cursor.update(cursor.value).onerror = requestCounter.errorHandler();
- objectStoreDataCount % 2 ? cursor.continue() : cursor.advance(1);
- }
- else {
- is(objectStoreDataCount, dbData.length, "Saw all data");
- requestCounter.decr();
- }
- };
- requestCounter.incr();
-
- let indexDataCount = 0;
-
- request = index.openCursor();
- request.onsuccess = function(event) {
- let cursor = event.target.result;
- if (cursor) {
- indexDataCount++;
- cursor.update(cursor.value).onerror = requestCounter.errorHandler();
- indexDataCount % 2 ? cursor.continue() : cursor.advance(1);
- }
- else {
- is(indexDataCount, dbData.length, "Saw all data");
- requestCounter.decr();
- }
- };
- requestCounter.incr();
-
- let indexKeyDataCount = 0;
-
- request = index.openCursor();
- request.onsuccess = function(event) {
- let cursor = event.target.result;
- if (cursor) {
- indexKeyDataCount++;
- cursor.update(cursor.value).onerror = requestCounter.errorHandler();
- indexKeyDataCount % 2 ? cursor.continue() : cursor.advance(1);
- }
- else {
- is(indexKeyDataCount, dbData.length, "Saw all data");
- requestCounter.decr();
- }
- };
- requestCounter.incr();
-
- // Wait for all requests.
- yield undefined;
-
- transaction.oncomplete = grabEventAndContinueHandler;
- event = yield undefined;
-
- is(event.type, "complete", "Transaction succeeded");
-
- db.close();
- }
-
- { // Make sure deleting operations in readwrite transactions succeed in low
- // disk mode.
- info("Test 13");
-
- setLowDiskMode(true);
-
- let request = indexedDB.open(dbName, dbVersion);
- request.onerror = errorHandler;
- request.onupgradeneeded = unexpectedSuccessHandler;
- request.onsuccess = grabEventAndContinueHandler;
- let event = yield undefined;
-
- let db = event.target.result;
- db.onerror = errorHandler;
-
- let transaction = db.transaction(objectStoreName, "readwrite");
- let objectStore = transaction.objectStore(objectStoreName);
- let index = objectStore.index(indexName);
-
- let dataIndex = 0;
- let data = dbData[dataIndex++];
-
- let requestCounter = new RequestCounter();
-
- objectStore.delete(data.foo).onsuccess = requestCounter.handler();
-
- objectStore.openCursor().onsuccess = function(event) {
- let cursor = event.target.result;
- if (cursor) {
- cursor.delete().onsuccess = requestCounter.handler();
- }
- requestCounter.decr();
- };
- requestCounter.incr();
-
- index.openCursor(null, "prev").onsuccess = function(event) {
- let cursor = event.target.result;
- if (cursor) {
- cursor.delete().onsuccess = requestCounter.handler();
- }
- requestCounter.decr();
- };
- requestCounter.incr();
-
- yield undefined;
-
- objectStore.count().onsuccess = grabEventAndContinueHandler;
- event = yield undefined;
-
- is(event.target.result, dbData.length - 3, "Actually deleted something");
-
- objectStore.clear();
- objectStore.count().onsuccess = grabEventAndContinueHandler;
- event = yield undefined;
-
- is(event.target.result, 0, "Actually cleared");
-
- transaction.oncomplete = grabEventAndContinueHandler;
- event = yield undefined;
-
- is(event.type, "complete", "Transaction succeeded");
-
- db.close();
- }
-
- finishTest();
- yield undefined;
-}
-
-function RequestCounter(expectedType) {
- this._counter = 0;
-}
-RequestCounter.prototype = {
- incr: function() {
- this._counter++;
- },
-
- decr: function() {
- if (!--this._counter) {
- continueToNextStepSync();
- }
- },
-
- handler: function(type, preventDefault) {
- this.incr();
- return function(event) {
- is(event.type, type || "success", "Correct type");
- this.decr();
- }.bind(this);
- },
-
- errorHandler: function(eventType, errorName) {
- this.incr();
- return function(event) {
- is(event.type, eventType || "error", "Correct type");
- is(event.target.error.name, errorName || "QuotaExceededError",
- "Correct error name");
- event.preventDefault();
- event.stopPropagation();
- this.decr();
- }.bind(this);
- }
-};
diff --git a/dom/indexedDB/test/unit/xpcshell-head-parent-process.js b/dom/indexedDB/test/unit/xpcshell-head-parent-process.js
index def791f52..fe69b1f7b 100644
--- a/dom/indexedDB/test/unit/xpcshell-head-parent-process.js
+++ b/dom/indexedDB/test/unit/xpcshell-head-parent-process.js
@@ -66,9 +66,6 @@ function finishTest()
resetWasm();
resetExperimental();
resetTesting();
-
- SpecialPowers.notifyObserversInParentProcess(null, "disk-space-watcher",
- "free");
}
SpecialPowers.removeFiles();
diff --git a/dom/indexedDB/test/unit/xpcshell-parent-process.ini b/dom/indexedDB/test/unit/xpcshell-parent-process.ini
index 04df5f552..2def60c34 100644
--- a/dom/indexedDB/test/unit/xpcshell-parent-process.ini
+++ b/dom/indexedDB/test/unit/xpcshell-parent-process.ini
@@ -46,7 +46,6 @@ skip-if = toolkit == 'android'
[test_invalidate.js]
# disabled for the moment.
skip-if = true
-[test_lowDiskSpace.js]
[test_maximal_serialized_object_size.js]
[test_metadata2Restore.js]
[test_metadataRestore.js]
diff --git a/dom/tests/mochitest/ajax/offline/mochitest.ini b/dom/tests/mochitest/ajax/offline/mochitest.ini
index 961b143b6..45909e94e 100644
--- a/dom/tests/mochitest/ajax/offline/mochitest.ini
+++ b/dom/tests/mochitest/ajax/offline/mochitest.ini
@@ -79,8 +79,6 @@ support-files =
[test_fallback.html]
[test_foreign.html]
[test_identicalManifest.html]
-[test_lowDeviceStorage.html]
-[test_lowDeviceStorageDuringUpdate.html]
[test_missingFile.html]
[test_missingManifest.html]
[test_noManifest.html]
diff --git a/dom/tests/mochitest/ajax/offline/test_lowDeviceStorage.html b/dom/tests/mochitest/ajax/offline/test_lowDeviceStorage.html
deleted file mode 100644
index d03ef5a12..000000000
--- a/dom/tests/mochitest/ajax/offline/test_lowDeviceStorage.html
+++ /dev/null
@@ -1,91 +0,0 @@
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<title>Low device storage</title>
-
-<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
-<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-
-<script type="text/javascript">
-
-/**
- * This test checks that an offline cache update scheduled *after* a low device
- * storage situation appears is canceled. It basically does:
- *
- * 1. Notifies to the offline cache update service about a fake
- * low device storage situation.
- * 2. Schedules an update and observes for its notifications.
- * 3. We are supposed to receive an error event notifying about the cancelation
- * of the update because of the low storage situation.
- * 4. Notifies to the offline cache update service that we've recovered from
- * the low storage situation.
- */
-
-var updateService = SpecialPowers.Cc['@mozilla.org/offlinecacheupdate-service;1']
- .getService(Ci.nsIOfflineCacheUpdateService);
-
-var obs = SpecialPowers.Cc["@mozilla.org/observer-service;1"]
- .getService(SpecialPowers.Ci.nsIObserverService);
-
-var errorReceived = false;
-
-var systemPrincipal = SpecialPowers.Services.scriptSecurityManager.getSystemPrincipal();
-
-function finish() {
- obs.notifyObservers(updateService, "disk-space-watcher", "free");
-
- OfflineTest.teardownAndFinish();
-}
-
-if (OfflineTest.setup()) {
- obs.notifyObservers(updateService, "disk-space-watcher", "full");
-
- var updateObserver = {
- updateStateChanged: function (aUpdate, aState) {
- switch(aState) {
- case Ci.nsIOfflineCacheUpdateObserver.STATE_ERROR:
- errorReceived = true;
- OfflineTest.ok(true, "Expected error. Update canceled");
- break;
- case Ci.nsIOfflineCacheUpdateObserver.STATE_FINISHED:
- aUpdate.removeObserver(this);
- OfflineTest.ok(errorReceived,
- "Finished after receiving the expected error");
- finish();
- break;
- case Ci.nsIOfflineCacheUpdateObserver.STATE_NOUPDATE:
- aUpdate.removeObserver(this);
- OfflineTest.ok(false, "No update");
- finish();
- break;
- case Ci.nsIOfflineCacheUpdateObserver.STATE_DOWNLOADING:
- case Ci.nsIOfflineCacheUpdateObserver.STATE_ITEMSTARTED:
- case Ci.nsIOfflineCacheUpdateObserver.STATE_ITEMPROGRESS:
- aUpdate.removeObserver(this);
- OfflineTest.ok(false, "The update was supposed to be canceled");
- finish();
- break;
- }
- },
- applicationCacheAvailable: function() {}
- };
-
- var manifest = "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest";
- var ioService = Cc["@mozilla.org/network/io-service;1"]
- .getService(Ci.nsIIOService);
- var manifestURI = ioService.newURI(manifest, null, null);
- var documentURI = ioService.newURI(document.documentURI, null, null);
- var update = updateService.scheduleUpdate(manifestURI, documentURI, systemPrincipal, window);
- update.addObserver(updateObserver, false);
-}
-
-SimpleTest.waitForExplicitFinish();
-
-</script>
-
-</head>
-
-<body>
-
-</body>
-</html>
diff --git a/dom/tests/mochitest/ajax/offline/test_lowDeviceStorageDuringUpdate.html b/dom/tests/mochitest/ajax/offline/test_lowDeviceStorageDuringUpdate.html
deleted file mode 100644
index 88a0b4eae..000000000
--- a/dom/tests/mochitest/ajax/offline/test_lowDeviceStorageDuringUpdate.html
+++ /dev/null
@@ -1,58 +0,0 @@
-<html xmlns="http://www.w3.org/1999/xhtml" manifest="http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest">
-<head>
-<title>Low device storage during update</title>
-
-<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-<script type="text/javascript" src="/tests/dom/tests/mochitest/ajax/offline/offlineTests.js"></script>
-<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-
-<script type="text/javascript">
-
-/**
- * This test checks that an offline cache update is canceled when a low device
- * storage condition is detected during the update.
- */
-
-var updateService = Cc['@mozilla.org/offlinecacheupdate-service;1']
- .getService(Ci.nsIOfflineCacheUpdateService);
-
-var obs = SpecialPowers.Cc["@mozilla.org/observer-service;1"]
- .getService(SpecialPowers.Ci.nsIObserverService);
-
-function finish() {
- obs.notifyObservers(updateService, "disk-space-watcher", "free");
-
- OfflineTest.teardownAndFinish();
-}
-
-function onError() {
- OfflineTest.ok(true, "Expected error: Update canceled");
- finish();
-}
-
-function onUnexpectedEvent() {
- OfflineTest.ok(false, "The update was supposed to be canceled");
- finish();
-}
-
-function onChecking() {
- obs.notifyObservers(updateService, "disk-space-watcher", "full");
-}
-
-if (OfflineTest.setup()) {
- applicationCache.onerror = OfflineTest.priv(onError);
- applicationCache.onprogress = OfflineTest.priv(onUnexpectedEvent);
- applicationCache.oncached = OfflineTest.priv(onUnexpectedEvent);
- applicationCache.onchecking = OfflineTest.priv(onChecking);
-}
-
-SimpleTest.waitForExplicitFinish();
-
-</script>
-
-</head>
-
-<body>
-
-</body>
-</html>
diff --git a/dom/tests/mochitest/localstorage/mochitest.ini b/dom/tests/mochitest/localstorage/mochitest.ini
index 5242bf9b1..30b90664a 100644
--- a/dom/tests/mochitest/localstorage/mochitest.ini
+++ b/dom/tests/mochitest/localstorage/mochitest.ini
@@ -47,6 +47,5 @@ skip-if = toolkit == 'android' #TIMED_OUT
skip-if = toolkit == 'android' #TIMED_OUT
[test_localStorageReplace.html]
skip-if = toolkit == 'android'
-[test_lowDeviceStorage.html]
[test_storageConstructor.html]
[test_localStorageSessionPrefOverride.html]
diff --git a/dom/tests/mochitest/localstorage/test_lowDeviceStorage.html b/dom/tests/mochitest/localstorage/test_lowDeviceStorage.html
deleted file mode 100644
index 046587150..000000000
--- a/dom/tests/mochitest/localstorage/test_lowDeviceStorage.html
+++ /dev/null
@@ -1,76 +0,0 @@
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<title>Test localStorage usage while in a low device storage situation</title>
-
-<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-<script type="text/javascript" src="localStorageCommon.js"></script>
-<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-
-<script type="text/javascript">
-
-/*
-This test does the following:
-- Stores an item in localStorage.
-- Checks the stored value.
-- Emulates a low device storage situation.
-- Gets the stored item again.
-- Removes the stored item.
-- Fails storing a new value.
-- Emulates recovering from a low device storage situation.
-- Stores a new value.
-- Checks the stored value.
-*/
-
-function lowDeviceStorage(lowStorage) {
- var data = lowStorage ? "full" : "free";
- os().notifyObservers(null, "disk-space-watcher", data);
-}
-
-function startTest() {
- // Add a test item.
- localStorage.setItem("item", "value");
- is(localStorage.getItem("item"), "value", "getItem()");
-
- // Emulates a low device storage situation.
- lowDeviceStorage(true);
-
- // Checks that we can still access to the stored item.
- is(localStorage.getItem("item"), "value",
- "getItem() during a device storage situation");
-
- // Removes the stored item.
- localStorage.removeItem("item");
- is(localStorage.getItem("item"), null,
- "getItem() after removing the item");
-
- // Fails storing a new item.
- try {
- localStorage.setItem("newItem", "value");
- ok(false, "Storing a new item is expected to fail");
- } catch(e) {
- ok(true, "Got an expected exception " + e);
- } finally {
- is(localStorage.getItem("newItem"), null,
- "setItem while device storage is low");
- }
-
- // Emulates recovering from a low device storage situation.
- lowDeviceStorage(false);
-
- // Add a test item after recovering from the low device storage situation.
- localStorage.setItem("newItem", "value");
- is(localStorage.getItem("newItem"), "value",
- "getItem() with available storage");
-
- SimpleTest.finish();
-}
-
-SimpleTest.waitForExplicitFinish();
-
-</script>
-
-</head>
-
-<body onload="startTest();">
-</body>
-</html>