Skip to content

Commit

Permalink
Merge autoland to mozilla-central. a=merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Butkovits Atila committed Oct 19, 2021
2 parents 47821a8 + 8ecb76d commit b247999
Show file tree
Hide file tree
Showing 157 changed files with 2,278 additions and 1,879 deletions.
10 changes: 10 additions & 0 deletions browser/app/profile/firefox.js
Original file line number Diff line number Diff line change
Expand Up @@ -1208,6 +1208,16 @@ pref("dom.ipc.shims.enabledWarnings", false);
// content process is killed when all windows are closed, so a change will
// take effect when the 1st window is opened.
pref("security.sandbox.content.level", 3);

// Disconnect content processes from the window server. Depends on
// out-of-process WebGL and non-native theming. i.e., both in-process WebGL
// and native theming depend on content processes having a connection to the
// window server. Window server disconnection is automatically disabled (and
// this pref overridden) if OOP WebGL is disabled. OOP WebGL is disabled
// for some tests.
#if defined(NIGHTLY_BUILD)
pref("security.sandbox.content.mac.disconnect-windowserver", true);
#endif
#endif

#if defined(XP_LINUX) && defined(MOZ_SANDBOX)
Expand Down
9 changes: 0 additions & 9 deletions browser/base/content/browser.css
Original file line number Diff line number Diff line change
Expand Up @@ -1349,15 +1349,6 @@ toolbarpaletteitem:not([place="palette"]) > #stop-reload-button {
animation-duration: 2s;
}

/* This effectively simulates a focus outline. */
#UITourHighlight[active="focus-outline"] {
background-color: transparent;
border: 2px solid var(--focus-outline-color);
border-radius: 4px;

animation-name: none;
}

/* Combined context-menu items */
#context-navigation > .menuitem-iconic > .menu-iconic-text,
#context-navigation > .menuitem-iconic > .menu-accel-container {
Expand Down
44 changes: 38 additions & 6 deletions browser/components/BrowserGlue.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
TelemetryUtils: "resource://gre/modules/TelemetryUtils.jsm",
TRRRacer: "resource:///modules/TRRPerformance.jsm",
UIState: "resource://services-sync/UIState.jsm",
UITour: "resource:///modules/UITour.jsm",
UrlbarQuickSuggest: "resource:///modules/UrlbarQuickSuggest.jsm",
UrlbarPrefs: "resource:///modules/UrlbarPrefs.jsm",
WebChannel: "resource://gre/modules/WebChannel.jsm",
Expand Down Expand Up @@ -2189,6 +2188,39 @@ BrowserGlue.prototype = {
Services.wm.addListener(windowListener);
},

_monitorGPCPref() {
const FEATURE_PREF_ENABLED = "privacy.globalprivacycontrol.enabled";
const FUNCTIONALITY_PREF_ENABLED =
"privacy.globalprivacycontrol.functionality.enabled";
const PREF_WAS_ENABLED = "privacy.globalprivacycontrol.was_ever_enabled";
const _checkGPCPref = async () => {
const feature_enabled = Services.prefs.getBoolPref(
FEATURE_PREF_ENABLED,
false
);
const functionality_enabled = Services.prefs.getBoolPref(
FUNCTIONALITY_PREF_ENABLED,
false
);
const was_enabled = Services.prefs.getBoolPref(PREF_WAS_ENABLED, false);
let value = 0;
if (feature_enabled && functionality_enabled) {
value = 1;
Services.prefs.setBoolPref(PREF_WAS_ENABLED, true);
} else if (was_enabled) {
value = 2;
}
Services.telemetry.scalarSet(
"security.global_privacy_control_enabled",
value
);
};

Services.prefs.addObserver(FEATURE_PREF_ENABLED, _checkGPCPref);
Services.prefs.addObserver(FUNCTIONALITY_PREF_ENABLED, _checkGPCPref);
_checkGPCPref();
},

