merge mozilla-inbound to mozilla-central a=merge

This commit is contained in:
Carsten "Tomcat" Book 2017-05-31 11:28:43 +02:00
commit 1a0d9545b9
33 changed files with 2733 additions and 2672 deletions

View File

@ -1,5 +1,5 @@
This is the PDF.js project output, https://github.com/mozilla/pdf.js
Current extension version is: 1.8.384
Current extension version is: 1.8.398
Taken from upstream commit: 8d55e6a0
Taken from upstream commit: 96377832

View File

@ -3405,8 +3405,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
}();
var version, build;
{
exports.version = version = '1.8.384';
exports.build = build = '8d55e6a0';
exports.version = version = '1.8.398';
exports.build = build = '96377832';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;
@ -4408,8 +4408,8 @@ if (!_util.globalScope.PDFJS) {
}
var PDFJS = _util.globalScope.PDFJS;
{
PDFJS.version = '1.8.384';
PDFJS.build = '8d55e6a0';
PDFJS.version = '1.8.398';
PDFJS.build = '96377832';
}
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {
@ -6740,8 +6740,8 @@ exports.TilingPattern = TilingPattern;
"use strict";
var pdfjsVersion = '1.8.384';
var pdfjsBuild = '8d55e6a0';
var pdfjsVersion = '1.8.398';
var pdfjsBuild = '96377832';
var pdfjsSharedUtil = __w_pdfjs_require__(0);
var pdfjsDisplayGlobal = __w_pdfjs_require__(8);
var pdfjsDisplayAPI = __w_pdfjs_require__(3);
@ -6777,6 +6777,7 @@ exports.createBlob = pdfjsSharedUtil.createBlob;
exports.RenderingCancelledException = pdfjsDisplayDOMUtils.RenderingCancelledException;
exports.getFilenameFromUrl = pdfjsDisplayDOMUtils.getFilenameFromUrl;
exports.addLinkAttributes = pdfjsDisplayDOMUtils.addLinkAttributes;
exports.StatTimer = pdfjsSharedUtil.StatTimer;
/***/ }),
/* 14 */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -422,7 +422,13 @@ DOMIntersectionObserver::Update(nsIDocument* aDocument, DOMHighResTimeStamp time
double targetArea = targetRect.width * targetRect.height;
double intersectionArea = !intersectionRect ?
0 : intersectionRect->width * intersectionRect->height;
double intersectionRatio = targetArea > 0.0 ? intersectionArea / targetArea : 0.0;
double intersectionRatio;
if (targetArea > 0.0) {
intersectionRatio = intersectionArea / targetArea;
} else {
intersectionRatio = intersectionRect.isSome() ? 1.0 : 0.0;
}
size_t threshold = -1;
if (intersectionRatio > 0.0) {

View File

@ -136,8 +136,8 @@ nsJSUtils::ExecutionContext::ExecutionContext(JSContext* aCx,
JS::Handle<JSObject*> aGlobal)
:
#ifdef MOZ_GECKO_PROFILER
mSamplerRAII("nsJSUtils::ExecutionContext", /* PROFILER_LABEL */
js::ProfileEntry::Category::JS, __LINE__),
mProfilerRAII("nsJSUtils::ExecutionContext", /* PROFILER_LABEL */
js::ProfileEntry::Category::JS, __LINE__),
#endif
mCx(aCx)
, mCompartment(aCx, aGlobal)

View File

@ -70,7 +70,7 @@ public:
class MOZ_STACK_CLASS ExecutionContext {
#ifdef MOZ_GECKO_PROFILER
// Register stack annotations for the Gecko profiler.
mozilla::SamplerStackFrameRAII mSamplerRAII;
mozilla::ProfilerStackFrameRAII mProfilerRAII;
#endif
JSContext* mCx;

View File

@ -779,7 +779,7 @@ limitations under the License.
spy.waitForNotification(function() {
var records = sortRecords(spy.lastCall.args[0]);
expect(records.length).to.be(1);
expect(records[0].intersectionRatio).to.be(0);
expect(records[0].intersectionRatio).to.be(1);
expect(records[0].isIntersecting).to.be.ok();
done();
});

View File

@ -663,7 +663,7 @@ HTMLImageElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
if (LoadingEnabled() &&
OwnerDoc()->IsCurrentActiveDocument()) {
nsContentUtils::AddScriptRunner(
NewRunnableMethod(this, &HTMLImageElement::MaybeLoadImage));
NewRunnableMethod<bool>(this, &HTMLImageElement::MaybeLoadImage, false));
}
}
@ -690,8 +690,6 @@ HTMLImageElement::UnbindFromTree(bool aDeep, bool aNullParent)
}
}
mLastSelectedSource = nullptr;
nsImageLoadingContent::UnbindFromTree(aDeep, aNullParent);
nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
}
@ -724,7 +722,7 @@ HTMLImageElement::UpdateFormOwner()
}
void
HTMLImageElement::MaybeLoadImage()
HTMLImageElement::MaybeLoadImage(bool aAlwaysForceLoad)
{
// Our base URI may have changed, or we may have had responsive parameters
// change while not bound to the tree. Re-parse src/srcset and call LoadImage,
@ -732,7 +730,7 @@ HTMLImageElement::MaybeLoadImage()
// Note, check LoadingEnabled() after LoadImage call.
LoadSelectedImage(false, true, false);
LoadSelectedImage(aAlwaysForceLoad, /* aNotify */ true, aAlwaysForceLoad);
if (!LoadingEnabled()) {
CancelImageRequests(true);
@ -750,8 +748,18 @@ void
HTMLImageElement::NodeInfoChanged(nsIDocument* aOldDoc)
{
nsGenericHTMLElement::NodeInfoChanged(aOldDoc);
// Resetting the last selected source if adoption steps are run.
mLastSelectedSource = nullptr;
// Force reload image if adoption steps are run.
// If loading is temporarily disabled, don't even launch script runner.
// Otherwise script runner may run later when someone has reenabled loading.
if (LoadingEnabled()) {
// Use script runner for the case the adopt is from appendChild.
// Bug 1076583 - We still behave synchronously in the non-responsive case
nsContentUtils::AddScriptRunner(
(InResponsiveMode())
? NewRunnableMethod<bool>(this, &HTMLImageElement::QueueImageLoadTask, true)
: NewRunnableMethod<bool>(this, &HTMLImageElement::MaybeLoadImage, true)
);
}
}
// static
@ -873,7 +881,7 @@ HTMLImageElement::CopyInnerTo(Element* aDest, bool aPreallocateChildren)
mUseUrgentStartForChannel = EventStateManager::IsHandlingUserInput();
nsContentUtils::AddScriptRunner(
NewRunnableMethod(dest, &HTMLImageElement::MaybeLoadImage));
NewRunnableMethod<bool>(dest, &HTMLImageElement::MaybeLoadImage, false));
}
}

