mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-06 15:58:39 +09:00
Revert "Issue #21 - Remove use counters telemetry"
This reverts commit 8ca9db6b65.
This commit is contained in:
parent
bebaa470c6
commit
92a1cc3139
45 changed files with 1128 additions and 36 deletions
|
|
@ -9718,6 +9718,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
|
||||
{
|
||||
|
|
@ -9733,6 +9746,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,
|
||||
|
|
@ -11983,6 +11997,69 @@ nsIDocument::GetTopLevelContentDocument()
|
|||
return parent;
|
||||
}
|
||||
|
||||
void
|
||||
nsIDocument::PropagateUseCounters(nsIDocument* aParentDocument)
|
||||
{
|
||||
MOZ_ASSERT(this != aParentDocument);
|
||||
|
||||
// What really matters here is that our use counters get propagated as
|
||||
// high up in the content document hierarchy as possible. So,
|
||||
// starting with aParentDocument, we need to find the toplevel content
|
||||
// document, and propagate our use counters into its
|
||||
// mChildDocumentUseCounters.
|
||||
nsIDocument* contentParent = aParentDocument->GetTopLevelContentDocument();
|
||||
|
||||
if (!contentParent) {
|
||||
return;
|
||||
}
|
||||
|
||||
contentParent->mChildDocumentUseCounters |= mUseCounters;
|
||||
contentParent->mChildDocumentUseCounters |= mChildDocumentUseCounters;
|
||||
}
|
||||
|
||||
void
|
||||
nsIDocument::SetPageUseCounter(UseCounter aUseCounter)
|
||||
{
|
||||
// We want to set the use counter on the "page" that owns us; the definition
|
||||
// of "page" depends on what kind of document we are. See the comments below
|
||||
// for details. In any event, checking all the conditions below is
|
||||
// reasonably expensive, so we cache whether we've notified our owning page.
|
||||
if (mNotifiedPageForUseCounter[aUseCounter]) {
|
||||
return;
|
||||
}
|
||||
mNotifiedPageForUseCounter[aUseCounter] = true;
|
||||
|
||||
if (mDisplayDocument) {
|
||||
// If we are a resource document, we won't have a docshell and so we won't
|
||||
// record any page use counters on this document. Instead, we should
|
||||
// forward it up to the document that loaded us.
|
||||
MOZ_ASSERT(!mDocumentContainer);
|
||||
mDisplayDocument->SetChildDocumentUseCounter(aUseCounter);
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsBeingUsedAsImage()) {
|
||||
// If this is an SVG image document, we also won't have a docshell.
|
||||
MOZ_ASSERT(!mDocumentContainer);
|
||||
return;
|
||||
}
|
||||
|
||||
// We only care about use counters in content. If we're already a toplevel
|
||||
// content document, then we should have already set the use counter on
|
||||
// ourselves, and we are done.
|
||||
nsIDocument* contentParent = GetTopLevelContentDocument();
|
||||
if (!contentParent) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this == contentParent) {
|
||||
MOZ_ASSERT(GetUseCounter(aUseCounter));
|
||||
return;
|
||||
}
|
||||
|
||||
contentParent->SetChildDocumentUseCounter(aUseCounter);
|
||||
}
|
||||
|
||||
bool
|
||||
nsIDocument::HasScriptsBlockedBySandbox()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue