• Devlin Cronin's avatar
    Introduce Function::FunctionProtoToString() · 2ccd4dc5
    Devlin Cronin authored
    Add a new function on the public API to allow serializing a function to
    a string using the built-in toString() implementation, allowing
    serialization without worrying about untrusted author script overriding
    the toString() implementation. This is similar in nature to
    Object::ObjectProtoToString() (but that only returns "[object Function]"
    for any passed function).
    
    Add tests for the same.
    
    Bug: chromium:1144841
    Change-Id: Ie4c29b870034c0817c23bf91f9424f956098823d
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2514768Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
    Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#70976}
    2ccd4dc5
v8.h 397 KB