Changeset 65031 in webkit
- Timestamp:
- Aug 9, 2010 6:47:42 PM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r65030 r65031 1 2010-08-09 Adam Barth <abarth@webkit.org> 2 3 Reviewed by Eric Seidel. 4 5 Remove error-prone external SegementedSubstring contructor 6 https://bugs.webkit.org/show_bug.cgi?id=43752 7 8 There's a lot of code that assumes that SegmentedString takes ownership 9 of its substrings. For example, when the HTML parser pauses and 10 resumes asynchronously, it could explode if SegmentedString didn't own 11 its substrings. 12 13 Prior to this patch, there was a constructor that let 14 SegmentedSubstring use an external string buffer. It turns out it was 15 only used in a handful of places, but I'd rather pay the memcpy of 16 these small strings than risk having them used after free. 17 18 * bindings/js/JSHTMLDocumentCustom.cpp: 19 (WebCore::documentWrite): 20 * html/LegacyHTMLDocumentParser.cpp: 21 (WebCore::LegacyHTMLDocumentParser::parseNonHTMLText): 22 (WebCore::LegacyHTMLDocumentParser::scriptHandler): 23 (WebCore::LegacyHTMLDocumentParser::parseComment): 24 * platform/text/SegmentedString.h: 25 (WebCore::SegmentedString::SegmentedString): 26 1 27 2010-08-09 Gavin Barraclough <barraclough@apple.com> 2 28 -
trunk/WebCore/bindings/js/JSHTMLDocumentCustom.cpp
r61057 r65031 151 151 } 152 152 if (addNewline) 153 segmentedString.append(SegmentedString( &newlineCharacter, 1));153 segmentedString.append(SegmentedString(String(&newlineCharacter, 1))); 154 154 155 155 Document* activeDocument = asJSDOMWindow(exec->lexicalGlobalObject())->impl()->document(); -
trunk/WebCore/html/LegacyHTMLDocumentParser.cpp
r62302 r65031 347 347 state = scriptHandler(state); 348 348 else { 349 state = processListing(SegmentedString( m_scriptCode, m_scriptCodeSize), state);349 state = processListing(SegmentedString(String(m_scriptCode, m_scriptCodeSize)), state); 350 350 processToken(); 351 351 if (state.inStyle()) { … … 452 452 } 453 453 454 state = processListing(SegmentedString( m_scriptCode, m_scriptCodeSize), state);454 state = processListing(SegmentedString(String(m_scriptCode, m_scriptCodeSize)), state); 455 455 RefPtr<Node> node = processToken(); 456 456 … … 626 626 m_currentToken.tagName = commentAtom; 627 627 m_currentToken.beginTag = true; 628 state = processListing(SegmentedString( m_scriptCode, m_scriptCodeSize - endCharsCount), state);628 state = processListing(SegmentedString(String(m_scriptCode, m_scriptCodeSize - endCharsCount)), state); 629 629 processToken(); 630 630 m_currentToken.tagName = commentAtom; -
trunk/WebCore/platform/text/SegmentedString.h
r62172 r65031 39 39 } 40 40 41 SegmentedSubstring(const UChar* str, int length) : m_length(length), m_current(length == 0 ? 0 : str), m_doNotExcludeLineNumbers(true) {}42 43 41 void clear() { m_length = 0; m_current = 0; } 44 42 … … 73 71 SegmentedString() 74 72 : m_pushedChar1(0), m_pushedChar2(0), m_currentChar(0), m_composite(false), m_closed(false) {} 75 SegmentedString(const UChar* str, int length) : m_pushedChar1(0), m_pushedChar2(0)76 , m_currentString(str, length), m_currentChar(m_currentString.m_current), m_composite(false), m_closed(false) {}77 73 SegmentedString(const String& str) 78 74 : m_pushedChar1(0), m_pushedChar2(0), m_currentString(str)
Note: See TracChangeset
for help on using the changeset viewer.