mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-07 00:08:39 +09:00
[Basilisk] Remove last bits of telemetry
This commit is contained in:
parent
23ef0c81f7
commit
b5a13a2a38
1 changed files with 31 additions and 101 deletions
|
|
@ -372,34 +372,28 @@
|
|||
var textBox = this._textbox;
|
||||
var textValue = textBox.value;
|
||||
|
||||
let selection = this.telemetrySearchDetails;
|
||||
let selection = this.searchDetails;
|
||||
let oneOffRecorded = false;
|
||||
|
||||
if (!selection || (selection.index == -1)) {
|
||||
oneOffRecorded = this.textbox.popup.oneOffButtons
|
||||
.maybeRecordTelemetry(aEvent, aWhere, aParams);
|
||||
if (!oneOffRecorded) {
|
||||
let source = "unknown";
|
||||
let type = "unknown";
|
||||
let target = aEvent.originalTarget;
|
||||
if (aEvent instanceof KeyboardEvent) {
|
||||
type = "key";
|
||||
} else if (aEvent instanceof MouseEvent) {
|
||||
type = "mouse";
|
||||
if (target.classList.contains("search-panel-header") ||
|
||||
target.parentNode.classList.contains("search-panel-header")) {
|
||||
source = "header";
|
||||
}
|
||||
} else if (aEvent instanceof XULCommandEvent) {
|
||||
if (target.getAttribute("anonid") == "paste-and-search") {
|
||||
source = "paste";
|
||||
}
|
||||
let source = "unknown";
|
||||
let type = "unknown";
|
||||
let target = aEvent.originalTarget;
|
||||
if (aEvent instanceof KeyboardEvent) {
|
||||
type = "key";
|
||||
} else if (aEvent instanceof MouseEvent) {
|
||||
type = "mouse";
|
||||
if (target.classList.contains("search-panel-header") ||
|
||||
target.parentNode.classList.contains("search-panel-header")) {
|
||||
source = "header";
|
||||
}
|
||||
if (!aEngine) {
|
||||
aEngine = this.currentEngine;
|
||||
} else if (aEvent instanceof XULCommandEvent) {
|
||||
if (target.getAttribute("anonid") == "paste-and-search") {
|
||||
source = "paste";
|
||||
}
|
||||
BrowserSearch.recordOneoffSearchInTelemetry(aEngine, source, type,
|
||||
aWhere);
|
||||
}
|
||||
if (!aEngine) {
|
||||
aEngine = this.currentEngine;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -433,16 +427,16 @@
|
|||
|
||||
let engine = aEngine || this.currentEngine;
|
||||
var submission = engine.getSubmission(aData, null, "searchbar");
|
||||
let telemetrySearchDetails = this.telemetrySearchDetails;
|
||||
this.telemetrySearchDetails = null;
|
||||
if (telemetrySearchDetails && telemetrySearchDetails.index == -1) {
|
||||
telemetrySearchDetails = null;
|
||||
let searchDetails = this.searchDetails;
|
||||
this.searchDetails = null;
|
||||
if (searchDetails && searchDetails.index == -1) {
|
||||
searchDetails = null;
|
||||
}
|
||||
// If we hit here, we come either from a one-off, a plain search or a suggestion.
|
||||
const details = {
|
||||
isOneOff: aOneOff,
|
||||
isSuggestion: (!aOneOff && telemetrySearchDetails),
|
||||
selection: telemetrySearchDetails
|
||||
isSuggestion: (!aOneOff && searchDetails),
|
||||
selection: searchDetails
|
||||
};
|
||||
BrowserSearch.recordSearchInTelemetry(engine, "searchbar", details);
|
||||
// null parameter below specifies HTML response for search
|
||||
|
|
@ -767,7 +761,7 @@
|
|||
}
|
||||
if (this._selectionDetails &&
|
||||
this._selectionDetails.currentIndex != -1) {
|
||||
BrowserSearch.searchBar.telemetrySearchDetails = this._selectionDetails;
|
||||
BrowserSearch.searchBar.searchDetails = this._selectionDetails;
|
||||
this._selectionDetails = null;
|
||||
}
|
||||
document.getBindingParent(this).handleSearchCommand(aEvent, engine);
|
||||
|
|
@ -986,7 +980,7 @@
|
|||
|
||||
// Set the origin before assigning the popup, as the assignment does
|
||||
// a rebuild and would miss the origin.
|
||||
this.oneOffButtons.telemetryOrigin = "searchbar";
|
||||
this.oneOffButtons.oneoffOrigin = "searchbar";
|
||||
// Set popup after setting the minWidth since it builds the buttons.
|
||||
this.oneOffButtons.popup = this;
|
||||
this.oneOffButtons.textbox = this.input;
|
||||
|
|
@ -1181,9 +1175,8 @@
|
|||
]]></setter>
|
||||
</property>
|
||||
|
||||
<!-- Set this to a string that identifies your one-offs consumer. It'll
|
||||
be appended to telemetry recorded with maybeRecordTelemetry(). -->
|
||||
<field name="telemetryOrigin">""</field>
|
||||
<!-- Set this to a string that identifies your one-offs consumer. -->
|
||||
<field name="oneoffOrigin">""</field>
|
||||
|
||||
<field name="_query">""</field>
|
||||
|
||||
|
|
@ -1402,7 +1395,7 @@
|
|||
let button = document.createElementNS(kXULNS, "button");
|
||||
let label = this.bundle.formatStringFromName("cmd_addFoundEngine",
|
||||
[engine.title], 1);
|
||||
button.id = this.telemetryOrigin + "-add-engine-" +
|
||||
button.id = this.oneoffOrigin + "-add-engine-" +
|
||||
engine.title.replace(/ /g, '-');
|
||||
button.setAttribute("class", "addengine-item");
|
||||
button.setAttribute("label", label);
|
||||
|
|
@ -1470,9 +1463,9 @@
|
|||
|
||||
// Ensure we can refer to the settings buttons by ID:
|
||||
let settingsEl = document.getAnonymousElementByAttribute(this, "anonid", "search-settings");
|
||||
settingsEl.id = this.telemetryOrigin + "-anon-search-settings";
|
||||
settingsEl.id = this.oneoffOrigin + "-anon-search-settings";
|
||||
let compactSettingsEl = document.getAnonymousElementByAttribute(this, "anonid", "search-settings-compact");
|
||||
compactSettingsEl.id = this.telemetryOrigin +
|
||||
compactSettingsEl.id = this.oneoffOrigin +
|
||||
"-anon-search-settings-compact";
|
||||
|
||||
let dummyItems = enginesPerRow - (oneOffCount % enginesPerRow || enginesPerRow);
|
||||
|
|
@ -1546,7 +1539,7 @@
|
|||
<method name="_buttonIDForEngine">
|
||||
<parameter name="engine"/>
|
||||
<body><![CDATA[
|
||||
return this.telemetryOrigin + "-engine-one-off-item-" +
|
||||
return this.oneoffOrigin + "-engine-one-off-item-" +
|
||||
engine.name.replace(/ /g, '-');
|
||||
]]></body>
|
||||
</method>
|
||||
|
|
@ -1881,69 +1874,6 @@
|
|||
return false;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<!--
|
||||
If the given event is related to the one-offs, this method records
|
||||
one-off telemetry for it. this.telemetryOrigin will be appended to the
|
||||
computed source, so make sure you set that first.
|
||||
|
||||
@param aEvent
|
||||
An event, like a click on a one-off button.
|
||||
@param aOpenUILinkWhere
|
||||
The "where" passed to openUILink.
|
||||
@param aOpenUILinkParams
|
||||
The "params" passed to openUILink.
|
||||
@return True if telemetry was recorded and false if not.
|
||||
-->
|
||||
<method name="maybeRecordTelemetry">
|
||||
<parameter name="aEvent"/>
|
||||
<parameter name="aOpenUILinkWhere"/>
|
||||
<parameter name="aOpenUILinkParams"/>
|
||||
<body><![CDATA[
|
||||
if (!aEvent) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let source = null;
|
||||
let type = "unknown";
|
||||
let engine = null;
|
||||
let target = aEvent.originalTarget;
|
||||
|
||||
if (aEvent instanceof KeyboardEvent) {
|
||||
type = "key";
|
||||
if (this.selectedButton) {
|
||||
source = "oneoff";
|
||||
engine = this.selectedButton.engine;
|
||||
}
|
||||
} else if (aEvent instanceof MouseEvent) {
|
||||
type = "mouse";
|
||||
if (target.classList.contains("searchbar-engine-one-off-item")) {
|
||||
source = "oneoff";
|
||||
engine = target.engine;
|
||||
}
|
||||
} else if ((aEvent instanceof XULCommandEvent) &&
|
||||
target.getAttribute("anonid") ==
|
||||
"search-one-offs-context-open-in-new-tab") {
|
||||
source = "oneoff-context";
|
||||
engine = this._contextEngine;
|
||||
}
|
||||
|
||||
if (!source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.telemetryOrigin) {
|
||||
source += "-" + this.telemetryOrigin;
|
||||
}
|
||||
|
||||
let tabBackground = aOpenUILinkWhere == "tab" &&
|
||||
aOpenUILinkParams &&
|
||||
aOpenUILinkParams.inBackground;
|
||||
let where = tabBackground ? "tab-background" : aOpenUILinkWhere;
|
||||
return true;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue