blob: 99c7f185e289f9c6d7ebdc82b15046939d61e7ee [file] [log] [blame]
This is a test to make sure DOM Storage mutations fire StorageEvents that are caught by the event listener attached via setattribute.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Testing sessionStorage
storage.clear()
PASS storage.length is 0
iframe.onload = step1
iframe.src = 'resources/setattribute-event-handler.html'
Reset storage event list
storageEventList = new Array()
storage.setItem('FOO', 'BAR')
PASS storageEventList.length is 1
PASS storageEventList[0].key is "FOO"
PASS storageEventList[0].oldValue is null
PASS storageEventList[0].newValue is "BAR"
storage.setItem('FU', 'BAR')
storage.setItem('a', '1')
storage.setItem('b', '2')
storage.setItem('b', '3')
PASS storageEventList.length is 5
PASS storageEventList[1].key is "FU"
PASS storageEventList[1].oldValue is null
PASS storageEventList[1].newValue is "BAR"
PASS storageEventList[2].key is "a"
PASS storageEventList[2].oldValue is null
PASS storageEventList[2].newValue is "1"
PASS storageEventList[3].key is "b"
PASS storageEventList[3].oldValue is null
PASS storageEventList[3].newValue is "2"
PASS storageEventList[4].key is "b"
PASS storageEventList[4].oldValue is "2"
PASS storageEventList[4].newValue is "3"
storage.removeItem('FOO')
PASS storageEventList.length is 6
PASS storageEventList[5].key is "FOO"
PASS storageEventList[5].oldValue is "BAR"
PASS storageEventList[5].newValue is null
storage.removeItem('FU')
PASS storageEventList.length is 7
PASS storageEventList[6].key is "FU"
PASS storageEventList[6].oldValue is "BAR"
PASS storageEventList[6].newValue is null
storage.clear()
PASS storageEventList.length is 8
PASS storageEventList[7].key is null
PASS storageEventList[7].oldValue is null
PASS storageEventList[7].newValue is null
Testing localStorage
storage.clear()
PASS storage.length is 0
iframe.onload = step1
iframe.src = 'resources/setattribute-event-handler.html'
Reset storage event list
storageEventList = new Array()
storage.setItem('FOO', 'BAR')
PASS storageEventList.length is 1
PASS storageEventList[0].key is "FOO"
PASS storageEventList[0].oldValue is null
PASS storageEventList[0].newValue is "BAR"
storage.setItem('FU', 'BAR')
storage.setItem('a', '1')
storage.setItem('b', '2')
storage.setItem('b', '3')
PASS storageEventList.length is 5
PASS storageEventList[1].key is "FU"
PASS storageEventList[1].oldValue is null
PASS storageEventList[1].newValue is "BAR"
PASS storageEventList[2].key is "a"
PASS storageEventList[2].oldValue is null
PASS storageEventList[2].newValue is "1"
PASS storageEventList[3].key is "b"
PASS storageEventList[3].oldValue is null
PASS storageEventList[3].newValue is "2"
PASS storageEventList[4].key is "b"
PASS storageEventList[4].oldValue is "2"
PASS storageEventList[4].newValue is "3"
storage.removeItem('FOO')
PASS storageEventList.length is 6
PASS storageEventList[5].key is "FOO"
PASS storageEventList[5].oldValue is "BAR"
PASS storageEventList[5].newValue is null
storage.removeItem('FU')
PASS storageEventList.length is 7
PASS storageEventList[6].key is "FU"
PASS storageEventList[6].oldValue is "BAR"
PASS storageEventList[6].newValue is null
storage.clear()
PASS storageEventList.length is 8
PASS storageEventList[7].key is null
PASS storageEventList[7].oldValue is null
PASS storageEventList[7].newValue is null
PASS successfullyParsed is true
TEST COMPLETE