Changeset 159275 in webkit
- Timestamp:
- Nov 13, 2013 9:46:10 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r159274 r159275 1 2013-11-13 Victor Costan <costan@gmail.com> 2 3 Blob constructor accepts a sequence (array-like object) as first arg. 4 https://bugs.webkit.org/show_bug.cgi?id=124175 5 6 Reviewed by Christophe Dumez. 7 8 9 * crypto/subtle/argument-conversion-expected.txt: Updated sequence error expectations. 10 * fast/dom/Window/window-postmessage-args-expected.txt: Updated sequence error expectations. 11 * fast/events/constructors/message-event-constructor-expected.txt: Updated sequence error expectations. 12 * fast/events/message-port-multi-expected.txt: Updated sequence error expectations. 13 * fast/files/blob-constructor-expected.txt: Updated error text and added expectations. 14 * fast/files/script-tests/blob-constructor.js: Added sequence test cases. 15 * fast/workers/worker-context-multi-port-expected.txt: Updated sequence error expectations. 16 * fast/workers/worker-multi-port-expected.txt: Updated sequence error expectations. 17 1 18 2013-11-13 Sun-woo Nam <sunny.nam@samsung.com> 2 19 -
trunk/LayoutTests/crypto/subtle/argument-conversion-expected.txt
r158396 r159275 18 18 Passing invalid data to digest() 19 19 PASS crypto.subtle.digest({name: 'sha-1'}) threw exception TypeError: Not enough arguments. 20 PASS crypto.subtle.digest({name: 'sha-1'}, null) threw exception TypeError: Type error.21 PASS crypto.subtle.digest({name: 'sha-1'}, 10) threw exception TypeError: Type error.20 PASS crypto.subtle.digest({name: 'sha-1'}, null) threw exception TypeError: Value is not a sequence. 21 PASS crypto.subtle.digest({name: 'sha-1'}, 10) threw exception TypeError: Value is not a sequence. 22 22 PASS crypto.subtle.digest({name: 'sha-1'}, [10]) threw exception TypeError: Only ArrayBuffer and ArrayBufferView objects can be part of CryptoOperationData sequence. 23 23 PASS crypto.subtle.digest({name: 'sha-1'}, new Uint8Array([0])) threw exception TypeError: Only ArrayBuffer and ArrayBufferView objects can be part of CryptoOperationData sequence. -
trunk/LayoutTests/fast/dom/Window/window-postmessage-args-expected.txt
r128658 r159275 1 1 Test that the second argument of window.postMessage is ignored or triggers an error if it is not a message port. You should see PASS message '1' through '7', followed by 'done', with messages 4-7 received below. 2 2 3 PASS: Posting message ('1', 1): threw exception TypeError: Type error4 PASS: Posting message ('2', c): threw exception TypeError: Type error5 PASS: Posting message ('3', [object Object]): threw exception TypeError: Type error3 PASS: Posting message ('1', 1): threw exception TypeError: Value is not a sequence 4 PASS: Posting message ('2', c): threw exception TypeError: Value is not a sequence 5 PASS: Posting message ('3', [object Object]): threw exception TypeError: Value is not a sequence 6 6 PASS: Posting message ('4', [object Window]) did not throw an exception 7 7 PASS: Posting message ('4a', *) did not throw an exception -
trunk/LayoutTests/fast/events/constructors/message-event-constructor-expected.txt
r155959 r159275 84 84 PASS new MessageEvent('eventType', { ports: null }).ports is [] 85 85 PASS new MessageEvent('eventType', { ports: [1, 2, 3] }).ports[2] threw exception TypeError: Type error. 86 PASS new MessageEvent('eventType', { ports: test_object }).ports threw exception TypeError: Type error.87 PASS new MessageEvent('eventType', { ports: document }).ports threw exception TypeError: Type error.88 PASS new MessageEvent('eventType', { ports: false }).ports threw exception TypeError: Type error.89 PASS new MessageEvent('eventType', { ports: true }).ports threw exception TypeError: Type error.90 PASS new MessageEvent('eventType', { ports: '' }).ports threw exception TypeError: Type error.91 PASS new MessageEvent('eventType', { ports: 'chocolate' }).ports threw exception TypeError: Type error.92 PASS new MessageEvent('eventType', { ports: 12345 }).ports threw exception TypeError: Type error.93 PASS new MessageEvent('eventType', { ports: 18446744073709551615 }).ports threw exception TypeError: Type error.94 PASS new MessageEvent('eventType', { ports: NaN }).ports threw exception TypeError: Type error.95 PASS new MessageEvent('eventType', { get ports() { return 123; } }).ports threw exception TypeError: Type error.86 PASS new MessageEvent('eventType', { ports: test_object }).ports threw exception TypeError: Value is not a sequence. 87 PASS new MessageEvent('eventType', { ports: document }).ports threw exception TypeError: Value is not a sequence. 88 PASS new MessageEvent('eventType', { ports: false }).ports threw exception TypeError: Value is not a sequence. 89 PASS new MessageEvent('eventType', { ports: true }).ports threw exception TypeError: Value is not a sequence. 90 PASS new MessageEvent('eventType', { ports: '' }).ports threw exception TypeError: Value is not a sequence. 91 PASS new MessageEvent('eventType', { ports: 'chocolate' }).ports threw exception TypeError: Value is not a sequence. 92 PASS new MessageEvent('eventType', { ports: 12345 }).ports threw exception TypeError: Value is not a sequence. 93 PASS new MessageEvent('eventType', { ports: 18446744073709551615 }).ports threw exception TypeError: Value is not a sequence. 94 PASS new MessageEvent('eventType', { ports: NaN }).ports threw exception TypeError: Value is not a sequence. 95 PASS new MessageEvent('eventType', { get ports() { return 123; } }).ports threw exception TypeError: Value is not a sequence. 96 96 PASS new MessageEvent('eventType', { get ports() { throw 'MessageEvent Error'; } }) threw exception MessageEvent Error. 97 PASS new MessageEvent('eventType', { ports: {valueOf: function () { return [channel.port1, channel.port2, channel.port2]; } } }).ports[0] threw exception TypeError: Type error.97 PASS new MessageEvent('eventType', { ports: {valueOf: function () { return [channel.port1, channel.port2, channel.port2]; } } }).ports[0] threw exception TypeError: Value is not a sequence. 98 98 PASS new MessageEvent('eventType', { bubbles: true, cancelable: true, data: test_object, origin: 'wonderful', lastEventId: 'excellent', source: window, ports: [channel.port1, channel.port2, channel2.port1] }).bubbles is true 99 99 PASS new MessageEvent('eventType', { bubbles: true, cancelable: true, data: test_object, origin: 'wonderful', lastEventId: 'excellent', source: window, ports: [channel.port1, channel.port2, channel2.port1] }).cancelable is true -
trunk/LayoutTests/fast/events/message-port-multi-expected.txt
r135168 r159275 9 9 PASS channel.port1.postMessage("notAPort", [channel3.port1, {}, channel3.port2]) threw exception TypeError: Type error. 10 10 PASS channel.port1.postMessage("duplicate port", [channel3.port1, channel3.port1]) threw exception Error: InvalidStateError: DOM Exception 11. 11 PASS channel.port1.postMessage("notAnArray", channel3.port1) threw exception TypeError: Type error.11 PASS channel.port1.postMessage("notAnArray", channel3.port1) threw exception TypeError: Value is not a sequence. 12 12 PASS channel.port1.postMessage("notASequence", [{length: 3}]) threw exception TypeError: Type error. 13 13 PASS channel.port1.postMessage("largeSequence", largePortArray) threw exception Error: InvalidStateError: DOM Exception 11. -
trunk/LayoutTests/fast/files/blob-constructor-expected.txt
r148997 r159275 11 11 PASS (new Blob(['hello'], {type:'text/html', endings:'native'})) instanceof window.Blob is true 12 12 PASS (new Blob(['hello'], {type:'text/html', endings:'transparent'})) instanceof window.Blob is true 13 PASS new Blob('hello') threw exception TypeError: First argument of the constructor is not of type Array.14 PASS new Blob(0) threw exception TypeError: First argument of the constructor is not of type Array.13 PASS new Blob('hello') threw exception TypeError: Value is not a sequence. 14 PASS new Blob(0) threw exception TypeError: Value is not a sequence. 15 15 PASS (new Blob([])) instanceof window.Blob is true 16 16 PASS (new Blob(['stringPrimitive'])) instanceof window.Blob is true … … 73 73 PASS new Blob([(new Float64Array(100)).buffer, (new Int32Array(100)).buffer, (new Uint8Array(100)).buffer, (new DataView(new ArrayBuffer(100))).buffer]).size is 1400 74 74 PASS new Blob([new Blob([(new Int32Array(100)).buffer]), (new Uint8Array(100)).buffer, (new Float32Array(100)).buffer, (new DataView(new ArrayBuffer(100))).buffer]).size is 1000 75 PASS new Blob({length: 0}) instanceof window.Blob is true 76 PASS new Blob({length: 0}).size is 0 77 PASS new Blob({length: 1, 0: 'string'}).size is 6 78 PASS new Blob({length: 2, 0: new Uint8Array(100), 1: new Int16Array(100)}).size is 300 79 PASS new Blob({length: 1, 0: 'string'}, {type: 'text/html'}).type is 'text/html' 80 PASS new Blob({length: 0}, {endings:'illegal'}) threw exception TypeError: The endings property must be either "transparent" or "native". 75 81 PASS successfullyParsed is true 76 82 -
trunk/LayoutTests/fast/files/script-tests/blob-constructor.js
r148997 r159275 11 11 12 12 // Test invalid blob parts 13 shouldThrow("new Blob('hello')", "'TypeError: First argument of the constructor is not of type Array'");14 shouldThrow("new Blob(0)", "'TypeError: First argument of the constructor is not of type Array'");13 shouldThrow("new Blob('hello')", "'TypeError: Value is not a sequence'"); 14 shouldThrow("new Blob(0)", "'TypeError: Value is not a sequence'"); 15 15 16 16 // Test valid blob parts. … … 99 99 shouldBe("new Blob([(new Float64Array(100)).buffer, (new Int32Array(100)).buffer, (new Uint8Array(100)).buffer, (new DataView(new ArrayBuffer(100))).buffer]).size", "1400"); 100 100 shouldBe("new Blob([new Blob([(new Int32Array(100)).buffer]), (new Uint8Array(100)).buffer, (new Float32Array(100)).buffer, (new DataView(new ArrayBuffer(100))).buffer]).size", "1000"); 101 102 // Test passing blob parts in sequences. 103 shouldBeTrue("new Blob({length: 0}) instanceof window.Blob"); 104 shouldBe("new Blob({length: 0}).size", "0"); 105 shouldBe("new Blob({length: 1, 0: 'string'}).size", "6"); 106 shouldBe("new Blob({length: 2, 0: new Uint8Array(100), 1: new Int16Array(100)}).size", "300"); 107 shouldBe("new Blob({length: 1, 0: 'string'}, {type: 'text/html'}).type", "'text/html'"); 108 shouldThrow("new Blob({length: 0}, {endings:'illegal'})", "'TypeError: The endings property must be either \"transparent\" or \"native\"'"); -
trunk/LayoutTests/fast/workers/worker-context-multi-port-expected.txt
r134648 r159275 10 10 PASS posting a non-port did throw: TypeError: Type error 11 11 PASS event.ports contains two ports when two ports re-sent after error 12 PASS posting a non-array did throw: TypeError: Type error12 PASS posting a non-array did throw: TypeError: Value is not a sequence 13 13 PASS posting a non-sequence did throw: TypeError: Type error 14 14 -
trunk/LayoutTests/fast/workers/worker-multi-port-expected.txt
r134648 r159275 6 6 PASS worker.postMessage("null port", [channel3.port1, null, channel3.port2]) threw exception Error: InvalidStateError: DOM Exception 11. 7 7 PASS worker.postMessage("notAPort", [channel3.port1, {}, channel3.port2]) threw exception TypeError: Type error. 8 PASS worker.postMessage("notAnArray", channel3.port1) threw exception TypeError: Type error.8 PASS worker.postMessage("notAnArray", channel3.port1) threw exception TypeError: Value is not a sequence. 9 9 PASS worker.postMessage("notASequence", [{length: 3}]) threw exception TypeError: Type error. 10 10 PASS event.ports is non-null and zero length when no port sent -
trunk/Source/WebCore/ChangeLog
r159272 r159275 1 2013-11-13 Victor Costan <costan@gmail.com> 2 3 Blob constructor accepts a sequence (array-like object) as first arg. 4 https://bugs.webkit.org/show_bug.cgi?id=124175 5 6 Reviewed by Christophe Dumez. 7 8 Added test cases to fast/files/script-tests/blob-constructor.js. 9 10 * bindings/js/JSBlobCustom.cpp: Make the constructor work with sequences. 11 (WebCore::JSBlobConstructor::constructJSBlob): 12 * bindings/js/JSDOMBinding.h: 13 (WebCore::toJSSequence): Slightly better error message when conversion fails. 14 (WebCore::toJS): Whitespace. 15 (WebCore::jsArray): Whitespace. 16 1 17 2013-11-13 Joseph Pecoraro <pecoraro@apple.com> 2 18 -
trunk/Source/WebCore/bindings/js/JSBlobCustom.cpp
r154127 r159275 72 72 } 73 73 74 JSValue firstArg = exec->argument(0); 75 if (!isJSArray(firstArg)) 76 return throwVMError(exec, createTypeError(exec, "First argument of the constructor is not of type Array")); 74 unsigned blobPartsLength = 0; 75 JSObject* blobParts = toJSSequence(exec, exec->argument(0), blobPartsLength); 76 if (exec->hadException()) 77 return JSValue::encode(jsUndefined()); 78 ASSERT(blobParts); 77 79 78 80 String type; … … 111 113 BlobBuilder blobBuilder; 112 114 113 JSArray* array = asArray(firstArg); 114 unsigned length = array->length(); 115 116 for (unsigned i = 0; i < length; ++i) { 117 JSValue item = array->getIndex(exec, i); 115 for (unsigned i = 0; i < blobPartsLength; ++i) { 116 JSValue item = blobParts->get(exec, i); 118 117 #if ENABLE(BLOB) 119 118 if (item.inherits(JSArrayBuffer::info())) -
trunk/Source/WebCore/bindings/js/JSDOMBinding.h
r158997 r159275 120 120 return static_cast<WebCoreTypedArrayController*>(world.vm()->m_typedArrayController.get())->wrapperOwner(); 121 121 } 122 122 123 123 inline void* wrapperContext(DOMWrapperWorld& world, JSC::ArrayBuffer*) 124 124 { … … 198 198 weakRemove(world.m_wrappers, (void*)domObject, wrapper); 199 199 } 200 200 201 201 #define CREATE_DOM_WRAPPER(exec, globalObject, className, object) createWrapper<JS##className>(exec, globalObject, static_cast<className*>(object)) 202 202 template<class WrapperClass, class DOMClass> inline JSDOMWrapper* createWrapper(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, DOMClass* node) … … 252 252 return jsStringWithCache(exec, s.string()); 253 253 } 254 254 255 255 JSC::JSValue jsStringOrNull(JSC::ExecState*, const String&); // null if the string is null 256 256 JSC::JSValue jsStringOrNull(JSC::ExecState*, const URL&); // null if the URL is null … … 326 326 JSC::JSObject* object = value.getObject(); 327 327 if (!object) { 328 throw TypeError(exec);328 throwVMError(exec, createTypeError(exec, "Value is not a sequence")); 329 329 return 0; 330 330 } … … 335 335 336 336 if (lengthValue.isUndefinedOrNull()) { 337 throw TypeError(exec);337 throwVMError(exec, createTypeError(exec, "Value is not a sequence")); 338 338 return 0; 339 339 } … … 375 375 { 376 376 JSC::JSArray* array = constructEmptyArray(exec, 0, vector.size()); 377 377 378 378 for (size_t i = 0; i < vector.size(); ++i) 379 379 array->putDirectIndex(exec, i, toJS(exec, globalObject, vector[i])); 380 380 381 381 return array; 382 382 } … … 386 386 { 387 387 JSC::JSArray* array = constructEmptyArray(exec, 0, vector.size()); 388 388 389 389 for (size_t i = 0; i < vector.size(); ++i) 390 390 array->putDirectIndex(exec, i, toJS(exec, globalObject, vector[i].get())); 391 391 392 392 return array; 393 393 } … … 429 429 { 430 430 JSC::MarkedArgumentBuffer list; 431 typename Vector<T, inlineCapacity>::const_iterator end = iterator.end(); 431 typename Vector<T, inlineCapacity>::const_iterator end = iterator.end(); 432 432 typedef JSValueTraits<T> TraitsType; 433 433
Note: See TracChangeset
for help on using the changeset viewer.