summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/keyboard-lock/resources/iframe-lock-helper.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/keyboard-lock/resources/iframe-lock-helper.html')
-rw-r--r--testing/web-platform/tests/keyboard-lock/resources/iframe-lock-helper.html20
1 files changed, 20 insertions, 0 deletions
diff --git a/testing/web-platform/tests/keyboard-lock/resources/iframe-lock-helper.html b/testing/web-platform/tests/keyboard-lock/resources/iframe-lock-helper.html
new file mode 100644
index 0000000000..3950802f8e
--- /dev/null
+++ b/testing/web-platform/tests/keyboard-lock/resources/iframe-lock-helper.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<script>
+'use strict';
+
+window.onmessage = message => {
+ if (message.data === 'Ready') {
+ let onSuccess = () => { parent.postMessage('Failure', '*'); };
+ let onError = error => {
+ if (error.name == 'InvalidStateError') {
+ parent.postMessage('Success', '*');
+ } else {
+ parent.postMessage('Failure', '*');
+ }
+ };
+
+ navigator.keyboard.lock().then(onSuccess, onError);
+ }
+};
+
+</script>