New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
XSLImportRule and XSLStyleSheet should use weak pointers instead of raw pointers #3522
Conversation
EWS run on previous version of this PR (hash 1b8d891) |
EWS run on previous version of this PR (hash 4502008) |
XSLStyleSheet* parent = parentStyleSheet(); | ||
if (parent) | ||
m_styleSheet->setParentStyleSheet(parent); | ||
// FIXME: parentStyleSheet() should never be null here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I donβt understand why this comment says FIXME
. What are we going to fix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, we pass a reference instead of a pointer if it's never null. I can't easily validate that, however.
rootSheet = parentSheet; | ||
} | ||
|
||
if (rootSheet) | ||
cachedResourceLoader = rootSheet->cachedResourceLoader(); | ||
RefPtr cachedResourceLoader = rootSheet->cachedResourceLoader(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code just above this checks rootSheet
for null, but here we dereference the pointer unconditionally. The old code didnβt do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is true but line 99/106 below also unconditionally dereferences the resource loader.
Whilst it's after an early exit for a cyclic relationship, I don't think that's relevant as far as nullify of the resource loader is concerned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could remove the unnecessary null check above then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose we could. I'll go do that.
β¦aw pointers https://bugs.webkit.org/show_bug.cgi?id=244181 Reviewed by Darin Adler. Deploy WeakPtr where raw pointers are used. * Source/WebCore/dom/ProcessingInstruction.cpp: (WebCore::ProcessingInstruction::setXSLStyleSheet): * Source/WebCore/xml/XSLImportRule.cpp: (WebCore::XSLImportRule::XSLImportRule): (WebCore::XSLImportRule::setXSLStyleSheet): (WebCore::XSLImportRule::loadSheet): * Source/WebCore/xml/XSLImportRule.h: (WebCore::XSLImportRule::parentStyleSheet const): * Source/WebCore/xml/XSLStyleSheet.h: * Source/WebCore/xml/XSLStyleSheetLibxslt.cpp: (WebCore::XSLStyleSheet::XSLStyleSheet): (WebCore::XSLStyleSheet::checkLoaded): (WebCore::XSLStyleSheet::loadChildSheet): (WebCore::XSLStyleSheet::ownerDocument): (WebCore::XSLStyleSheet::locateStylesheetSubResource): Canonical link: https://commits.webkit.org/253695@main
57d9247
to
896fddc
Compare
Committed 253695@main (896fddc): https://commits.webkit.org/253695@main Reviewed commits have been landed. Closing PR #3522 and removing active labels. |
896fddc
57d9247