summaryrefslogtreecommitdiffstats
path: root/LayoutTests/storage/domstorage/events/script-tests/documentURI.js
blob: 4b4f4cbdd7e795ff2cef8ba5148340489ecea556 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
description("Test that changing documentURI has no effects on the uri passed into storage events.");

function test(storageString, callback)
{
    window.completionCallback = callback;
    window.storage = eval(storageString);
    if (!storage) {
        testFailed(storageString + " DOES NOT exist");
        return;
    }

    debug("Testing " + storageString);

    evalAndLog("storage.clear()");
    shouldBe("storage.length", "0");

    runAfterStorageEvents(step1);
}

function step1()
{
    debug("Reset storage event list");
    evalAndLog("storageEventList = new Array()");
    evalAndLog("storage.foo = '123'");

    runAfterStorageEvents(step2);
}

function step2()
{
    shouldBe("storageEventList.length", "1");
    debug("Saving URI");
    window.lastURI = storageEventList[0].uri;

    evalAndLog("document.documentURI = 'abc'");
    shouldBeEqualToString("document.documentURI", "abc");
    evalAndLog("storage.foo = 'xyz'");

    runAfterStorageEvents(step3);
}

function step3()
{
    shouldBe("storageEventList.length", "2");
    shouldBeTrue(String(window.lastURI == storageEventList[1].uri));

    completionCallback();
}

testStorages(test);

var successfullyParsed = true;