Revision b55e29597d92ab89063673f031151e2bdb4b9479 authored by Joe Downing on 22 March 2018, 07:35:35 UTC, committed by Chromium WPT Sync on 22 March 2018, 07:35:35 UTC
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.keyboardUnlock(); 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 Reviewed-on: https://chromium-review.googlesource.com/969656 Reviewed-by: Philip Jägenstedt <foolip@chromium.org> Reviewed-by: Gary Kacmarcik <garykac@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Commit-Queue: Daniel Cheng <dcheng@chromium.org> Cr-Commit-Position: refs/heads/master@{#544996}
1 parent 1a8c195
redirect-origin.htm
<!DOCTYPE html>
<meta charset=utf-8>
<title>CORS - redirect</title>
<meta name=author title="Odin Hørthe Omdal" href="mailto:odiho@opera.com">
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=support.js?pipe=sub></script>
<h1>CORS redirect handling</h1>
<div id=log></div>
<script>
// Test count for cache busting and easy identifying of request in traffic analyzer
var num_test = 0,
origin = location.protocol + "//" + location.host,
remote_origin = origin.replace('://', '://' + SUBDOMAIN + '.'),
local = dirname(location.href) + 'resources/cors-makeheader.py',
remote = local.replace('://', '://' + SUBDOMAIN + '.'),
remote2 = local.replace('://', '://' + SUBDOMAIN2 + '.');
/* First page Redirect to Expect what */
// local -> remote
redir_test([ 'local', '*' ], [ 'remote', '*' ], origin );
redir_test([ 'local', '*' ], [ 'remote', origin ], origin );
redir_test([ 'local', '*' ], [ 'remote', 'null' ], 'disallow');
redir_test([ 'local', '*' ], [ 'remote', 'none' ], 'disallow');
redir_test([ 'local', origin ], [ 'remote', '*' ], origin );
redir_test([ 'local', origin ], [ 'remote', origin ], origin );
redir_test([ 'local', origin ], [ 'remote', 'null' ], 'disallow');
redir_test([ 'local', origin ], [ 'remote', 'none' ], 'disallow');
redir_test([ 'local', 'null' ], [ 'remote', '*' ], origin );
redir_test([ 'local', 'none' ], [ 'remote', '*' ], origin );
// remote -> local
redir_test([ 'remote', '*' ], [ 'local', '*' ], 'null' );
redir_test([ 'remote', '*' ], [ 'local', origin ], 'disallow');
redir_test([ 'remote', '*' ], [ 'local', 'null' ], 'null' );
redir_test([ 'remote', '*' ], [ 'local', 'none' ], 'disallow');
redir_test([ 'remote', origin ], [ 'local', '*' ], 'null' );
redir_test([ 'remote', origin ], [ 'local', origin ], 'disallow');
redir_test([ 'remote', origin ], [ 'local', 'null' ], 'null' );
redir_test([ 'remote', origin ], [ 'local', 'none' ], 'disallow');
redir_test([ 'remote', 'null' ], [ 'local', '*' ], 'disallow');
redir_test([ 'remote', 'none' ], [ 'local', '*' ], 'disallow');
// remote -> remote
redir_test([ 'remote', '*' ], [ 'remote', '*' ], origin );
redir_test([ 'remote', '*' ], [ 'remote', origin ], origin );
redir_test([ 'remote', '*' ], [ 'remote', 'null' ], 'disallow');
redir_test([ 'remote', '*' ], [ 'remote', 'none' ], 'disallow');
redir_test([ 'remote', origin ], [ 'remote', '*' ], origin );
redir_test([ 'remote', origin ], [ 'remote', origin ], origin );
redir_test([ 'remote', origin ], [ 'remote', 'null' ], 'disallow');
redir_test([ 'remote', origin ], [ 'remote', 'none' ], 'disallow');
redir_test([ 'remote', 'null' ], [ 'remote', '*' ], 'disallow');
redir_test([ 'remote', 'none' ], [ 'remote', '*' ], 'disallow');
// remote -> remote2
redir_test([ 'remote', '*' ], [ 'remote2', '*' ], 'null' );
redir_test([ 'remote', '*' ], [ 'remote2', origin ], 'disallow');
redir_test([ 'remote', '*' ], [ 'remote2', 'null' ], 'null' );
redir_test([ 'remote', '*' ], [ 'remote2', 'none' ], 'disallow');
redir_test([ 'remote', origin ], [ 'remote2', '*' ], 'null' );
redir_test([ 'remote', origin ], [ 'remote2', origin ], 'disallow');
redir_test([ 'remote', origin ], [ 'remote2', 'null' ], 'null');
redir_test([ 'remote', origin ], [ 'remote2', 'none' ], 'disallow');
redir_test([ 'remote', 'null' ], [ 'remote2', '*' ], 'disallow');
redir_test([ 'remote', 'none' ], [ 'remote2', '*' ], 'disallow');
// Bonus weird edge checks
redir_test([ 'remote', '*' ], [ 'remote', remote_origin ], 'disallow');
redir_test([ 'remote', '*' ], [ 'remote2', remote_origin ], 'disallow');
redir_test([ 'remote', remote_origin ], [ 'remote', "*" ], 'disallow');
/*
* The helpers
*/
function redir_test(first, second, expect_origin) {
var first_url, second_url,
urls = { "remote": remote, "local": local, "remote2": remote2 };
first_url = urls[first[0]] + "?origin=" + first[1];
second_url = urls[second[0]] + "?origin=" + second[1];
if (expect_origin=="disallow") {
shouldFail(first[0]+" ("+first[1]+") to "
+ second[0]+" ("+second[1]+"), expect to fail", [ first_url, second_url ]);
}
else {
shouldPass(first[0]+" ("+first[1]+") to "
+ second[0]+" ("+second[1]+"), expect origin="+expect_origin, expect_origin, [ first_url, second_url ]);
}
}
function shouldPass(desc, expected_origin, urls) {
var test_id = num_test,
t = async_test(desc);
num_test++;
t.step(function() {
var final_url,
client = new XMLHttpRequest();
client.open('GET', buildURL(urls, test_id));
client.onreadystatechange = t.step_func(function() {
if (client.readyState != client.DONE)
return;
assert_true(!!client.response, "Got response");
r = JSON.parse(client.response)
assert_equals(r['origin'], expected_origin, 'Origin Header')
assert_equals(r['get_value'], 'last', 'get_value')
t.done();
});
client.send(null)
});
}
function shouldFail(desc, urls) {
var test_id = num_test,
t = async_test(desc);
num_test++;
t.step(function() {
var client = new XMLHttpRequest();
client.open('GET', buildURL(urls, test_id));
client.onreadystatechange = t.step_func(function() {
if (client.readyState != client.DONE)
return;
assert_false(!!client.response, "Got response");
});
client.onerror = t.step_func(function(e) {
t.done();
});
client.send(null)
});
}
function buildURL(urls, id) {
var tmp_url;
if (typeof(urls) == "string") {
return urls + "&" + id + "_0";
}
for (var i = urls.length; i--; ) {
if (!tmp_url)
{
tmp_url = urls[i] + "&get_value=last&" + id + "_" + i;
continue;
}
tmp_url = urls[i]
+ "&location="
+ encodeURIComponent(tmp_url)
+ "&" + id + "_" + i;
}
return tmp_url;
}
</script>
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...