event_session_url.html (1420B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title>WebStorage Test: sessionStorage event - url</title> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 </head> 8 <body> 9 <h1>event_session_url</h1> 10 <div id="log"></div> 11 <script> 12 async_test(function(t) { 13 sessionStorage.clear(); 14 t.add_cleanup(function() { sessionStorage.clear() }); 15 16 self.fail = t.step_func(function(msg) { 17 assert_unreached(msg); 18 t.done(); 19 }); 20 21 function onStorageEvent(event) { 22 var url = window.location.href; 23 24 var pos = url.lastIndexOf("/"); 25 if (pos != -1) { 26 url = url.substr(0, pos + 1); 27 url = url + "resources/session_set_item_iframe.html"; 28 } 29 30 assert_equals(event.url, url); 31 t.done(); 32 } 33 34 window.addEventListener('storage', t.step_func(onStorageEvent), false); 35 36 var el = document.createElement("iframe"); 37 el.setAttribute('id', 'ifrm'); 38 el.setAttribute('src', 'resources/session_set_item_iframe.html'); 39 document.body.appendChild(el); 40 }, "url property test of session event - Session event is fired due to an invocation of the setItem() method."); 41 </script> 42 </body> 43 </html>