Thu, 15 Jan 2015 15:55:04 +0100
Back out 97036ab72558 which inappropriately compared turds to third parties.
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 | // In step 2 we instantiate sessionStorage in the other frame |
michael@0 | 21 | case 1: |
michael@0 | 22 | // Must not fire (storage must be clear!) |
michael@0 | 23 | sessionStorage.clear(); |
michael@0 | 24 | // Must fire X:null->'1' |
michael@0 | 25 | sessionStorage.setItem("X", "1"); |
michael@0 | 26 | // Must fire X:'1'->'2' |
michael@0 | 27 | sessionStorage.setItem("X", "2"); |
michael@0 | 28 | // Must not fire |
michael@0 | 29 | sessionStorage.setItem("X", "2"); |
michael@0 | 30 | // Must fire X:'2'->null |
michael@0 | 31 | sessionStorage.removeItem("X"); |
michael@0 | 32 | // Must not fire |
michael@0 | 33 | sessionStorage.removeItem("X"); |
michael@0 | 34 | // Must not fire |
michael@0 | 35 | sessionStorage.removeItem("Y"); |
michael@0 | 36 | // Must fire X:null->'2' (we need something in the storage) |
michael@0 | 37 | sessionStorage.setItem("X", "2"); |
michael@0 | 38 | // Must fire null:null->null (one item has been erased) |
michael@0 | 39 | sessionStorage.clear(); |
michael@0 | 40 | // Must not fire |
michael@0 | 41 | sessionStorage.clear(); |
michael@0 | 42 | break; |
michael@0 | 43 | |
michael@0 | 44 | // Wait some time to let the async event be propagated |
michael@0 | 45 | case 11: |
michael@0 | 46 | is(gotEvent, false, "Expected no events"); |
michael@0 | 47 | return finishTest(); |
michael@0 | 48 | } |
michael@0 | 49 | |
michael@0 | 50 | // Increase by two to distinguish each test step order |
michael@0 | 51 | // in both master doStep and slave doStep functions. |
michael@0 | 52 | ++currentStep; |
michael@0 | 53 | ++currentStep; |
michael@0 | 54 | |
michael@0 | 55 | return true; |
michael@0 | 56 | } |
michael@0 | 57 | |
michael@0 | 58 | </script> |
michael@0 | 59 | |
michael@0 | 60 | </head> |
michael@0 | 61 | |
michael@0 | 62 | <body onload="postMsg('frame loaded');"> |
michael@0 | 63 | <iframe src="http://example.com:80/tests/dom/tests/mochitest/storageevent/frameSessionStorageSlaveEqual.html" |
michael@0 | 64 | name="slaveFrame"> |
michael@0 | 65 | </iframe> |
michael@0 | 66 | </body> |
michael@0 | 67 | </html> |