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 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; var version, build;
{ {
exports.version = version = '1.8.384'; exports.version = version = '1.8.398';
exports.build = build = '8d55e6a0'; exports.build = build = '96377832';
} }
exports.getDocument = getDocument; exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort; exports.LoopbackPort = LoopbackPort;
@ -4408,8 +4408,8 @@ if (!_util.globalScope.PDFJS) {
} }
var PDFJS = _util.globalScope.PDFJS; var PDFJS = _util.globalScope.PDFJS;
{ {
PDFJS.version = '1.8.384'; PDFJS.version = '1.8.398';
PDFJS.build = '8d55e6a0'; PDFJS.build = '96377832';
} }
PDFJS.pdfBug = false; PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) { if (PDFJS.verbosity !== undefined) {
@ -6740,8 +6740,8 @@ exports.TilingPattern = TilingPattern;
"use strict"; "use strict";
var pdfjsVersion = '1.8.384'; var pdfjsVersion = '1.8.398';
var pdfjsBuild = '8d55e6a0'; var pdfjsBuild = '96377832';
var pdfjsSharedUtil = __w_pdfjs_require__(0); var pdfjsSharedUtil = __w_pdfjs_require__(0);
var pdfjsDisplayGlobal = __w_pdfjs_require__(8); var pdfjsDisplayGlobal = __w_pdfjs_require__(8);
var pdfjsDisplayAPI = __w_pdfjs_require__(3); var pdfjsDisplayAPI = __w_pdfjs_require__(3);
@ -6777,6 +6777,7 @@ exports.createBlob = pdfjsSharedUtil.createBlob;
exports.RenderingCancelledException = pdfjsDisplayDOMUtils.RenderingCancelledException; exports.RenderingCancelledException = pdfjsDisplayDOMUtils.RenderingCancelledException;
exports.getFilenameFromUrl = pdfjsDisplayDOMUtils.getFilenameFromUrl; exports.getFilenameFromUrl = pdfjsDisplayDOMUtils.getFilenameFromUrl;
exports.addLinkAttributes = pdfjsDisplayDOMUtils.addLinkAttributes; exports.addLinkAttributes = pdfjsDisplayDOMUtils.addLinkAttributes;
exports.StatTimer = pdfjsSharedUtil.StatTimer;
/***/ }), /***/ }),
/* 14 */ /* 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 targetArea = targetRect.width * targetRect.height;
double intersectionArea = !intersectionRect ? double intersectionArea = !intersectionRect ?
0 : intersectionRect->width * intersectionRect->height; 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; size_t threshold = -1;
if (intersectionRatio > 0.0) { if (intersectionRatio > 0.0) {

View File

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

View File

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

View File

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

View File

@ -663,7 +663,7 @@ HTMLImageElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
if (LoadingEnabled() && if (LoadingEnabled() &&
OwnerDoc()->IsCurrentActiveDocument()) { OwnerDoc()->IsCurrentActiveDocument()) {
nsContentUtils::AddScriptRunner( 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); nsImageLoadingContent::UnbindFromTree(aDeep, aNullParent);
nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent); nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
} }
@ -724,7 +722,7 @@ HTMLImageElement::UpdateFormOwner()
} }
void void
HTMLImageElement::MaybeLoadImage() HTMLImageElement::MaybeLoadImage(bool aAlwaysForceLoad)
{ {
// Our base URI may have changed, or we may have had responsive parameters // 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, // 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. // Note, check LoadingEnabled() after LoadImage call.
LoadSelectedImage(false, true, false); LoadSelectedImage(aAlwaysForceLoad, /* aNotify */ true, aAlwaysForceLoad);
if (!LoadingEnabled()) { if (!LoadingEnabled()) {
CancelImageRequests(true); CancelImageRequests(true);
@ -750,8 +748,18 @@ void
HTMLImageElement::NodeInfoChanged(nsIDocument* aOldDoc) HTMLImageElement::NodeInfoChanged(nsIDocument* aOldDoc)
{ {
nsGenericHTMLElement::NodeInfoChanged(aOldDoc); nsGenericHTMLElement::NodeInfoChanged(aOldDoc);
// Resetting the last selected source if adoption steps are run. // Force reload image if adoption steps are run.
mLastSelectedSource = nullptr; // 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 // static
@ -873,7 +881,7 @@ HTMLImageElement::CopyInnerTo(Element* aDest, bool aPreallocateChildren)
mUseUrgentStartForChannel = EventStateManager::IsHandlingUserInput(); mUseUrgentStartForChannel = EventStateManager::IsHandlingUserInput();
nsContentUtils::AddScriptRunner( 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); nsresult CopyInnerTo(Element* aDest, bool aPreallocateChildren);
void MaybeLoadImage(); void MaybeLoadImage(bool aAlwaysForceLoad);
bool IsMap() 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. 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. # 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. 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" # LOCALIZATION NOTE: Do not translate "DOMException", "code" and "name"
DOMExceptionCodeWarning=Use of DOMExceptions code attribute is deprecated. Use name instead. DOMExceptionCodeWarning=Use of DOMExceptions code attribute is deprecated. Use name instead.
# LOCALIZATION NOTE: Do not translate "__exposedProps__" # LOCALIZATION NOTE: Do not translate "__exposedProps__"

View File

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

View File

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

View File

@ -18,6 +18,10 @@
#include "nsCocoaFeatures.h" #include "nsCocoaFeatures.h"
#endif #endif
#include "nsPrintfCString.h" #include "nsPrintfCString.h"
#include "nsContentUtils.h"
#include "nsIScriptError.h"
#include "mozilla/Unused.h"
#include "nsDataHashtable.h"
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
@ -165,17 +169,54 @@ MediaKeySystemAccessManager::Request(DetailedPromise* aPromise,
return; 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 = bool isPrivateBrowsing =
mWindow->GetExtantDoc() && mWindow->GetExtantDoc() &&
mWindow->GetExtantDoc()->NodePrincipal()->GetPrivateBrowsingId() > 0; mWindow->GetExtantDoc()->NodePrincipal()->GetPrivateBrowsingId() > 0;
MediaKeySystemConfiguration config; MediaKeySystemConfiguration config;
if (MediaKeySystemAccess::GetSupportedConfig( if (MediaKeySystemAccess::GetSupportedConfig(
aKeySystem, aConfigs, config, &diagnostics, isPrivateBrowsing)) { aKeySystem, aConfigs, config, &diagnostics, isPrivateBrowsing, deprecationWarningLogFn)) {
RefPtr<MediaKeySystemAccess> access( RefPtr<MediaKeySystemAccess> access(
new MediaKeySystemAccess(mWindow, aKeySystem, config)); new MediaKeySystemAccess(mWindow, aKeySystem, config));
aPromise->MaybeResolve(access); aPromise->MaybeResolve(access);
diagnostics.StoreMediaKeySystemAccess(mWindow->GetExtantDoc(), diagnostics.StoreMediaKeySystemAccess(mWindow->GetExtantDoc(),
aKeySystem, true, __func__); 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; return;
} }
// Not to inform user, because nothing to do if the corresponding keySystem // Not to inform user, because nothing to do if the corresponding keySystem

View File

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

View File

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

View File

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

View File

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

View File

@ -102,6 +102,14 @@ SharedRGBImage::GetTextureClient(KnowsCompositor* aForwarder)
return mTextureClient.get(); return mTextureClient.get();
} }
static void
ReleaseTextureClient(void* aData)
{
RELEASE_MANUALLY(static_cast<TextureClient*>(aData));
}
static gfx::UserDataKey sTextureClientKey;
already_AddRefed<gfx::SourceSurface> already_AddRefed<gfx::SourceSurface>
SharedRGBImage::GetAsSourceSurface() SharedRGBImage::GetAsSourceSurface()
{ {
@ -127,6 +135,18 @@ SharedRGBImage::GetAsSourceSurface()
} }
surface = drawTarget->Snapshot(); 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; mSourceSurface = surface;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -391,6 +391,12 @@ ReflowInput::Init(nsPresContext* aPresContext,
mStyleText = mFrame->StyleText(); mStyleText = mFrame->StyleText();
LayoutFrameType type = mFrame->Type(); 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); InitFrameType(type);
InitCBReflowInput(); InitCBReflowInput();

View File

@ -110,6 +110,10 @@ nsPlaceholderFrame::Reflow(nsPresContext* aPresContext,
const ReflowInput& aReflowInput, const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) 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 #ifdef DEBUG
// We should be getting reflowed before our out-of-flow. // 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 // 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": [
[ [
"/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", "2047645c2bdecc90189878cc68e861087d7bd84b",
"testharness" "testharness"
], ],
"html/semantics/embedded-content/the-img-element/adoption.html": [
"6786386a825f42b04733a2e91c5e95ea907c00fc",
"testharness"
],
"html/semantics/embedded-content/the-img-element/brokenimg.jpg": [ "html/semantics/embedded-content/the-img-element/brokenimg.jpg": [
"200b8085f98203ccf455504727ba9d92203f1080", "200b8085f98203ccf455504727ba9d92203f1080",
"support" "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] [zero-area-element-visible.html]
type: testharness type: testharness
disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1359316 disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1335644
[First rAF should generate a notification.]
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, "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." "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": { "MEDIACACHE_WATERMARK_KB": {
"record_in_processes": ["main", "content"], "record_in_processes": ["main", "content"],
"alert_emails": ["gsquelart@mozilla.com"], "alert_emails": ["gsquelart@mozilla.com"],

View File

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

View File

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