setters-long-string.tentative.https.sub.html (1079B)
1 <!doctype html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 5 <body> 6 <script> 7 'use strict'; 8 9 promise_test(async t => { 10 try { 11 await sharedStorage.set('a'.repeat(2621441), 'b'); 12 } catch (e) { 13 assert_equals(e.name, 'DataError'); 14 return; 15 } 16 assert_unreached("did not reject"); 17 }, 'sharedStorage.set with key length too big'); 18 19 promise_test(async t => { 20 try { 21 await sharedStorage.set('a', 'b'.repeat(2621441)); 22 } catch (e) { 23 assert_equals(e.name, 'DataError'); 24 return; 25 } 26 assert_unreached("did not reject"); 27 }, 'sharedStorage.set with value length too big'); 28 29 promise_test(() => { 30 return sharedStorage.set('a'.repeat(2621440), '').then(() => { 31 // Clean up. 32 sharedStorage.delete('a'.repeat(2621440)); 33 }); 34 }, 'sharedStorage.set with max allowed key length'); 35 36 promise_test(() => { 37 return sharedStorage.set('a', 'b'.repeat(2621439)).then(() => { 38 // Clean up. 39 sharedStorage.delete('a'); 40 }); 41 }, 'sharedStorage.set with max allowed value length'); 42 43 </script> 44 </body>