Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move KeyboardLock API methods to a 'keyboard' object
This change moves the KeyboardLock API methods to a 'keyboard' namespace on the Navigator object. We are doing this work now as there has been a request for additional keyboard functionality that would also be placed on the new keyboard object and we wanted to move the KeyboardLock methods there for consistency before we launch. KeyboardLock API Spec is here: https://w3c.github.io/keyboard-lock/#API Old calling pattern: Navigator.keyboardLock(); Navigator.leyboardUnlock(); New calling pattern: Navigator.keyboard.lock(); Navigator.keyboard.unlock(); Note: The main logic in the KeyboardLock.cpp class and tests is the same as it was, however the file changed enough that git does not recognize it as a file move. BUG=680809 Change-Id: I234b2ab12d5ecd44c894ed5103863fd96fd548d4
- Loading branch information
1 parent
6e1b5f4
commit 47b2598
Showing
7 changed files
with
53 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
partial interface Navigator { | ||
[SecureContext, SameObject] readonly attribute Keyboard keyboard; | ||
}; | ||
|
||
[SecureContext, Exposed=Window] interface Keyboard { | ||
Promise<void> lock(optional sequence<DOMString> keyCodes = []); | ||
void unlock(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<title>Keyboard IDL tests</title> | ||
<link rel="help" href="https://w3c.github.io/keyboard-lock/"/> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/resources/WebIDLParser.js"></script> | ||
<script src="/resources/idlharness.js"></script> | ||
<script> | ||
'use strict'; | ||
|
||
function doTest(idls) { | ||
var idl_array = new IdlArray(); | ||
idl_array.add_untested_idls('interface Navigator {};'); | ||
for (let idl of idls) { | ||
idl_array.add_idls(idl); | ||
} | ||
idl_array.add_objects({ | ||
Navigator: ['navigator'], | ||
Keyboard: ['navigator.keyboard'], | ||
}); | ||
idl_array.test(); | ||
}; | ||
|
||
function fetchText(url) { | ||
return fetch(url).then((response) => response.text()); | ||
} | ||
|
||
promise_test(() => { | ||
return Promise.all(["/interfaces/keyboard-apis.idl"].map(fetchText)) | ||
.then(doTest); | ||
}, "Test driver"); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.