Bug 1720615 - Stop collecting telemetry for popup condition of window.open. r=smaug

This reverts bug 1710010 change.

Differential Revision: https://phabricator.services.mozilla.com/D120954
This commit is contained in:
Tooru Fujisawa 2021-08-02 01:12:38 +00:00
Родитель 50445cc8e2
Коммит 90726cc705
2 изменённых файлов: 5 добавлений и 52 удалений

Просмотреть файл

@ -16633,18 +16633,5 @@
"n_buckets": 100,
"keyed": true,
"description": "The time that a transaction is waiting for HTTPS RR"
},
"WINDOW_OPEN_TYPE": {
"record_in_processes": ["content"],
"products": ["firefox"],
"alert_emails": ["arai.unmht@gmail.com"],
"expires_in_version": "93",
"kind": "categorical",
"labels": ["NoPopup_Empty", "NoPopup_Other",
"Popup_Width", "Popup_Location",
"Popup_Menubar", "Popup_Resizable",
"Popup_Scrollbars", "Popup_Status"],
"bug_numbers": [1710010],
"description": "Whether and how window.open opens a new popup or a new tab"
}
}

Просмотреть файл

@ -29,7 +29,6 @@
#include "mozilla/dom/BrowsingContextGroup.h"
#include "mozilla/dom/Document.h"
#include "mozilla/dom/DocumentInlines.h"
#include "mozilla/Telemetry.h"
#include "nsIDOMChromeWindow.h"
#include "nsIPrompt.h"
#include "nsIScriptObjectPrincipal.h"
@ -1773,74 +1772,41 @@ uint32_t nsWindowWatcher::EnsureFlagsSafeForContent(uint32_t aChromeFlags,
return aChromeFlags;
}
// Determine if we should open a new popup instead of a new tab.
//
// Also collect a telemetry how the popup/tab is requested, to help creating a
// proposal for standardizing window.open's `features` parameter.
//
// * NoPopup_{Empty, Other}
// (expected) Both current behavior and proposed behavior opens a non-popup
// * Popup_Width
// (expected) Both current behavior and proposed behavior opens a popup
// * Popup_{Location, Menubar, Resizable, Scrollbars, Status}
// (unexpected) Current behavior opens a popup, and proposed behavior opens
// a non-popup
//
// static
bool nsWindowWatcher::ShouldOpenPopup(const WindowFeatures& aFeatures,
const SizeSpec& aSizeSpec) {
if (aFeatures.IsEmpty()) {
AccumulateCategorical(
mozilla::Telemetry::LABELS_WINDOW_OPEN_TYPE::NoPopup_Empty);
return false;
}
// Follow Safari's behavior that opens a popup when width is specified.
// This also follows current proposal.
if (aSizeSpec.WidthSpecified()) {
AccumulateCategorical(
mozilla::Telemetry::LABELS_WINDOW_OPEN_TYPE::Popup_Width);
return true;
}
// Remaining conditions excluding the last non-popup don't follow the
// current proposal.
// Follow Google Chrome's behavior that opens a popup depending on
// the following features.
if (!aFeatures.GetBoolWithDefault("location", false) &&
!aFeatures.GetBoolWithDefault("toolbar", false)) {
AccumulateCategorical(
mozilla::Telemetry::LABELS_WINDOW_OPEN_TYPE::Popup_Location);
return true;
}
if (!aFeatures.GetBoolWithDefault("menubar", false)) {
AccumulateCategorical(
mozilla::Telemetry::LABELS_WINDOW_OPEN_TYPE::Popup_Menubar);
return true;
}
if (!aFeatures.GetBoolWithDefault("resizable", true)) {
AccumulateCategorical(
mozilla::Telemetry::LABELS_WINDOW_OPEN_TYPE::Popup_Resizable);
return true;
}
if (!aFeatures.GetBoolWithDefault("scrollbars", false)) {
AccumulateCategorical(
mozilla::Telemetry::LABELS_WINDOW_OPEN_TYPE::Popup_Scrollbars);
return true;
}
if (!aFeatures.GetBoolWithDefault("status", false)) {
AccumulateCategorical(
mozilla::Telemetry::LABELS_WINDOW_OPEN_TYPE::Popup_Status);
return true;
}
AccumulateCategorical(
mozilla::Telemetry::LABELS_WINDOW_OPEN_TYPE::NoPopup_Other);
// Follow Safari's behavior that opens a popup when width is specified.
if (aSizeSpec.WidthSpecified()) {
return true;
}
return false;
}