Index: LayoutTests/http/tests/resources/pointer-lock/iframe-common-prefixed.js |
diff --git a/LayoutTests/http/tests/resources/pointer-lock/iframe-common-prefixed.js b/LayoutTests/http/tests/resources/pointer-lock/iframe-common-prefixed.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2190747aab753450435397685dcefb6b9432e4ce |
--- /dev/null |
+++ b/LayoutTests/http/tests/resources/pointer-lock/iframe-common-prefixed.js |
@@ -0,0 +1,27 @@ |
+function thisFileName() |
+{ |
+ return window.location.href.split("/").pop(); |
+} |
+ |
+window.onmessage = function (messageEvent) { |
+ switch (messageEvent.data[0]) { |
+ case "eval": |
+ eval(messageEvent.data[1]); |
+ break; |
+ case "pass message down": |
+ iframe = document.getElementsByTagName("iframe")[0]; |
+ iframe.contentWindow.postMessage(messageEvent.data.slice(1), "*"); |
+ break; |
+ default: |
+ // Pass all other messages up to parent. |
+ parent.postMessage(messageEvent.data, "*"); |
+ } |
+} |
+ |
+document.onwebkitpointerlockchange = function () { |
+ parent.postMessage(thisFileName() + " onwebkitpointerlockchange, document.webkitPointerLockElement = " + document.webkitPointerLockElement, "*"); |
+} |
+ |
+document.onwebkitpointerlockerror = function () { |
+ parent.postMessage(thisFileName() + " onwebkitpointerlockerror", "*"); |
+} |