Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Side by Side Diff: Source/core/css/FontFace.cpp

Issue 216563002: [SVG Fonts] Fix <font-face> element leak document (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 } else 579 } else
580 #endif 580 #endif
581 { 581 {
582 source = adoptPtr(new RemoteFontFaceSource(fetched)); 582 source = adoptPtr(new RemoteFontFaceSource(fetched));
583 } 583 }
584 } 584 }
585 } 585 }
586 } else { 586 } else {
587 #if ENABLE(SVG_FONTS) 587 #if ENABLE(SVG_FONTS)
588 if (item->svgFontFaceElement()) { 588 if (item->svgFontFaceElement()) {
589 source = adoptPtr(new SVGFontFaceSource(item->svgFontFaceElement ())); 589 RefPtr<SVGFontFaceElement> fontfaceElement = item->svgFontFaceEl ement();
590 // SVGFontFaceSource assumes that it is the case where <font-fac e> element resides in the same document.
591 // We put a RELEASE_ASSERT here as it will cause UAF if the assu mption is false.
592 RELEASE_ASSERT(fontfaceElement->inDocument());
593 RELEASE_ASSERT(fontfaceElement->document() == document);
594 source = adoptPtr(new SVGFontFaceSource(fontfaceElement.get()));
590 } else 595 } else
591 #endif 596 #endif
592 { 597 {
593 source = adoptPtr(new LocalFontFaceSource(item->resource())); 598 source = adoptPtr(new LocalFontFaceSource(item->resource()));
594 } 599 }
595 } 600 }
596 601
597 if (source) 602 if (source)
598 m_cssFontFace->addSource(source.release()); 603 m_cssFontFace->addSource(source.release());
599 } 604 }
(...skipping 25 matching lines...) Expand all
625 visitor->trace(m_featureSettings); 630 visitor->trace(m_featureSettings);
626 visitor->trace(m_error); 631 visitor->trace(m_error);
627 } 632 }
628 633
629 bool FontFace::hadBlankText() const 634 bool FontFace::hadBlankText() const
630 { 635 {
631 return m_cssFontFace->hadBlankText(); 636 return m_cssFontFace->hadBlankText();
632 } 637 }
633 638
634 } // namespace WebCore 639 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/svg/svg-font-face-leak-document-expected.txt ('k') | Source/core/rendering/svg/SVGTextRunRenderingContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698