-
-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from quasicomputational/wpt-sync-2019-03-13
Re-sync with upstream WPT.
- Loading branch information
Showing
472 changed files
with
92,434 additions
and
18,890 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
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,5 @@ | ||
spec: https://w3c.github.io/IndexedDB/ | ||
suggested_reviewers: | ||
- odinho | ||
- inexorabletash | ||
- zqzhang |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
This directory contains the Indexed Database API test suite. | ||
|
||
To run the tests in this test suite within a browser, go to: <http://w3c-test.org/IndexedDB/>. | ||
To run the tests in this test suite within a browser, go to: <https://w3c-test.org/IndexedDB/>. | ||
|
||
The latest Editor's Draft of Indexed Database API is: <http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html>. | ||
The latest Editor's Draft of Indexed Database API is: <https://w3c.github.io/IndexedDB/>. | ||
|
||
The latest W3C Technical Report of Indexed Database API is: <http://www.w3.org/TR/IndexedDB/>. | ||
The latest W3C Technical Report of Indexed Database API is: <https://www.w3.org/TR/IndexedDB/>. | ||
|
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,72 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>IndexedDB: BigInt keys and values</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="support.js"></script> | ||
|
||
<script> | ||
// BigInt and BigInt objects are supported in serialization, per | ||
// https://github.com/whatwg/html/pull/3480 | ||
// This support allows them to be used as IndexedDB values. | ||
|
||
function value_test(value, predicate, name) { | ||
async_test(t => { | ||
t.step(function() { | ||
assert_true(predicate(value), | ||
"Predicate should return true for the initial value."); | ||
}); | ||
|
||
createdb(t).onupgradeneeded = t.step_func(e => { | ||
e.target.result | ||
.createObjectStore("store") | ||
.add(value, 1); | ||
|
||
e.target.onsuccess = t.step_func(e => { | ||
e.target.result | ||
.transaction("store") | ||
.objectStore("store") | ||
.get(1) | ||
.onsuccess = t.step_func(e => | ||
{ | ||
assert_true(predicate(e.target.result), | ||
"Predicate should return true for the deserialized result."); | ||
t.done(); | ||
}); | ||
}); | ||
}); | ||
}, "BigInts as values in IndexedDB - " + name); | ||
} | ||
|
||
value_test(1n, | ||
x => x === 1n, | ||
"primitive BigInt"); | ||
value_test(Object(1n), | ||
x => typeof x === 'object' && | ||
x instanceof BigInt && | ||
x.valueOf() === 1n, | ||
"BigInt object"); | ||
value_test({val: 1n}, | ||
x => x.val === 1n, | ||
"primitive BigInt inside object"); | ||
value_test({val: Object(1n)}, | ||
x => x.val.valueOf() === 1n && | ||
x.val instanceof BigInt && | ||
x.val.valueOf() === 1n, | ||
"BigInt object inside object"); | ||
|
||
// However, BigInt is not supported as an IndexedDB key; support | ||
// has been proposed in the following PR, but that change has not | ||
// landed at the time this patch was written | ||
// https://github.com/w3c/IndexedDB/pull/231 | ||
|
||
function invalidKey(key, name) { | ||
test(t => { | ||
assert_throws("DataError", () => indexedDB.cmp(0, key)); | ||
}, "BigInts as keys in IndexedDB - " + name); | ||
} | ||
|
||
invalidKey(1n, "primitive BigInt"); | ||
// Still an error even if the IndexedDB patch lands | ||
invalidKey(Object(1n), "BigInt object"); | ||
</script> |
104 changes: 0 additions & 104 deletions
104
src/test/web-platform-tests/IndexedDB/bindings-inject-key.html
This file was deleted.
Oops, something went wrong.
35 changes: 35 additions & 0 deletions
35
src/test/web-platform-tests/IndexedDB/bindings-inject-keys-bypass-setters.html
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,35 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<title>IndexedDB: ES bindings - Inject a key into a value - Keys bypass setters</title> | ||
<meta name="help" | ||
href="https://w3c.github.io/IndexedDB/#inject-key-into-value-keys-bypass-setters"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="support-promises.js"></script> | ||
<script> | ||
|
||
promise_test(async t => { | ||
const db = await createDatabase(t, db => { | ||
db.createObjectStore('store'); | ||
}); | ||
|
||
let setter_called = false; | ||
Object.defineProperty(Object.prototype, '10', { | ||
configurable: true, | ||
set: value => { setter_called = true; }, | ||
}); | ||
t.add_cleanup(() => { delete Object.prototype['10']; }); | ||
|
||
const tx = db.transaction('store', 'readwrite'); | ||
const result = await promiseForRequest(t, tx.objectStore('store').put( | ||
'value', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'key'])); | ||
|
||
assert_false(setter_called, | ||
'Setter should not be called for key result.'); | ||
assert_true(result.hasOwnProperty('10'), | ||
'Result should have own-property overriding prototype setter.'); | ||
assert_equals(result[10], 'key', | ||
'Result should have expected property.'); | ||
}, 'Returning keys to script should bypass prototype setters'); | ||
|
||
</script> |
35 changes: 35 additions & 0 deletions
35
src/test/web-platform-tests/IndexedDB/bindings-inject-values-bypass-chain.html
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,35 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<title>IndexedDB: ES bindings - Inject a key into a value - Values bypass chain</title> | ||
<meta name="help" | ||
href="https://w3c.github.io/IndexedDB/#inject-key-into-value-values-bypass-chain"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="support-promises.js"></script> | ||
<script> | ||
|
||
promise_test(async t => { | ||
const db = await createDatabase(t, db => { | ||
db.createObjectStore('store', {autoIncrement: true, keyPath: 'a.b.c'}); | ||
}); | ||
|
||
Object.prototype.a = {b: {c: 'on proto'}}; | ||
t.add_cleanup(() => { delete Object.prototype.a; }); | ||
|
||
const tx = db.transaction('store', 'readwrite'); | ||
tx.objectStore('store').put({}); | ||
const result = await promiseForRequest(t, tx.objectStore('store').get(1)); | ||
|
||
assert_true(result.hasOwnProperty('a'), | ||
'Result should have own-properties overriding prototype.'); | ||
assert_true(result.a.hasOwnProperty('b'), | ||
'Result should have own-properties overriding prototype.'); | ||
assert_true(result.a.b.hasOwnProperty('c'), | ||
'Result should have own-properties overriding prototype.'); | ||
assert_equals(result.a.b.c, 1, | ||
'Own property should match primary key generator value'); | ||
assert_equals(Object.prototype.a.b.c, 'on proto', | ||
'Prototype should not be modified'); | ||
}, 'Returning values to script should bypass prototype chain'); | ||
|
||
</script> |
36 changes: 36 additions & 0 deletions
36
src/test/web-platform-tests/IndexedDB/bindings-inject-values-bypass-setters.html
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,36 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<title>IndexedDB: ES bindings - Inject a key into a value - Values bypass | ||
setters</title> | ||
<meta name="help" | ||
href="https://w3c.github.io/IndexedDB/#inject-key-into-value-values-bypass-setters"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="support-promises.js"></script> | ||
<script> | ||
|
||
promise_test(async t => { | ||
const db = await createDatabase(t, db => { | ||
db.createObjectStore('store', {autoIncrement: true, keyPath: 'id'}); | ||
}); | ||
|
||
let setter_called = false; | ||
Object.defineProperty(Object.prototype, 'id', { | ||
configurable: true, | ||
set: value => { setter_called = true; }, | ||
}); | ||
t.add_cleanup(() => { delete Object.prototype['id']; }); | ||
|
||
const tx = db.transaction('store', 'readwrite'); | ||
tx.objectStore('store').put({}); | ||
const result = await promiseForRequest(t, tx.objectStore('store').get(1)); | ||
|
||
assert_false(setter_called, | ||
'Setter should not be called for key result.'); | ||
assert_true(result.hasOwnProperty('id'), | ||
'Result should have own-property overriding prototype setter.'); | ||
assert_equals(result.id, 1, | ||
'Own property should match primary key generator value'); | ||
}, 'Returning values to script should bypass prototype setters'); | ||
|
||
</script> |
Oops, something went wrong.