Skip to content

Commit

Permalink
123.0b9
Browse files Browse the repository at this point in the history
  • Loading branch information
bot committed Feb 15, 2024
1 parent 8f3057c commit a780d26
Show file tree
Hide file tree
Showing 10 changed files with 128 additions and 63 deletions.
10 changes: 5 additions & 5 deletions firefox-src-part/browser/app/profile/firefox.js
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,10 @@ pref("permissions.desktop-notification.notNow.enabled", false);

pref("permissions.fullscreen.allowed", false);

// Force external link opens into the default user context ID instead of guessing
// the most appropriate one based on the URL (https://bugzilla.mozilla.org/show_bug.cgi?id=1874599#c8)
pref("browser.link.force_default_user_context_id_for_external_opens", false);

// handle links targeting new windows
// 1=current window/tab, 2=new window, 3=new tab in most recent window
pref("browser.link.open_newwindow", 3);
Expand Down Expand Up @@ -2958,11 +2962,7 @@ pref("cookiebanners.ui.desktop.cfrVariant", 0);
pref("dom.security.credentialmanagement.identity.enabled", true);
#endif

#if defined(NIGHTLY_BUILD)
pref("ui.new-webcompat-reporter.enabled", true);
#else
pref("ui.new-webcompat-reporter.enabled", false);
#endif

#if defined(EARLY_BETA_OR_EARLIER)
pref("ui.new-webcompat-reporter.send-more-info-link", true);
Expand All @@ -2971,7 +2971,7 @@ pref("ui.new-webcompat-reporter.send-more-info-link", false);
#endif

# 0 = disabled, 1 = reason optional, 2 = reason required.
pref("ui.new-webcompat-reporter.reason-dropdown", 0);
pref("ui.new-webcompat-reporter.reason-dropdown", 2);

pref("ui.new-webcompat-reporter.reason-dropdown.randomized", true);

