Home | History | Annotate | Download | only in script-tests
      1 description("Test that changing documentURI has no effects on the url passed into storage events.");
      2 
      3 function test(storageString, callback)
      4 {
      5     window.completionCallback = callback;
      6     window.storage = eval(storageString);
      7     if (!storage) {
      8         testFailed(storageString + " DOES NOT exist");
      9         return;
     10     }
     11 
     12     debug("Testing " + storageString);
     13 
     14     evalAndLog("storage.clear()");
     15     shouldBe("storage.length", "0");
     16 
     17     runAfterStorageEvents(step1);
     18 }
     19 
     20 function step1()
     21 {
     22     debug("Reset storage event list");
     23     evalAndLog("storageEventList = new Array()");
     24     evalAndLog("storage.foo = '123'");
     25 
     26     runAfterStorageEvents(step2);
     27 }
     28 
     29 function step2()
     30 {
     31     shouldBe("storageEventList.length", "1");
     32     debug("Saving url");
     33     window.lastURL = storageEventList[0].url;
     34 
     35     evalAndLog("document.documentURI = 'abc'");
     36     shouldBeEqualToString("document.documentURI", "abc");
     37     evalAndLog("storage.foo = 'xyz'");
     38 
     39     runAfterStorageEvents(step3);
     40 }
     41 
     42 function step3()
     43 {
     44     shouldBe("storageEventList.length", "2");
     45     shouldBeTrue(String(window.lastURL == storageEventList[1].url));
     46 
     47     completionCallback();
     48 }
     49 
     50 testStorages(test);
     51 
     52 var successfullyParsed = true;
     53