mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 968923 - part 6 - add use counters for deprecated operations; r=bz
This commit is contained in:
parent
d654122752
commit
c1906b331b
@ -22,6 +22,12 @@ enum UseCounter : int16_t {
|
||||
#undef USE_COUNTER_DOM_METHOD
|
||||
#undef USE_COUNTER_DOM_ATTRIBUTE
|
||||
#undef USE_COUNTER_CSS_PROPERTY
|
||||
|
||||
#define DEPRECATED_OPERATION(op_) \
|
||||
eUseCounter_##op_,
|
||||
#include "nsDeprecatedOperationList.h"
|
||||
#undef DEPRECATED_OPERATION
|
||||
|
||||
eUseCounter_Count
|
||||
};
|
||||
|
||||
|
@ -10405,6 +10405,19 @@ static const char* kDocumentWarnings[] = {
|
||||
};
|
||||
#undef DOCUMENT_WARNING
|
||||
|
||||
static UseCounter
|
||||
OperationToUseCounter(nsIDocument::DeprecatedOperations aOperation)
|
||||
{
|
||||
switch(aOperation) {
|
||||
#define DEPRECATED_OPERATION(_op) \
|
||||
case nsIDocument::e##_op: return eUseCounter_##_op;
|
||||
#include "nsDeprecatedOperationList.h"
|
||||
#undef DEPRECATED_OPERATION
|
||||
default:
|
||||
MOZ_CRASH();
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
nsIDocument::HasWarnedAbout(DeprecatedOperations aOperation) const
|
||||
{
|
||||
@ -10420,6 +10433,7 @@ nsIDocument::WarnOnceAbout(DeprecatedOperations aOperation,
|
||||
return;
|
||||
}
|
||||
mDeprecationWarnedAbout[aOperation] = true;
|
||||
const_cast<nsIDocument*>(this)->SetDocumentAndPageUseCounter(OperationToUseCounter(aOperation));
|
||||
uint32_t flags = asError ? nsIScriptError::errorFlag
|
||||
: nsIScriptError::warningFlag;
|
||||
nsContentUtils::ReportToConsole(flags,
|
||||
|
@ -2,6 +2,7 @@
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
import collections
|
||||
import json
|
||||
import math
|
||||
import os
|
||||
@ -279,8 +280,33 @@ def from_Histograms_json(filename):
|
||||
def from_UseCounters_conf(filename):
|
||||
return usecounters.generate_histograms(filename)
|
||||
|
||||
def from_nsDeprecatedOperationList(filename):
|
||||
operation_regex = re.compile('^DEPRECATED_OPERATION\\(([^)]+)\\)')
|
||||
histograms = collections.OrderedDict()
|
||||
|
||||
with open(filename, 'r') as f:
|
||||
for line in f:
|
||||
match = operation_regex.search(line)
|
||||
if not match:
|
||||
continue
|
||||
|
||||
op = match.group(1)
|
||||
|
||||
def add_counter(context):
|
||||
name = 'USE_COUNTER_DEPRECATED_%s_%s' % (op, context.upper())
|
||||
histograms[name] = {
|
||||
'expires_in_version': 'never',
|
||||
'kind': 'boolean',
|
||||
'description': 'Whether a %s used %s' % (context, op)
|
||||
}
|
||||
add_counter('document')
|
||||
add_counter('page')
|
||||
|
||||
return histograms
|
||||
|
||||
FILENAME_PARSERS = {
|
||||
'Histograms.json': from_Histograms_json,
|
||||
'nsDeprecatedOperationList.h': from_nsDeprecatedOperationList,
|
||||
}
|
||||
|
||||
# Similarly to the dance above with buildconfig, usecounters may not be
|
||||
|
@ -65,6 +65,7 @@ GENERATED_FILES = [
|
||||
histogram_files = [
|
||||
'Histograms.json',
|
||||
'/dom/base/UseCounters.conf',
|
||||
'/dom/base/nsDeprecatedOperationList.h',
|
||||
]
|
||||
|
||||
data = GENERATED_FILES['TelemetryHistogramData.inc']
|
||||
|
Loading…
Reference in New Issue
Block a user