RESOLVED FIXED 74752
Consolidate before-advice regarding attribute modification into a single method
https://bugs.webkit.org/show_bug.cgi?id=74752
Summary Consolidate before-advice regarding attribute modification into a single method
Adam Klein
Reported 2011-12-16 14:38:32 PST
Consolidate before-advice regarding attribute modification into a single method
Attachments
Patch (8.42 KB, patch)
2011-12-16 14:53 PST, Adam Klein
no flags
Resolved conflicts with trunk (8.46 KB, patch)
2011-12-16 16:34 PST, Adam Klein
no flags
Patch for landing (8.52 KB, patch)
2011-12-16 18:05 PST, Adam Klein
no flags
Adam Klein
Comment 1 2011-12-16 14:53:09 PST
Ryosuke Niwa
Comment 2 2011-12-16 16:23:30 PST
Comment on attachment 119680 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=119680&action=review > Source/WebCore/dom/Attr.cpp:182 > + valueBuilder.append(static_cast<Text *>(n)->data()); There should be no space between Text and *. > Source/WebCore/dom/Attr.cpp:185 > + AtomicString value = valueBuilder.toString(); We should probably call this variable newValue for clarity. > Source/WebCore/dom/NamedNodeMap.cpp:146 > + if (!attribute || !m_element) { Can we have a test for this change?
Adam Klein
Comment 3 2011-12-16 16:31:56 PST
Comment on attachment 119680 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=119680&action=review >> Source/WebCore/dom/Attr.cpp:182 >> + valueBuilder.append(static_cast<Text *>(n)->data()); > > There should be no space between Text and *. Done. >> Source/WebCore/dom/Attr.cpp:185 >> + AtomicString value = valueBuilder.toString(); > > We should probably call this variable newValue for clarity. Done. >> Source/WebCore/dom/NamedNodeMap.cpp:146 >> + if (!attribute || !m_element) { > > Can we have a test for this change? It's not possible to get a reference to a NamedNodeMap whose element is null from JavaScript, since the NamedNodeMap wrapper holds a (hidden) reference back to the element. See NamedNodeMap::detachFromElement() for more discussion. Adding this null check makes it clear why it's safe to call a method on m_element below, and is symmetrical with the check at the top of setNamedItem(). Would you rather I replace this with an ASSERT(m_element) instead?
Adam Klein
Comment 4 2011-12-16 16:34:22 PST
Created attachment 119698 [details] Resolved conflicts with trunk
Ryosuke Niwa
Comment 5 2011-12-16 16:38:24 PST
Comment on attachment 119680 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=119680&action=review >>> Source/WebCore/dom/NamedNodeMap.cpp:146 >>> + if (!attribute || !m_element) { >> >> Can we have a test for this change? > > It's not possible to get a reference to a NamedNodeMap whose element is null from JavaScript, since the NamedNodeMap wrapper holds a (hidden) reference back to the element. See NamedNodeMap::detachFromElement() for more discussion. > > Adding this null check makes it clear why it's safe to call a method on m_element below, and is symmetrical with the check at the top of setNamedItem(). Would you rather I replace this with an ASSERT(m_element) instead? I'd rather see ASSERT(m_element).
Ryosuke Niwa
Comment 6 2011-12-16 16:39:07 PST
Comment on attachment 119698 [details] Resolved conflicts with trunk r=me provided the change in removeNamedItem is replaced by an assertion.
Adam Klein
Comment 7 2011-12-16 18:05:32 PST
Created attachment 119709 [details] Patch for landing
WebKit Review Bot
Comment 8 2011-12-16 20:36:51 PST
Comment on attachment 119709 [details] Patch for landing Clearing flags on attachment: 119709 Committed r103140: <http://trac.webkit.org/changeset/103140>
WebKit Review Bot
Comment 9 2011-12-16 20:36:55 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.