Changeset 122628 in webkit


Ignore:
Timestamp:
Jul 13, 2012 1:45:55 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Restructure V8Utilities::extractTransferables() with help of toV8Sequence()
https://bugs.webkit.org/show_bug.cgi?id=91208

Patch by Vineet Chaudhary <Vineet> on 2012-07-13
Reviewed by Kentaro Hara.

Source/WebCore:

We can remove the specialised check for MessagePort from V8Utilities::extractTransferables()
using toV8Sequence() as it validates the passed object for sequence type per WebIDL spec.

No new test as just refactoring.
Existing tests under fast/dom/Window/window-* fast/dom/events/*
covers tests.

  • bindings/v8/V8Utilities.cpp:

(WebCore::extractTransferables):

LayoutTests:

We can remove the specialised check for MessagePort from V8Utilities::extractTransferables()
using toV8Sequence() as it validates the passed object for sequence type per WebIDL spec.
Removing port specific expected results.

  • platform/chromium-win/fast/workers/worker-context-multi-port-expected.txt: Removed.
  • platform/chromium-win/fast/workers/worker-multi-port-expected.txt: Removed.
  • platform/chromium/fast/dom/Window/window-postmessage-args-expected.txt: Removed.
  • platform/chromium/fast/events/constructors/message-event-constructor-expected.txt: Removed.
  • platform/chromium/fast/events/message-port-multi-expected.txt: Rebaselined.
Location:
trunk
Files:
4 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r122626 r122628  
     12012-07-13  Vineet Chaudhary  <rgf748@motorola.com>
     2
     3        Restructure V8Utilities::extractTransferables() with help of toV8Sequence()
     4        https://bugs.webkit.org/show_bug.cgi?id=91208
     5
     6        Reviewed by Kentaro Hara.
     7
     8        We can remove the specialised check for MessagePort from V8Utilities::extractTransferables()
     9        using toV8Sequence() as it validates the passed object for sequence type per WebIDL spec.
     10        Removing port specific expected results.
     11
     12        * platform/chromium-win/fast/workers/worker-context-multi-port-expected.txt: Removed.
     13        * platform/chromium-win/fast/workers/worker-multi-port-expected.txt: Removed.
     14        * platform/chromium/fast/dom/Window/window-postmessage-args-expected.txt: Removed.
     15        * platform/chromium/fast/events/constructors/message-event-constructor-expected.txt: Removed.
     16        * platform/chromium/fast/events/message-port-multi-expected.txt: Rebaselined.
     17
    1182012-07-13  Vincent Scheib  <scheib@chromium.org>
    219
  • trunk/LayoutTests/platform/chromium/fast/events/message-port-multi-expected.txt

    r109233 r122628  
    77PASS channel.port1.postMessage("entangled port", [channel.port2]) threw exception Error: DATA_CLONE_ERR: DOM Exception 25.
    88PASS channel.port1.postMessage("null port", [channel3.port1, null, channel3.port2]) threw exception Error: DATA_CLONE_ERR: DOM Exception 25.
    9 PASS channel.port1.postMessage("notAPort", [channel3.port1, {}, channel3.port2]) threw exception TypeError: TransferArray argument must contain only Transferables.
    10 PASS channel.port1.postMessage("notAnArray", channel3.port1) threw exception TypeError: TransferArray argument has no length attribute.
    11 PASS channel.port1.postMessage("notASequence", [{length: 3}]) threw exception TypeError: TransferArray argument must contain only Transferables.
     9PASS channel.port1.postMessage("notAPort", [channel3.port1, {}, channel3.port2]) threw exception TypeError: Type error.
     10PASS channel.port1.postMessage("notAnArray", channel3.port1) threw exception TypeError: Type error.
     11PASS channel.port1.postMessage("notASequence", [{length: 3}]) threw exception TypeError: Type error.
    1212PASS channel.port1.postMessage("largeSequence", largePortArray) threw exception Error: DATA_CLONE_ERR: DOM Exception 25.
    1313PASS event.ports is non-null and zero length when no port sent
  • trunk/Source/WebCore/ChangeLog

    r122626 r122628  
     12012-07-13  Vineet Chaudhary  <rgf748@motorola.com>
     2
     3        Restructure V8Utilities::extractTransferables() with help of toV8Sequence()
     4        https://bugs.webkit.org/show_bug.cgi?id=91208
     5
     6        Reviewed by Kentaro Hara.
     7
     8        We can remove the specialised check for MessagePort from V8Utilities::extractTransferables()
     9        using toV8Sequence() as it validates the passed object for sequence type per WebIDL spec.
     10
     11        No new test as just refactoring.
     12        Existing tests under fast/dom/Window/window-* fast/dom/events/*
     13        covers tests.
     14
     15        * bindings/v8/V8Utilities.cpp:
     16        (WebCore::extractTransferables):
     17
    1182012-07-13  Vincent Scheib  <scheib@chromium.org>
    219
  • trunk/Source/WebCore/bindings/v8/V8Utilities.cpp

    r121538 r122628  
    9393    }
    9494
    95     if (!value->IsObject()) {
    96         V8Proxy::throwTypeError("TransferArray argument must be an object");
    97         return false;
    98     }
    9995    uint32_t length = 0;
    100     v8::Local<v8::Object> transferrables = v8::Local<v8::Object>::Cast(value);
    101 
    10296    if (value->IsArray()) {
    10397        v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(value);
    10498        length = array->Length();
    10599    } else {
    106         // Sequence-type object - get the length attribute
    107         v8::Local<v8::Value> sequenceLength = transferrables->Get(v8::String::New("length"));
    108         if (!sequenceLength->IsNumber()) {
    109             V8Proxy::throwTypeError("TransferArray argument has no length attribute");
     100        if (toV8Sequence(value, length).IsEmpty())
    110101            return false;
    111         }
    112         length = sequenceLength->Uint32Value();
    113     }
     102    }
     103
     104    v8::Local<v8::Object> transferrables = v8::Local<v8::Object>::Cast(value);
    114105
    115106    // Validate the passed array of transferrables.
     
    127118            arrayBuffers.append(V8ArrayBuffer::toNative(v8::Handle<v8::Object>::Cast(transferrable)));
    128119        else {
    129             V8Proxy::throwTypeError("TransferArray argument must contain only Transferables");
     120            V8Proxy::throwTypeError();
    130121            return false;
    131122        }
Note: See TracChangeset for help on using the changeset viewer.