Changeset 126067 in webkit
- Timestamp:
- Aug 20, 2012 2:12:55 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r126063 r126067 1 2012-08-20 Christophe Dumez <christophe.dumez@intel.com> 2 3 [JSC] SerializedScriptValue::create() should throw a DataCloneError if input is an unsupported object 4 https://bugs.webkit.org/show_bug.cgi?id=94493 5 6 Reviewed by Oliver Hunt. 7 8 Add checks for Function, Error and host objects arguments to 9 MessagePort.postMessage() in fast/events/message-port-multi.html. 10 11 According to the structured clone specification, we should throw 12 a DataCloneError for such input types. 13 14 * fast/dom/Window/anonymous-slot-with-changes-expected.txt: 15 * fast/dom/Window/anonymous-slot-with-changes.html: Update test to expect 16 an exception when passing a function to postMessage(). 17 * fast/events/message-port-multi-expected.txt: Update expected result 18 accordingly. 19 * fast/events/resources/message-port-multi.js: 20 (testTransfers.try.f1): 21 * platform/chromium/fast/events/message-port-multi-expected.txt: Removed. 22 Now identical to global expectation. 23 1 24 2012-08-20 Ken Buchanan <kenrb@chromium.org> 2 25 Line boxes not being dirtied correctly during inline removal -
trunk/LayoutTests/fast/dom/Window/anonymous-slot-with-changes-expected.txt
r54129 r126067 1 1 Tests that we clone object hierarchies 2 PASS: 'postMessage((function(){}))' threw Error: DATA_CLONE_ERR: DOM Exception 25 2 3 PASS: eventData is null of type object 3 4 PASS: eventData is null of type object … … 50 51 PASS: eventData is ,,1 of type object 51 52 PASS: eventData is ,,1 of type object 52 PASS: eventData is null of type object53 PASS: eventData is null of type object54 PASS: eventData is null of type object55 PASS: eventData is null of type object56 PASS: eventData is null of type object57 53 PASS: eventData is 2009-02-13T23:31:30.000Z of type object 58 54 PASS: eventData is 2009-02-13T23:31:30.000Z of type object -
trunk/LayoutTests/fast/dom/Window/anonymous-slot-with-changes.html
r120792 r126067 124 124 tryPostMessage('[1,2,3]'); 125 125 tryPostMessage('[,,1]'); 126 tryPostMessage('(function(){})', false, 'null');126 tryPostMessage('(function(){})', true); 127 127 tryPostMessage('new Date(1234567890000)'); 128 128 tryPostMessage('"done"'); -
trunk/LayoutTests/fast/events/message-port-multi-expected.txt
r119087 r126067 15 15 PASS event.ports contains two ports when two ports sent 16 16 PASS event.ports contains two ports when two ports re-sent after error 17 PASS Sending host object has thrown TypeError: Unable to deserialize data. 17 PASS Sending host object has thrown Error: DATA_CLONE_ERR: DOM Exception 25 18 PASS Sending host object has thrown Error: DATA_CLONE_ERR: DOM Exception 25 19 PASS Sending Function object has thrown Error: DATA_CLONE_ERR: DOM Exception 25 20 PASS Sending Error object has thrown Error: DATA_CLONE_ERR: DOM Exception 25 18 21 PASS send-port: transferred one port 19 22 PASS send-port-twice: transferred one port twice -
trunk/LayoutTests/fast/events/resources/message-port-multi.js
r120792 r126067 48 48 testFailed("Sending host object should throw"); 49 49 } catch(e) { 50 testPassed("Sending host object has thrown " + e); 50 if (e.code == DOMException.DATA_CLONE_ERR) 51 testPassed("Sending host object has thrown " + e); 52 else 53 testFailed("Sending host object should throw a DataCloneError, got: " + e); 54 } 55 try { 56 channel0.port1.webkitPostMessage({id:"host-object2", hostObject:navigator, port:c4.port1}, [c4.port1]); 57 testFailed("Sending host object should throw"); 58 } catch(e) { 59 if (e.code == DOMException.DATA_CLONE_ERR) 60 testPassed("Sending host object has thrown " + e); 61 else 62 testFailed("Sending host object should throw a DataCloneError, got: " + e); 63 } 64 try { 65 var f1 = function() {} 66 channel0.port1.webkitPostMessage({id:"function-object", function:f1, port:c4.port1}, [c4.port1]); 67 testFailed("Sending Function object should throw"); 68 } catch(e) { 69 if (e.code == DOMException.DATA_CLONE_ERR) 70 testPassed("Sending Function object has thrown " + e); 71 else 72 testFailed("Sending Function object should throw a DataCloneError, got: " + e); 73 } 74 try { 75 var err = new Error(); 76 channel0.port1.webkitPostMessage({id:"error-object", error:err, port:c4.port1}, [c4.port1]); 77 testFailed("Sending Error object should throw"); 78 } catch(e) { 79 if (e.code == DOMException.DATA_CLONE_ERR) 80 testPassed("Sending Error object has thrown " + e); 81 else 82 testPassed("Sending Error object should throw a DataCloneError, got: " + e); 51 83 } 52 84 c4.port1.postMessage("Should succeed"); -
trunk/Source/WebCore/ChangeLog
r126066 r126067 1 2012-08-20 Christophe Dumez <christophe.dumez@intel.com> 2 3 [JSC] SerializedScriptValue::create() should throw a DataCloneError if input is an unsupported object 4 https://bugs.webkit.org/show_bug.cgi?id=94493 5 6 Reviewed by Oliver Hunt. 7 8 Update JSC implementation for SerializedScriptValue::create() so that 9 a DataCloneError is thrown when the input value is an unsupported 10 object. The previous implementation was not throwing any error. 11 12 This change is according to the structured clone specification at: 13 http://www.w3.org/TR/html5/common-dom-interfaces.html#structured-clone 14 15 This also matches the corresponding V8 implementation. 16 17 Test: fast/events/message-port-multi.html. 18 19 * bindings/js/SerializedScriptValue.cpp: 20 (WebCore::CloneSerializer::dumpIfTerminal): 21 (WebCore::CloneSerializer::serialize): 22 (WebCore::SerializedScriptValue::maybeThrowExceptionIfSerializationFailed): 23 * bindings/js/SerializedScriptValue.h: 24 1 25 2012-08-20 Sheriff Bot <webkit.review.bot@gmail.com> 2 26 -
trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp
r119563 r126067 583 583 if (isArray(value)) 584 584 return false; 585 586 // Object cannot be serialized because the act of walking the object creates new objects587 if (value.isObject() && asObject(value)->inherits(&JSNavigator::s_info)) {588 fail();589 write(NullTag);590 return true;591 }592 585 593 586 if (value.isObject()) { … … 678 671 } 679 672 680 CallData unusedData; 681 if (getCallData(value, unusedData) == CallTypeNone) 682 return false; 673 return false; 683 674 } 684 675 // Any other types are expected to serialize as null. … … 899 890 if (!startObject(inObject)) 900 891 break; 892 // At this point, all supported objects other than Object 893 // objects have been handled. If we reach this point and 894 // the input is not an Object object then we should throw 895 // a DataCloneError. 896 if (inObject->classInfo() != &JSFinalObject::s_info) 897 return DataCloneError; 901 898 inputObjectStack.append(inObject); 902 899 indexStack.append(0); … … 1921 1918 throwError(exec, createTypeError(exec, "Unable to deserialize data.")); 1922 1919 break; 1920 case DataCloneError: 1921 setDOMException(exec, DATA_CLONE_ERR); 1922 break; 1923 1923 case ExistingExceptionError: 1924 1924 break; -
trunk/Source/WebCore/bindings/js/SerializedScriptValue.h
r117377 r126067 52 52 ValidationError, 53 53 ExistingExceptionError, 54 DataCloneError, 54 55 UnspecifiedError 55 56 };
Note: See TracChangeset
for help on using the changeset viewer.