// All initial windows have opened.
_onWindowsRestored: function BG__onWindowsRestored() {
if (this._windowsWereRestored) {
Expand Down Expand Up @@ -2266,6 +2298,7 @@ BrowserGlue.prototype = {
if (AppConstants.NIGHTLY_BUILD) {
this._monitorTranslationsPref();
}
this._monitorGPCPref();
},

/**
Expand Down Expand Up @@ -4071,11 +4104,10 @@ BrowserGlue.prototype = {
{
"l10n-id": "restore-session-startup-suggestion-button",
callback: () => {
UITour.getTarget(win, "history").then(historyMenu => {
UITour.showHighlight(win, historyMenu, "focus-outline", {
autohide: true,
});
});
win.PanelUI.selectAndMarkItem([
"appMenu-history-button",
"appMenu-restoreSession",
]);
},
},
];
Expand Down
8 changes: 7 additions & 1 deletion browser/components/customizableui/PanelMultiView.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -1216,7 +1216,11 @@ var PanelMultiView = class extends AssociatedToNode {
currentView.keyNavigation(aEvent);
break;
case "mousemove":
this.openViews.forEach(panelView => panelView.clearNavigation());
this.openViews.forEach(panelView => {
if (!panelView.ignoreMouseMove) {
panelView.clearNavigation();
}
});
break;
case "popupshowing": {
this._viewContainer.setAttribute("panelopen", "true");
Expand Down Expand Up @@ -1807,6 +1811,8 @@ var PanelView = class extends AssociatedToNode {
return popup && popup.state == "open";
};

this.ignoreMouseMove = false;

let keyCode = event.code;
switch (keyCode) {
case "ArrowDown":
Expand Down
81 changes: 81 additions & 0 deletions browser/components/customizableui/content/panelUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,87 @@ const PanelUI = {
}
},

/**
* Selects and marks an item by id from the main view. The ids are an array,
* the first in the main view and the later ids in subsequent subviews that
* become marked when the user opens the subview. The subview marking is
* cancelled if a different subview is opened.
*/
async selectAndMarkItem(itemIds) {
// This shouldn't really occur, but return early just in case.
if (document.documentElement.hasAttribute("customizing")) {
return;
}

// This function was triggered from a button while the menu was
// already open, so the panel should be in the process of hiding.
// Wait for the panel to hide first, then reopen it.
if (this.panel.state == "hiding") {
await new Promise(resolve => {
this.panel.addEventListener("popuphidden", resolve, { once: true });
});
}

if (this.panel.state != "open") {
await new Promise(resolve => {
this.panel.addEventListener("ViewShown", resolve, { once: true });
this.show();
});
}

let currentView;

let viewShownCB = event => {
viewHidingCB();

if (itemIds.length) {
let subItem = window.document.getElementById(itemIds[0]);
if (event.target.id == subItem?.closest("panelview")?.id) {
Services.tm.dispatchToMainThread(() => {
markItem(event.target);
});
} else {
itemIds = [];
}
}
};

let viewHidingCB = () => {
if (currentView) {
currentView.ignoreMouseMove = false;
}
currentView = null;
};

let popupHiddenCB = () => {
viewHidingCB();
this.panel.removeEventListener("ViewShown", viewShownCB);
};

let markItem = viewNode => {
let id = itemIds.shift();
let item = window.document.getElementById(id);
item.setAttribute("tabindex", "-1");

currentView = PanelView.forNode(viewNode);
currentView.selectedElement = item;
currentView.focusSelectedElement(true);

// Prevent the mouse from changing the highlight temporarily.
// This flag gets removed when the view is hidden or a key
// is pressed.
currentView.ignoreMouseMove = true;

if (itemIds.length) {
this.panel.addEventListener("ViewShown", viewShownCB, { once: true });
}
this.panel.addEventListener("ViewHiding", viewHidingCB, { once: true });
};

this.panel.addEventListener("popuphidden", popupHiddenCB, { once: true });
markItem(this.mainView);
},

updateNotifications(notificationsChanged) {
let notifications = this._notifications;
if (!notifications || !notifications.length) {
Expand Down
6 changes: 3 additions & 3 deletions browser/components/downloads/DownloadsViewUI.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ var gDownloadElementButtons = {
},
show: {
commandName: "downloadsCmd_show",
l10nId: "downloads-cmd-show-button",
descriptionL10nId: "downloads-cmd-show-description",
panelL10nId: "downloads-cmd-show-panel",
l10nId: "downloads-cmd-show-button-2",
descriptionL10nId: "downloads-cmd-show-description-2",
panelL10nId: "downloads-cmd-show-panel-2",
iconClass: "downloadIconShow",
},
subviewOpenOrRemoveFile: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,7 @@
data-l10n-id="downloads-cmd-always-use-system-default"/>
<menuitem command="downloadsCmd_show"
class="downloadShowMenuItem"
#ifdef XP_MACOSX
data-l10n-id="downloads-cmd-show-menuitem-mac"
#else
data-l10n-id="downloads-cmd-show-menuitem"
#endif
/>
data-l10n-id="downloads-cmd-show-menuitem-2"/>

<menuseparator class="downloadCommandsSeparator"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,7 @@
data-l10n-id="downloads-cmd-always-use-system-default"/>
<menuitem command="downloadsCmd_show"
class="downloadShowMenuItem"
#ifdef XP_MACOSX
data-l10n-id="downloads-cmd-show-menuitem-mac"
#else
data-l10n-id="downloads-cmd-show-menuitem"
#endif
/>
data-l10n-id="downloads-cmd-show-menuitem-2"/>

<menuseparator class="downloadCommandsSeparator"/>

Expand Down
2 changes: 2 additions & 0 deletions browser/components/extensions/test/browser/browser.ini
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ skip-if = (webrender && debug) # bug 1553577
[browser_ext_contentscript_in_parent.js]
[browser_ext_contentscript_incognito.js]
[browser_ext_contentscript_nontab_connect.js]
[browser_ext_contentscript_sender_url.js]
skip-if = debug # The nature of the reduced STR test triggers an unrelated debug assertion in DOM IPC code, see bug 1736590.
[browser_ext_contextMenus.js]
support-files = !/browser/components/places/tests/browser/head.js
[browser_ext_contextMenus_checkboxes.js]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";

add_task(async function test_sender_url() {
let extension = ExtensionTestUtils.loadExtension({
manifest: {
content_scripts: [
{
matches: ["http://mochi.test/*"],
run_at: "document_start",
js: ["script.js"],
},
],
},

background() {
browser.runtime.onMessage.addListener((msg, sender) => {
browser.test.log("Message received.");
browser.test.sendMessage("sender.url", sender.url);
});
},

files: {
"script.js"() {
browser.test.log("Content script loaded.");
browser.runtime.sendMessage(0);
},
},
});

const image =
"http://mochi.test:8888/browser/browser/components/extensions/test/browser/ctxmenu-image.png";

// Bug is only visible and test only works without Fission,
// or with Fission but without BFcache in parent.
await SpecialPowers.pushPrefEnv({
set: [["fission.bfcacheInParent", false]],
});

function awaitNewTab() {
return BrowserTestUtils.waitForLocationChange(gBrowser, "about:newtab");
}

await extension.startup();

await BrowserTestUtils.withNewTab({ gBrowser }, async browser => {
let newTab = awaitNewTab();
BrowserTestUtils.loadURI(browser, "about:newtab");
await newTab;

BrowserTestUtils.loadURI(browser, image);
let url = await extension.awaitMessage("sender.url");
is(url, image, `Correct sender.url: ${url}`);

let wentBack = awaitNewTab();
await browser.goBack();
await wentBack;

await browser.goForward();
url = await extension.awaitMessage("sender.url");
is(url, image, `Correct sender.url: ${url}`);
});

await extension.unload();
await SpecialPowers.popPrefEnv();
});
Loading

0 comments on commit b247999

Please sign in to comment.