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

Unified Diff: third_party/WebKit/Source/core/frame/Frame.cpp

Issue 2680843006: Tidy DEFINE_(THREAD_SAFE_)STATIC_LOCAL() implementations. (Closed)
Patch Set: explain safety of HTMLTableSectionElement singletons Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/frame/Frame.cpp
diff --git a/third_party/WebKit/Source/core/frame/Frame.cpp b/third_party/WebKit/Source/core/frame/Frame.cpp
index 36729ad46393f405d1d0a128f320b3bc3125a1e4..8cd16c0f0eac6bcfe8d912d0b00c8dc90d85ee3e 100644
--- a/third_party/WebKit/Source/core/frame/Frame.cpp
+++ b/third_party/WebKit/Source/core/frame/Frame.cpp
@@ -124,7 +124,12 @@ HTMLFrameOwnerElement* Frame::deprecatedLocalOwner() const {
}
static ChromeClient& emptyChromeClient() {
- DEFINE_STATIC_LOCAL(EmptyChromeClient, client, (EmptyChromeClient::create()));
+ // |ChromeClient| contains a weak reference to a |Node| (which derives
+ // from |ScriptWrappable|). That reference is only used for unit testing
+ // purposes and will not accidentally leak between contexts. Consequently,
haraken 2017/02/11 10:25:20 Nit: I don't think "leak between contexts" can hap
sof 2017/02/11 12:09:11 Hmm, doesn't the test from https://codereview.chro
dcheng 2017/02/12 09:33:45 The cross-context leak happens if: - we have a sta
sof 2017/02/12 21:52:28 Yes, it could be made to work for the unit tests t
haraken 2017/02/12 23:56:47 I think the problem here is *just* (=not security
+ // disable the singleton verification check.
+ DEFINE_STATIC_LOCAL(EmptyChromeClient, client, (EmptyChromeClient::create()),
+ CheckScriptWrappable::No);
return client;
}

Powered by Google App Engine
This is Rietveld 408576698