Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: LayoutTests/fast/js/structured-clone.html

Issue 1297223004: ScriptValueSerializer should throw, not crash, when handling unknown types (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 <!DOCTYPE HTML> 1 <!DOCTYPE HTML>
2 <script src="../../resources/testharness.js"></script> 2 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script> 3 <script src="../../resources/testharnessreport.js"></script>
4 <script> 4 <script>
5 function promise_test(func, name, properties) { 5 function promise_test(func, name, properties) {
6 properties = properties || {}; 6 properties = properties || {};
7 var test = async_test(name, properties); 7 var test = async_test(name, properties);
8 Promise.resolve(test.step(func, test, test)) 8 Promise.resolve(test.step(func, test, test))
9 .then(function() { test.done(); }) 9 .then(function() { test.done(); })
10 .catch(test.step_func(function(value) { throw value; })); 10 .catch(test.step_func(function(value) { throw value; }));
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 promise_test(function() { 198 promise_test(function() {
199 var set = new Set([function(){}]); 199 var set = new Set([function(){}]);
200 return structuredClone(set).then(function(clone) { 200 return structuredClone(set).then(function(clone) {
201 assert_unreached('Should have thrown an exception'); 201 assert_unreached('Should have thrown an exception');
202 }).catch(function(ex) { 202 }).catch(function(ex) {
203 assert_true(ex instanceof DOMException, 'Should throw a DOMException'); 203 assert_true(ex instanceof DOMException, 'Should throw a DOMException');
204 assert_equals(ex.code, DOMException.DATA_CLONE_ERR, 'Should be a DataClo neError'); 204 assert_equals(ex.code, DOMException.DATA_CLONE_ERR, 'Should be a DataClo neError');
205 }); 205 });
206 }, 'Cloning Sets should fail if they contain non-cloneable things'); 206 }, 'Cloning Sets should fail if they contain non-cloneable things');
207 207
208 promise_test(function() {
209 return structuredClone(Symbol('foo')).then(function(clone) {
210 assert_unreached('Should have thrown an exception');
211 }).catch(function(ex) {
jsbell 2015/08/19 01:24:11 I believe this will 'catch' the exception thrown b
adamk 2015/08/19 20:19:34 Fixed here and above to use the two-arg then().
212 assert_true(ex instanceof DOMException, 'Should throw a DOMException');
213 assert_equals(ex.code, DOMException.DATA_CLONE_ERR, 'Should be a DataClo neError');
214 });
215 }, 'Cloning Symbols should fail');
216
208 </script> 217 </script>
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/core/v8/ScriptValueSerializer.cpp » ('j') | Source/bindings/core/v8/ScriptValueSerializer.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698