Skip to content

Commit

Permalink
129.0.2 rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex313031 committed Sep 4, 2024
1 parent 67737c7 commit c950286
Show file tree
Hide file tree
Showing 32 changed files with 1,417 additions and 378 deletions.
3 changes: 3 additions & 0 deletions app/nsBrowserApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ static int do_main(int argc, char* argv[], char* envp[]) {
#ifdef LIBFUZZER
shellData.fuzzerDriver = fuzzer::FuzzerDriver;
#endif
#ifdef AFLFUZZ
shellData.fuzzerDriver = afl_interface_raw;
#endif

return gBootstrap->XRE_XPCShellMain(--argc, argv, envp, &shellData);
}
Expand Down
285 changes: 204 additions & 81 deletions app/profile/firefox.js

Large diffs are not rendered by default.

65 changes: 61 additions & 4 deletions browser/components/customizableui/CustomizableUI.sys.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ var CustomizableUIInternal = {
"developer-button",
"unified-extensions-button",
"fxa-toolbar-menu-button",
lazy.resetPBMToolbarButtonEnabled ? "reset-pbm-toolbar-button" : null,
].filter(name => name);

this.registerArea(
Expand Down Expand Up @@ -368,6 +369,14 @@ var CustomizableUIInternal = {
shouldSetPref = shouldAdd;
} else if (widget._introducedInVersion > currentVersion) {
shouldAdd = true;
} else if (
widget._introducedByPref &&
Services.prefs.getBoolPref(widget._introducedByPref)
) {
shouldSetPref = shouldAdd = !Services.prefs.getBoolPref(
prefId,
false
);
}

if (shouldAdd) {
Expand Down Expand Up @@ -747,7 +756,7 @@ var CustomizableUIInternal = {
!widget ||
widget.source !== CustomizableUI.SOURCE_BUILTIN ||
!widget.defaultArea ||
!widget._introducedInVersion ||
!(widget._introducedInVersion || widget._introducedByPref) ||
savedPlacements.includes(widget.id)
) {
continue;
Expand Down Expand Up @@ -1138,6 +1147,10 @@ var CustomizableUIInternal = {
continue;
}

if (!inPrivateWindow && widget?.hideInNonPrivateBrowsing) {
continue;
}

this.ensureButtonContextMenu(node, aAreaNode);

// This needs updating in case we're resetting / undoing a reset.
Expand Down Expand Up @@ -1370,6 +1383,8 @@ var CustomizableUIInternal = {
let showInPrivateBrowsing = gPalette.has(aWidgetId)
? gPalette.get(aWidgetId).showInPrivateBrowsing
: true;
let hideInNonPrivateBrowsing =
gPalette.get(aWidgetId)?.hideInNonPrivateBrowsing ?? false;

for (let areaNode of areaNodes) {
let window = areaNode.ownerGlobal;
Expand All @@ -1380,6 +1395,13 @@ var CustomizableUIInternal = {
continue;
}

if (
hideInNonPrivateBrowsing &&
!lazy.PrivateBrowsingUtils.isWindowPrivate(window)
) {
continue;
}

let container = this.getCustomizationTarget(areaNode);
let widgetNode = window.document.getElementById(aWidgetId);
if (widgetNode && isOverflowable) {
Expand Down Expand Up @@ -1557,6 +1579,8 @@ var CustomizableUIInternal = {
let showInPrivateBrowsing = gPalette.has(aWidgetId)
? gPalette.get(aWidgetId).showInPrivateBrowsing
: true;
let hideInNonPrivateBrowsing =
gPalette.get(aWidgetId)?.hideInNonPrivateBrowsing ?? false;

if (
!showInPrivateBrowsing &&
Expand All @@ -1565,6 +1589,13 @@ var CustomizableUIInternal = {
return;
}

if (
hideInNonPrivateBrowsing &&
!lazy.PrivateBrowsingUtils.isWindowPrivate(window)
) {
return;
}

let [, widgetNode] = this.getWidgetNode(aWidgetId, window);
if (!widgetNode) {
lazy.log.error("Widget '" + aWidgetId + "' not found, unable to move");
Expand Down Expand Up @@ -1826,6 +1857,12 @@ var CustomizableUIInternal = {
) {
return null;
}
if (
aWidget.hideInNonPrivateBrowsing &&
!lazy.PrivateBrowsingUtils.isWindowPrivate(aDocument.defaultView)
) {
return null;
}

lazy.log.debug("Building " + aWidget.id + " of type " + aWidget.type);

Expand Down Expand Up @@ -2324,7 +2361,10 @@ var CustomizableUIInternal = {
// gPalette.
for (let [id, widget] of gPalette) {
if (!widget.currentArea) {
if (widget.showInPrivateBrowsing || !isWindowPrivate) {
if (
(isWindowPrivate && widget.showInPrivateBrowsing) ||
(!isWindowPrivate && !widget.hideInNonPrivateBrowsing)
) {
widgets.add(id);
}
}
Expand Down Expand Up @@ -2951,7 +2991,9 @@ var CustomizableUIInternal = {
tooltiptext: null,
l10nId: null,
showInPrivateBrowsing: true,
hideInNonPrivateBrowsing: false,
_introducedInVersion: -1,
_introducedByPref: null,
keepBroadcastAttributesWhenCustomizing: false,
disallowSubView: false,
webExtension: false,
Expand Down Expand Up @@ -2992,6 +3034,7 @@ var CustomizableUIInternal = {
const kOptBoolProps = [
"removable",
"showInPrivateBrowsing",
"hideInNonPrivateBrowsing",
"overflows",
"tabSpecific",
"locationSpecific",
Expand Down Expand Up @@ -3034,6 +3077,10 @@ var CustomizableUIInternal = {

if (aSource == CustomizableUI.SOURCE_BUILTIN) {
widget._introducedInVersion = aData.introducedInVersion || 0;

if (aData._introducedByPref) {
widget._introducedByPref = aData._introducedByPref;
}
}

this.wrapWidgetEventHandler("onBeforeCreated", widget);
Expand Down Expand Up @@ -3522,7 +3569,12 @@ var CustomizableUIInternal = {
// that are present. This avoids including items that don't exist (e.g. ids
// of add-on items that the user has uninstalled).
let orderedPlacements = CustomizableUI.getWidgetIdsInArea(container.id);
return orderedPlacements.filter(w => currentWidgets.has(w));
return orderedPlacements.filter(w => {
return (
currentWidgets.has(w) ||
this.getWidgetProvider(w) == CustomizableUI.PROVIDER_API
);
});
},

get inDefaultState() {
Expand Down Expand Up @@ -4164,6 +4216,8 @@ export var CustomizableUI = {
* as the "$shortcut" variable to the fluent message.
* - showInPrivateBrowsing: whether to show the widget in private browsing
* mode (optional, default: true)
* - hideInNonPrivateBrowsing: whether to hide the widget in non private
* browsing mode windows (optional, default: false)
* - tabSpecific: If true, closes the panel if the tab changes.
* - locationSpecific: If true, closes the panel if the location changes.
* This is similar to tabSpecific, but also if the location
Expand Down Expand Up @@ -4218,6 +4272,8 @@ export var CustomizableUI = {
* - tooltiptext: for API-provided widgets, the tooltip of the widget;
* - showInPrivateBrowsing: for API-provided widgets, whether the widget is
* visible in private browsing;
* - hideInNonPrivateBrowsing: for API-provided widgets, whether the widget is
* hidden in non-private browsing;
*
* Single window wrappers obtained through forWindow(someWindow) or from the
* instances array have the following properties
Expand Down Expand Up @@ -4772,7 +4828,7 @@ export var CustomizableUI = {
let item = menuChild;
if (!item.hasAttribute("onclick")) {
subviewItem.addEventListener("click", event => {
let newEvent = new doc.defaultView.MouseEvent(event.type, event);
let newEvent = new doc.ownerGlobal.PointerEvent("click", event);

// Telemetry should only pay attention to the original event.
lazy.BrowserUsageTelemetry.ignoreEvent(newEvent);
Expand Down Expand Up @@ -4919,6 +4975,7 @@ function WidgetGroupWrapper(aWidget) {
"label",
"tooltiptext",
"showInPrivateBrowsing",
"hideInNonPrivateBrowsing",
"viewId",
"disallowSubView",
"webExtension",
Expand Down
32 changes: 0 additions & 32 deletions browser/confvars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,6 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

MOZ_APP_VENDOR=Alex313031

MOZ_UPDATER=0

if test "$OS_ARCH" = "WINNT"; then
if ! test "$HAVE_64BIT_BUILD"; then
if test "$MOZ_UPDATE_CHANNEL" = "nightly" -o \
"$MOZ_UPDATE_CHANNEL" = "nightly-try" -o \
"$MOZ_UPDATE_CHANNEL" = "aurora" -o \
"$MOZ_UPDATE_CHANNEL" = "beta" -o \
"$MOZ_UPDATE_CHANNEL" = "release"; then
if ! test "$MOZ_DEBUG"; then
if ! test "$USE_STUB_INSTALLER"; then
# Expect USE_STUB_INSTALLER from taskcluster for downstream task consistency
echo "ERROR: STUB installer expected to be enabled but"
echo "ERROR: USE_STUB_INSTALLER is not specified in the environment"
exit 1
fi
MOZ_STUB_INSTALLER=1
fi
fi
fi
fi

BROWSER_CHROME_URL=chrome://browser/content/browser.xhtml

# MOZ_APP_DISPLAYNAME will be set by branding/configure.sh
# MOZ_BRANDING_DIRECTORY is the default branding directory used when none is
# specified. It should never point to the "official" branding directory.
Expand All @@ -37,9 +11,3 @@ BROWSER_CHROME_URL=chrome://browser/content/browser.xhtml
# For the mozilla-aurora repository, use "aurora".
MOZ_BRANDING_DIRECTORY=browser/branding/mercury
MOZ_OFFICIAL_BRANDING_DIRECTORY=browser/branding/official
MOZ_APP_ID={ec8030f7-c20a-464f-9b0e-13a3a9e97384}

MOZ_PROFILE_MIGRATOR=1

# Include the DevTools client, not just the server (which is the default)
MOZ_DEVTOOLS=all
10 changes: 5 additions & 5 deletions browser/installer/package-manifest.in
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,6 @@
@RESPATH@/browser/chrome.manifest
@RESPATH@/browser/chrome/browser@JAREXT@
@RESPATH@/browser/chrome/browser.manifest
@RESPATH@/chrome/pdfjs.manifest
@RESPATH@/chrome/pdfjs/*
@RESPATH@/chrome/toolkit@JAREXT@
@RESPATH@/chrome/toolkit.manifest
#ifdef MOZ_GTK
Expand All @@ -231,6 +229,11 @@
@RESPATH@/browser/chrome/devtools.manifest
@RESPATH@/browser/@PREF_DIR@/debugger.js

; PdfJs
@RESPATH@/chrome/pdfjs.manifest
@RESPATH@/chrome/pdfjs/*
@RESPATH@/defaults/pref/PdfJsDefaultPrefs.js

; shell icons
#ifdef XP_UNIX
#ifndef XP_MACOSX
Expand Down Expand Up @@ -392,9 +395,6 @@ bin/libfreebl_64int_3.so
@BINPATH@/@DLL_PREFIX@mozwer@DLL_SUFFIX@
#endif
#endif
#ifdef MOZ_CRASHREPORTER_INJECTOR
@BINPATH@/breakpadinjector.dll
#endif
#endif

; [ minidump-analyzer ]
Expand Down
7 changes: 5 additions & 2 deletions browser/installer/windows/nsis/uninstaller.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ Var RefreshRequested
; MigrateTaskBarShortcut and is not intended to be used here.
; See Bug 1329869 for more.
Var AddTaskbarSC
; Will be the registry hive that we are going to write things like class keys
; into. This will generally be HKLM if running with elevation, otherwise HKCU.
Var RegHive

; Other included files may depend upon these includes!
; The following includes are provided by NSIS.
Expand Down Expand Up @@ -475,11 +478,11 @@ Section "Uninstall"
ClearErrors
WriteRegStr HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" "Write Test"
${If} ${Errors}
StrCpy $TmpVal "HKCU" ; used primarily for logging
StrCpy $RegHive "HKCU"
${Else}
SetShellVarContext all ; Set SHCTX to HKLM
DeleteRegValue HKLM "Software\Mozilla" "${BrandShortName}InstallerTest"
StrCpy $TmpVal "HKLM" ; used primarily for logging
StrCpy $RegHive "HKLM"
${un.RegCleanMain} "Software\Mozilla"
${un.RegCleanUninstall}
${un.DeleteShortcuts}
Expand Down
36 changes: 36 additions & 0 deletions browser/moz.configure
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,46 @@ imply_option("MOZ_SERVICES_SYNC", True)
imply_option("MOZ_DEDICATED_PROFILES", True)
imply_option("MOZ_BLOCK_PROFILE_DOWNGRADE", False)
imply_option("MOZ_NORMANDY", False)
imply_option("MOZ_PROFILE_MIGRATOR", True)


imply_option("MOZ_APP_VENDOR", "Alex313031")
imply_option("MOZ_APP_ID", "{ec8030f7-c20a-464f-9b0e-13a3a9e97385}")
# Include the DevTools client, not just the server (which is the default)
imply_option("MOZ_DEVTOOLS", "all")
imply_option("BROWSER_CHROME_URL", "chrome://browser/content/browser.xhtml")

with only_when(target_has_linux_kernel & compile_environment):
option(env="MOZ_NO_PIE_COMPAT", help="Enable non-PIE wrapper")

set_config("MOZ_NO_PIE_COMPAT", depends_if("MOZ_NO_PIE_COMPAT")(lambda _: True))


@depends(target, update_channel, have_64_bit, moz_debug, "MOZ_AUTOMATION")
@imports(_from="os", _import="environ")
def requires_stub_installer(
target, update_channel, have_64_bit, moz_debug, moz_automation
):
if target.kernel != "WINNT":
return False
if have_64_bit:
return False
if update_channel not in ("nightly", "nightly-try", "aurora", "beta", "release"):
return False

if moz_debug:
return False

# Expect USE_STUB_INSTALLER from taskcluster for downstream task consistency
if moz_automation and not environ.get("USE_STUB_INSTALLER"):
die(
"STUB installer expected to be enabled but "
"USE_STUB_INSTALLER is not specified in the environment"
)

return True


imply_option("MOZ_STUB_INSTALLER", True, when=requires_stub_installer)

include("../toolkit/moz.configure")
Loading

0 comments on commit c950286

Please sign in to comment.