VOOZH about

URL: https://phabricator.services.mozilla.com/D287248

⇱ ⚙ D287248 Bug 2022264 - IAB Ads Devtools toggle fix r=#home-newtab-reviewers


Bug 2022264 - IAB Ads Devtools toggle fix r=#home-newtab-reviewers
Needs RevisionPublic

Authored by Dre on Mar 11 2026, 10:42 PM.
Referenced Files
Unknown Object (File)
Tue, Jun 16, 10:23 PM
Unknown Object (File)
Wed, Jun 3, 10:30 AM
Unknown Object (File)
Wed, Jun 3, 8:19 AM
Unknown Object (File)
Wed, Jun 3, 4:43 AM
Unknown Object (File)
Wed, Jun 3, 3:40 AM
Unknown Object (File)
Wed, Jun 3, 2:50 AM
Unknown Object (File)
Tue, Jun 2, 11:27 PM
Unknown Object (File)
Tue, Jun 2, 8:16 PM

Details

Reviewers
ini
Group Reviewers
desktop-theme-reviewers
Bugzilla Bug ID
2022264
Test Plan

Prereqs — prefs to set (about:config)

The ad-size and SPOC placement prefs are *written by the control*, so don't set
those manually. You only need to unlock the panel and the contextual-banner path:

PrefValueWhy
Enables the New Tab devtools admin (open )
Required for the contextual-banner pref writes (steps 2-4)
Same — gates the placement/count writes

Build/launch: -> -> ,
then open and expand IAB Banner Ad Sizes.

