Ignore:
Timestamp:
May 9, 2017, 6:01:26 PM (8 years ago)
Author:
[email protected]
Message:

JSInjectedScriptHost should get a copy of the boundArgs
https://bugs.webkit.org/show_bug.cgi?id=171897

Reviewed by Joseph Pecoraro.

The boundArgs array is very special - it cannot be mutated in any way. So, it makes sense
for the inspector to get a copy of it.

  • inspector/JSInjectedScriptHost.cpp:

(Inspector::JSInjectedScriptHost::getInternalProperties):

  • runtime/JSBoundFunction.cpp:

(JSC::JSBoundFunction::boundArgsCopy):

  • runtime/JSBoundFunction.h:

(JSC::JSBoundFunction::boundArgs):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/JSBoundFunction.cpp

    r212015 r216561  
    192192}
    193193
     194JSArray* JSBoundFunction::boundArgsCopy(ExecState* exec)
     195{
     196    VM& vm = exec->vm();
     197    auto scope = DECLARE_THROW_SCOPE(vm);
     198    JSArray* result = constructEmptyArray(exec, nullptr, globalObject());
     199    RETURN_IF_EXCEPTION(scope, nullptr);
     200    for (unsigned i = 0; i < m_boundArgs->length(); ++i) {
     201        result->push(exec, m_boundArgs->getIndexQuickly(i));
     202        RETURN_IF_EXCEPTION(scope, nullptr);
     203    }
     204    return result;
     205}
     206
    194207void JSBoundFunction::finishCreation(VM& vm, NativeExecutable* executable, int length)
    195208{
Note: See TracChangeset for help on using the changeset viewer.