bug 880741 add indexeddb to frameworker, r=gavin

This commit is contained in:
Shane Caraveo 2013-06-07 11:25:15 -07:00
parent 73e8300de5
commit aaa8b1fc12
3 changed files with 26 additions and 1 deletions

View File

@ -136,7 +136,7 @@ FrameWorker.prototype = {
let workerAPI = ['WebSocket', 'localStorage', 'atob', 'btoa', let workerAPI = ['WebSocket', 'localStorage', 'atob', 'btoa',
'clearInterval', 'clearTimeout', 'dump', 'clearInterval', 'clearTimeout', 'dump',
'setInterval', 'setTimeout', 'XMLHttpRequest', 'setInterval', 'setTimeout', 'XMLHttpRequest',
'FileReader', 'Blob', 'EventSource', 'FileReader', 'Blob', 'EventSource', 'indexedDB',
'location']; 'location'];
// Bug 798660 - XHR and WebSocket have issues in a sandbox and need // Bug 798660 - XHR and WebSocket have issues in a sandbox and need
// to be unwrapped to work // to be unwrapped to work

View File

@ -652,4 +652,17 @@ let tests = {
worker.port.postMessage({topic: "ping"}) worker.port.postMessage({topic: "ping"})
}, },
testIndexedDB: function(cbnext) {
let worker = getFrameWorkerHandle("https://example.com/browser/toolkit/components/social/test/browser/worker_social.js", undefined, "testIndexedDB");
worker.port.onmessage = function(e) {
let m = e.data;
if (m.topic == "social.indexeddb-result") {
is(m.data.result, "ok", "created indexeddb");
worker.terminate();
cbnext();
}
}
worker.port.postMessage({topic: "test-indexeddb-create"})
},
} }

View File

@ -47,6 +47,18 @@ onconnect = function(e) {
data: data}); data: data});
testerPort.postMessage({topic: 'did-notification-create'}); testerPort.postMessage({topic: 'did-notification-create'});
break; break;
case "test-indexeddb-create":
var request = indexedDB.open("workerdb", 1);
request.onerror = function(event) {
port.postMessage({topic: 'social.indexeddb-result', data: { result: "error" }});
};
request.onsuccess = function(event) {
// Do something with request.result!
var db = request.result;
db.close();
port.postMessage({topic: 'social.indexeddb-result', data: { result: "ok" }});
};
break;
} }
} }
// used for "test-reload-worker" // used for "test-reload-worker"