Prefs the control writes (observe these, don't set them):

  • , ,
  • /
  • /

(All under the branch in about:config.)

    1. Automated
  • — DiscoveryStreamAdmin suite green, including:
    • billboard select, leaderboard select, off-clears-prefs, medium-rectangle preserved, rectangle-toggle refresh

Manual (devtools admin panel)

Prereqs: then , launch with .

  1. Open a New Tab, open the DiscoveryStream devtools admin, expand IAB Banner Ad Sizes.
  2. Billboard: set Banner size → Billboard.
    • = true, = false.
    • added to with count .
    • = , count .
  3. Leaderboard (mutual exclusivity): set Banner size → Leaderboard.
    • Billboard flips to false, leaderboard true; placements/contextualBanners switch to .
    • Never both enabled at once.
  4. Off: set Banner size → Off.
    • Both billboard/leaderboard prefs false; both removed from spocs placements/counts.
    • and counts cleared.
  5. MREC independence: toggle Enable IAB Medium Rectangle (MREC) on/off.
    • and placement update independently of the banner-size dropdown.
    • Changing banner size preserves an enabled MREC.
  6. Persistence/refresh: after each change, confirm the cache refreshes (newtab content reloads) and the dropdown reflects current prefs on reopen.

Diff Detail

Repository
rFIREFOXAUTOLAND firefox-autoland
Branch
HEAD

Unit TestsBroken

TimeTest
0 mscode-review::general
WARNING: A generic error occurred in the code review bot.

Event Timeline

Dre planned changes to this revision.Mar 11 2026, 10:42 PM
Dre created this revision.
phab-bot changed the visibility from "Custom Policy" to "Public (No Login Required)".Mar 11 2026, 10:44 PM
phab-bot changed the edit policy from "Custom Policy" to "Restricted Project (Project)".
phab-bot removed a project: secure-revision.
Dre planned changes to this revision.Mar 11 2026, 11:01 PM
Dre updated this revision to Diff 1222188.
Dre requested review of this revision.Mar 11 2026, 11:08 PM
Dre retitled this revision from WIP: Bug 2022264 - IAB Ads Devtools toggle fix r=#home-newtab-reviewers to Bug 2022264 - IAB Ads Devtools toggle fix r=#home-newtab-reviewers.Mar 11 2026, 11:08 PM
Comment Actions

Summary

Intent

The changes fix the IAB Ads DevTools toggle behavior in the Firefox New Tab page's Discovery Stream admin panel. The bug relates to the billboard and leaderboard ad size options, which should be mutually exclusive (only one can be active at a time), but the previous implementation using separate toggle switches allowed both to be enabled simultaneously. Additionally, toggling these options did not trigger a cache refresh, meaning changes wouldn't take effect immediately.

Solution

The solution replaces the two separate switches for billboard and leaderboard banner sizes with a single dropdown control that has three options: "Off", "Billboard", and "Leaderboard". This inherently enforces mutual exclusivity between the two banner sizes at the UI level.

Key implementation details:

  1. New dropdown: The billboard and leaderboard toggles are replaced with a element containing three elements. Since emits native DOM change events (not React synthetic events), a ref-based approach is used to attach/detach the event listener directly on the DOM node.
  1. Ref management: A new method handles attaching and cleaning up the native event listener on the element, including proper cleanup in .
  1. Centralized placement update logic: A new method consolidates the logic for updating all IAB-related preferences. It accepts a map of placement states, conditionally dispatches pref changes only when values differ from current state, updates the spoc placements/counts arrays, manages contextual banner prefs, and crucially calls at the end to ensure changes take effect immediately.
  1. Refactored : The existing toggle handler (still used for the medium rectangle toggle) now builds a object and enforces mutual exclusivity between billboard and leaderboard before delegating to .
  1. CSS additions: New styles are added for the class to properly layout the dropdown, along with various styling improvements for the personalization/inferred overrides sections of the admin panel.
  1. Tests: New test cases verify that billboard and leaderboard are kept mutually exclusive, that the change handler works correctly with proper event listener setup/teardown, and that cache refresh is triggered after toggling the medium rectangle.

Automated review completed with no comments.
Dre planned changes to this revision.Mar 17 2026, 5:34 PM
Comment Actions

There are PREFS used in here and with the new PrefsConstants file, I will update the prefs usage once that lands.

Dre requested review of this revision.Mar 17 2026, 8:57 PM
thecount added inline comments.
browser/extensions/newtab/content-src/components/DiscoveryStreamAdmin/DiscoveryStreamAdmin.scss
249

Minor, do we need both min-width: max-content and width: max-content?

Dre marked an inline comment as done.
browser/extensions/newtab/content-src/components/DiscoveryStreamAdmin/DiscoveryStreamAdmin.scss
249

You're good Scott! I'll remove, it's not needed.

Dre edited the test plan for this revision. (Show Details)
ini added a project: testing-approved.
ini added a subscriber: ini.
Comment Actions

r+! nice work

This revision is now accepted and ready to land.Mar 23 2026, 10:43 PM
Dre edited the summary of this revision. (Show Details)
Dre edited the test plan for this revision. (Show Details)
Dre edited the summary of this revision. (Show Details)
ini requested changes to this revision.Tue, Jun 16, 9:20 PM
Comment Actions

So it turns out the Leaderboard ad size is no longer supported, and per Amber's comment in Bug 2030401 we want to remove all code related to it. Was the intention of this patch to prevent the billboard and leaderboard from being enabled simultaneously? If so, we can just keep the old billboard toggle, and remove the leaderboard toggle.

This revision now requires changes to proceed.Tue, Jun 16, 9:20 PM
Comment Actions

This revision makes changes to files both inside and in files outside of it. The New Tab page for Firefox Desktop supports train-hopping — a mechanism that allows New Tab code to be deployed to Beta and Release channels independently of the standard release train. Cross-layer changes can break train-hop compatibility, which may block New Tab deployments until fixes reach Release through normal channels.

If your change modifies platform code that browser/extensions/newtab depends on (such as module URIs, DOM APIs, or Nimbus feature definitions), please check whether a compatibility shim is needed. Shims should be marked with a comment indicating the Firefox version that must reach Release before the shim can be removed.

If your change is unrelated to the New Tab page's train-hop compatibility (for example, it only touches tests or documentation), you can possibly disregard this message - but if you are unsure whether your change affects train-hop compatibility, please ensure that someone from the home-newtab-reviewers-rotation review group has a chance to review before landing.

Revision Contents

PathSize
browser/
extensions/
newtab/
content-src/
components/
DiscoveryStreamAdmin/
143 lines
19 lines
css/
16 lines
nova/
16 lines
data/
content/
120 lines
test/
unit/
content-src/
components/
260 lines
CommitTreeParentsAuthorSummaryDate
76b34723916c25140189c69c1d85bc4044b2Dre Grant
Bug 2022264 - IAB Ads Devtools toggle fix r=#home-newtab-reviewers (Show More…)
Mar 26 2026, 5:46 PM

Diff 1299175

browser/extensions/newtab/content-src/components/DiscoveryStreamAdmin/DiscoveryStreamAdmin.jsx

Loading...

browser/extensions/newtab/content-src/components/DiscoveryStreamAdmin/DiscoveryStreamAdmin.scss

Loading...

browser/extensions/newtab/css/activity-stream.css

Loading...

browser/extensions/newtab/css/nova/activity-stream.css

Loading...

browser/extensions/newtab/data/content/activity-stream.bundle.js

Loading...

browser/extensions/newtab/test/unit/content-src/components/DiscoveryStreamAdmin.test.jsx

Loading...