diff options
author | FranklinDM <mrmineshafter17@gmail.com> | 2022-04-04 22:54:59 +0800 |
---|---|---|
committer | FranklinDM <mrmineshafter17@gmail.com> | 2022-04-24 00:02:42 +0800 |
commit | 17b2aa76508e24b937fc92666bb0513360b103cc (patch) | |
tree | 68e865ffc347d36560614e6b68af91e2e96b6b75 /dom/bindings | |
parent | 5aa65d2aeab36ea8de8129c0babcf70a5e4e662a (diff) | |
download | uxp-17b2aa76508e24b937fc92666bb0513360b103cc.tar.gz |
Issue #21 - Remove use counters telemetry
This reverts Bug 968923 - Implement some equivalent of Chrome's use counters (on top of telemetry?)
For reference: https://bugzilla.mozilla.org/show_bug.cgi?id=968923
Diffstat (limited to 'dom/bindings')
-rw-r--r-- | dom/bindings/BindingUtils.cpp | 12 | ||||
-rw-r--r-- | dom/bindings/BindingUtils.h | 6 | ||||
-rw-r--r-- | dom/bindings/Codegen.py | 37 | ||||
-rw-r--r-- | dom/bindings/parser/WebIDL.py | 10 |
4 files changed, 5 insertions, 60 deletions
diff --git a/dom/bindings/BindingUtils.cpp b/dom/bindings/BindingUtils.cpp index a8884d6a45..512b9f8173 100644 --- a/dom/bindings/BindingUtils.cpp +++ b/dom/bindings/BindingUtils.cpp @@ -14,7 +14,6 @@ #include "mozilla/Preferences.h" #include "mozilla/SizePrintfMacros.h" #include "mozilla/Unused.h" -#include "mozilla/UseCounter.h" #include "mozilla/dom/DocGroup.h" #include "AccessCheck.h" @@ -59,7 +58,6 @@ #include "mozilla/jsipc/CrossProcessObjectWrappers.h" #include "nsDOMClassInfo.h" #include "ipc/ErrorIPCUtils.h" -#include "mozilla/UseCounter.h" namespace mozilla { namespace dom { @@ -3592,16 +3590,6 @@ AssertReflectorHasGivenProto(JSContext* aCx, JSObject* aReflector, } // namespace binding_detail #endif // DEBUG -void -SetDocumentAndPageUseCounter(JSContext* aCx, JSObject* aObject, - UseCounter aUseCounter) -{ - nsGlobalWindow* win = xpc::WindowGlobalOrNull(js::UncheckedUnwrap(aObject)); - if (win && win->GetDocument()) { - win->GetDocument()->SetDocumentAndPageUseCounter(aUseCounter); - } -} - namespace { // This runnable is used to write a deprecation message from a worker to the diff --git a/dom/bindings/BindingUtils.h b/dom/bindings/BindingUtils.h index c80631fc14..9ae5ed1f73 100644 --- a/dom/bindings/BindingUtils.h +++ b/dom/bindings/BindingUtils.h @@ -46,8 +46,6 @@ class nsIJSID; namespace mozilla { -enum UseCounter : int16_t; - namespace dom { class CustomElementReactionsStack; template<typename KeyType, typename ValueType> class Record; @@ -3428,10 +3426,6 @@ already_AddRefed<nsGenericHTMLElement> CreateHTMLElement(const GlobalObject& aGlobal, const JS::CallArgs& aCallArgs, JS::Handle<JSObject*> aGivenProto, ErrorResult& aRv); -void -SetDocumentAndPageUseCounter(JSContext* aCx, JSObject* aObject, - UseCounter aUseCounter); - // Warnings void DeprecationWarning(JSContext* aCx, JSObject* aObject, diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index 42ce94fcb4..a70253fc3a 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -7467,8 +7467,8 @@ class CGPerSignatureCall(CGThing): def __init__(self, returnType, arguments, nativeMethodName, static, descriptor, idlNode, argConversionStartsAt=0, getter=False, - setter=False, isConstructor=False, useCounterName=None, - resultVar=None, objectName="obj"): + setter=False, isConstructor=False, resultVar=None, + objectName="obj"): assert idlNode.isMethod() == (not getter and not setter) assert idlNode.isAttr() == (getter or setter) # Constructors are always static @@ -7701,11 +7701,6 @@ class CGPerSignatureCall(CGThing): nativeMethodName, static, argsPost=argsPost, resultVar=resultVar)) - if useCounterName: - # Generate a telemetry call for when [UseCounter] is used. - code = "SetDocumentAndPageUseCounter(cx, obj, eUseCounter_%s);\n" % useCounterName - cgThings.append(CGGeneric(code)) - self.cgRoot = CGList(cgThings) def getArguments(self): @@ -7934,11 +7929,6 @@ class CGMethodCall(CGThing): methodName = "%s.%s" % (descriptor.interface.identifier.name, method.identifier.name) argDesc = "argument %d of " + methodName - if method.getExtendedAttribute("UseCounter"): - useCounterName = methodName.replace(".", "_") - else: - useCounterName = None - if method.isStatic(): nativeType = descriptor.nativeType staticTypeOverride = PropertyDefiner.getStringAttr(method, "StaticClassOverride") @@ -7960,8 +7950,7 @@ class CGMethodCall(CGThing): nativeMethodName, static, descriptor, method, argConversionStartsAt=argConversionStartsAt, - isConstructor=isConstructor, - useCounterName=useCounterName) + isConstructor=isConstructor) signatures = method.signatures() if len(signatures) == 1: @@ -8337,16 +8326,11 @@ class CGGetterCall(CGPerSignatureCall): getter. """ def __init__(self, returnType, nativeMethodName, descriptor, attr): - if attr.getExtendedAttribute("UseCounter"): - useCounterName = "%s_%s_getter" % (descriptor.interface.identifier.name, - attr.identifier.name) - else: - useCounterName = None if attr.isStatic(): nativeMethodName = "%s::%s" % (descriptor.nativeType, nativeMethodName) CGPerSignatureCall.__init__(self, returnType, [], nativeMethodName, attr.isStatic(), descriptor, attr, - getter=True, useCounterName=useCounterName) + getter=True) class CGNavigatorGetterCall(CGPerSignatureCall): @@ -8413,17 +8397,12 @@ class CGSetterCall(CGPerSignatureCall): setter. """ def __init__(self, argType, nativeMethodName, descriptor, attr): - if attr.getExtendedAttribute("UseCounter"): - useCounterName = "%s_%s_setter" % (descriptor.interface.identifier.name, - attr.identifier.name) - else: - useCounterName = None if attr.isStatic(): nativeMethodName = "%s::%s" % (descriptor.nativeType, nativeMethodName) CGPerSignatureCall.__init__(self, None, [FakeArgument(argType, attr, allowTreatNonCallableAsNull=True)], nativeMethodName, attr.isStatic(), - descriptor, attr, setter=True, useCounterName=useCounterName) + descriptor, attr, setter=True) def wrap_return_value(self): attr = self.idlNode @@ -13932,12 +13911,6 @@ class CGBindingRoot(CGThing): bindingHeaders[CGHeaders.getDeclarationFilename(enums[0])] = True bindingHeaders["jsapi.h"] = True - # For things that have [UseCounter] - def descriptorRequiresTelemetry(desc): - iface = desc.interface - return any(m.getExtendedAttribute("UseCounter") for m in iface.members) - bindingHeaders["mozilla/UseCounter.h"] = any( - descriptorRequiresTelemetry(d) for d in descriptors) bindingHeaders["mozilla/dom/SimpleGlobalObject.h"] = any( CGDictionary.dictionarySafeToJSONify(d) for d in dictionaries) bindingHeaders["XrayWrapper.h"] = any( diff --git a/dom/bindings/parser/WebIDL.py b/dom/bindings/parser/WebIDL.py index 81911996d5..ce8862c02b 100644 --- a/dom/bindings/parser/WebIDL.py +++ b/dom/bindings/parser/WebIDL.py @@ -4245,11 +4245,6 @@ class IDLAttribute(IDLInterfaceMember): "readonly attributes" % attr.value(), [attr.location, self.location]) self._setDependsOn(attr.value()) - elif identifier == "UseCounter": - if self.stringifier: - raise WebIDLError("[UseCounter] must not be used on a " - "stringifier attribute", - [attr.location, self.location]) elif identifier == "Unscopable": if not attr.noArguments(): raise WebIDLError("[Unscopable] must take no arguments", @@ -4979,11 +4974,6 @@ class IDLMethod(IDLInterfaceMember, IDLScope): raise WebIDLError("[Alias] takes an identifier or string", [attr.location]) self._addAlias(attr.value()) - elif identifier == "UseCounter": - if self.isSpecial(): - raise WebIDLError("[UseCounter] must not be used on a special " - "operation", - [attr.location, self.location]) elif identifier == "Unscopable": if not attr.noArguments(): raise WebIDLError("[Unscopable] must take no arguments", |