import changes from `dev' branch of rmottola/Arctic-Fox:

- Bug 1256731 - patch 2 - Notify front-end code when screen resolution changes on Windows, so that TabsInTitlebar code can refresh its computations. r=gijs,emk (4b0baacc83)
- Bug 1219215 - part 1: remove window-drag bindings and other callers of WindowDraggingUtils, replace with using window-dragging region everywhere, r=dao,felipe (4c8f9ebcd4)
- Bug 1253498 - Update pdf.js to version 1.4.121. r=bdahl (562abb5b6a)
- Bug 1256037 - Update pdf.js to version 1.4.137. r=bdahl (adc91322e2)
- Bug 1261352 - Update pdf.js to version 1.4.185. r=bdahl, r=Mossop (04584d13db)
- Bug 1263067 - Update pdf.js to version 1.4.213. r=bdahl, r=sicking (7e484dfad1)
- Bug 1256165 - fit to width again after the restore session button is added, r=Felipe (4a9ccc6c04)
- Bug 1261307: Convert |StreamSocketConsumer::ReceiveSocketData| to |UniquePtr|, r=nfroyd (65088da288)
- Bug 1264377. Get rid of some unnecessary custom JSClass hook functions in xpconnect sandboxes and DOM simple globals. r=bholley (578df7a830)
- Bug 1249518 - Make DaemonSocketPDU able to send multiple file descriptors in single unit. r=tzimmermann (1bf04f8f43)
This commit is contained in:
2024-08-15 09:33:06 +08:00
parent 12dc484cbd
commit d8b22e8e35
28 changed files with 6164 additions and 5040 deletions
@@ -27,6 +27,10 @@ var searchText;
var gInitialized = false;
var gObserver = new MutationObserver(function (mutations) {
for (let mutation of mutations) {
// The addition of the restore session button changes our width:
if (mutation.attributeName == "session") {
fitToWidth();
}
if (mutation.attributeName == "snippetsVersion") {
if (!gInitialized) {
ensureSnippetsMapThen(loadSnippets);
@@ -41,6 +45,7 @@ window.addEventListener("pageshow", function () {
// Delay search engine setup, cause browser.js::BrowserOnAboutPageLoad runs
// later and may use asynchronous getters.
window.gObserver.observe(document.documentElement, { attributes: true });
window.gObserver.observe(document.getElementById("launcher"), { attributes: true });
fitToWidth();
setupSearch();
window.addEventListener("resize", fitToWidth);
@@ -190,21 +190,6 @@ var TabsInTitlebar = {
: titlebarContentHeight;
titlebar.style.marginBottom = "-" + baseHeight + "px";
if (!this._draghandles) {
this._draghandles = {};
let tmp = {};
Components.utils.import("resource://gre/modules/WindowDraggingUtils.jsm", tmp);
let mouseDownCheck = function () {
return !this._dragBindingAlive && TabsInTitlebar.enabled;
};
this._draghandles.tabsToolbar = new tmp.WindowDraggingElement(tabsToolbar);
this._draghandles.tabsToolbar.mouseDownCheck = mouseDownCheck;
this._draghandles.navToolbox = new tmp.WindowDraggingElement(gNavToolbox);
this._draghandles.navToolbox.mouseDownCheck = mouseDownCheck;
}
} else {
document.documentElement.removeAttribute("tabsintitlebar");
}
+41
View File
@@ -18,6 +18,12 @@ browser[remote="true"] {
-moz-binding: url("chrome://browser/content/tabbrowser.xml#tabbrowser-remote-browser");
}
%ifdef XP_MACOSX
#toolbar-menubar {
-moz-binding: url("chrome://browser/content/customizableui/toolbar.xml#toolbar-menubar-stub");
}
%endif
browser[frameType="social"][remote="true"] {
-moz-binding: url("chrome://global/content/bindings/remote-browser.xml#remote-browser");
}
@@ -124,6 +130,7 @@ toolbar[printpreview="true"] {
#titlebar {
-moz-binding: url("chrome://global/content/bindings/general.xml#windowdragbox");
-moz-window-dragging: drag;
}
#titlebar-spacer {
@@ -136,6 +143,29 @@ toolbar[printpreview="true"] {
}
%endif
%if !defined(MOZ_WIDGET_GTK) && !defined(MOZ_WIDGET_QT)
#TabsToolbar > .private-browsing-indicator {
-moz-box-ordinal-group: 1000;
}
%endif
%ifdef XP_WIN
#main-window[sizemode="maximized"] #titlebar-buttonbox {
-moz-appearance: -moz-window-button-box-maximized;
}
#main-window[tabletmode] #titlebar-min,
#main-window[tabletmode] #titlebar-max {
display: none !important;
}
#main-window[tabsintitlebar] #TabsToolbar,
#main-window[tabsintitlebar] #toolbar-menubar:not([autohide=true]),
#main-window[tabsintitlebar] #navigator-toolbox > toolbar:not(#toolbar-menubar):-moz-lwtheme {
-moz-window-dragging: drag;
}
%endif
#main-window[inDOMFullscreen] #sidebar-box,
#main-window[inDOMFullscreen] #sidebar-splitter {
visibility: collapse;
@@ -184,6 +214,17 @@ toolbar[mode="icons"] > #reload-button[displaystop] {
}
%endif
/* Ensure that empty parts of the bookmarks container can be dragged on OSX, and on other OSes
* only when a lwtheme is in use. */
%ifdef XP_MACOSX
#PlacesToolbarItems {
%else
#main-window[tabsintitlebar] #PlacesToolbarItems:-moz-lwtheme {
%endif
-moz-window-dragging: drag;
}
#navigator-toolbox[fullscreenShouldAnimate] {
transition: 1.5s margin-top ease-out;
}
+1 -1
View File
@@ -1,3 +1,3 @@
This is the pdf.js project output, https://github.com/mozilla/pdf.js
Current extension version is: 1.4.95
Current extension version is: 1.4.213
@@ -264,11 +264,9 @@ ChromeActions.prototype = {
var extHelperAppSvc =
Cc['@mozilla.org/uriloader/external-helper-app-service;1'].
getService(Ci.nsIExternalHelperAppService);
var frontWindow = Cc['@mozilla.org/embedcomp/window-watcher;1'].
getService(Ci.nsIWindowWatcher).activeWindow;
var docIsPrivate = this.isInPrivateBrowsing();
var netChannel = createNewChannel(blobUri, frontWindow.document, null);
var netChannel = createNewChannel(blobUri, this.domWindow.document, null);
if ('nsIPrivateBrowsingChannel' in Ci &&
netChannel instanceof Ci.nsIPrivateBrowsingChannel) {
netChannel.setPrivate(docIsPrivate);
@@ -304,10 +302,14 @@ ChromeActions.prototype = {
var listener = {
extListener: null,
onStartRequest: function(aRequest, aContext) {
var loadContext = self.domWindow
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsILoadContext);
this.extListener = extHelperAppSvc.doContent(
(data.isAttachment ? 'application/octet-stream' :
'application/pdf'),
aRequest, frontWindow, false);
aRequest, loadContext, false);
this.extListener.onStartRequest(aRequest, aContext);
},
onStopRequest: function(aRequest, aContext, aStatusCode) {
@@ -1021,14 +1023,18 @@ PdfStreamConverter.prototype = {
// Keep the URL the same so the browser sees it as the same.
channel.originalURI = aRequest.URI;
channel.loadGroup = aRequest.loadGroup;
channel.loadInfo.originAttributes = aRequest.loadInfo.originAttributes;
// We can use resource principal when data is fetched by the chrome
// make sure we reuse the origin attributes from the request channel to keep
// isolation consistent.
// e.g. useful for NoScript
var ssm = Cc['@mozilla.org/scriptsecuritymanager;1']
.getService(Ci.nsIScriptSecurityManager);
var uri = NetUtil.newURI(PDF_VIEWER_WEB_PAGE, null, null);
var attrs = aRequest.loadInfo.originAttributes;
var resourcePrincipal;
resourcePrincipal = ssm.createCodebasePrincipal(uri, {});
resourcePrincipal = ssm.createCodebasePrincipal(uri, attrs);
aRequest.owner = resourcePrincipal;
channel.asyncOpen(proxy, aContext);
},
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* globals PDFJS */
/* globals pdfjsLib */
'use strict';
@@ -307,8 +307,8 @@ var Stepper = (function StepperClosure() {
this.table = table;
if (!opMap) {
opMap = Object.create(null);
for (var key in PDFJS.OPS) {
opMap[PDFJS.OPS[key]] = key;
for (var key in pdfjsLib.OPS) {
opMap[pdfjsLib.OPS[key]] = key;
}
}
},
@@ -460,7 +460,7 @@ var Stats = (function Stats() {
manager: null,
init: function init() {
this.panel.setAttribute('style', 'padding: 5px;');
PDFJS.enableStats = true;
pdfjsLib.PDFJS.enableStats = true;
},
enabled: false,
active: false,
@@ -191,12 +191,14 @@
html {
height: 100%;
width: 100%;
/* Font size is needed to make the activity bar the correct size. */
font-size: 10px;
}
body {
height: 100%;
width: 100%;
background-color: #404040;
background-image: url(images/texture.png);
}
@@ -1865,11 +1867,15 @@ html[dir='rtl'] #documentPropertiesOverlay .row > * {
body[data-mozPrintCallback] #printContainer {
display: block;
}
#printContainer {
height: 100%;
}
/* wrapper around (scaled) print canvas elements */
#printContainer > div {
position: relative;
top: 0;
left: 0;
height: 100%;
overflow: hidden;
}
#printContainer canvas {
File diff suppressed because it is too large Load Diff
-12
View File
@@ -368,13 +368,6 @@
padding-right: 1px;
}
/* Make the window draggable by glassed toolbars (bug 555081) */
#toolbar-menubar:not([autohide="true"]),
#TabsToolbar,
#navigator-toolbox > toolbar:not(#toolbar-menubar):not(#addon-bar):-moz-lwtheme {
-moz-binding: url("chrome://browser/content/customizableui/toolbar.xml#toolbar-drag");
}
#appcontent:not(:-moz-lwtheme) {
background-color: -moz-dialog;
}
@@ -471,11 +464,6 @@
background-color: rgb(215,228,242);
}
#toolbar-menubar:not([autohide=true]):not(:-moz-lwtheme),
#TabsToolbar:not(:-moz-lwtheme) {
-moz-binding: url("chrome://browser/content/customizableui/toolbar.xml#toolbar-drag");
}
/* Render a window top border for lwthemes: */
#main-window[tabsintitlebar][sizemode="normal"] > #tab-view-deck > #browser-panel:-moz-lwtheme {
background-image: linear-gradient(to bottom,
@@ -222,7 +222,11 @@ public:
{
DaemonSocketPDU& pdu = GetPDU();
aArg1 = pdu.AcquireFd();
auto receiveFds = pdu.AcquireFds();
if (NS_WARN_IF(receiveFds.Length() == 0)) {
return NS_ERROR_ILLEGAL_VALUE;
}
aArg1 = receiveFds[0];
if (NS_WARN_IF(aArg1 < 0)) {
return NS_ERROR_ILLEGAL_VALUE;
@@ -279,7 +283,14 @@ BluetoothDaemonSocketModule::ConnectRsp(const DaemonSocketPDUHeader& aHeader,
BluetoothSocketResultHandler* aRes)
{
/* the file descriptor is attached in the PDU's ancillary data */
int fd = aPDU.AcquireFd();
auto receiveFds = aPDU.AcquireFds();
if (receiveFds.Length() == 0) {
ErrorRunnable::Dispatch(aRes, &BluetoothSocketResultHandler::OnError,
ConstantInitOp1<BluetoothStatus>(STATUS_FAIL));
return;
}
int fd = -1;
fd = receiveFds[0];
if (fd < 0) {
ErrorRunnable::Dispatch(aRes, &BluetoothSocketResultHandler::OnError,
ConstantInitOp1<BluetoothStatus>(STATUS_FAIL));
+3 -3
View File
@@ -63,7 +63,7 @@ public:
//
void ReceiveSocketData(
int aIndex, nsAutoPtr<mozilla::ipc::UnixSocketBuffer>& aBuffer) override;
int aIndex, UniquePtr<mozilla::ipc::UnixSocketBuffer>& aBuffer) override;
void OnConnectSuccess(int aIndex) override;
void OnConnectError(int aIndex) override;
@@ -363,12 +363,12 @@ NfcConsumer::IsNfcServiceThread() const
void
NfcConsumer::ReceiveSocketData(
int aIndex, nsAutoPtr<mozilla::ipc::UnixSocketBuffer>& aBuffer)
int aIndex, UniquePtr<mozilla::ipc::UnixSocketBuffer>& aBuffer)
{
MOZ_ASSERT(IsNfcServiceThread());
MOZ_ASSERT(aIndex == STREAM_SOCKET);
Receive(aBuffer);
Receive(aBuffer.get());
}
void
+17 -8
View File
@@ -119,7 +119,7 @@ DaemonSocketPDU::Receive(int aFd)
iv.iov_base = GetData(0);
iv.iov_len = GetAvailableSpace();
uint8_t cmsgbuf[CMSG_SPACE(sizeof(int))];
uint8_t cmsgbuf[CMSG_SPACE(sizeof(int)* MAX_NFDS)];
struct msghdr msg;
memset(&msg, 0, sizeof(msg));
@@ -140,24 +140,33 @@ DaemonSocketPDU::Receive(int aFd)
SetRange(0, res);
struct cmsghdr *chdr = CMSG_FIRSTHDR(&msg);
struct cmsghdr* chdr = CMSG_FIRSTHDR(&msg);
for (; chdr; chdr = CMSG_NXTHDR(&msg, chdr)) {
if (NS_WARN_IF(!CMSGHDR_CONTAINS_FD(chdr))) {
continue;
}
// Retrieve sent file descriptor. If multiple file descriptors
// have been sent, we close all but the final one.
mReceivedFd = *(static_cast<int*>(CMSG_DATA(chdr)));
// Retrieve sent file descriptors.
size_t fdCount = (chdr->cmsg_len - CMSG_ALIGN(sizeof(struct cmsghdr))) / sizeof(int);
for (size_t i = 0; i < fdCount; i++) {
int* receivedFd = static_cast<int*>(CMSG_DATA(chdr)) + i;
mReceivedFds.AppendElement(ScopedClose(*receivedFd));
}
}
return res;
}
int
DaemonSocketPDU::AcquireFd()
nsTArray<int>
DaemonSocketPDU::AcquireFds()
{
return mReceivedFd.forget();
// Forget all RAII object to avoid closing the fds.
nsTArray<int> fds;
for (auto& fd : mReceivedFds) {
fds.AppendElement(fd.forget());
}
mReceivedFds.Clear();
return fds;
}
nsresult
+4 -2
View File
@@ -10,10 +10,12 @@
#include "mozilla/FileUtils.h"
#include "mozilla/ipc/SocketBase.h"
#include "mozilla/ipc/DaemonSocketMessageHandlers.h"
#include "nsTArray.h"
namespace mozilla {
namespace ipc {
static const size_t MAX_NFDS = 16;
class DaemonSocketIOConsumer;
/**
@@ -72,7 +74,7 @@ public:
ssize_t Send(int aFd) override;
ssize_t Receive(int aFd) override;
int AcquireFd();
nsTArray<int> AcquireFds();
nsresult UpdateHeader();
@@ -82,7 +84,7 @@ private:
DaemonSocketIOConsumer* mConsumer;
RefPtr<DaemonSocketResultHandler> mRes;
ScopedClose mReceivedFd;
nsTArray<ScopedClose> mReceivedFds;
};
}
-6
View File
@@ -11,12 +11,6 @@ import ipdl.builtin
from ipdl.cxx.ast import *
from ipdl.type import Actor, ActorType, ProcessGraph, TypeVisitor, builtinHeaderIncludes
# FIXME/cjones: the chromium Message logging code doesn't work on
# gcc/POSIX, because it wprintf()s across the chromium/mozilla
# boundary. one side builds with -fshort-wchar, the other doesn't.
# this code will remain off until the chromium base lib is replaced
EMIT_LOGGING_CODE = ('win32' == sys.platform)
##-----------------------------------------------------------------------------
## "Public" interface to lowering
##
+4 -4
View File
@@ -882,7 +882,7 @@ KeyStore::SendData(const uint8_t *aData, int aLength)
// |StreamSocketConsumer|, |ListenSocketConsumer|
void
KeyStore::ReceiveSocketData(int aIndex, nsAutoPtr<UnixSocketBuffer>& aMessage)
KeyStore::ReceiveSocketData(int aIndex, UniquePtr<UnixSocketBuffer>& aMessage)
{
MOZ_ASSERT(NS_IsMainThread());
@@ -892,13 +892,13 @@ KeyStore::ReceiveSocketData(int aIndex, nsAutoPtr<UnixSocketBuffer>& aMessage)
mHandlerInfo.state == STATE_PROCESSING) {
switch (mHandlerInfo.state) {
case STATE_IDLE:
result = ReadCommand(aMessage);
result = ReadCommand(aMessage.get());
break;
case STATE_READ_PARAM_LEN:
result = ReadLength(aMessage);
result = ReadLength(aMessage.get());
break;
case STATE_READ_PARAM_DATA:
result = ReadData(aMessage);
result = ReadData(aMessage.get());
break;
case STATE_PROCESSING:
if (mHandlerInfo.command == 'g') {
+1 -1
View File
@@ -124,7 +124,7 @@ private:
//
void ReceiveSocketData(int aIndex,
nsAutoPtr<UnixSocketBuffer>& aMessage) override;
UniquePtr<UnixSocketBuffer>& aMessage) override;
void OnConnectSuccess(int aIndex) override;
void OnConnectError(int aIndex) override;
void OnDisconnect(int aIndex) override;
+2 -2
View File
@@ -227,7 +227,7 @@ public:
}
private:
nsAutoPtr<UnixSocketBuffer> mBuffer;
UniquePtr<UnixSocketBuffer> mBuffer;
};
void
@@ -366,7 +366,7 @@ StreamSocket::~StreamSocket()
}
void
StreamSocket::ReceiveSocketData(nsAutoPtr<UnixSocketBuffer>& aBuffer)
StreamSocket::ReceiveSocketData(UniquePtr<UnixSocketBuffer>& aBuffer)
{
mConsumer->ReceiveSocketData(mIndex, aBuffer);
}
+1 -1
View File
@@ -34,7 +34,7 @@ public:
*
* @param aBuffer Data received from the socket.
*/
void ReceiveSocketData(nsAutoPtr<UnixSocketBuffer>& aBuffer);
void ReceiveSocketData(UniquePtr<UnixSocketBuffer>& aBuffer);
/**
* Starts a task on the socket that will try to connect to a socket in a
+2 -2
View File
@@ -7,7 +7,7 @@
#ifndef mozilla_ipc_streamsocketconsumer_h
#define mozilla_ipc_streamsocketconsumer_h
#include "nsAutoPtr.h"
#include "mozilla/UniquePtr.h"
namespace mozilla {
namespace ipc {
@@ -27,7 +27,7 @@ public:
* @param aBuffer Data received from the socket.
*/
virtual void ReceiveSocketData(int aIndex,
nsAutoPtr<UnixSocketBuffer>& aBuffer) = 0;
UniquePtr<UnixSocketBuffer>& aBuffer) = 0;
/**
* Callback for socket success. Consumer-thread only.
+2 -2
View File
@@ -248,21 +248,21 @@ caption {
titlebar,
toolbar:not([nowindowdrag="true"]):not([customizing="true"]),
statusbar:not([nowindowdrag="true"]),
%endif
windowdragbox {
-moz-window-dragging: drag;
}
/* The list below is non-comprehensive and will probably need some tweaking. */
toolbaritem,
toolbarbutton,
button,
textbox,
searchbar,
tab,
radio,
splitter {
-moz-window-dragging: no-drag;
}
%endif
/******* toolbar *******/
+5 -11
View File
@@ -4,18 +4,18 @@
Components.utils.import("resource://gre/modules/AppConstants.jsm");
const USE_HITTEST = /^(win|macosx)/i.test(AppConstants.platform);
const HAVE_CSS_WINDOW_DRAG_SUPPORT = ["win", "macosx"].includes(AppConstants.platform);
this.EXPORTED_SYMBOLS = [ "WindowDraggingElement" ];
this.WindowDraggingElement = function WindowDraggingElement(elem) {
this._elem = elem;
this._window = elem.ownerDocument.defaultView;
if (HAVE_CSS_WINDOW_DRAG_SUPPORT && !this.isPanel()) {
return;
}
if (USE_HITTEST && !this.isPanel())
this._elem.addEventListener("MozMouseHittest", this, false);
else
this._elem.addEventListener("mousedown", this, false);
this._elem.addEventListener("mousedown", this, false);
};
WindowDraggingElement.prototype = {
@@ -57,12 +57,6 @@ WindowDraggingElement.prototype = {
},
handleEvent: function(aEvent) {
let isPanel = this.isPanel();
if (USE_HITTEST && !isPanel) {
if (this.shouldDrag(aEvent))
aEvent.preventDefault();
return;
}
switch (aEvent.type) {
case "mousedown":
if (!this.shouldDrag(aEvent))
+5
View File
@@ -54,6 +54,11 @@ nsIWidgetListener::SizeModeChanged(nsSizeMode aSizeMode)
{
}
void
nsIWidgetListener::UIResolutionChanged()
{
}
void
nsIWidgetListener::FullscreenChanged(bool aInFullscreen)
{
+6
View File
@@ -79,6 +79,12 @@ public:
*/
virtual void SizeModeChanged(nsSizeMode aSizeMode);
/**
* Called when the DPI (device resolution scaling factor) is changed,
* such that UI elements may need to be rescaled.
*/
virtual void UIResolutionChanged();
/**
* Called when the z-order of the window is changed. Returns true if the
* notification was handled. aPlacement indicates the new z order. If
+1
View File
@@ -113,6 +113,7 @@ void nsWindowBase::ChangedDPI()
if (presShell) {
presShell->BackingScaleFactorChanged();
}
mWidgetListener->UIResolutionChanged();
}
}
+11
View File
@@ -377,6 +377,17 @@ nsWebShellWindow::SizeModeChanged(nsSizeMode sizeMode)
// then need to be different.
}
void
nsWebShellWindow::UIResolutionChanged()
{
nsCOMPtr<nsPIDOMWindowOuter> ourWindow =
mDocShell ? mDocShell->GetWindow() : nullptr;
if (ourWindow) {
MOZ_ASSERT(ourWindow->IsOuterWindow());
ourWindow->DispatchCustomEvent(NS_LITERAL_STRING("resolutionchange"));
}
}
void
nsWebShellWindow::FullscreenChanged(bool aInFullscreen)
{
+1
View File
@@ -56,6 +56,7 @@ public:
virtual bool WindowResized(nsIWidget* aWidget, int32_t aWidth, int32_t aHeight) override;
virtual bool RequestWindowClose(nsIWidget* aWidget) override;
virtual void SizeModeChanged(nsSizeMode sizeMode) override;
virtual void UIResolutionChanged() override;
virtual void FullscreenChanged(bool aInFullscreen) override;
virtual void OSToolbarButtonPressed() override;
virtual bool ZLevelChanged(bool aImmediate, nsWindowZ *aPlacement,