diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
commit | 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch) | |
tree | a31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /testing/web-platform/tests/IndexedDB/bindings-inject-keys-bypass-setters.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip |
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/IndexedDB/bindings-inject-keys-bypass-setters.html')
-rw-r--r-- | testing/web-platform/tests/IndexedDB/bindings-inject-keys-bypass-setters.html | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/testing/web-platform/tests/IndexedDB/bindings-inject-keys-bypass-setters.html b/testing/web-platform/tests/IndexedDB/bindings-inject-keys-bypass-setters.html new file mode 100644 index 0000000000..e67377fb77 --- /dev/null +++ b/testing/web-platform/tests/IndexedDB/bindings-inject-keys-bypass-setters.html @@ -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="resources/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', {durability: 'relaxed'}); + 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> |