Changeset 164008 in webkit


Ignore:
Timestamp:
Feb 12, 2014, 8:05:10 PM (11 years ago)
Author:
ap@apple.com
Message:

Don't crash when SerializedScriptValue deserialization fails
https://bugs.webkit.org/show_bug.cgi?id=128657

Reviewed by Oliver Hunt.

Source/WebCore:

Test: crypto/subtle/postMessage-worker.html

  • bindings/js/JSMessageEventCustom.cpp: (WebCore::JSMessageEvent::data): Added a FIXME.
  • bindings/js/SerializedScriptValue.cpp:

(WebCore::CloneBase::fail): Don't assert on failure.
(WebCore::SerializedScriptValue::deserialize): Never return a null JSValue, these
are not allowed.

LayoutTests:

  • crypto/subtle/postMessage-worker-expected.txt:
  • crypto/subtle/resources/postMessage-worker.js:
  • platform/mac/TestExpectations:

Unskip the test, and land (unimportant) failure results.

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r164000 r164008  
     12014-02-12  Alexey Proskuryakov  <ap@apple.com>
     2
     3        Don't crash when SerializedScriptValue deserialization fails
     4        https://bugs.webkit.org/show_bug.cgi?id=128657
     5
     6        Reviewed by Oliver Hunt.
     7
     8        * crypto/subtle/postMessage-worker-expected.txt:
     9        * crypto/subtle/resources/postMessage-worker.js:
     10        * platform/mac/TestExpectations:
     11        Unskip the test, and land (unimportant) failure results.
     12
    1132014-02-12  Brady Eidson  <beidson@apple.com>
    214
  • trunk/LayoutTests/crypto/subtle/postMessage-worker-expected.txt

    r160547 r164008  
    44
    55
    6 PASS All checks passed in worker
    7 PASS key.type is 'secret'
    8 PASS key.extractable is true
    9 PASS key.algorithm.name is 'HMAC'
    10 PASS key.algorithm.length is 16
    11 PASS key.usages is ["decrypt", "encrypt", "sign", "verify"]
     6FAIL Check failed in worker: key is null
    127PASS successfullyParsed is true
    138
  • trunk/LayoutTests/crypto/subtle/resources/postMessage-worker.js

    r160547 r164008  
    22{
    33    var key = evt.data;
     4    if (!key)
     5        postMessage({ result:false, message:'key is ' + key });
    46    if (key.type != 'secret')
    57        postMessage({ result:false, message:'key.type should be "secret"' });
  • trunk/LayoutTests/platform/mac/TestExpectations

    r163981 r164008  
    12461246webkit.org/b/124261 [ MountainLion ] crypto/subtle [ Skip ]
    12471247
    1248 # Deserialization of a CryptoKey in a worker fails with a crash.
    1249 crypto/subtle/postMessage-worker.html [ Skip ]
    1250 
    12511248webkit.org/b/124311 compositing/regions/transform-transparent-positioned-video-inside-region.html [ Pass ImageOnlyFailure ]
    12521249
  • trunk/Source/WebCore/ChangeLog

    r164006 r164008  
     12014-02-11  Alexey Proskuryakov  <ap@apple.com>
     2
     3        Don't crash when SerializedScriptValue deserialization fails
     4        https://bugs.webkit.org/show_bug.cgi?id=128657
     5
     6        Reviewed by Oliver Hunt.
     7
     8        Test: crypto/subtle/postMessage-worker.html
     9
     10        * bindings/js/JSMessageEventCustom.cpp: (WebCore::JSMessageEvent::data): Added a FIXME.
     11
     12        * bindings/js/SerializedScriptValue.cpp:
     13        (WebCore::CloneBase::fail): Don't assert on failure.
     14        (WebCore::SerializedScriptValue::deserialize): Never return a null JSValue, these
     15        are not allowed.
     16
    1172014-02-12  Bem Jones-Bey  <bjonesbe@adobe.com>
    218
  • trunk/Source/WebCore/bindings/js/JSMessageEventCustom.cpp

    r163744 r164008  
    6565        if (RefPtr<SerializedScriptValue> serializedValue = event.dataAsSerializedScriptValue()) {
    6666            MessagePortArray ports = impl().ports();
     67            // FIXME: Why does this suppress exceptions?
    6768            result = serializedValue->deserialize(exec, globalObject(), &ports, NonThrowing);
    68         }
    69         else
     69        } else
    7070            result = jsNull();
    7171        break;
  • trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp

    r163863 r164008  
    382382    }
    383383
    384     NO_RETURN_DUE_TO_ASSERT
    385384    void fail()
    386385    {
    387         ASSERT_NOT_REACHED();
    388386        m_failed = true;
    389387    }
     
    26422640    if (throwExceptions == Throwing)
    26432641        maybeThrowExceptionIfSerializationFailed(exec, result.second);
    2644     return result.first;
     2642    return result.first ? result.first : jsNull();
    26452643}
    26462644
     
    26542652            *exception = toRef(exec, exec->exception());
    26552653        exec->clearException();
    2656         return 0;
     2654        return nullptr;
    26572655    }
    26582656    ASSERT(value);
Note: See TracChangeset for help on using the changeset viewer.