Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | <html xmlns="http://www.w3.org/1999/xhtml"> |
michael@0 | 2 | <head> |
michael@0 | 3 | <title>master frame for event storage propagation</title> |
michael@0 | 4 | |
michael@0 | 5 | <script type="text/javascript" src="interOriginFrame.js"></script> |
michael@0 | 6 | <script type="text/javascript"> |
michael@0 | 7 | |
michael@0 | 8 | var currentStep = 1; |
michael@0 | 9 | var gotEvent = false; |
michael@0 | 10 | |
michael@0 | 11 | window.addEventListener("storage", function(event) |
michael@0 | 12 | { |
michael@0 | 13 | gotEvent = true; |
michael@0 | 14 | }, false); |
michael@0 | 15 | |
michael@0 | 16 | function doStep() |
michael@0 | 17 | { |
michael@0 | 18 | switch (currentStep) |
michael@0 | 19 | { |
michael@0 | 20 | case 1: |
michael@0 | 21 | // Must not fire (storage must be clear!) |
michael@0 | 22 | localStorage.clear(); |
michael@0 | 23 | // Must fire X:null->'1' |
michael@0 | 24 | localStorage.setItem("X", "1"); |
michael@0 | 25 | // Must fire X:'1'->'2' |
michael@0 | 26 | localStorage.setItem("X", "2"); |
michael@0 | 27 | // Must not fire |
michael@0 | 28 | localStorage.setItem("X", "2"); |
michael@0 | 29 | // Must fire X:'2'->null |
michael@0 | 30 | localStorage.removeItem("X"); |
michael@0 | 31 | // Must not fire |
michael@0 | 32 | localStorage.removeItem("X"); |
michael@0 | 33 | // Must not fire |
michael@0 | 34 | localStorage.removeItem("Y"); |
michael@0 | 35 | // Must fire X:null->'2' (we need something in the storage) |
michael@0 | 36 | localStorage.setItem("X", "2"); |
michael@0 | 37 | // Must fire null:null->null (one item has been erased) |
michael@0 | 38 | localStorage.clear(); |
michael@0 | 39 | // Must not fire |
michael@0 | 40 | localStorage.clear(); |
michael@0 | 41 | break; |
michael@0 | 42 | |
michael@0 | 43 | // Wait some time to let the async event be propagated |
michael@0 | 44 | case 11: |
michael@0 | 45 | is(gotEvent, false, "Expected no events"); |
michael@0 | 46 | return finishTest(); |
michael@0 | 47 | } |
michael@0 | 48 | |
michael@0 | 49 | // Increase by two to distinguish each test step order |
michael@0 | 50 | // in both master doStep and slave doStep functions. |
michael@0 | 51 | ++currentStep; |
michael@0 | 52 | ++currentStep; |
michael@0 | 53 | |
michael@0 | 54 | return true; |
michael@0 | 55 | } |
michael@0 | 56 | |
michael@0 | 57 | </script> |
michael@0 | 58 | |
michael@0 | 59 | </head> |
michael@0 | 60 | |
michael@0 | 61 | <body onload="postMsg('frame loaded');"> |
michael@0 | 62 | </body> |
michael@0 | 63 | </html> |