View File

@ -99,7 +99,7 @@ public:
nsresult CopyInnerTo(Element* aDest, bool aPreallocateChildren);
void MaybeLoadImage();
void MaybeLoadImage(bool aAlwaysForceLoad);
bool IsMap()
{

View File

@ -147,6 +147,10 @@ MediaStreamAddTrackDifferentAudioChannel=MediaStreamTrack %S could not be added
MediaStreamStopDeprecatedWarning=MediaStream.stop() is deprecated and will soon be removed. Use MediaStreamTrack.stop() instead.
# LOCALIZATION NOTE: %S is the URL of the web page which is not served on HTTPS and thus is not encrypted and considered insecure.
MediaEMEInsecureContextDeprecatedWarning=Using Encrypted Media Extensions at %S on an insecure (i.e. non-HTTPS) context is deprecated and will soon be removed. You should consider switching to a secure origin such as HTTPS.
# LOCALIZATION NOTE: %S is the URL of the web page which is calling web APIs without passing data (either an audioCapabilities or a videoCapabilities) that will soon be required.
MediaEMENoCapabilitiesDeprecatedWarning=Calling navigator.requestMediaKeySystemAccess() (at %S) without passing a candidate MediaKeySystemConfiguration containing audioCapabilities or videoCapabilities is deprecated and will soon become unsupported.
# LOCALIZATION NOTE: %S is the URL of the web page which is calling web APIs without passing data (a "codecs" string in the "contentType") that will soon be required.
MediaEMENoCodecsDeprecatedWarning=Calling navigator.requestMediaKeySystemAccess() (at %S) without passing a candidate MediaKeySystemConfiguration containing audioCapabilities or videoCapabilities without a contentType with a “codecs” string is deprecated and will soon become unsupported.
# LOCALIZATION NOTE: Do not translate "DOMException", "code" and "name"
DOMExceptionCodeWarning=Use of DOMExceptions code attribute is deprecated. Use name instead.
# LOCALIZATION NOTE: Do not translate "__exposedProps__"

View File

@ -37,6 +37,7 @@
#ifdef MOZ_WIDGET_ANDROID
#include "FennecJNIWrappers.h"
#endif
#include <functional>
namespace mozilla {
namespace dom {
@ -548,11 +549,13 @@ IsParameterUnrecognized(const nsAString& aContentType)
// 3.1.2.3 Get Supported Capabilities for Audio/Video Type
static Sequence<MediaKeySystemMediaCapability>
GetSupportedCapabilities(const CodecType aCodecType,
const nsTArray<MediaKeySystemMediaCapability>& aRequestedCapabilities,
const MediaKeySystemConfiguration& aPartialConfig,
const KeySystemConfig& aKeySystem,
DecoderDoctorDiagnostics* aDiagnostics)
GetSupportedCapabilities(
const CodecType aCodecType,
const nsTArray<MediaKeySystemMediaCapability>& aRequestedCapabilities,
const MediaKeySystemConfiguration& aPartialConfig,
const KeySystemConfig& aKeySystem,
DecoderDoctorDiagnostics* aDiagnostics,
const std::function<void(const char*)>& aDeprecationLogFn)
{
// Let local accumulated configuration be a local copy of partial configuration.
// (Note: It's not necessary for us to maintain a local copy, as we don't need
@ -665,6 +668,9 @@ GetSupportedCapabilities(const CodecType aCodecType,
// If media types is empty:
if (codecs.IsEmpty()) {
// Log deprecation warning to encourage authors to not do this!
aDeprecationLogFn("MediaEMENoCodecsDeprecatedWarning");
// TODO: Remove this once we're sure it doesn't break the web.
// If container normatively implies a specific set of codecs and codec constraints:
// Let parameters be that set.
if (isMP4) {
@ -840,7 +846,8 @@ GetSupportedConfig(const KeySystemConfig& aKeySystem,
const MediaKeySystemConfiguration& aCandidate,
MediaKeySystemConfiguration& aOutConfig,
DecoderDoctorDiagnostics* aDiagnostics,
bool aInPrivateBrowsing)
bool aInPrivateBrowsing,
const std::function<void(const char*)>& aDeprecationLogFn)
{
// Let accumulated configuration be a new MediaKeySystemConfiguration dictionary.
MediaKeySystemConfiguration config;
@ -953,8 +960,13 @@ GetSupportedConfig(const KeySystemConfig& aKeySystem,
// If the videoCapabilities and audioCapabilities members in candidate
// configuration are both empty, return NotSupported.
// TODO: Most sites using EME still don't pass capabilities, so we
// can't reject on it yet without breaking them. So add this later.
if (aCandidate.mAudioCapabilities.IsEmpty() &&
aCandidate.mVideoCapabilities.IsEmpty()) {
// TODO: Most sites using EME still don't pass capabilities, so we
// can't reject on it yet without breaking them. So add this later.
// Log deprecation warning to encourage authors to not do this!
aDeprecationLogFn("MediaEMENoCapabilitiesDeprecatedWarning");
}
// If the videoCapabilities member in candidate configuration is non-empty:
if (!aCandidate.mVideoCapabilities.IsEmpty()) {
@ -967,7 +979,8 @@ GetSupportedConfig(const KeySystemConfig& aKeySystem,
aCandidate.mVideoCapabilities,
config,
aKeySystem,
aDiagnostics);
aDiagnostics,
aDeprecationLogFn);
// If video capabilities is null, return NotSupported.
if (caps.IsEmpty()) {
EME_LOG("MediaKeySystemConfiguration (label='%s') rejected; "
@ -992,7 +1005,8 @@ GetSupportedConfig(const KeySystemConfig& aKeySystem,
aCandidate.mAudioCapabilities,
config,
aKeySystem,
aDiagnostics);
aDiagnostics,
aDeprecationLogFn);
// If audio capabilities is null, return NotSupported.
if (caps.IsEmpty()) {
EME_LOG("MediaKeySystemConfiguration (label='%s') rejected; "
@ -1071,7 +1085,8 @@ MediaKeySystemAccess::GetSupportedConfig(
const Sequence<MediaKeySystemConfiguration>& aConfigs,
MediaKeySystemConfiguration& aOutConfig,
DecoderDoctorDiagnostics* aDiagnostics,
bool aIsPrivateBrowsing)
bool aIsPrivateBrowsing,
const std::function<void(const char*)>& aDeprecationLogFn)
{
KeySystemConfig implementation;
if (!GetKeySystemConfig(aKeySystem, implementation)) {
@ -1082,7 +1097,8 @@ MediaKeySystemAccess::GetSupportedConfig(
candidate,
aOutConfig,
aDiagnostics,
aIsPrivateBrowsing)) {
aIsPrivateBrowsing,
aDeprecationLogFn)) {
return true;
}
}

View File

@ -66,7 +66,8 @@ public:
const Sequence<MediaKeySystemConfiguration>& aConfigs,
MediaKeySystemConfiguration& aOutConfig,
DecoderDoctorDiagnostics* aDiagnostics,
bool aIsPrivateBrowsing);
bool aIsPrivateBrowsing,
const std::function<void(const char*)>& aDeprecationLogFn);
static bool KeySystemSupportsInitDataType(const nsAString& aKeySystem,
const nsAString& aInitDataType);

View File

@ -18,6 +18,10 @@
#include "nsCocoaFeatures.h"
#endif
#include "nsPrintfCString.h"
#include "nsContentUtils.h"
#include "nsIScriptError.h"
#include "mozilla/Unused.h"
#include "nsDataHashtable.h"
namespace mozilla {
namespace dom {
@ -165,17 +169,54 @@ MediaKeySystemAccessManager::Request(DetailedPromise* aPromise,
return;
}
nsCOMPtr<nsIDocument> doc = mWindow->GetExtantDoc();
nsDataHashtable<nsCharPtrHashKey, bool> warnings;
std::function<void(const char*)> deprecationWarningLogFn =
[&](const char* aMsgName) {
EME_LOG("Logging deprecation warning '%s' to WebConsole.", aMsgName);
warnings.Put(aMsgName, true);
nsString uri;
if (doc) {
Unused << doc->GetDocumentURI(uri);
}
const char16_t* params[] = { uri.get() };
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
NS_LITERAL_CSTRING("Media"),
doc,
nsContentUtils::eDOM_PROPERTIES,
aMsgName,
params,
ArrayLength(params));
};
bool isPrivateBrowsing =
mWindow->GetExtantDoc() &&
mWindow->GetExtantDoc()->NodePrincipal()->GetPrivateBrowsingId() > 0;
MediaKeySystemConfiguration config;
if (MediaKeySystemAccess::GetSupportedConfig(
aKeySystem, aConfigs, config, &diagnostics, isPrivateBrowsing)) {
aKeySystem, aConfigs, config, &diagnostics, isPrivateBrowsing, deprecationWarningLogFn)) {
RefPtr<MediaKeySystemAccess> access(
new MediaKeySystemAccess(mWindow, aKeySystem, config));
aPromise->MaybeResolve(access);
diagnostics.StoreMediaKeySystemAccess(mWindow->GetExtantDoc(),
aKeySystem, true, __func__);
// Accumulate telemetry to report whether we hit deprecation warnings.
if (warnings.Get("MediaEMENoCapabilitiesDeprecatedWarning")) {
Telemetry::Accumulate(
Telemetry::HistogramID::MEDIA_EME_REQUEST_DEPRECATED_WARNINGS, 1);
EME_LOG("MEDIA_EME_REQUEST_DEPRECATED_WARNINGS "
"MediaEMENoCapabilitiesDeprecatedWarning");
} else if (warnings.Get("MediaEMENoCodecsDeprecatedWarning")) {
Telemetry::Accumulate(
Telemetry::HistogramID::MEDIA_EME_REQUEST_DEPRECATED_WARNINGS, 2);
EME_LOG("MEDIA_EME_REQUEST_DEPRECATED_WARNINGS "
"MediaEMENoCodecsDeprecatedWarning");
} else {
Telemetry::Accumulate(
Telemetry::HistogramID::MEDIA_EME_REQUEST_DEPRECATED_WARNINGS, 0);
EME_LOG("MEDIA_EME_REQUEST_DEPRECATED_WARNINGS No warnings");
}
return;
}
// Not to inform user, because nothing to do if the corresponding keySystem

View File

@ -7,6 +7,7 @@
#include "MainThreadUtils.h"
#include "nsThreadUtils.h"
#include "CompositorBridgeParent.h"
#include "mozilla/layers/ImageBridgeParent.h"
#include "mozilla/media/MediaSystemResourceService.h"
namespace mozilla {
@ -105,6 +106,7 @@ CompositorThreadHolder::CreateCompositorThread()
}
CompositorBridgeParent::Setup();
ImageBridgeParent::Setup();
return compositorThread;
}

View File

@ -10,6 +10,7 @@
#include "base/message_loop.h" // for MessageLoop
#include "base/process.h" // for ProcessId
#include "base/task.h" // for CancelableTask, DeleteTask, etc
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/gfx/Point.h" // for IntSize
#include "mozilla/Hal.h" // for hal::SetCurrentThreadPriority()
#include "mozilla/HalTypes.h" // for hal::THREAD_PRIORITY_COMPOSITOR
@ -23,6 +24,7 @@
#include "mozilla/layers/PImageBridgeParent.h"
#include "mozilla/layers/TextureHostOGL.h" // for TextureHostOGL
#include "mozilla/layers/Compositor.h"
#include "mozilla/Monitor.h"
#include "mozilla/mozalloc.h" // for operator new, etc
#include "mozilla/Unused.h"
#include "nsDebug.h" // for NS_RUNTIMEABORT, etc
@ -42,11 +44,21 @@ using namespace mozilla::media;
std::map<base::ProcessId, ImageBridgeParent*> ImageBridgeParent::sImageBridges;
MessageLoop* ImageBridgeParent::sMainLoop = nullptr;
StaticAutoPtr<mozilla::Monitor> sImageBridgesLock;
// defined in CompositorBridgeParent.cpp
CompositorThreadHolder* GetCompositorThreadHolder();
/* static */ void
ImageBridgeParent::Setup()
{
MOZ_ASSERT(NS_IsMainThread());
if (!sImageBridgesLock) {
sImageBridgesLock = new Monitor("ImageBridges");
mozilla::ClearOnShutdown(&sImageBridgesLock);
}
}
ImageBridgeParent::ImageBridgeParent(MessageLoop* aLoop,
ProcessId aChildProcessId)
: mMessageLoop(aLoop)
@ -54,17 +66,18 @@ ImageBridgeParent::ImageBridgeParent(MessageLoop* aLoop,
, mClosed(false)
{
MOZ_ASSERT(NS_IsMainThread());
sMainLoop = MessageLoop::current();
// creates the map only if it has not been created already, so it is safe
// with several bridges
sImageBridges[aChildProcessId] = this;
{
MonitorAutoLock lock(*sImageBridgesLock);
sImageBridges[aChildProcessId] = this;
}
SetOtherProcessId(aChildProcessId);
}
ImageBridgeParent::~ImageBridgeParent()
{
sImageBridges.erase(OtherPid());
}
static StaticRefPtr<ImageBridgeParent> sImageBridgeParentSingleton;
@ -105,7 +118,10 @@ ImageBridgeParent::ActorDestroy(ActorDestroyReason aWhy)
// Can't alloc/dealloc shmems from now on.
mClosed = true;
mCompositables.clear();
{
MonitorAutoLock lock(*sImageBridgesLock);
sImageBridges.erase(OtherPid());
}
MessageLoop::current()->PostTask(NewRunnableMethod(this, &ImageBridgeParent::DeferredDestroy));
// It is very important that this method gets called at shutdown (be it a clean
@ -327,9 +343,11 @@ ImageBridgeParent::DeferredDestroy()
mSelfRef = nullptr; // "this" ImageBridge may get deleted here.
}
ImageBridgeParent*
RefPtr<ImageBridgeParent>
ImageBridgeParent::GetInstance(ProcessId aId)
{
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
MonitorAutoLock lock(*sImageBridgesLock);
NS_ASSERTION(sImageBridges.count(aId) == 1, "ImageBridgeParent for the process");
return sImageBridges[aId];
}
@ -377,26 +395,6 @@ bool ImageBridgeParent::IsSameProcess() const
return OtherPid() == base::GetCurrentProcId();
}
/*static*/ void
ImageBridgeParent::SetAboutToSendAsyncMessages(base::ProcessId aChildProcessId)
{
ImageBridgeParent* imageBridge = ImageBridgeParent::GetInstance(aChildProcessId);
if (!imageBridge) {
return;
}
imageBridge->SetAboutToSendAsyncMessages();
}
/*static*/ void
ImageBridgeParent::SendPendingAsyncMessages(base::ProcessId aChildProcessId)
{
ImageBridgeParent* imageBridge = ImageBridgeParent::GetInstance(aChildProcessId);
if (!imageBridge) {
return;
}
imageBridge->SendPendingAsyncMessages();
}
void
ImageBridgeParent::NotifyNotUsed(PTextureParent* aTexture, uint64_t aTransactionId)
{

View File

@ -50,6 +50,11 @@ protected:
public:
~ImageBridgeParent();
/**
* Creates the globals of ImageBridgeParent.
*/
static void Setup();
static ImageBridgeParent* CreateSameProcess();
static bool CreateForGPUProcess(Endpoint<PImageBridgeParent>&& aEndpoint);
static bool CreateForContent(Endpoint<PImageBridgeParent>&& aEndpoint);
@ -107,13 +112,7 @@ public:
virtual bool IsSameProcess() const override;
using CompositableParentManager::SetAboutToSendAsyncMessages;
static void SetAboutToSendAsyncMessages(base::ProcessId aChildProcessId);
using CompositableParentManager::SendPendingAsyncMessages;
static void SendPendingAsyncMessages(base::ProcessId aChildProcessId);
static ImageBridgeParent* GetInstance(ProcessId aId);
static RefPtr<ImageBridgeParent> GetInstance(ProcessId aId);
static bool NotifyImageComposites(nsTArray<ImageCompositeNotificationInfo>& aNotifications);
@ -141,8 +140,6 @@ private:
*/
static std::map<base::ProcessId, ImageBridgeParent*> sImageBridges;
static MessageLoop* sMainLoop;
RefPtr<CompositorThreadHolder> mCompositorThreadHolder;
};

View File

@ -111,13 +111,11 @@ public:
, mActorsToDestroy(aDestroyActors)
{
mLayerTransaction->SetAboutToSendAsyncMessages();
ImageBridgeParent::SetAboutToSendAsyncMessages(mLayerTransaction->GetChildProcessId());
}
~AutoLayerTransactionParentAsyncMessageSender()
{
mLayerTransaction->SendPendingAsyncMessages();
ImageBridgeParent::SendPendingAsyncMessages(mLayerTransaction->GetChildProcessId());
if (mActorsToDestroy) {
// Destroy the actors after sending the async messages because the latter may contain
// references to some actors.
@ -409,7 +407,7 @@ LayerTransactionParent::RecvUpdate(const TransactionInfo& aInfo)
}
case Edit::TOpAttachAsyncCompositable: {
const OpAttachAsyncCompositable& op = edit.get_OpAttachAsyncCompositable();
ImageBridgeParent* imageBridge = ImageBridgeParent::GetInstance(OtherPid());
RefPtr<ImageBridgeParent> imageBridge = ImageBridgeParent::GetInstance(OtherPid());
if (!imageBridge) {
return IPC_FAIL_NO_REASON(this);
}

View File

@ -102,6 +102,14 @@ SharedRGBImage::GetTextureClient(KnowsCompositor* aForwarder)
return mTextureClient.get();
}
static void
ReleaseTextureClient(void* aData)
{
RELEASE_MANUALLY(static_cast<TextureClient*>(aData));
}
static gfx::UserDataKey sTextureClientKey;
already_AddRefed<gfx::SourceSurface>
SharedRGBImage::GetAsSourceSurface()
{
@ -127,6 +135,18 @@ SharedRGBImage::GetAsSourceSurface()
}
surface = drawTarget->Snapshot();
if (!surface) {
return nullptr;
}
// The surface may outlive the owning TextureClient. So, we need to ensure
// that the surface keeps the TextureClient alive via a reference held in
// user data. The TextureClient's DrawTarget only has a weak reference to the
// surface, so we won't create any cycles by just referencing the TextureClient.
if (!surface->GetUserData(&sTextureClientKey)) {
surface->AddUserData(&sTextureClientKey, mTextureClient, ReleaseTextureClient);
ADDREF_MANUALLY(mTextureClient);
}
}
mSourceSurface = surface;

View File

@ -641,7 +641,7 @@ WebRenderBridgeParent::RecvAddExternalImageId(const ExternalImageId& aImageId,
MOZ_ASSERT(!mExternalImageIds.Get(wr::AsUint64(aImageId)).get());
ImageBridgeParent* imageBridge = ImageBridgeParent::GetInstance(OtherPid());
RefPtr<ImageBridgeParent> imageBridge = ImageBridgeParent::GetInstance(OtherPid());
if (!imageBridge) {
return IPC_FAIL_NO_REASON(this);
}

View File

@ -55,8 +55,8 @@ class ProfileEntry
// Line number for non-JS entries, the bytecode offset otherwise.
int32_t volatile lineOrPcOffset;
// General purpose storage describing this frame.
uint32_t volatile flags_;
// Flags are in the low bits. The category is in the high bits.
uint32_t volatile flagsAndCategory_;
static int32_t pcToOffset(JSScript* aScript, jsbytecode* aPc);
@ -67,15 +67,15 @@ class ProfileEntry
// a JS frame is assumed by default. You're not allowed to publicly
// change the frame type. Instead, initialize the ProfileEntry as either
// a JS or CPP frame with `initJsFrame` or `initCppFrame` respectively.
IS_CPP_ENTRY = 1 << 0,
IS_CPP_ENTRY = 1u << 0,
// This ProfileEntry is a dummy entry indicating the start of a run
// of JS pseudostack entries.
BEGIN_PSEUDO_JS = 1 << 1,
BEGIN_PSEUDO_JS = 1u << 1,
// This flag is used to indicate that an interpreter JS entry has OSR-ed
// into baseline.
OSR = 1 << 2,
OSR = 1u << 2,
// Union of all flags.
ALL = IS_CPP_ENTRY|BEGIN_PSEUDO_JS|OSR,
@ -86,15 +86,15 @@ class ProfileEntry
// Keep these in sync with devtools/client/performance/modules/categories.js
enum class Category : uint32_t {
OTHER = 0x10,
CSS = 0x20,
JS = 0x40,
GC = 0x80,
CC = 0x100,
NETWORK = 0x200,
GRAPHICS = 0x400,
STORAGE = 0x800,
EVENTS = 0x1000,
OTHER = 1u << 4,
CSS = 1u << 5,
JS = 1u << 6,
GC = 1u << 7,
CC = 1u << 8,
NETWORK = 1u << 9,
GRAPHICS = 1u << 10,
STORAGE = 1u << 11,
EVENTS = 1u << 12,
FIRST = OTHER,
LAST = EVENTS
@ -124,7 +124,7 @@ class ProfileEntry
dynamicString_ = aDynamicString;
spOrScript = sp;
lineOrPcOffset = static_cast<int32_t>(aLine);
flags_ = aFlags | js::ProfileEntry::IS_CPP_ENTRY | uint32_t(aCategory);
flagsAndCategory_ = aFlags | js::ProfileEntry::IS_CPP_ENTRY | uint32_t(aCategory);
}
void initJsFrame(const char* aLabel, const char* aDynamicString, JSScript* aScript,
@ -134,33 +134,23 @@ class ProfileEntry
dynamicString_ = aDynamicString;
spOrScript = aScript;
lineOrPcOffset = pcToOffset(aScript, aPc);
flags_ = uint32_t(js::ProfileEntry::Category::JS); // No flags, just the JS category.
flagsAndCategory_ = uint32_t(js::ProfileEntry::Category::JS); // No flags needed.
}
void setFlag(uint32_t flag) volatile {
MOZ_ASSERT(flag != IS_CPP_ENTRY);
flags_ |= flag;
flagsAndCategory_ |= flag;
}
void unsetFlag(uint32_t flag) volatile {
MOZ_ASSERT(flag != IS_CPP_ENTRY);
flags_ &= ~flag;
flagsAndCategory_ &= ~flag;
}
bool hasFlag(uint32_t flag) const volatile {
return bool(flags_ & flag);
}
uint32_t flags() const volatile {
return flags_;
return bool(flagsAndCategory_ & flag);
}
uint32_t category() const volatile {
return flags_ & CATEGORY_MASK;
}
void setCategory(Category c) volatile {
MOZ_ASSERT(c >= Category::FIRST);
MOZ_ASSERT(c <= Category::LAST);
flags_ &= ~CATEGORY_MASK;
setFlag(uint32_t(c));
return flagsAndCategory_ & CATEGORY_MASK;
}
void setOSR() volatile {
@ -179,7 +169,9 @@ class ProfileEntry
MOZ_ASSERT(!isJs());
return spOrScript;
}
JS_PUBLIC_API(JSScript*) script() const volatile;
uint32_t line() const volatile {
MOZ_ASSERT(!isJs());
return static_cast<uint32_t>(lineOrPcOffset);
@ -193,7 +185,7 @@ class ProfileEntry
// We can't know the layout of JSScript, so look in vm/GeckoProfiler.cpp.
JS_FRIEND_API(jsbytecode*) pc() const volatile;
JS_FRIEND_API(void) setPC(jsbytecode* pc) volatile;
void setPC(jsbytecode* pc) volatile;
void trace(JSTracer* trc) volatile;
@ -201,11 +193,6 @@ class ProfileEntry
// signify a nullptr pc, use a -1 index. This is checked against in
// pc() and setPC() to set/get the right pc.
static const int32_t NullPCOffset = -1;
static size_t offsetOfLabel() { return offsetof(ProfileEntry, label_); }
static size_t offsetOfSpOrScript() { return offsetof(ProfileEntry, spOrScript); }
static size_t offsetOfLineOrPcOffset() { return offsetof(ProfileEntry, lineOrPcOffset); }
static size_t offsetOfFlags() { return offsetof(ProfileEntry, flags_); }
};
JS_FRIEND_API(void)

View File

@ -405,10 +405,6 @@ AutoGeckoProfilerEntry::AutoGeckoProfilerEntry(JSRuntime* rt, const char* label,
}
spBefore_ = profiler_->stackPointer();
profiler_->pseudoStack_->pushCppFrame(
label, /* dynamicString = */ nullptr, /* sp = */ this, /* line = */ 0,
js::ProfileEntry::Category::OTHER, js::ProfileEntry::BEGIN_PSEUDO_JS);
profiler_->pseudoStack_->pushCppFrame(
label, /* dynamicString = */ nullptr, /* sp = */ this, /* line = */ 0, category);
}
@ -418,8 +414,7 @@ AutoGeckoProfilerEntry::~AutoGeckoProfilerEntry()
if (!profiler_)
return;
profiler_->pseudoStack_->pop(); // the C++ frame
profiler_->pseudoStack_->pop(); // the BEGIN_PSEUDO_JS frame
profiler_->pseudoStack_->pop();
MOZ_ASSERT(spBefore_ == profiler_->stackPointer());
}
@ -502,7 +497,7 @@ ProfileEntry::pcToOffset(JSScript* aScript, jsbytecode* aPc) {
return aPc ? aScript->pcToOffset(aPc) : NullPCOffset;
}
JS_FRIEND_API(void)
void
ProfileEntry::setPC(jsbytecode* pc) volatile
{
MOZ_ASSERT(isJs());

View File

@ -347,7 +347,6 @@ Instance::Instance(JSContext* cx,
#ifndef WASM_HUGE_MEMORY
tlsData()->boundsCheckLimit = memory ? memory->buffer().wasmBoundsCheckLimit() : 0;
#endif
tlsData()->globalData = globals_->globalData();
tlsData()->instance = this;
tlsData()->addressOfContext = (JSContext**)object->zone()->group()->addressOfOwnerContext();

View File

@ -1295,9 +1295,6 @@ struct TlsData
uint32_t boundsCheckLimit;
#endif
// Pointer to the global data for this Instance.
uint8_t* globalData;
// Pointer to the Instance that contains this TLS data.
Instance* instance;

View File

@ -391,6 +391,12 @@ ReflowInput::Init(nsPresContext* aPresContext,
mStyleText = mFrame->StyleText();
LayoutFrameType type = mFrame->Type();
if (type == mozilla::LayoutFrameType::Placeholder) {
// Placeholders have a no-op Reflow method that doesn't need the rest of
// this initialization, so we bail out early.
ComputedBSize() = ComputedISize() = 0;
return;
}
InitFrameType(type);
InitCBReflowInput();

View File

@ -110,6 +110,10 @@ nsPlaceholderFrame::Reflow(nsPresContext* aPresContext,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
// NOTE that the ReflowInput passed to this method is not fully initialized,
// on the grounds that reflowing a placeholder is a rather trivial operation.
// (See bug 1367711.)
#ifdef DEBUG
// We should be getting reflowed before our out-of-flow.
// If this is our first reflow, and our out-of-flow has already received its

View File

@ -100547,6 +100547,12 @@
{}
]
],
"html/semantics/embedded-content/the-img-element/adoption.html": [
[
"/html/semantics/embedded-content/the-img-element/adoption.html",
{}
]
],
"html/semantics/embedded-content/the-img-element/current-pixel-density/basic.html": [
[
"/html/semantics/embedded-content/the-img-element/current-pixel-density/basic.html",
@ -188242,6 +188248,10 @@
"2047645c2bdecc90189878cc68e861087d7bd84b",
"testharness"
],
"html/semantics/embedded-content/the-img-element/adoption.html": [
"6786386a825f42b04733a2e91c5e95ea907c00fc",
"testharness"
],
"html/semantics/embedded-content/the-img-element/brokenimg.jpg": [
"200b8085f98203ccf455504727ba9d92203f1080",
"support"

View File

@ -1,3 +0,0 @@
[document-adopt-base-url.html]
type: reftest
expected: FAIL

View File

@ -1,6 +1,4 @@
[zero-area-element-visible.html]
type: testharness
disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1359316
[First rAF should generate a notification.]
disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1335644
disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1335644

View File

@ -0,0 +1,91 @@
<!doctype html>
<meta charset=utf-8>
<title>Adopting an image updates the image data</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
<!-- tests -->
<div id="adoptTest1"></div>
<picture id="adoptTest2">
<source srcset="/images/green-2x2.png">
</picture>
<script>
function resolve(url) {
if (url === "") {
return url;
}
var a = document.createElement('a');
a.href = url;
return a.href;
}
function t(desc, data, expect) {
async_test(function(t) {
var d = (new DOMParser()).parseFromString(data, 'text/html');
var i = d.querySelector('img');
i.onerror = this.unreached_func('got unexpected error event');
i.onload = this.step_func_done(function() {
assert_equals(i.currentSrc, resolve(expect));
});
var n = d.querySelector('[adopt-node]');
document.adoptNode(n);
}, desc);
}
onload = function() {
t('img (src only)',
'<img src="/images/green-1x1.png" adopt-node>',
'/images/green-1x1.png');
t('img (src only), parent is picture',
'<picture adopt-node><img src="/images/green-1x1.png"></picture>',
'/images/green-1x1.png');
t('img (src only), previous sibling is source',
'<picture adopt-node><source srcset="/images/green-1x1.png"><img src="/images/green-2x2.png"></picture>',
'/images/green-1x1.png');
t('img (srcset 1 cand)',
'<img srcset="/images/green-1x1.png" adopt-node>',
'/images/green-1x1.png');
t('img (srcset 1 cand), parent is picture',
'<picture adopt-node><img srcset="/images/green-1x1.png"></picture>',
'/images/green-1x1.png');
t('img (srcset 1 cand), previous sibling is source',
'<picture adopt-node><source srcset="/images/green-1x1.png"><img srcset="/images/green-2x2.png"></picture>',
'/images/green-1x1.png');
async_test(function(t) {
var d = (new DOMParser()).parseFromString('<template><img src="/images/green-1x1.png"></template>', 'text/html');
var i = d.querySelector('template').content.querySelector('img').cloneNode(1);
i.onerror = this.unreached_func('got unexpected error event');
i.onload = this.step_func_done(function() {
assert_equals(i.currentSrc, resolve('/images/green-1x1.png'));
});
document.getElementById('adoptTest1').appendChild(i);
}, 'adopt a cloned img in template');
async_test(function(t) {
var preload = new Image();
preload.src = '/images/green-1x1.png?' + Math.random();
preload.onload = t.step_func(function() {
var d = (new DOMParser()).parseFromString('<img src="' + preload.src + '">', 'text/html');
var i = d.querySelector('img');
i.onerror = this.unreached_func('got unexpected error event');
i.onload = this.step_func_done(function() {
assert_equals(i.currentSrc, resolve("/images/green-2x2.png"));
});
var p = document.getElementById('adoptTest2');
p.appendChild(i);
});
}, 'adoption is from appendChild');
};
</script>

View File

@ -8352,6 +8352,15 @@
"n_values": 50,
"description": "Counts of the maximum number of shared memory buffers used for transferring video frames between the CDM and Gecko processes during playback of DRM'd video. Reported once per CDMVideoDecoder instance, i.e., once per JavaScript SourceBuffer during playback of video using EME."
},
"MEDIA_EME_REQUEST_DEPRECATED_WARNINGS": {
"record_in_processes": ["main", "content"],
"alert_emails": ["cpearce@mozilla.com"],
"bug_numbers": [1368596],
"expires_in_version": "60",
"kind": "enumerated",
"n_values": 10,
"description": "Counts types of deprecation warnings logged on every successful call to navigator.requestMediaKeySystemAccess(). 0=No warnings logged, 1=MediaEMENoCapabilitiesDeprecatedWarning, 2=MediaEMENoCodecsDeprecatedWarning."
},
"MEDIACACHE_WATERMARK_KB": {
"record_in_processes": ["main", "content"],
"alert_emails": ["gsquelart@mozilla.com"],

View File

@ -127,21 +127,21 @@ using UniqueProfilerBacktrace =
#define PROFILER_LABEL(name_space, info, category) \
PROFILER_PLATFORM_TRACING(name_space "::" info) \
mozilla::SamplerStackFrameRAII \
PROFILER_APPEND_LINE_NUMBER(sampler_raii)(name_space "::" info, category, \
__LINE__)
mozilla::ProfilerStackFrameRAII \
PROFILER_APPEND_LINE_NUMBER(profiler_raii)(name_space "::" info, category, \
__LINE__)
#define PROFILER_LABEL_FUNC(category) \
PROFILER_PLATFORM_TRACING(PROFILER_FUNCTION_NAME) \
mozilla::SamplerStackFrameRAII \
PROFILER_APPEND_LINE_NUMBER(sampler_raii)(PROFILER_FUNCTION_NAME, category, \
__LINE__)
mozilla::ProfilerStackFrameRAII \
PROFILER_APPEND_LINE_NUMBER(profiler_raii)(PROFILER_FUNCTION_NAME, category, \
__LINE__)
#define PROFILER_LABEL_DYNAMIC(name_space, info, category, str) \
PROFILER_PLATFORM_TRACING(name_space "::" info) \
mozilla::SamplerStackFrameDynamicRAII \
PROFILER_APPEND_LINE_NUMBER(sampler_raii)(name_space "::" info, category, \
__LINE__, str)
mozilla::ProfilerStackFrameDynamicRAII \
PROFILER_APPEND_LINE_NUMBER(profiler_raii)(name_space "::" info, category, \
__LINE__, str)
#define PROFILER_MARKER(info) profiler_add_marker(info)
#define PROFILER_MARKER_PAYLOAD(info, payload) \
@ -410,7 +410,7 @@ extern MOZ_THREAD_LOCAL(PseudoStack*) sPseudoStack;
//
// A short-lived, non-owning PseudoStack reference is created between each
// profiler_call_enter() / profiler_call_exit() call pair. RAII objects (e.g.
// SamplerStackFrameRAII) ensure that these calls are balanced. Furthermore,
// ProfilerStackFrameRAII) ensure that these calls are balanced. Furthermore,
// the RAII objects exist within the thread itself, which means they are
// necessarily bounded by the lifetime of the thread, which ensures that the
// references held can't be used after the PseudoStack is destroyed.
@ -502,18 +502,18 @@ void profiler_add_marker(const char *aMarker,
namespace mozilla {
class MOZ_RAII SamplerStackFrameRAII {
class MOZ_RAII ProfilerStackFrameRAII {
public:
// We only copy the strings at save time, so to take multiple parameters we'd
// need to copy them then.
SamplerStackFrameRAII(const char *aInfo,
ProfilerStackFrameRAII(const char *aInfo,
js::ProfileEntry::Category aCategory, uint32_t line
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
{
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
mHandle = profiler_call_enter(aInfo, aCategory, this, line);
}
~SamplerStackFrameRAII() {
~ProfilerStackFrameRAII() {
profiler_call_exit(mHandle);
}
private:
@ -521,9 +521,9 @@ private:
void* mHandle;
};
class MOZ_RAII SamplerStackFrameDynamicRAII {
class MOZ_RAII ProfilerStackFrameDynamicRAII {
public:
SamplerStackFrameDynamicRAII(const char* aInfo,
ProfilerStackFrameDynamicRAII(const char* aInfo,
js::ProfileEntry::Category aCategory, uint32_t aLine,
const char* aDynamicString)
{
@ -531,7 +531,7 @@ public:
aDynamicString);
}
~SamplerStackFrameDynamicRAII() {
~ProfilerStackFrameDynamicRAII() {
profiler_call_exit(mHandle);
}

View File

@ -476,9 +476,9 @@ TEST(GeckoProfiler, PseudoStack)
}
#if defined(MOZ_GECKO_PROFILER)
SamplerStackFrameRAII raii1("A", js::ProfileEntry::Category::STORAGE, 888);
SamplerStackFrameDynamicRAII raii2("A", js::ProfileEntry::Category::STORAGE,
888, dynamic.get());
ProfilerStackFrameRAII raii1("A", js::ProfileEntry::Category::STORAGE, 888);
ProfilerStackFrameDynamicRAII raii2("A", js::ProfileEntry::Category::STORAGE,
888, dynamic.get());
void* handle = profiler_call_enter("A", js::ProfileEntry::Category::NETWORK,
this, 999);
ASSERT_TRUE(profiler_get_backtrace());