1if (window.layoutTestController) {
2    layoutTestController.dumpAsText();
3    layoutTestController.waitUntilDone();
4}
5
6iframe = document.createElement("IFRAME");
7iframe.src = "about:blank";
8document.body.appendChild(iframe);
9iframe.contentWindow.document.body.innerText = "Nothing to see here.";
10
11storageEventList = new Array();
12iframe.contentWindow.onstorage = function (e) {
13    window.parent.storageEventList.push(e);
14}
15
16function runAfterStorageEvents(callback) {
17    var currentCount = storageEventList.length;
18    function onTimeout() {
19        if (currentCount != storageEventList.length)
20            runAfterStorageEvents(callback);
21        else
22            callback();
23    }
24    setTimeout(onTimeout, 0);
25}
26
27function testStorages(testCallback)
28{
29    // When we're done testing LocalStorage, this is run.
30    function allDone()
31    {
32        debug("");
33        debug("");
34        window.successfullyParsed = true;
35        isSuccessfullyParsed();
36        debug("");
37        if (window.layoutTestController)
38            layoutTestController.notifyDone()
39    }
40
41    // When we're done testing with SessionStorage, this is run.
42    function runLocalStorage()
43    {
44        debug("");
45        debug("");
46        testCallback("localStorage", allDone);
47    }
48
49    // First run the test with SessionStorage.
50    testCallback("sessionStorage", runLocalStorage);
51}
52