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

Side by Side Diff: third_party/WebKit/Source/core/frame/Deprecation.cpp

Issue 1990683002: [DevTools] Capture call stacks for deprecation console messages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 7 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
« no previous file with comments | « third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/frame/Deprecation.h" 5 #include "core/frame/Deprecation.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/dom/ExecutionContext.h" 8 #include "core/dom/ExecutionContext.h"
9 #include "core/frame/FrameConsole.h" 9 #include "core/frame/FrameConsole.h"
10 #include "core/frame/FrameHost.h" 10 #include "core/frame/FrameHost.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 void Deprecation::warnOnDeprecatedProperties(const LocalFrame* frame, CSSPropert yID unresolvedProperty) 92 void Deprecation::warnOnDeprecatedProperties(const LocalFrame* frame, CSSPropert yID unresolvedProperty)
93 { 93 {
94 FrameHost* host = frame ? frame->host() : nullptr; 94 FrameHost* host = frame ? frame->host() : nullptr;
95 if (!host || host->deprecation().isSuppressed(unresolvedProperty)) 95 if (!host || host->deprecation().isSuppressed(unresolvedProperty))
96 return; 96 return;
97 97
98 String message = deprecationMessage(unresolvedProperty); 98 String message = deprecationMessage(unresolvedProperty);
99 if (!message.isEmpty()) { 99 if (!message.isEmpty()) {
100 host->deprecation().suppress(unresolvedProperty); 100 host->deprecation().suppress(unresolvedProperty);
101 frame->console().addMessage(ConsoleMessage::create(DeprecationMessageSou rce, WarningMessageLevel, message)); 101 ConsoleMessage* consoleMessage = ConsoleMessage::create(DeprecationMessa geSource, WarningMessageLevel, message);
102 consoleMessage->collectCallStack();
103 frame->console().addMessage(consoleMessage);
102 } 104 }
103 } 105 }
104 106
105 String Deprecation::deprecationMessage(CSSPropertyID unresolvedProperty) 107 String Deprecation::deprecationMessage(CSSPropertyID unresolvedProperty)
106 { 108 {
107 // TODO: Add a switch here when there are properties that we intend to depre cate. 109 // TODO: Add a switch here when there are properties that we intend to depre cate.
108 // Returning an empty string for now. 110 // Returning an empty string for now.
109 return emptyString(); 111 return emptyString();
110 } 112 }
111 113
112 void Deprecation::countDeprecation(const LocalFrame* frame, UseCounter::Feature feature) 114 void Deprecation::countDeprecation(const LocalFrame* frame, UseCounter::Feature feature)
113 { 115 {
114 if (!frame) 116 if (!frame)
115 return; 117 return;
116 FrameHost* host = frame->host(); 118 FrameHost* host = frame->host();
117 if (!host) 119 if (!host)
118 return; 120 return;
119 121
120 if (!host->useCounter().hasRecordedMeasurement(feature)) { 122 if (!host->useCounter().hasRecordedMeasurement(feature)) {
121 host->useCounter().recordMeasurement(feature); 123 host->useCounter().recordMeasurement(feature);
122 ASSERT(!deprecationMessage(feature).isEmpty()); 124 ASSERT(!deprecationMessage(feature).isEmpty());
123 frame->console().addMessage(ConsoleMessage::create(DeprecationMessageSou rce, WarningMessageLevel, deprecationMessage(feature))); 125 ConsoleMessage* consoleMessage = ConsoleMessage::create(DeprecationMessa geSource, WarningMessageLevel, deprecationMessage(feature));
126 consoleMessage->collectCallStack();
127 frame->console().addMessage(consoleMessage);
124 } 128 }
125 } 129 }
126 130
127 void Deprecation::countDeprecation(ExecutionContext* context, UseCounter::Featur e feature) 131 void Deprecation::countDeprecation(ExecutionContext* context, UseCounter::Featur e feature)
128 { 132 {
129 if (!context) 133 if (!context)
130 return; 134 return;
131 if (context->isDocument()) { 135 if (context->isDocument()) {
132 Deprecation::countDeprecation(*toDocument(context), feature); 136 Deprecation::countDeprecation(*toDocument(context), feature);
133 return; 137 return;
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 case UseCounter::UntrustedEventDefaultHandled: 395 case UseCounter::UntrustedEventDefaultHandled:
392 return String::format("A DOM event generated from JavaScript has trigger ed a default action inside the browser. This behavior is non-standard and will b e removed in %s. See https://www.chromestatus.com/features/5718803933560832 for more details.", milestoneString(53)); 396 return String::format("A DOM event generated from JavaScript has trigger ed a default action inside the browser. This behavior is non-standard and will b e removed in %s. See https://www.chromestatus.com/features/5718803933560832 for more details.", milestoneString(53));
393 397
394 // Features that aren't deprecated don't have a deprecation message. 398 // Features that aren't deprecated don't have a deprecation message.
395 default: 399 default:
396 return String(); 400 return String();
397 } 401 }
398 } 402 }
399 403
400 } // namespace blink 404 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698