[webkit-dev] Lets use PassRefPtr for arguments less; lets use RefPtr for locals and data members more

Ryosuke Niwa rniwa at webkit.org
Sun Jun 19 14:13:07 PDT 2011

On Sun, Jun 19, 2011 at 2:05 PM, Darin Adler <darin at apple.com> wrote:

> On Jun 19, 2011, at 2:03 PM, Ryosuke Niwa wrote:
> > One of the most common security bugs I have seen in editing is that we
> keep a raw pointer to a node and call some helper method that modifies DOM
> (therefore invoking scripts).
> >
> > I'm sometimes tempted to replace all instances of Node* in the editing
> component by RefPtr/PassRefPtr.
> I suspect that if the data members and local variables had type RefPtr,
> then it mostly wouldn’t matter if argument types were PassRefPtr or raw
> pointers for this purpose.

Right, although it's tricky to catch cases where we call a function that
takes multiple arguments (one of them being Node*) with the return value of
a function that modifies DOM.

- Ryosuke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20110619/3a3bb00a/attachment.html>

More information about the webkit-dev mailing list