MFH: r567916

firefox: import upstream bugfixes

1 https://bugzilla.mozilla.org/show_bug.cgi?id=1694670
  "Linux startup crash in [@ qcms_data_create_rgb_with_gamma]"
  crash on startup when loading certain ICC profiles
2 https://bugzilla.mozilla.org/show_bug.cgi?id=1694699
  "Investigate tabs API regression in Firefox 86"
  regression causing loss of tabs from tab groups

PR:		253886 ([2])
Reported by:	Hans Petter Selasky [1], Graham Perrin [2]
This commit is contained in:
Christoph Moench-Tegeder 2021-03-09 09:59:59 +00:00
parent 98d0c6df24
commit daa3d4ee49
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/branches/2021Q1/; revision=567917
3 changed files with 138 additions and 1 deletions

View File

@ -3,7 +3,7 @@
PORTNAME= firefox
DISTVERSION= 86.0
PORTREVISION= 2
PORTREVISION= 3
PORTEPOCH= 2
CATEGORIES= www
MASTER_SITES= MOZILLA/${PORTNAME}/releases/${DISTVERSION}/source \

View File

@ -0,0 +1,22 @@
diff --git gfx/qcms/src/iccread.rs gfx/qcms/src/iccread.rs
--- gfx/qcms/src/iccread.rs
+++ gfx/qcms/src/iccread.rs
@@ -229,7 +229,7 @@
read_u16(mem, offset)
}
pub fn write_u32(mem: &mut [u8], offset: usize, value: u32) {
- if offset <= mem.len() - std::mem::size_of_val(&value) {
+ if offset > mem.len() - std::mem::size_of_val(&value) {
panic!("OOB");
}
let mem = mem.as_mut_ptr();
@@ -238,7 +238,7 @@
}
}
pub fn write_u16(mem: &mut [u8], offset: usize, value: u16) {
- if offset <= mem.len() - std::mem::size_of_val(&value) {
+ if offset > mem.len() - std::mem::size_of_val(&value) {
panic!("OOB");
}
let mem = mem.as_mut_ptr();

View File

@ -0,0 +1,115 @@
diff --git browser/components/extensions/parent/ext-tabs.js browser/components/extensions/parent/ext-tabs.js
--- browser/components/extensions/parent/ext-tabs.js
+++ browser/components/extensions/parent/ext-tabs.js
@@ -217,9 +217,13 @@
function sanitize(tab, changeInfo) {
let result = {};
let nonempty = false;
- const hasTabs = tab.hasTabPermission;
for (let prop in changeInfo) {
- if (hasTabs || !restricted.has(prop)) {
+ // In practice, changeInfo contains at most one property from
+ // restricted. Therefore it is not necessary to cache the value
+ // of tab.hasTabPermission outside the loop.
+ // Unnecessarily accessing tab.hasTabPermission can cause bugs, see
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=1694699#c21
+ if (!restricted.has(prop) || tab.hasTabPermission) {
nonempty = true;
result[prop] = changeInfo[prop];
}
diff --git browser/components/extensions/test/browser/browser_ext_tabs_hide.js browser/components/extensions/test/browser/browser_ext_tabs_hide.js
--- browser/components/extensions/test/browser/browser_ext_tabs_hide.js
+++ browser/components/extensions/test/browser/browser_ext_tabs_hide.js
@@ -349,6 +349,7 @@
if ("hidden" in changeInfo) {
browser.test.assertEq(tabId, testTab.id, "correct tab was hidden");
browser.test.assertTrue(changeInfo.hidden, "tab is hidden");
+ browser.test.assertEq(tab.url, testTab.url, "tab has correct URL");
browser.test.sendMessage("changeInfo");
}
});
diff --git browser/components/extensions/test/browser/browser_ext_tabs_move_discarded.js browser/components/extensions/test/browser/browser_ext_tabs_move_discarded.js
--- browser/components/extensions/test/browser/browser_ext_tabs_move_discarded.js
+++ browser/components/extensions/test/browser/browser_ext_tabs_move_discarded.js
@@ -2,7 +2,7 @@
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
-add_task(async function() {
+add_task(async function move_discarded_to_window() {
let extension = ExtensionTestUtils.loadExtension({
manifest: { permissions: ["tabs"] },
background: async function() {
@@ -29,3 +29,54 @@
await extension.awaitFinish("tabs.move");
await extension.unload();
});
+
+add_task(async function move_hidden_discarded_to_window() {
+ let extensionWithoutTabsPermission = ExtensionTestUtils.loadExtension({
+ manifest: {
+ permissions: ["http://example.com/"],
+ },
+ background() {
+ browser.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
+ if (changeInfo.hidden) {
+ browser.test.assertEq(
+ tab.url,
+ "http://example.com/?hideme",
+ "tab.url is correctly observed without tabs permission"
+ );
+ browser.test.sendMessage("onUpdated_checked");
+ }
+ });
+ },
+ });
+ await extensionWithoutTabsPermission.startup();
+
+ let extension = ExtensionTestUtils.loadExtension({
+ manifest: { permissions: ["tabs", "tabHide"] },
+ // ExtensionControlledPopup's populateDescription method requires an addon:
+ useAddonManager: "temporary",
+ async background() {
+ let url = "http://example.com/?hideme";
+ let tab = await browser.tabs.create({ url, discarded: true });
+ await browser.tabs.hide(tab.id);
+
+ let { id: windowId } = await browser.windows.create();
+
+ // Move the tab into that window
+ [tab] = await browser.tabs.move(tab.id, { windowId, index: -1 });
+ browser.test.assertTrue(tab.discarded, "Tab should still be discarded");
+ browser.test.assertTrue(tab.hidden, "Tab should still be hidden");
+ browser.test.assertEq(url, tab.url, "Tab URL should still be correct");
+
+ await browser.windows.remove(windowId);
+ browser.test.notifyPass("move_hidden_discarded_to_window");
+ },
+ });
+
+ await extension.startup();
+ await extension.awaitFinish("move_hidden_discarded_to_window");
+ await extension.unload();
+
+ await extensionWithoutTabsPermission.awaitMessage("onUpdated_checked");
+ await extensionWithoutTabsPermission.awaitMessage("onUpdated_checked");
+ await extensionWithoutTabsPermission.unload();
+});
diff --git mobile/android/components/extensions/ext-tabs.js mobile/android/components/extensions/ext-tabs.js
--- mobile/android/components/extensions/ext-tabs.js
+++ mobile/android/components/extensions/ext-tabs.js
@@ -233,9 +233,11 @@
function sanitize(tab, changeInfo) {
const result = {};
let nonempty = false;
- const hasTabs = tab.hasTabPermission;
for (const prop in changeInfo) {
- if (hasTabs || !restricted.includes(prop)) {
+ // In practice, changeInfo contains at most one property from
+ // restricted. Therefore it is not necessary to cache the value
+ // of tab.hasTabPermission outside the loop.
+ if (!restricted.includes(prop) || tab.hasTabPermission) {
nonempty = true;
result[prop] = changeInfo[prop];
}