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

Issue 112953007: Make TreeScope::documentScope() return a reference and ensure m_documentScope is never NULL (Closed)

Created:
6 years, 11 months ago by adamk
Modified:
6 years, 11 months ago
Reviewers:
Hajime Morrita, esprehn
CC:
blink-reviews, sof, eae+blinkwatch, dglazkov+blink, apavlov+blink_chromium.org, adamk+blink_chromium.org, darktears
Visibility:
Public.

Description

Make TreeScope::documentScope() return a reference and ensure m_documentScope is never NULL The only big change is the removal of TreeScope::clearDocumentScope(). Now that documentScope() always returns a reference, no caller should even be able to deal with it being null. And since we already ASSERT in ~Document and ~TreeScope that guardRefCount is 0, there should be no one else with a reference to this TreeScope. Thus, the call to setTreeScope(0) in ~TreeScope should be sufficient to avoid a use-after-free of |this| as a Document. The rest of the lines touched in this patch are just pointer -> reference conversion. Also removed the unused default TreeScope constructor. BUG=331922 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=164586

Patch Set 1 #

Total comments: 4

Patch Set 2 : Added FIXMEs #

Unified diffs Side-by-side diffs Delta from patch set Stats (+33 lines, -52 lines) Patch
M Source/core/css/StyleSheetList.h View 1 1 chunk +2 lines, -1 line 0 comments Download
M Source/core/dom/Document.h View 1 chunk +1 line, -1 line 0 comments Download
M Source/core/dom/Document.cpp View 1 2 chunks +2 lines, -3 lines 0 comments Download
M Source/core/dom/Node.h View 1 1 chunk +1 line, -2 lines 0 comments Download
M Source/core/dom/NodeRareData.h View 2 chunks +7 lines, -7 lines 0 comments Download
M Source/core/dom/StyleSheetCollection.h View 1 1 chunk +2 lines, -1 line 0 comments Download
M Source/core/dom/TreeScope.h View 3 chunks +6 lines, -9 lines 0 comments Download
M Source/core/dom/TreeScope.cpp View 3 chunks +1 line, -16 lines 0 comments Download
M Source/core/dom/TreeScopeAdopter.h View 1 chunk +2 lines, -2 lines 0 comments Download
M Source/core/dom/TreeScopeAdopter.cpp View 3 chunks +9 lines, -10 lines 0 comments Download

Messages

Total messages: 7 (0 generated)
adamk
6 years, 11 months ago (2014-01-07 00:54:09 UTC) #1
esprehn
lgtm https://codereview.chromium.org/112953007/diff/1/Source/core/css/StyleSheetList.h File Source/core/css/StyleSheetList.h (right): https://codereview.chromium.org/112953007/diff/1/Source/core/css/StyleSheetList.h#newcode46 Source/core/css/StyleSheetList.h:46: Document* document() { return &m_treeScope->documentScope(); } FIXME: should ...
6 years, 11 months ago (2014-01-07 01:06:09 UTC) #2
adamk
https://codereview.chromium.org/112953007/diff/1/Source/core/css/StyleSheetList.h File Source/core/css/StyleSheetList.h (right): https://codereview.chromium.org/112953007/diff/1/Source/core/css/StyleSheetList.h#newcode46 Source/core/css/StyleSheetList.h:46: Document* document() { return &m_treeScope->documentScope(); } On 2014/01/07 01:06:09, ...
6 years, 11 months ago (2014-01-07 01:11:12 UTC) #3
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/adamk@chromium.org/112953007/110001
6 years, 11 months ago (2014-01-07 01:11:30 UTC) #4
commit-bot: I haz the power
Retried try job too often on win_blink_rel for step(s) webkit_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=win_blink_rel&number=21798
6 years, 11 months ago (2014-01-07 13:44:24 UTC) #5
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/adamk@chromium.org/112953007/110001
6 years, 11 months ago (2014-01-07 13:53:00 UTC) #6
commit-bot: I haz the power
6 years, 11 months ago (2014-01-07 14:59:30 UTC) #7
Message was sent while issue was closed.
Change committed as 164586

Powered by Google App Engine
This is Rietveld 408576698