Changeset 126464 in webkit
- Timestamp:
- Aug 23, 2012 12:08:54 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r126460 r126464 1 2012-08-23 Christophe Dumez <christophe.dumez@intel.com> 2 3 Serialization of JavaScript values does not appear to respect new HTML5 Structured Clone semantics 4 https://bugs.webkit.org/show_bug.cgi?id=65292 5 6 Reviewed by Oliver Hunt. 7 8 Update expected results for fast/dom/Window/window-postmessage-clone.html 9 now that String, Boolean and Number object are correctly serialized with 10 JSC. 11 12 * fast/dom/Window/window-postmessage-clone-expected.txt: 13 * platform/gtk/fast/dom/Window/window-postmessage-clone-expected.txt: 14 1 15 2012-08-23 Kenneth Russell <kbr@google.com> 2 16 -
trunk/LayoutTests/fast/dom/Window/window-postmessage-clone-expected.txt
r115088 r126464 1 1 Tests that we clone object hierarchies 2 2 3 FAIL: 'postMessage((function(){}))' should throw but didn't 4 FAIL: 'postMessage(var x = 0; try { eval("badref"); } catch(e) { x = e; } x)' should throw but didn't 5 PASS: 'postMessage(window)' threw TypeError: Type error3 PASS: 'postMessage((function(){}))' threw Error: DATA_CLONE_ERR: DOM Exception 25 4 PASS: 'postMessage(var x = 0; try { eval("badref"); } catch(e) { x = e; } x)' threw Error: DATA_CLONE_ERR: DOM Exception 25 5 PASS: 'postMessage(window)' threw Error: DATA_CLONE_ERR: DOM Exception 25 6 6 PASS: 'postMessage(({get a() { throw "x" }}))' threw x 7 7 PASS: 'postMessage((function() {return {get a() { throw "accessor-exn"; }};})())' threw accessor-exn … … 28 28 PASS: eventData is 1,2,3 of type object 29 29 PASS: eventData is ,,1 of type object 30 FAIL: eventData is null should be function () {} of type function31 FAIL: eventData is [object Object] should be ReferenceError: Can't find variable: badref of type object32 30 PASS: eventData is 2009-02-13T23:31:30.000Z of type object 33 31 PASS: eventData is [object Object] of type object 34 FAIL: eventData is [object Object] should betrue of type object35 FAIL: eventData is [object Object] should befalse of type object36 FAIL: eventData is [object Object] should begnirts of type object37 FAIL: eventData is [object Object] should be42 of type object32 PASS: eventData is true of type object 33 PASS: eventData is false of type object 34 PASS: eventData is gnirts of type object 35 PASS: eventData is 42 of type object 38 36 PASS: eventData is === to eventData.self 39 37 PASS: eventData is === to eventData[0] … … 91 89 PASS: window.acalled === true 92 90 FAIL: window.bcalled === undefined 93 FAIL: Boolean values correct (0)94 FAIL: Boolean values correct (3)91 PASS: Boolean values correct (0) 92 PASS: Boolean values correct (3) 95 93 PASS: Boolean values correct (1,2) 96 94 PASS: Boolean values correct (4,5) … … 99 97 PASS: References to Booleans correct (0,2) 100 98 PASS: References to Booleans correct (3,5) 101 FAIL: Number values correct (0)99 PASS: Number values correct (0) 102 100 PASS: Number values correct (0,2) 103 101 PASS: References to numbers correct (0,1) 104 102 PASS: References to numbers correct (0,2) 105 FAIL: String values correct (0)103 PASS: String values correct (0) 106 104 PASS: String values correct (0,2) 107 105 PASS: References to strings correct (0,1) 108 106 PASS: References to strings correct (0,2) 109 FAIL: String object properties not serialized110 FAIL: Number object properties not serialized111 FAIL: Boolean object properties not serialized107 PASS: String object properties not serialized 108 PASS: Number object properties not serialized 109 PASS: Boolean object properties not serialized 112 110 PASS: Date values correct (0) 113 111 PASS: Date values correct (1) -
trunk/LayoutTests/platform/gtk/fast/dom/Window/window-postmessage-clone-expected.txt
r114992 r126464 1 CONSOLE MESSAGE: line 86: TypeError: No default value2 CONSOLE MESSAGE: line 86: TypeError: No default value3 1 Tests that we clone object hierarchies 4 2 5 FAIL: 'postMessage((function(){}))' should throw but didn't 6 FAIL: 'postMessage(var x = 0; try { eval("badref"); } catch(e) { x = e; } x)' should throw but didn't 7 PASS: 'postMessage(window)' threw TypeError: Type error3 PASS: 'postMessage((function(){}))' threw Error: DATA_CLONE_ERR: DOM Exception 25 4 PASS: 'postMessage(var x = 0; try { eval("badref"); } catch(e) { x = e; } x)' threw Error: DATA_CLONE_ERR: DOM Exception 25 5 PASS: 'postMessage(window)' threw Error: DATA_CLONE_ERR: DOM Exception 25 8 6 PASS: 'postMessage(({get a() { throw "x" }}))' threw x 9 7 PASS: eventData is null of type object … … 26 24 PASS: eventData is 1,2,3 of type object 27 25 PASS: eventData is ,,1 of type object 28 FAIL: eventData is null should be function () {} of type function29 FAIL: eventData is [object Object] should be ReferenceError: Can't find variable: badref of type object30 26 PASS: eventData is 2009-02-13T23:31:30.000Z of type object 31 27 PASS: eventData is [object Object] of type object 32 FAIL: eventData is [object Object] should betrue of type object33 FAIL: eventData is [object Object] should befalse of type object34 FAIL: eventData is [object Object] should begnirts of type object35 FAIL: eventData is [object Object] should be42 of type object28 PASS: eventData is true of type object 29 PASS: eventData is false of type object 30 PASS: eventData is gnirts of type object 31 PASS: eventData is 42 of type object 36 32 PASS: eventData is === to eventData.self 37 33 PASS: eventData is === to eventData[0] … … 93 89 PASS: window.acalled === true 94 90 FAIL: window.bcalled === undefined 95 FAIL: Boolean values correct (0)96 FAIL: Boolean values correct (3)91 PASS: Boolean values correct (0) 92 PASS: Boolean values correct (3) 97 93 PASS: Boolean values correct (1,2) 98 94 PASS: Boolean values correct (4,5) … … 101 97 PASS: References to Booleans correct (0,2) 102 98 PASS: References to Booleans correct (3,5) 103 FAIL: Number values correct (0)99 PASS: Number values correct (0) 104 100 PASS: Number values correct (0,2) 105 101 PASS: References to numbers correct (0,1) 106 102 PASS: References to numbers correct (0,2) 107 FAIL: String values correct (0)103 PASS: String values correct (0) 108 104 PASS: String values correct (0,2) 109 105 PASS: References to strings correct (0,1) 110 106 PASS: References to strings correct (0,2) 111 FAIL: String object properties not serialized112 FAIL: Number object properties not serialized113 FAIL: Boolean object properties not serialized107 PASS: String object properties not serialized 108 PASS: Number object properties not serialized 109 PASS: Boolean object properties not serialized 114 110 PASS: Date values correct (0) 115 111 PASS: Date values correct (1) -
trunk/Source/JavaScriptCore/ChangeLog
r126387 r126464 1 2012-08-23 Christophe Dumez <christophe.dumez@intel.com> 2 3 Serialization of JavaScript values does not appear to respect new HTML5 Structured Clone semantics 4 https://bugs.webkit.org/show_bug.cgi?id=65292 5 6 Reviewed by Oliver Hunt. 7 8 Add function to construct a StringObject from a JSValue. 9 Similar functions already exist for NumberObject and 10 BooleanObject for example. 11 12 Export several symbols so address linking errors in 13 WebCore. 14 15 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: 16 * runtime/BooleanObject.h: 17 (BooleanObject): 18 * runtime/NumberObject.h: 19 (NumberObject): 20 (JSC): 21 * runtime/StringObject.cpp: 22 (JSC::constructString): 23 (JSC): 24 * runtime/StringObject.h: 25 (JSC): 26 1 27 2012-08-22 Filip Pizlo <fpizlo@apple.com> 2 28 -
trunk/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
r125711 r126464 2 2 3 3 ??0ArrayBufferView@WTF@@IAE@V?$PassRefPtr@VArrayBuffer@WTF@@@1@I@Z 4 ??0BooleanObject@JSC@@IAE@AAVJSGlobalData@1@PAVStructure@1@@Z 4 5 ??0CString@WTF@@QAE@PBD@Z 5 6 ??0CString@WTF@@QAE@PBDI@Z … … 108 109 ?constructEmptyObject@JSC@@YAPAVJSObject@1@PAVExecState@1@@Z 109 110 ?constructFunctionSkippingEvalEnabledCheck@JSC@@YAPAVJSObject@1@PAVExecState@1@PAVJSGlobalObject@1@ABVArgList@1@ABVIdentifier@1@ABVUString@1@ABVTextPosition@WTF@@@Z 111 ?constructNumber@JSC@@YAPAVNumberObject@1@PAVExecState@1@PAVJSGlobalObject@1@VJSValue@1@@Z 112 ?constructString@JSC@@YAPAVStringObject@1@PAVExecState@1@PAVJSGlobalObject@1@VJSValue@1@@Z 110 113 ?convertLatin1ToUTF8@Unicode@WTF@@YA?AW4ConversionResult@12@PAPBEPBEPAPADPAD@Z 111 114 ?convertUTF16ToUTF8@Unicode@WTF@@YA?AW4ConversionResult@12@PAPB_WPB_WPAPADPAD_N@Z … … 187 190 ?finalize@WeakHandleOwner@JSC@@UAEXV?$Handle@W4Unknown@JSC@@@2@PAX@Z 188 191 ?findAllocator@WeakSet@JSC@@AAEPAUFreeCell@WeakBlock@2@XZ 192 ?finishCreation@BooleanObject@JSC@@IAEXAAVJSGlobalData@2@@Z 189 193 ?finishCreation@DateInstance@JSC@@IAEXAAVJSGlobalData@2@N@Z 190 194 ?finishCreation@InternalFunction@JSC@@IAEXAAVJSGlobalData@2@ABVUString@2@@Z -
trunk/Source/JavaScriptCore/runtime/BooleanObject.h
r103243 r126464 28 28 class BooleanObject : public JSWrapperObject { 29 29 protected: 30 BooleanObject(JSGlobalData&, Structure*);31 void finishCreation(JSGlobalData&);30 JS_EXPORT_PRIVATE BooleanObject(JSGlobalData&, Structure*); 31 JS_EXPORT_PRIVATE void finishCreation(JSGlobalData&); 32 32 33 33 public: … … 41 41 } 42 42 43 static const ClassInfo s_info;43 static JS_EXPORTDATA const ClassInfo s_info; 44 44 45 45 static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype) -
trunk/Source/JavaScriptCore/runtime/NumberObject.h
r103243 r126464 41 41 } 42 42 43 static const ClassInfo s_info;43 static JS_EXPORTDATA const ClassInfo s_info; 44 44 45 45 static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype) … … 49 49 }; 50 50 51 NumberObject* constructNumber(ExecState*, JSGlobalObject*, JSValue);51 JS_EXPORT_PRIVATE NumberObject* constructNumber(ExecState*, JSGlobalObject*, JSValue); 52 52 53 53 } // namespace JSC -
trunk/Source/JavaScriptCore/runtime/StringObject.cpp
r116828 r126464 23 23 24 24 #include "Error.h" 25 #include "JSGlobalObject.h" 25 26 #include "PropertyNameArray.h" 26 27 … … 144 145 } 145 146 147 StringObject* constructString(ExecState* exec, JSGlobalObject* globalObject, JSValue string) 148 { 149 StringObject* object = StringObject::create(exec, globalObject->stringObjectStructure()); 150 object->setInternalValue(exec->globalData(), string); 151 return object; 152 } 153 146 154 } // namespace JSC -
trunk/Source/JavaScriptCore/runtime/StringObject.h
r116828 r126464 79 79 } 80 80 81 JS_EXPORT_PRIVATE StringObject* constructString(ExecState*, JSGlobalObject*, JSValue); 82 81 83 } // namespace JSC 82 84 -
trunk/Source/WebCore/ChangeLog
r126461 r126464 1 2012-08-23 Christophe Dumez <christophe.dumez@intel.com> 2 3 Serialization of JavaScript values does not appear to respect new HTML5 Structured Clone semantics 4 https://bugs.webkit.org/show_bug.cgi?id=65292 5 6 Reviewed by Oliver Hunt. 7 8 JSC now correctly serialize Boolean, Number and String objects as per 9 the structured clone algorithm specification. This patch reduces the 10 delta with the V8 implementation of SerializedScriptValue. 11 12 No new tests, already tested by fast/dom/Window/window-postmessage-clone.html 13 14 * bindings/js/SerializedScriptValue.cpp: 15 (WebCore): 16 (WebCore::CloneSerializer::dumpStringObject): 17 (CloneSerializer): 18 (WebCore::CloneSerializer::dumpIfTerminal): 19 (WebCore::CloneDeserializer::readTerminal): 20 1 21 2012-08-23 Joshua Bell <jsbell@chromium.org> 2 22 -
trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp
r126067 r126464 57 57 #include <JavaScriptCore/APICast.h> 58 58 #include <JavaScriptCore/APIShims.h> 59 #include <runtime/BooleanObject.h> 59 60 #include <runtime/DateInstance.h> 60 61 #include <runtime/Error.h> … … 109 110 ArrayBufferViewTag = 22, 110 111 ArrayBufferTransferTag = 23, 112 TrueObjectTag = 24, 113 FalseObjectTag = 25, 114 StringObjectTag = 26, 115 EmptyStringObjectTag = 27, 116 NumberObjectTag = 28, 111 117 ErrorTag = 255 112 118 }; … … 153 159 * Initial version was 1. 154 160 * Version 2. added the ObjectReferenceTag and support for serialization of cyclic graphs. 161 * Version 3. added the FalseObjectTag, TrueObjectTag, NumberObjectTag, StringObjectTag 162 * and EmptyStringObjectTag for serialization of Boolean, Number and String objects. 155 163 */ 156 static const unsigned int CurrentVersion = 2;164 static const unsigned int CurrentVersion = 3; 157 165 static const unsigned int TerminatorTag = 0xFFFFFFFF; 158 166 static const unsigned int StringPoolTag = 0xFFFFFFFE; … … 183 191 * | FalseTag 184 192 * | TrueTag 193 * | FalseObjectTag 194 * | TrueObjectTag 185 195 * | DoubleTag <value:double> 196 * | NumberObjectTag <value:double> 186 197 * | DateTag <value:double> 187 198 * | String 188 199 * | EmptyStringTag 200 * | EmptyStringObjectTag 189 201 * | File 190 202 * | FileList … … 200 212 * EmptyStringTag 201 213 * StringTag StringData 214 * 215 * StringObject: 216 * EmptyStringObjectTag 217 * StringObjectTag StringData 202 218 * 203 219 * StringData :- … … 518 534 } 519 535 536 void dumpStringObject(UString str) 537 { 538 if (str.isEmpty()) 539 write(EmptyStringObjectTag); 540 else { 541 write(StringObjectTag); 542 write(str); 543 } 544 } 545 520 546 bool dumpArrayBufferView(JSObject* obj, SerializationReturnCode& code) 521 547 { … … 586 612 if (value.isObject()) { 587 613 JSObject* obj = asObject(value); 614 if (obj->inherits(&BooleanObject::s_info)) { 615 if (!startObjectInternal(obj)) // handle duplicates 616 return true; 617 write(asBooleanObject(value)->internalValue().toBoolean() ? TrueObjectTag : FalseObjectTag); 618 return true; 619 } 620 if (obj->inherits(&StringObject::s_info)) { 621 if (!startObjectInternal(obj)) // handle duplicates 622 return true; 623 UString str = asString(asStringObject(value)->internalValue())->value(m_exec); 624 dumpStringObject(str); 625 return true; 626 } 627 if (obj->inherits(&NumberObject::s_info)) { 628 if (!startObjectInternal(obj)) // handle duplicates 629 return true; 630 write(NumberObjectTag); 631 NumberObject* obj = static_cast<NumberObject*>(asObject(value)); 632 write(obj->internalValue().asNumber()); 633 return true; 634 } 588 635 if (obj->inherits(&JSFile::s_info)) { 589 636 write(FileTag); … … 1399 1446 case TrueTag: 1400 1447 return jsBoolean(true); 1448 case FalseObjectTag: { 1449 BooleanObject* obj = BooleanObject::create(m_exec->globalData(), m_globalObject->booleanObjectStructure()); 1450 obj->setInternalValue(m_exec->globalData(), jsBoolean(false)); 1451 m_gcBuffer.append(obj); 1452 return obj; 1453 } 1454 case TrueObjectTag: { 1455 BooleanObject* obj = BooleanObject::create(m_exec->globalData(), m_globalObject->booleanObjectStructure()); 1456 obj->setInternalValue(m_exec->globalData(), jsBoolean(true)); 1457 m_gcBuffer.append(obj); 1458 return obj; 1459 } 1401 1460 case DoubleTag: { 1402 1461 double d; … … 1404 1463 return JSValue(); 1405 1464 return jsNumber(d); 1465 } 1466 case NumberObjectTag: { 1467 double d; 1468 if (!read(d)) 1469 return JSValue(); 1470 NumberObject* obj = constructNumber(m_exec, m_globalObject, jsNumber(d)); 1471 m_gcBuffer.append(obj); 1472 return obj; 1406 1473 } 1407 1474 case DateTag: { … … 1480 1547 case EmptyStringTag: 1481 1548 return jsEmptyString(&m_exec->globalData()); 1549 case StringObjectTag: { 1550 CachedStringRef cachedString; 1551 if (!readStringData(cachedString)) 1552 return JSValue(); 1553 StringObject* obj = constructString(m_exec, m_globalObject, cachedString->jsString(m_exec)); 1554 m_gcBuffer.append(obj); 1555 return obj; 1556 } 1557 case EmptyStringObjectTag: { 1558 StringObject* obj = constructString(m_exec, m_globalObject, jsEmptyString(&m_exec->globalData())); 1559 m_gcBuffer.append(obj); 1560 return obj; 1561 } 1482 1562 case RegExpTag: { 1483 1563 CachedStringRef pattern;
Note: See TracChangeset
for help on using the changeset viewer.