Expand Down
21 changes: 2 additions & 19 deletions firefox-src-part/browser/base/content/browser-sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -803,20 +803,6 @@ var gSync = {
let fxaStatus = document.documentElement.getAttribute("fxastatus");

if (fxaStatus == "not_configured") {
let extraParams = {};
let fxaButtonVisibilityExperiment =
ExperimentAPI.getExperimentMetaData({
featureId: "fxaButtonVisibility",
}) ??
ExperimentAPI.getRolloutMetaData({
featureId: "fxaButtonVisibility",
});
if (fxaButtonVisibilityExperiment) {
extraParams = {
entrypoint_experiment: fxaButtonVisibilityExperiment.slug,
entrypoint_variation: fxaButtonVisibilityExperiment.branch.slug,
};
}
// If we're signed out but have the PXI pref enabled
// we should show the PXI panel instead of taking the user
// straight to FxA sign-in
Expand All @@ -825,11 +811,8 @@ var gSync = {
this.updateCTAPanel();
PanelUI.showSubView("PanelUI-fxa", anchor, aEvent);
} else {
let panel =
anchor.id == "appMenu-fxa-label2"
? PanelMultiView.getViewNode(document, "PanelUI-fxa")
: undefined;
this.openFxAEmailFirstPageFromFxaMenu(panel, extraParams);
this.emitFxaToolbarTelemetry("toolbar_icon", anchor);
openTrustedLinkIn("about:preferences#sync", "tab");
PanelUI.hide();
}
return;
Expand Down
9 changes: 8 additions & 1 deletion firefox-src-part/browser/base/content/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -6139,8 +6139,15 @@ nsBrowserAccess.prototype = {
) {
var browsingContext = null;
var isExternal = !!(aFlags & Ci.nsIBrowserDOMWindow.OPEN_EXTERNAL);
var guessUserContextIdEnabled =
isExternal &&
!Services.prefs.getBoolPref(
"browser.link.force_default_user_context_id_for_external_opens",
false
);
var openingUserContextId =
(isExternal && URILoadingHelper.guessUserContextId(aURI)) ||
(guessUserContextIdEnabled &&
URILoadingHelper.guessUserContextId(aURI)) ||
Ci.nsIScriptSecurityManager.DEFAULT_USER_CONTEXT_ID;

if (aOpenWindowInfo && isExternal) {
Expand Down
70 changes: 62 additions & 8 deletions firefox-src-part/browser/components/newtab/lib/TopSitesFeed.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ const SPONSORED_TILE_PARTNERS = new Set([

const DISPLAY_FAIL_REASON_OVERSOLD = "oversold";
const DISPLAY_FAIL_REASON_DISMISSED = "dismissed";
// Unable to determine reason if tile is/is not displayed.
const DISPLAY_FAIL_REASON_UNRESOLVED = "unresolved";

function getShortURLForCurrentSearch() {
const url = shortURL({ url: Services.search.defaultEngine.searchForm });
Expand All @@ -154,6 +156,7 @@ function getShortURLForCurrentSearch() {
class TopSitesTelemetry {
constructor() {
this.allSponsoredTiles = {};
this.sponsoredTilesConfigured = 0;
}

_tileProviderForTiles(tiles) {
Expand Down Expand Up @@ -205,6 +208,7 @@ class TopSitesTelemetry {
NIMBUS_VARIABLE_MAX_SPONSORED
) ?? MAX_NUM_SPONSORED;

this.sponsoredTilesConfigured = maxSponsored;
Glean.topsites.sponsoredTilesConfigured.set(maxSponsored);
}

Expand Down Expand Up @@ -260,21 +264,71 @@ class TopSitesTelemetry {
}

_setTilePositions(currentTiles) {
// This function performs many loops over a small dataset. The size of
// dataset is limited by the number of sponsored tiles displayed on
// the newtab instance.
if (this.allSponsoredTiles) {
let tilePositionsAssigned = [];
// processing the currentTiles parameter, assigns a position to the
// corresponding property in this.allSponsoredTiles
currentTiles.forEach(item => {
if (this._buildPropertyKey(item) in this.allSponsoredTiles) {
let tile = this.allSponsoredTiles[this._buildPropertyKey(item)];
if (
tile.display_fail_reason === undefined ||
tile.display_fail_reason === null
) {
tile.display_position = item.sponsored_position;
}
let tile = this.allSponsoredTiles[this._buildPropertyKey(item)];
if (
tile &&
(tile.display_fail_reason === undefined ||
tile.display_fail_reason === null)
) {
tile.display_position = item.sponsored_position;
// Track assigned tile slots.
tilePositionsAssigned.push(item.sponsored_position);
}
});

// Need to check if any objects in this.allSponsoredTiles do not
// have either a display_fail_reason or a display_position set.
// This can happen if the tiles list was updated before the
// metric is written to Glean.
// See https://bugzilla.mozilla.org/show_bug.cgi?id=1877197
let tilesMissingPosition = [];
Object.keys(this.allSponsoredTiles).forEach(property => {
let tile = this.allSponsoredTiles[property];
if (!tile.display_fail_reason && !tile.display_position) {
tilesMissingPosition.push(property);
}
});

if (tilesMissingPosition.length) {
// Determine if any available slots exist based on max number of tiles
// and the list of tiles already used and assign to a tile with missing
// value.
for (let i = 1; i <= this.sponsoredTilesConfigured; i++) {
if (!tilePositionsAssigned.includes(i)) {
let tileProperty = tilesMissingPosition.shift();
this.allSponsoredTiles[tileProperty].display_position = i;
}
}
}

// At this point we might still have a few unresolved states. These
// rows will be tagged with a display_fail_reason `unresolved`.
this._detectErrorConditionAndSetUnresolved();
}
}

// Checks the data for inconsistent state and updates the display_fail_reason
_detectErrorConditionAndSetUnresolved() {
Object.keys(this.allSponsoredTiles).forEach(property => {
let tile = this.allSponsoredTiles[property];
if (
(!tile.display_fail_reason && !tile.display_position) ||
(tile.display_fail_reason && tile.display_position)
) {
tile.display_position = null;
tile.display_fail_reason = DISPLAY_FAIL_REASON_UNRESOLVED;
}
});
}

finalizeNewtabPingFields(currentTiles) {
this._setTilePositions(currentTiles);
Glean.topsites.sponsoredTilesReceived.set(
Expand Down
28 changes: 20 additions & 8 deletions firefox-src-part/browser/components/shopping/ShoppingUtils.sys.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export const ShoppingUtils = {

this.setOnUpdate(undefined, undefined, this.optedIn);
this.recordUserAdsPreference();
this.recordUserAutoOpenPreference();

if (this._isAutoOpenEligible()) {
Services.prefs.setBoolPref(ACTIVE_PREF, true);
Expand Down Expand Up @@ -157,11 +158,8 @@ export const ShoppingUtils = {

// For users in either the nimbus control or treatment groups, increment a
// counter when they visit supported product pages.
maybeRecordExposure(aLocationURI, aFlags) {
if (
(this.nimbusEnabled || this.nimbusControl) &&
ShoppingUtils.isProductPageNavigation(aLocationURI, aFlags)
) {
recordExposure() {
if (this.nimbusEnabled || this.nimbusControl) {
Glean.shopping.productPageVisits.add(1);
}
},
Expand All @@ -175,6 +173,12 @@ export const ShoppingUtils = {
Glean.shoppingSettings.disabledAds.set(!ShoppingUtils.adsUserEnabled);
},

recordUserAutoOpenPreference() {
Glean.shoppingSettings.autoOpenUserDisabled.set(
!ShoppingUtils.autoOpenUserEnabled
);
},

/**
* If the user has not opted in, automatically set the sidebar to `active` if:
* 1. The sidebar has not already been automatically set to `active` twice.
Expand Down Expand Up @@ -248,12 +252,19 @@ export const ShoppingUtils = {
},

onLocationChange(aLocationURI, aFlags) {
this.maybeRecordExposure(aLocationURI, aFlags);
let isProductPageNavigation = this.isProductPageNavigation(
aLocationURI,
aFlags
);

if (isProductPageNavigation) {
this.recordExposure(aLocationURI, aFlags);
}

if (
this._isAutoOpenEligible() &&
this.resetActiveOnNextProductPage &&
this.isProductPageNavigation(aLocationURI, aFlags)
isProductPageNavigation
) {
this.resetActiveOnNextProductPage = false;
Services.prefs.setBoolPref(ACTIVE_PREF, true);
Expand Down Expand Up @@ -295,5 +306,6 @@ XPCOMUtils.defineLazyPreferenceGetter(
ShoppingUtils,
"autoOpenUserEnabled",
AUTO_OPEN_USER_ENABLED_PREF,
false
false,
ShoppingUtils.recordUserAutoOpenPreference
);
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ class ShoppingSettings extends MozLitElement {

onToggleAutoOpen() {
this.autoOpenEnabledByUser = this.autoOpenToggleEl.pressed;
let action = this.autoOpenEnabledByUser ? "enabled" : "disabled";
Glean.shopping.surfaceAutoOpenSettingToggled.record({ action });
RPMSetPref(
"browser.shopping.experience2023.autoOpen.userEnabled",
this.autoOpenEnabledByUser
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class ShoppingMessageBar extends MozLitElement {
composed: true,
})
);
Glean.shopping.surfaceNoThanksButtonClicked.record();
}

handleKeepClosedClick() {
Expand All @@ -90,6 +91,7 @@ class ShoppingMessageBar extends MozLitElement {
composed: true,
})
);
Glean.shopping.surfaceYesKeepClosedButtonClicked.record();
}

getStaleWarningTemplate() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@ export async function runBackgroundTask(commandLine) {
// Similarly, debug commands are always allowed.
switch (command) {
case "uninstall": {
lazy.log.info(`Uninstalling for token "${token}"`);
let token = commandLine.getArgument(1);
lazy.log.info(`Uninstalling for token "${token}"`);
defaultAgent.uninstall(token);
return EXIT_CODE.SUCCESS;
}
case "unregister-task": {
lazy.log.info(`Unregistering task for token "${token}"`);
let token = commandLine.getArgument(1);
lazy.log.info(`Unregistering task for token "${token}"`);
defaultAgent.unregisterTask(token);
return EXIT_CODE.SUCCESS;
}
Expand All @@ -133,14 +133,14 @@ export async function runBackgroundTask(commandLine) {

switch (command) {
case "register-task": {
lazy.log.info(`Registering task for token "${token}"`);
let token = commandLine.getArgument(1);
lazy.log.info(`Registering task for token "${token}"`);
defaultAgent.registerTask(token);
return EXIT_CODE.SUCCESS;
}
case "update-task": {
lazy.log.info(`Updating task for token "${token}"`);
let token = commandLine.getArgument(1);
lazy.log.info(`Updating task for token "${token}"`);
defaultAgent.updateTask(token);
return EXIT_CODE.SUCCESS;
}
Expand Down
39 changes: 22 additions & 17 deletions firefox-src-part/toolkit/profile/xpcshell/head.js
Original file line number Diff line number Diff line change
Expand Up @@ -594,25 +594,30 @@ function checkProfileService(
}
}

function checkStartupReason(expected = undefined) {
const tId = "startup.profile_selection_reason";
// Maps the interesting scalar IDs to simple names that can be used as JS variables.
const SCALARS = {
selectionReason: "startup.profile_selection_reason",
databaseVersion: "startup.profile_database_version",
profileCount: "startup.profile_count",
};

function getTelemetryScalars() {
let scalars = TelemetryTestUtils.getProcessScalars("parent");

if (expected === undefined) {
Assert.ok(
!(tId in scalars),
"Startup telemetry should not have been recorded."
);
return;
let results = {};
for (let [prop, scalarId] of Object.entries(SCALARS)) {
results[prop] = scalars[scalarId];
}

if (tId in scalars) {
Assert.equal(
scalars[tId],
expected,
"Should have seen the right startup reason."
);
} else {
Assert.ok(false, "Startup telemetry should have been recorded.");
}
return results;
}

function checkStartupReason(expected = undefined) {
let { selectionReason } = getTelemetryScalars();

Assert.equal(
selectionReason,
expected,
"Should have seen the right startup reason."
);
}
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
123.0b8
123.0b9

0 comments on commit a780d26

Please sign in to comment.