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 | <!DOCTYPE html> |
michael@0 | 2 | <script> |
michael@0 | 3 | window.onerror = function(msg, url, line) { |
michael@0 | 4 | var myMsg = JSON.stringify({msg: msg, url: url, line: line, error: true}); |
michael@0 | 5 | opener.postMessage(myMsg, "*"); |
michael@0 | 6 | } |
michael@0 | 7 | |
michael@0 | 8 | var report = false; |
michael@0 | 9 | |
michael@0 | 10 | function g() { |
michael@0 | 11 | if (report) { |
michael@0 | 12 | opener.postMessage("callbackHappened", "*"); |
michael@0 | 13 | } |
michael@0 | 14 | window.mozRequestAnimationFrame(g); |
michael@0 | 15 | } |
michael@0 | 16 | g(); |
michael@0 | 17 | |
michael@0 | 18 | window.onload = function() { |
michael@0 | 19 | opener.postMessage("loaded", "*"); |
michael@0 | 20 | } |
michael@0 | 21 | |
michael@0 | 22 | addEventListener("pagehide", function f(e) { |
michael@0 | 23 | if (!e.persisted && !report) { |
michael@0 | 24 | opener.postMessage("notcached", "*"); |
michael@0 | 25 | } |
michael@0 | 26 | }, false); |
michael@0 | 27 | |
michael@0 | 28 | addEventListener("pageshow", function f(e) { |
michael@0 | 29 | if (e.persisted) { |
michael@0 | 30 | opener.postMessage("revived", "*"); |
michael@0 | 31 | } |
michael@0 | 32 | }, false); |
michael@0 | 33 | |
michael@0 | 34 | window.onmessage = function (e) { |
michael@0 | 35 | if (e.data == "report") { |
michael@0 | 36 | report = true; |
michael@0 | 37 | } |
michael@0 | 38 | }; |
michael@0 | 39 | |
michael@0 | 40 | </script> |