mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-28 01:57:30 +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 textBox = this._textbox;
|
||||||
var textValue = textBox.value;
|
var textValue = textBox.value;
|
||||||
|
|
||||||
let selection = this.telemetrySearchDetails;
|
let selection = this.searchDetails;
|
||||||
let oneOffRecorded = false;
|
let oneOffRecorded = false;
|
||||||
|
|
||||||
if (!selection || (selection.index == -1)) {
|
if (!selection || (selection.index == -1)) {
|
||||||
oneOffRecorded = this.textbox.popup.oneOffButtons
|
let source = "unknown";
|
||||||
.maybeRecordTelemetry(aEvent, aWhere, aParams);
|
let type = "unknown";
|
||||||
if (!oneOffRecorded) {
|
let target = aEvent.originalTarget;
|
||||||
let source = "unknown";
|
if (aEvent instanceof KeyboardEvent) {
|
||||||
let type = "unknown";
|
type = "key";
|
||||||
let target = aEvent.originalTarget;
|
} else if (aEvent instanceof MouseEvent) {
|
||||||
if (aEvent instanceof KeyboardEvent) {
|
type = "mouse";
|
||||||
type = "key";
|
if (target.classList.contains("search-panel-header") ||
|
||||||
} else if (aEvent instanceof MouseEvent) {
|
target.parentNode.classList.contains("search-panel-header")) {
|
||||||
type = "mouse";
|
source = "header";
|
||||||
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";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (!aEngine) {
|
} else if (aEvent instanceof XULCommandEvent) {
|
||||||
aEngine = this.currentEngine;
|
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;
|
let engine = aEngine || this.currentEngine;
|
||||||
var submission = engine.getSubmission(aData, null, "searchbar");
|
var submission = engine.getSubmission(aData, null, "searchbar");
|
||||||
let telemetrySearchDetails = this.telemetrySearchDetails;
|
let searchDetails = this.searchDetails;
|
||||||
this.telemetrySearchDetails = null;
|
this.searchDetails = null;
|
||||||
if (telemetrySearchDetails && telemetrySearchDetails.index == -1) {
|
if (searchDetails && searchDetails.index == -1) {
|
||||||
telemetrySearchDetails = null;
|
searchDetails = null;
|
||||||
}
|
}
|
||||||
// If we hit here, we come either from a one-off, a plain search or a suggestion.
|
// If we hit here, we come either from a one-off, a plain search or a suggestion.
|
||||||
const details = {
|
const details = {
|
||||||
isOneOff: aOneOff,
|
isOneOff: aOneOff,
|
||||||
isSuggestion: (!aOneOff && telemetrySearchDetails),
|
isSuggestion: (!aOneOff && searchDetails),
|
||||||
selection: telemetrySearchDetails
|
selection: searchDetails
|
||||||
};
|
};
|
||||||
BrowserSearch.recordSearchInTelemetry(engine, "searchbar", details);
|
BrowserSearch.recordSearchInTelemetry(engine, "searchbar", details);
|
||||||
// null parameter below specifies HTML response for search
|
// null parameter below specifies HTML response for search
|
||||||
|
|
@ -767,7 +761,7 @@
|
||||||
}
|
}
|
||||||
if (this._selectionDetails &&
|
if (this._selectionDetails &&
|
||||||
this._selectionDetails.currentIndex != -1) {
|
this._selectionDetails.currentIndex != -1) {
|
||||||
BrowserSearch.searchBar.telemetrySearchDetails = this._selectionDetails;
|
BrowserSearch.searchBar.searchDetails = this._selectionDetails;
|
||||||
this._selectionDetails = null;
|
this._selectionDetails = null;
|
||||||
}
|
}
|
||||||
document.getBindingParent(this).handleSearchCommand(aEvent, engine);
|
document.getBindingParent(this).handleSearchCommand(aEvent, engine);
|
||||||
|
|
@ -986,7 +980,7 @@
|
||||||
|
|
||||||
// Set the origin before assigning the popup, as the assignment does
|
// Set the origin before assigning the popup, as the assignment does
|
||||||
// a rebuild and would miss the origin.
|
// 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.
|
// Set popup after setting the minWidth since it builds the buttons.
|
||||||
this.oneOffButtons.popup = this;
|
this.oneOffButtons.popup = this;
|
||||||
this.oneOffButtons.textbox = this.input;
|
this.oneOffButtons.textbox = this.input;
|
||||||
|
|
@ -1181,9 +1175,8 @@
|
||||||
]]></setter>
|
]]></setter>
|
||||||
</property>
|
</property>
|
||||||
|
|
||||||
<!-- Set this to a string that identifies your one-offs consumer. It'll
|
<!-- Set this to a string that identifies your one-offs consumer. -->
|
||||||
be appended to telemetry recorded with maybeRecordTelemetry(). -->
|
<field name="oneoffOrigin">""</field>
|
||||||
<field name="telemetryOrigin">""</field>
|
|
||||||
|
|
||||||
<field name="_query">""</field>
|
<field name="_query">""</field>
|
||||||
|
|
||||||
|
|
@ -1402,7 +1395,7 @@
|
||||||
let button = document.createElementNS(kXULNS, "button");
|
let button = document.createElementNS(kXULNS, "button");
|
||||||
let label = this.bundle.formatStringFromName("cmd_addFoundEngine",
|
let label = this.bundle.formatStringFromName("cmd_addFoundEngine",
|
||||||
[engine.title], 1);
|
[engine.title], 1);
|
||||||
button.id = this.telemetryOrigin + "-add-engine-" +
|
button.id = this.oneoffOrigin + "-add-engine-" +
|
||||||
engine.title.replace(/ /g, '-');
|
engine.title.replace(/ /g, '-');
|
||||||
button.setAttribute("class", "addengine-item");
|
button.setAttribute("class", "addengine-item");
|
||||||
button.setAttribute("label", label);
|
button.setAttribute("label", label);
|
||||||
|
|
@ -1470,9 +1463,9 @@
|
||||||
|
|
||||||
// Ensure we can refer to the settings buttons by ID:
|
// Ensure we can refer to the settings buttons by ID:
|
||||||
let settingsEl = document.getAnonymousElementByAttribute(this, "anonid", "search-settings");
|
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");
|
let compactSettingsEl = document.getAnonymousElementByAttribute(this, "anonid", "search-settings-compact");
|
||||||
compactSettingsEl.id = this.telemetryOrigin +
|
compactSettingsEl.id = this.oneoffOrigin +
|
||||||
"-anon-search-settings-compact";
|
"-anon-search-settings-compact";
|
||||||
|
|
||||||
let dummyItems = enginesPerRow - (oneOffCount % enginesPerRow || enginesPerRow);
|
let dummyItems = enginesPerRow - (oneOffCount % enginesPerRow || enginesPerRow);
|
||||||
|
|
@ -1546,7 +1539,7 @@
|
||||||
<method name="_buttonIDForEngine">
|
<method name="_buttonIDForEngine">
|
||||||
<parameter name="engine"/>
|
<parameter name="engine"/>
|
||||||
<body><![CDATA[
|
<body><![CDATA[
|
||||||
return this.telemetryOrigin + "-engine-one-off-item-" +
|
return this.oneoffOrigin + "-engine-one-off-item-" +
|
||||||
engine.name.replace(/ /g, '-');
|
engine.name.replace(/ /g, '-');
|
||||||
]]></body>
|
]]></body>
|
||||||
</method>
|
</method>
|
||||||
|
|
@ -1881,69 +1874,6 @@
|
||||||
return false;
|
return false;
|
||||||
]]></body>
|
]]></body>
|
||||||
</method>
|
</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>
|
</implementation>
|
||||||
|
|
||||||
<handlers>
|
<handlers>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue