gecko-dev/layout/generic/LayoutMessageUtils.h
Andreas Farre 4b493b6a30 Bug 1595491 - Part 1: Make <embed> and <object> behave more like <iframe>. r=smaug,emilio
By making image loading in <embed> and <object> behave more like when
an <iframe> loads an image, we can make sure that the synthetic
document generated is process switched if the image is cross
origin. This is done by making image loading in nsObjectLoadingContent
follow the document loading path.

We also make sure that we pass the image size back to the embedder
element to not get stuck with the intrinsic size.

To avoid named targeting being able to target these synthetic
documents, as well as showing up in `Window.frames` and being counted
in `Window.length`, we keep a filtered list of non-synthetic browsing
contexts for that use-case.

This feature is controlled by two prefs:

* browser.opaqueResponseBlocking.syntheticBrowsingContext

  This triggers the creation of synthetic documents for images loaded
  in <object> or embed.

* browser.opaqueResponseBlocking.syntheticBrowsingContext.filter

  This turns on the filtering of synthetic browsing contexts in named
  targeting, `Window.length` and `Window.frames`.

Differential Revision: https://phabricator.services.mozilla.com/D148117
2022-08-16 16:42:58 +00:00

55 lines
1.6 KiB
C++

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
#ifndef LAYOUT_GENERIC_LAYOUTMESSAGEUTILS_H_
#define LAYOUT_GENERIC_LAYOUTMESSAGEUTILS_H_
#include "ipc/EnumSerializer.h"
#include "ipc/IPCMessageUtils.h"
#include "nsIFrame.h"
#include "mozilla/AspectRatio.h"
#include "mozilla/webrender/WebRenderTypes.h"
namespace IPC {
template <>
struct ParamTraits<mozilla::IntrinsicSize> {
using paramType = mozilla::IntrinsicSize;
static void Write(MessageWriter* aWriter, const paramType& aParam) {
WriteParam(aWriter, aParam.width);
WriteParam(aWriter, aParam.height);
}
static bool Read(MessageReader* aReader, paramType* aResult) {
return ReadParam(aReader, &aResult->width) &&
ReadParam(aReader, &aResult->height);
}
};
template <>
struct ParamTraits<mozilla::AspectRatio> {
using paramType = mozilla::AspectRatio;
static void Write(MessageWriter* aWriter, const paramType& aParam) {
WriteParam(aWriter, aParam.mRatio);
}
static bool Read(MessageReader* aReader, paramType* aResult) {
return ReadParam(aReader, &aResult->mRatio);
}
};
template <>
struct ParamTraits<mozilla::StyleImageRendering>
: public ContiguousEnumSerializerInclusive<
mozilla::StyleImageRendering, mozilla::StyleImageRendering::Auto,
mozilla::StyleImageRendering::Optimizequality> {};
} // namespace IPC
#endif // LAYOUT_GENERIC_LAYOUTMESSAGEUTILS_H_