Summary: | The binding for getDistributedNodes unnecessarily makes a vector of nodes | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Ryosuke Niwa <rniwa> | ||||
Component: | DOM | Assignee: | Ryosuke Niwa <rniwa> | ||||
Status: | RESOLVED FIXED | ||||||
Severity: | Normal | CC: | cdumez, koivisto | ||||
Priority: | P2 | ||||||
Version: | WebKit Nightly Build | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Bug Depends on: | |||||||
Bug Blocks: | 148695 | ||||||
Attachments: |
|
Description
Ryosuke Niwa
2015-09-21 16:35:25 PDT
Created attachment 261703 [details]
Fixes the bug
Comment on attachment 261703 [details] Fixes the bug View in context: https://bugs.webkit.org/attachment.cgi?id=261703&action=review > Source/WebCore/bindings/js/JSDOMBinding.h:467 > +template<typename T> > +inline JSC::JSValue jsArray(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, const Vector<T>* vector) > +{ > + JSC::MarkedArgumentBuffer list; > + if (vector) { > + for (auto& element : *vector) > + list.append(JSValueTraits<T>::arrayJSValue(exec, globalObject, element)); > + } > + return JSC::constructArray(exec, nullptr, globalObject, list); > +} I suggest writing this instead: template<typename T, size_t inlineCapacity> inline JSC::JSValue jsArray(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, const Vector<T, inlineCapacity>* vector) { if (!vector) return JSC::constructEmptyArray(exec); return jsArray(exec, globalObject, *vector); } Committed r190093: <http://trac.webkit.org/changeset/190093> |