summaryrefslogtreecommitdiffstats
path: root/dom/html
diff options
context:
space:
mode:
Diffstat (limited to 'dom/html')
-rw-r--r--dom/html/HTMLCanvasElement.cpp71
-rw-r--r--dom/html/HTMLCanvasElement.h8
-rw-r--r--dom/html/HTMLFormControlsCollection.cpp1
-rw-r--r--dom/html/HTMLFormElement.cpp11
-rw-r--r--dom/html/HTMLImageElement.cpp2
-rw-r--r--dom/html/HTMLInputElement.cpp10
-rw-r--r--dom/html/HTMLMediaElement.cpp361
-rw-r--r--dom/html/HTMLMediaElement.h84
-rw-r--r--dom/html/HTMLOptionsCollection.cpp51
-rw-r--r--dom/html/HTMLOptionsCollection.h9
-rw-r--r--dom/html/HTMLSelectElement.cpp5
-rw-r--r--dom/html/HTMLSelectElement.h2
-rw-r--r--dom/html/HTMLTableElement.cpp15
-rw-r--r--dom/html/HTMLTableSectionElement.cpp2
-rw-r--r--dom/html/ImageDocument.cpp19
-rw-r--r--dom/html/ImageDocument.h3
-rw-r--r--dom/html/PluginDocument.cpp2
-rw-r--r--dom/html/TextTrackManager.cpp37
-rw-r--r--dom/html/TextTrackManager.h15
-rw-r--r--dom/html/VideoDocument.cpp2
-rw-r--r--dom/html/nsDOMStringMap.cpp1
-rw-r--r--dom/html/nsGenericHTMLElement.h7
-rw-r--r--dom/html/nsTextEditorState.cpp19
-rw-r--r--dom/html/test/mochitest.ini1
-rw-r--r--dom/html/test/test_document.watch.html129
25 files changed, 78 insertions, 789 deletions
diff --git a/dom/html/HTMLCanvasElement.cpp b/dom/html/HTMLCanvasElement.cpp
index 88b41bce0..4b5deab18 100644
--- a/dom/html/HTMLCanvasElement.cpp
+++ b/dom/html/HTMLCanvasElement.cpp
@@ -42,7 +42,6 @@
#include "nsRefreshDriver.h"
#include "nsStreamUtils.h"
#include "ActiveLayerTracker.h"
-#include "VRManagerChild.h"
#include "WebGL1Context.h"
#include "WebGL2Context.h"
@@ -358,7 +357,6 @@ NS_IMPL_ISUPPORTS(HTMLCanvasElementObserver, nsIObserver)
HTMLCanvasElement::HTMLCanvasElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
: nsGenericHTMLElement(aNodeInfo),
mResetLayer(true) ,
- mVRPresentationActive(false),
mWriteOnly(false)
{}
@@ -554,17 +552,23 @@ HTMLCanvasElement::CopyInnerTo(Element* aDest)
HTMLCanvasElement* dest = static_cast<HTMLCanvasElement*>(aDest);
dest->mOriginalCanvas = this;
- nsCOMPtr<nsISupports> cxt;
- dest->GetContext(NS_LITERAL_STRING("2d"), getter_AddRefs(cxt));
- RefPtr<CanvasRenderingContext2D> context2d =
- static_cast<CanvasRenderingContext2D*>(cxt.get());
- if (context2d && !mPrintCallback) {
- CanvasImageSource source;
- source.SetAsHTMLCanvasElement() = this;
- ErrorResult err;
- context2d->DrawImage(source,
- 0.0, 0.0, err);
- rv = err.StealNSResult();
+ // We make sure that the canvas is not zero sized since that would cause
+ // the DrawImage call below to return an error, which would cause printing
+ // to fail.
+ nsIntSize size = GetWidthHeight();
+ if (size.height > 0 && size.width > 0) {
+ nsCOMPtr<nsISupports> cxt;
+ dest->GetContext(NS_LITERAL_STRING("2d"), getter_AddRefs(cxt));
+ RefPtr<CanvasRenderingContext2D> context2d =
+ static_cast<CanvasRenderingContext2D*>(cxt.get());
+ if (context2d && !mPrintCallback) {
+ CanvasImageSource source;
+ source.SetAsHTMLCanvasElement() = this;
+ ErrorResult err;
+ context2d->DrawImage(source,
+ 0.0, 0.0, err);
+ rv = err.StealNSResult();
+ }
}
}
return rv;
@@ -1002,7 +1006,7 @@ HTMLCanvasElement::GetSize()
}
bool
-HTMLCanvasElement::IsWriteOnly()
+HTMLCanvasElement::IsWriteOnly() const
{
return mWriteOnly;
}
@@ -1111,7 +1115,7 @@ HTMLCanvasElement::GetCanvasLayer(nsDisplayListBuilder* aBuilder,
static uint8_t sOffscreenCanvasLayerUserDataDummy = 0;
if (mCurrentContext) {
- return mCurrentContext->GetCanvasLayer(aBuilder, aOldLayer, aManager, mVRPresentationActive);
+ return mCurrentContext->GetCanvasLayer(aBuilder, aOldLayer, aManager);
}
if (mOffscreenCanvas) {
@@ -1441,42 +1445,5 @@ HTMLCanvasElement::InvalidateFromAsyncCanvasRenderer(AsyncCanvasRenderer *aRende
element->InvalidateCanvasContent(nullptr);
}
-void
-HTMLCanvasElement::StartVRPresentation()
-{
- WebGLContext* webgl = static_cast<WebGLContext*>(GetContextAtIndex(0));
- if (!webgl) {
- return;
- }
-
- if (!webgl->StartVRPresentation()) {
- return;
- }
-
- mVRPresentationActive = true;
-}
-
-void
-HTMLCanvasElement::StopVRPresentation()
-{
- mVRPresentationActive = false;
-}
-
-already_AddRefed<layers::SharedSurfaceTextureClient>
-HTMLCanvasElement::GetVRFrame()
-{
- if (GetCurrentContextType() != CanvasContextType::WebGL1 &&
- GetCurrentContextType() != CanvasContextType::WebGL2) {
- return nullptr;
- }
-
- WebGLContext* webgl = static_cast<WebGLContext*>(GetContextAtIndex(0));
- if (!webgl) {
- return nullptr;
- }
-
- return webgl->GetVRFrame();
-}
-
} // namespace dom
} // namespace mozilla
diff --git a/dom/html/HTMLCanvasElement.h b/dom/html/HTMLCanvasElement.h
index 81c141d3c..e77db6ff1 100644
--- a/dom/html/HTMLCanvasElement.h
+++ b/dom/html/HTMLCanvasElement.h
@@ -224,9 +224,9 @@ public:
nsIntSize GetSize();
/**
- * Determine whether the canvas is write-only.
+ * Determine whether the canvas is write-only (tainted).
*/
- bool IsWriteOnly();
+ bool IsWriteOnly() const;
/**
* Force the canvas to be write-only.
@@ -350,10 +350,6 @@ public:
static void SetAttrFromAsyncCanvasRenderer(AsyncCanvasRenderer *aRenderer);
static void InvalidateFromAsyncCanvasRenderer(AsyncCanvasRenderer *aRenderer);
- void StartVRPresentation();
- void StopVRPresentation();
- already_AddRefed<layers::SharedSurfaceTextureClient> GetVRFrame();
-
protected:
virtual ~HTMLCanvasElement();
diff --git a/dom/html/HTMLFormControlsCollection.cpp b/dom/html/HTMLFormControlsCollection.cpp
index d91a6b5de..77fafae99 100644
--- a/dom/html/HTMLFormControlsCollection.cpp
+++ b/dom/html/HTMLFormControlsCollection.cpp
@@ -134,7 +134,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(HTMLFormControlsCollection)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(HTMLFormControlsCollection)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mNameLookupTable)
- NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(HTMLFormControlsCollection)
NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
diff --git a/dom/html/HTMLFormElement.cpp b/dom/html/HTMLFormElement.cpp
index 5164391f8..6bea19a2b 100644
--- a/dom/html/HTMLFormElement.cpp
+++ b/dom/html/HTMLFormElement.cpp
@@ -38,7 +38,6 @@
// form submission
#include "HTMLFormSubmissionConstants.h"
#include "mozilla/dom/FormData.h"
-#include "mozilla/Telemetry.h"
#include "nsIFormSubmitObserver.h"
#include "nsIObserverService.h"
#include "nsICategoryManager.h"
@@ -52,7 +51,6 @@
#include "nsIWebProgress.h"
#include "nsIDocShell.h"
#include "nsIPrompt.h"
-#include "nsISecurityUITelemetry.h"
#include "nsIStringBundle.h"
// radio buttons
@@ -955,15 +953,6 @@ HTMLFormElement::DoSecureToInsecureSubmitCheck(nsIURI* aActionURL,
return rv;
}
*aCancelSubmit = (buttonPressed == 1);
- uint32_t telemetryBucket =
- nsISecurityUITelemetry::WARNING_CONFIRM_POST_TO_INSECURE_FROM_SECURE;
- mozilla::Telemetry::Accumulate(mozilla::Telemetry::SECURITY_UI,
- telemetryBucket);
- if (!*aCancelSubmit) {
- // The user opted to continue, so note that in the next telemetry bucket.
- mozilla::Telemetry::Accumulate(mozilla::Telemetry::SECURITY_UI,
- telemetryBucket + 1);
- }
return NS_OK;
}
diff --git a/dom/html/HTMLImageElement.cpp b/dom/html/HTMLImageElement.cpp
index 4b2e7a07b..fab1cdef4 100644
--- a/dom/html/HTMLImageElement.cpp
+++ b/dom/html/HTMLImageElement.cpp
@@ -1345,8 +1345,6 @@ HTMLImageElement::FlushUseCounters()
nsCOMPtr<imgIContainer> container;
request->GetImage(getter_AddRefs(container));
-
- static_cast<image::Image*>(container.get())->ReportUseCounters();
}
} // namespace dom
diff --git a/dom/html/HTMLInputElement.cpp b/dom/html/HTMLInputElement.cpp
index e9086933b..0b879bb9b 100644
--- a/dom/html/HTMLInputElement.cpp
+++ b/dom/html/HTMLInputElement.cpp
@@ -24,7 +24,6 @@
#include "nsIPhonetic.h"
#include "HTMLFormSubmissionConstants.h"
-#include "mozilla/Telemetry.h"
#include "nsIControllers.h"
#include "nsIStringBundle.h"
#include "nsFocusManager.h"
@@ -1275,10 +1274,6 @@ HTMLInputElement::BeforeSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
container->RadioRequiredWillChange(name, !!aValue);
}
}
-
- if (aName == nsGkAtoms::webkitdirectory) {
- Telemetry::Accumulate(Telemetry::WEBKIT_DIRECTORY_USED, true);
- }
}
return nsGenericHTMLFormElementWithState::BeforeSetAttr(aNameSpaceID, aName,
@@ -4989,10 +4984,6 @@ HTMLInputElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
true);
dispatcher->PostDOMEvent();
}
-
-#ifdef EARLY_BETA_OR_EARLIER
- Telemetry::Accumulate(Telemetry::PWMGR_PASSWORD_INPUT_IN_FORM, !!mForm);
-#endif
}
return rv;
@@ -8863,7 +8854,6 @@ HTMLInputElement::UpdateEntries(const nsTArray<OwningFileOrDirectory>& aFilesOrD
void
HTMLInputElement::GetWebkitEntries(nsTArray<RefPtr<FileSystemEntry>>& aSequence)
{
- Telemetry::Accumulate(Telemetry::BLINK_FILESYSTEM_USED, true);
aSequence.AppendElements(mEntries);
}
diff --git a/dom/html/HTMLMediaElement.cpp b/dom/html/HTMLMediaElement.cpp
index 3954e6208..050d1ac69 100644
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -92,7 +92,6 @@
#include "mozilla/dom/VideoTrackList.h"
#include "mozilla/dom/TextTrack.h"
#include "nsIContentPolicy.h"
-#include "mozilla/Telemetry.h"
#include "DecoderDoctorDiagnostics.h"
#include "DecoderTraits.h"
#include "MediaContentType.h"
@@ -1038,14 +1037,6 @@ void HTMLMediaElement::ShutdownDecoder()
void HTMLMediaElement::AbortExistingLoads()
{
-#ifdef MOZ_EME
- // If there is no existing decoder then we don't have anything to
- // report. This prevents reporting the initial load from an
- // empty video element as a failed EME load.
- if (mDecoder) {
- ReportEMETelemetry();
- }
-#endif
// Abort any already-running instance of the resource selection algorithm.
mLoadWaitStatus = NOT_WAITING;
@@ -1901,8 +1892,6 @@ NS_IMETHODIMP HTMLMediaElement::GetCurrentTime(double* aCurrentTime)
void
HTMLMediaElement::FastSeek(double aTime, ErrorResult& aRv)
{
- LOG(LogLevel::Debug, ("Reporting telemetry VIDEO_FASTSEEK_USED"));
- Telemetry::Accumulate(Telemetry::VIDEO_FASTSEEK_USED, 1);
RefPtr<Promise> tobeDropped = Seek(aTime, SeekTarget::PrevSyncPoint, aRv);
}
@@ -3156,10 +3145,6 @@ HTMLMediaElement::~HTMLMediaElement()
if (mProgressTimer) {
StopProgress();
}
- if (mVideoDecodeSuspendTimer) {
- mVideoDecodeSuspendTimer->Cancel();
- mVideoDecodeSuspendTimer = nullptr;
- }
if (mSrcStream) {
EndSrcMediaStreamPlayback();
}
@@ -3650,228 +3635,6 @@ nsresult HTMLMediaElement::BindToTree(nsIDocument* aDocument, nsIContent* aParen
return rv;
}
-/* static */
-void HTMLMediaElement::VideoDecodeSuspendTimerCallback(nsITimer* aTimer, void* aClosure)
-{
- MOZ_ASSERT(NS_IsMainThread());
- auto element = static_cast<HTMLMediaElement*>(aClosure);
- element->mVideoDecodeSuspendTime.Start();
- element->mVideoDecodeSuspendTimer = nullptr;
-}
-
-void HTMLMediaElement::HiddenVideoStart()
-{
- MOZ_ASSERT(NS_IsMainThread());
- mHiddenPlayTime.Start();
- if (mVideoDecodeSuspendTimer) {
- // Already started, just keep it running.
- return;
- }
- mVideoDecodeSuspendTimer = do_CreateInstance("@mozilla.org/timer;1");
- mVideoDecodeSuspendTimer->InitWithNamedFuncCallback(
- VideoDecodeSuspendTimerCallback, this,
- MediaPrefs::MDSMSuspendBackgroundVideoDelay(), nsITimer::TYPE_ONE_SHOT,
- "HTMLMediaElement::VideoDecodeSuspendTimerCallback");
-}
-
-void HTMLMediaElement::HiddenVideoStop()
-{
- MOZ_ASSERT(NS_IsMainThread());
- mHiddenPlayTime.Pause();
- mVideoDecodeSuspendTime.Pause();
- if (!mVideoDecodeSuspendTimer) {
- return;
- }
- mVideoDecodeSuspendTimer->Cancel();
- mVideoDecodeSuspendTimer = nullptr;
-}
-
-#ifdef MOZ_EME
-void
-HTMLMediaElement::ReportEMETelemetry()
-{
- // Report telemetry for EME videos when a page is unloaded.
- NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
- if (mIsEncrypted && Preferences::GetBool("media.eme.enabled")) {
- Telemetry::Accumulate(Telemetry::VIDEO_EME_PLAY_SUCCESS, mLoadedDataFired);
- LOG(LogLevel::Debug, ("%p VIDEO_EME_PLAY_SUCCESS = %s",
- this, mLoadedDataFired ? "true" : "false"));
- }
-}
-#endif
-
-void
-HTMLMediaElement::ReportTelemetry()
-{
- // Report telemetry for videos when a page is unloaded. We
- // want to know data on what state the video is at when
- // the user has exited.
- enum UnloadedState {
- ENDED = 0,
- PAUSED = 1,
- STALLED = 2,
- SEEKING = 3,
- OTHER = 4
- };
-
- UnloadedState state = OTHER;
- if (Seeking()) {
- state = SEEKING;
- }
- else if (Ended()) {
- state = ENDED;
- }
- else if (Paused()) {
- state = PAUSED;
- }
- else {
- // For buffering we check if the current playback position is at the end
- // of a buffered range, within a margin of error. We also consider to be
- // buffering if the last frame status was buffering and the ready state is
- // HAVE_CURRENT_DATA to account for times where we are in a buffering state
- // regardless of what actual data we have buffered.
- bool stalled = false;
- RefPtr<TimeRanges> ranges = Buffered();
- const double errorMargin = 0.05;
- double t = CurrentTime();
- TimeRanges::index_type index = ranges->Find(t, errorMargin);
- ErrorResult ignore;
- stalled = index != TimeRanges::NoIndex &&
- (ranges->End(index, ignore) - t) < errorMargin;
- stalled |= mDecoder && NextFrameStatus() == MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE_BUFFERING &&
- mReadyState == HTMLMediaElement::HAVE_CURRENT_DATA;
- if (stalled) {
- state = STALLED;
- }
- }
-
- Telemetry::Accumulate(Telemetry::VIDEO_UNLOAD_STATE, state);
- LOG(LogLevel::Debug, ("%p VIDEO_UNLOAD_STATE = %d", this, state));
-
- FrameStatisticsData data;
-
- if (HTMLVideoElement* vid = HTMLVideoElement::FromContentOrNull(this)) {
- FrameStatistics* stats = vid->GetFrameStatistics();
- if (stats) {
- data = stats->GetFrameStatisticsData();
- if (data.mParsedFrames) {
- MOZ_ASSERT(data.mDroppedFrames <= data.mParsedFrames);
- // Dropped frames <= total frames, so 'percentage' cannot be higher than
- // 100 and therefore can fit in a uint32_t (that Telemetry takes).
- uint32_t percentage = 100 * data.mDroppedFrames / data.mParsedFrames;
- LOG(LogLevel::Debug,
- ("Reporting telemetry DROPPED_FRAMES_IN_VIDEO_PLAYBACK"));
- Telemetry::Accumulate(Telemetry::VIDEO_DROPPED_FRAMES_PROPORTION,
- percentage);
- }
- }
- }
-
- if (mMediaInfo.HasVideo() &&
- mMediaInfo.mVideo.mImage.height > 0) {
- // We have a valid video.
- double playTime = mPlayTime.Total();
- double hiddenPlayTime = mHiddenPlayTime.Total();
- double videoDecodeSuspendTime = mVideoDecodeSuspendTime.Total();
-
- Telemetry::Accumulate(Telemetry::VIDEO_PLAY_TIME_MS, SECONDS_TO_MS(playTime));
- LOG(LogLevel::Debug, ("%p VIDEO_PLAY_TIME_MS = %f", this, playTime));
-
- Telemetry::Accumulate(Telemetry::VIDEO_HIDDEN_PLAY_TIME_MS, SECONDS_TO_MS(hiddenPlayTime));
- LOG(LogLevel::Debug, ("%p VIDEO_HIDDEN_PLAY_TIME_MS = %f", this, hiddenPlayTime));
-
- if (playTime > 0.0) {
- // We have actually played something -> Report some valid-video telemetry.
-
- // Keyed by audio+video or video alone, and by a resolution range.
- nsCString key(mMediaInfo.HasAudio() ? "AV," : "V,");
- static const struct { int32_t mH; const char* mRes; } sResolutions[] = {
- { 240, "0<h<=240" },
- { 480, "240<h<=480" },
- { 576, "480<h<=576" },
- { 720, "576<h<=720" },
- { 1080, "720<h<=1080" },
- { 2160, "1080<h<=2160" }
- };
- const char* resolution = "h>2160";
- int32_t height = mMediaInfo.mVideo.mImage.height;
- for (const auto& res : sResolutions) {
- if (height <= res.mH) {
- resolution = res.mRes;
- break;
- }
- }
- key.AppendASCII(resolution);
-
- uint32_t hiddenPercentage = uint32_t(hiddenPlayTime / playTime * 100.0 + 0.5);
- Telemetry::Accumulate(Telemetry::VIDEO_HIDDEN_PLAY_TIME_PERCENTAGE,
- key,
- hiddenPercentage);
- // Also accumulate all percentages in an "All" key.
- Telemetry::Accumulate(Telemetry::VIDEO_HIDDEN_PLAY_TIME_PERCENTAGE,
- NS_LITERAL_CSTRING("All"),
- hiddenPercentage);
- LOG(LogLevel::Debug, ("%p VIDEO_HIDDEN_PLAY_TIME_PERCENTAGE = %u, keys: '%s' and 'All'",
- this, hiddenPercentage, key.get()));
-
- uint32_t videoDecodeSuspendPercentage =
- uint32_t(videoDecodeSuspendTime / playTime * 100.0 + 0.5);
- Telemetry::Accumulate(Telemetry::VIDEO_INFERRED_DECODE_SUSPEND_PERCENTAGE,
- key,
- videoDecodeSuspendPercentage);
- Telemetry::Accumulate(Telemetry::VIDEO_INFERRED_DECODE_SUSPEND_PERCENTAGE,
- NS_LITERAL_CSTRING("All"),
- videoDecodeSuspendPercentage);
- LOG(LogLevel::Debug, ("%p VIDEO_INFERRED_DECODE_SUSPEND_PERCENTAGE = %u, keys: '%s' and 'All'",
- this, videoDecodeSuspendPercentage, key.get()));
-
- if (data.mInterKeyframeCount != 0) {
- uint32_t average_ms =
- uint32_t(std::min<uint64_t>(double(data.mInterKeyframeSum_us)
- / double(data.mInterKeyframeCount)
- / 1000.0
- + 0.5,
- UINT32_MAX));
- Telemetry::Accumulate(Telemetry::VIDEO_INTER_KEYFRAME_AVERAGE_MS,
- key,
- average_ms);
- Telemetry::Accumulate(Telemetry::VIDEO_INTER_KEYFRAME_AVERAGE_MS,
- NS_LITERAL_CSTRING("All"),
- average_ms);
- LOG(LogLevel::Debug, ("%p VIDEO_INTER_KEYFRAME_AVERAGE_MS = %u, keys: '%s' and 'All'",
- this, average_ms, key.get()));
-
- uint32_t max_ms =
- uint32_t(std::min<uint64_t>((data.mInterKeyFrameMax_us + 500) / 1000,
- UINT32_MAX));
- Telemetry::Accumulate(Telemetry::VIDEO_INTER_KEYFRAME_MAX_MS,
- key,
- max_ms);
- Telemetry::Accumulate(Telemetry::VIDEO_INTER_KEYFRAME_MAX_MS,
- NS_LITERAL_CSTRING("All"),
- max_ms);
- LOG(LogLevel::Debug, ("%p VIDEO_INTER_KEYFRAME_MAX_MS = %u, keys: '%s' and 'All'",
- this, max_ms, key.get()));
- } else {
- // Here, we have played *some* of the video, but didn't get more than 1
- // keyframe. Report '0' if we have played for longer than the video-
- // decode-suspend delay (showing recovery would be difficult).
- uint32_t suspendDelay_ms = MediaPrefs::MDSMSuspendBackgroundVideoDelay();
- if (uint32_t(playTime * 1000.0) > suspendDelay_ms) {
- Telemetry::Accumulate(Telemetry::VIDEO_INTER_KEYFRAME_MAX_MS,
- key,
- 0);
- Telemetry::Accumulate(Telemetry::VIDEO_INTER_KEYFRAME_MAX_MS,
- NS_LITERAL_CSTRING("All"),
- 0);
- LOG(LogLevel::Debug, ("%p VIDEO_INTER_KEYFRAME_MAX_MS = 0 (only 1 keyframe), keys: '%s' and 'All'",
- this, key.get()));
- }
- }
- }
- }
-}
-
void HTMLMediaElement::UnbindFromTree(bool aDeep,
bool aNullParent)
{
@@ -5351,19 +5114,6 @@ nsresult HTMLMediaElement::DispatchAsyncEvent(const nsAString& aName)
nsCOMPtr<nsIRunnable> event = new nsAsyncEventRunner(aName, this);
NS_DispatchToMainThread(event);
- if ((aName.EqualsLiteral("play") || aName.EqualsLiteral("playing"))) {
- mPlayTime.Start();
- if (IsHidden()) {
- HiddenVideoStart();
- }
- } else if (aName.EqualsLiteral("waiting")) {
- mPlayTime.Pause();
- HiddenVideoStop();
- } else if (aName.EqualsLiteral("pause")) {
- mPlayTime.Pause();
- HiddenVideoStop();
- }
-
return NS_OK;
}
@@ -5489,11 +5239,6 @@ void HTMLMediaElement::SuspendOrResumeElement(bool aPauseElement, bool aSuspendE
UpdateSrcMediaStreamPlaying();
UpdateAudioChannelPlayingState();
if (aPauseElement) {
- ReportTelemetry();
-#ifdef MOZ_EME
- ReportEMETelemetry();
-#endif
-
#ifdef MOZ_EME
// For EME content, we may force destruction of the CDM client (and CDM
// instance if this is the last client for that CDM instance) and
@@ -5545,13 +5290,6 @@ bool HTMLMediaElement::IsBeingDestroyed()
void HTMLMediaElement::NotifyOwnerDocumentActivityChanged()
{
bool visible = !IsHidden();
- if (visible) {
- // Visible -> Just pause hidden play time (no-op if already paused).
- HiddenVideoStop();
- } else if (mPlayTime.IsStarted()) {
- // Not visible, play time is running -> Start hidden play time if needed.
- HiddenVideoStart();
- }
if (mDecoder && !IsBeingDestroyed()) {
mDecoder->NotifyOwnerActivityChanged(visible);
@@ -6327,18 +6065,10 @@ HTMLMediaElement::OnVisibilityChange(Visibility aNewVisibility)
break;
}
case Visibility::APPROXIMATELY_NONVISIBLE: {
- if (mPlayTime.IsStarted()) {
- // Not visible, play time is running -> Start hidden play time if needed.
- HiddenVideoStart();
- }
-
mDecoder->NotifyOwnerActivityChanged(false);
break;
}
case Visibility::APPROXIMATELY_VISIBLE: {
- // Visible -> Just pause hidden play time (no-op if already paused).
- HiddenVideoStop();
-
mDecoder->NotifyOwnerActivityChanged(true);
break;
}
@@ -6860,97 +6590,6 @@ HTMLMediaElement::MarkAsContentSource(CallerAPI aAPI)
{
const bool isVisible = mVisibilityState != Visibility::APPROXIMATELY_NONVISIBLE;
- if (isVisible) {
- // 0 = ALL_VISIBLE
- Telemetry::Accumulate(Telemetry::VIDEO_AS_CONTENT_SOURCE, 0);
- } else {
- // 1 = ALL_INVISIBLE
- Telemetry::Accumulate(Telemetry::VIDEO_AS_CONTENT_SOURCE, 1);
-
- if (IsInUncomposedDoc()) {
- // 0 = ALL_IN_TREE
- Telemetry::Accumulate(Telemetry::VIDEO_AS_CONTENT_SOURCE_IN_TREE_OR_NOT, 0);
- } else {
- // 1 = ALL_NOT_IN_TREE
- Telemetry::Accumulate(Telemetry::VIDEO_AS_CONTENT_SOURCE_IN_TREE_OR_NOT, 1);
- }
- }
-
- switch (aAPI) {
- case CallerAPI::DRAW_IMAGE: {
- if (isVisible) {
- // 2 = drawImage_VISIBLE
- Telemetry::Accumulate(Telemetry::VIDEO_AS_CONTENT_SOURCE, 2);
- } else {
- // 3 = drawImage_INVISIBLE
- Telemetry::Accumulate(Telemetry::VIDEO_AS_CONTENT_SOURCE, 3);
-
- if (IsInUncomposedDoc()) {
- // 2 = drawImage_IN_TREE
- Telemetry::Accumulate(Telemetry::VIDEO_AS_CONTENT_SOURCE_IN_TREE_OR_NOT, 2);
- } else {
- // 3 = drawImage_NOT_IN_TREE
- Telemetry::Accumulate(Telemetry::VIDEO_AS_CONTENT_SOURCE_IN_TREE_OR_NOT, 3);
- }
- }
- break;
- }
- case CallerAPI::CREATE_PATTERN: {
- if (isVisible) {
- // 4 = createPattern_VISIBLE
- Telemetry::Accumulate(Telemetry::VIDEO_AS_CONTENT_SOURCE, 4);
- } else {
- // 5 = createPattern_INVISIBLE
- Telemetry::Accumulate(Telemetry::VIDEO_AS_CONTENT_SOURCE, 5);
-
- if (IsInUncomposedDoc()) {
- // 4 = createPattern_IN_TREE
- Telemetry::Accumulate(Telemetry::VIDEO_AS_CONTENT_SOURCE_IN_TREE_OR_NOT, 4);
- } else {
- // 5 = createPattern_NOT_IN_TREE
- Telemetry::Accumulate(Telemetry::VIDEO_AS_CONTENT_SOURCE_IN_TREE_OR_NOT, 5);
- }
- }
- break;
- }
- case CallerAPI::CREATE_IMAGEBITMAP: {
- if (isVisible) {
- // 6 = createImageBitmap_VISIBLE
- Telemetry::Accumulate(Telemetry::VIDEO_AS_CONTENT_SOURCE, 6);
- } else {
- // 7 = createImageBitmap_INVISIBLE
- Telemetry::Accumulate(Telemetry::VIDEO_AS_CONTENT_SOURCE, 7);
-
- if (IsInUncomposedDoc()) {
- // 6 = createImageBitmap_IN_TREE
- Telemetry::Accumulate(Telemetry::VIDEO_AS_CONTENT_SOURCE_IN_TREE_OR_NOT, 6);
- } else {
- // 7 = createImageBitmap_NOT_IN_TREE
- Telemetry::Accumulate(Telemetry::VIDEO_AS_CONTENT_SOURCE_IN_TREE_OR_NOT, 7);
- }
- }
- break;
- }
- case CallerAPI::CAPTURE_STREAM: {
- if (isVisible) {
- // 8 = captureStream_VISIBLE
- Telemetry::Accumulate(Telemetry::VIDEO_AS_CONTENT_SOURCE, 8);
- } else {
- // 9 = captureStream_INVISIBLE
- Telemetry::Accumulate(Telemetry::VIDEO_AS_CONTENT_SOURCE, 9);
-
- if (IsInUncomposedDoc()) {
- // 8 = captureStream_IN_TREE
- Telemetry::Accumulate(Telemetry::VIDEO_AS_CONTENT_SOURCE_IN_TREE_OR_NOT, 8);
- } else {
- // 9 = captureStream_NOT_IN_TREE
- Telemetry::Accumulate(Telemetry::VIDEO_AS_CONTENT_SOURCE_IN_TREE_OR_NOT, 9);
- }
- }
- break;
- }
- }
-
LOG(LogLevel::Debug,
("%p Log VIDEO_AS_CONTENT_SOURCE: visibility = %u, API: '%d' and 'All'",
this, isVisible, aAPI));
diff --git a/dom/html/HTMLMediaElement.h b/dom/html/HTMLMediaElement.h
index af944a318..899e8449a 100644
--- a/dom/html/HTMLMediaElement.h
+++ b/dom/html/HTMLMediaElement.h
@@ -1195,29 +1195,6 @@ protected:
return isPaused;
}
- /**
- * Video has been playing while hidden and, if feature was enabled, would
- * trigger suspending decoder.
- * Used to track hidden-video-decode-suspend telemetry.
- */
- static void VideoDecodeSuspendTimerCallback(nsITimer* aTimer, void* aClosure);
- /**
- * Video is now both: playing and hidden.
- * Used to track hidden-video telemetry.
- */
- void HiddenVideoStart();
- /**
- * Video is not playing anymore and/or has become visible.
- * Used to track hidden-video telemetry.
- */
- void HiddenVideoStop();
-
-#ifdef MOZ_EME
- void ReportEMETelemetry();
-#endif
-
- void ReportTelemetry();
-
// Check the permissions for audiochannel.
bool CheckAudioChannelPermissions(const nsAString& aType);
@@ -1484,9 +1461,6 @@ protected:
// Timer used for updating progress events.
nsCOMPtr<nsITimer> mProgressTimer;
- // Timer used to simulate video-suspend.
- nsCOMPtr<nsITimer> mVideoDecodeSuspendTimer;
-
#ifdef MOZ_EME
// Encrypted Media Extension media keys.
RefPtr<MediaKeys> mMediaKeys;
@@ -1688,65 +1662,7 @@ protected:
// before attaching to the DOM tree.
bool mUnboundFromTree = false;
-public:
- // Helper class to measure times for MSE telemetry stats
- class TimeDurationAccumulator
- {
- public:
- TimeDurationAccumulator()
- : mCount(0)
- {}
- void Start()
- {
- if (IsStarted()) {
- return;
- }
- mStartTime = TimeStamp::Now();
- }
- void Pause()
- {
- if (!IsStarted()) {
- return;
- }
- mSum += (TimeStamp::Now() - mStartTime);
- mCount++;
- mStartTime = TimeStamp();
- }
- bool IsStarted() const
- {
- return !mStartTime.IsNull();
- }
- double Total() const
- {
- if (!IsStarted()) {
- return mSum.ToSeconds();
- }
- // Add current running time until now, but keep it running.
- return (mSum + (TimeStamp::Now() - mStartTime)).ToSeconds();
- }
- uint32_t Count() const
- {
- if (!IsStarted()) {
- return mCount;
- }
- // Count current run in this report, without increasing the stored count.
- return mCount + 1;
- }
- private:
- TimeStamp mStartTime;
- TimeDuration mSum;
- uint32_t mCount;
- };
private:
- // Total time a video has spent playing.
- TimeDurationAccumulator mPlayTime;
-
- // Total time a video has spent playing while hidden.
- TimeDurationAccumulator mHiddenPlayTime;
-
- // Total time a video has (or would have) spent in video-decode-suspend mode.
- TimeDurationAccumulator mVideoDecodeSuspendTime;
-
// Indicates if user has interacted with the element.
// Used to block autoplay when disabled.
bool mHasUserInteraction;
diff --git a/dom/html/HTMLOptionsCollection.cpp b/dom/html/HTMLOptionsCollection.cpp
index 294493c0c..67de97fc4 100644
--- a/dom/html/HTMLOptionsCollection.cpp
+++ b/dom/html/HTMLOptionsCollection.cpp
@@ -35,23 +35,8 @@ namespace mozilla {
namespace dom {
HTMLOptionsCollection::HTMLOptionsCollection(HTMLSelectElement* aSelect)
-{
- // Do not maintain a reference counted reference. When
- // the select goes away, it will let us know.
- mSelect = aSelect;
-}
-
-HTMLOptionsCollection::~HTMLOptionsCollection()
-{
- DropReference();
-}
-
-void
-HTMLOptionsCollection::DropReference()
-{
- // Drop our (non ref-counted) reference
- mSelect = nullptr;
-}
+ : mSelect(aSelect)
+{}
nsresult
HTMLOptionsCollection::GetOptionIndex(Element* aOption,
@@ -88,7 +73,9 @@ HTMLOptionsCollection::GetOptionIndex(Element* aOption,
}
-NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(HTMLOptionsCollection, mElements)
+NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(HTMLOptionsCollection,
+ mElements,
+ mSelect)
// nsISupports
@@ -124,10 +111,6 @@ HTMLOptionsCollection::GetLength(uint32_t* aLength)
NS_IMETHODIMP
HTMLOptionsCollection::SetLength(uint32_t aLength)
{
- if (!mSelect) {
- return NS_ERROR_UNEXPECTED;
- }
-
return mSelect->SetLength(aLength);
}
@@ -135,10 +118,6 @@ NS_IMETHODIMP
HTMLOptionsCollection::SetOption(uint32_t aIndex,
nsIDOMHTMLOptionElement* aOption)
{
- if (!mSelect) {
- return NS_OK;
- }
-
// if the new option is null, just remove this option. Note that it's safe
// to pass a too-large aIndex in here.
if (!aOption) {
@@ -187,11 +166,6 @@ HTMLOptionsCollection::SetOption(uint32_t aIndex,
int32_t
HTMLOptionsCollection::GetSelectedIndex(ErrorResult& aError)
{
- if (!mSelect) {
- aError.Throw(NS_ERROR_UNEXPECTED);
- return 0;
- }
-
int32_t selectedIndex;
aError = mSelect->GetSelectedIndex(&selectedIndex);
return selectedIndex;
@@ -209,11 +183,6 @@ void
HTMLOptionsCollection::SetSelectedIndex(int32_t aSelectedIndex,
ErrorResult& aError)
{
- if (!mSelect) {
- aError.Throw(NS_ERROR_UNEXPECTED);
- return;
- }
-
aError = mSelect->SetSelectedIndex(aSelectedIndex);
}
@@ -339,22 +308,12 @@ HTMLOptionsCollection::Add(const HTMLOptionOrOptGroupElement& aElement,
const Nullable<HTMLElementOrLong>& aBefore,
ErrorResult& aError)
{
- if (!mSelect) {
- aError.Throw(NS_ERROR_NOT_INITIALIZED);
- return;
- }
-
mSelect->Add(aElement, aBefore, aError);
}
void
HTMLOptionsCollection::Remove(int32_t aIndex, ErrorResult& aError)
{
- if (!mSelect) {
- aError.Throw(NS_ERROR_UNEXPECTED);
- return;
- }
-
uint32_t len = 0;
mSelect->GetLength(&len);
if (aIndex < 0 || (uint32_t)aIndex >= len)
diff --git a/dom/html/HTMLOptionsCollection.h b/dom/html/HTMLOptionsCollection.h
index 21123b3d2..496919555 100644
--- a/dom/html/HTMLOptionsCollection.h
+++ b/dom/html/HTMLOptionsCollection.h
@@ -46,7 +46,7 @@ public:
using nsWrapperCache::GetWrapper;
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
protected:
- virtual ~HTMLOptionsCollection();
+ virtual ~HTMLOptionsCollection() = default;
virtual JSObject* GetWrapperPreserveColorInternal() override
{
@@ -113,11 +113,6 @@ public:
}
/**
- * Drop the reference to the select. Called during select destruction.
- */
- void DropReference();
-
- /**
* Finds the index of a given option element.
* If the option isn't part of the collection, return NS_ERROR_FAILURE
* without setting aIndex.
@@ -161,7 +156,7 @@ private:
* various members such as InsertOptionAt are also infallible. */
nsTArray<RefPtr<mozilla::dom::HTMLOptionElement> > mElements;
/** The select element that contains this array */
- HTMLSelectElement* mSelect;
+ RefPtr<HTMLSelectElement> mSelect;
};
} // namespace dom
diff --git a/dom/html/HTMLSelectElement.cpp b/dom/html/HTMLSelectElement.cpp
index 53f42317a..9ba0a1efe 100644
--- a/dom/html/HTMLSelectElement.cpp
+++ b/dom/html/HTMLSelectElement.cpp
@@ -130,11 +130,6 @@ HTMLSelectElement::HTMLSelectElement(already_AddRefed<mozilla::dom::NodeInfo>& a
NS_EVENT_STATE_VALID);
}
-HTMLSelectElement::~HTMLSelectElement()
-{
- mOptions->DropReference();
-}
-
// ISupports
NS_IMPL_CYCLE_COLLECTION_CLASS(HTMLSelectElement)
diff --git a/dom/html/HTMLSelectElement.h b/dom/html/HTMLSelectElement.h
index 8a25385de..dc1075cd7 100644
--- a/dom/html/HTMLSelectElement.h
+++ b/dom/html/HTMLSelectElement.h
@@ -436,7 +436,7 @@ public:
void SetOpenInParentProcess(bool aVal);
protected:
- virtual ~HTMLSelectElement();
+ virtual ~HTMLSelectElement() = default;
friend class SafeOptionListMutation;
diff --git a/dom/html/HTMLTableElement.cpp b/dom/html/HTMLTableElement.cpp
index ec1b7cecb..c5b7696cf 100644
--- a/dom/html/HTMLTableElement.cpp
+++ b/dom/html/HTMLTableElement.cpp
@@ -421,11 +421,10 @@ HTMLTableElement::CreateTHead()
void
HTMLTableElement::DeleteTHead()
{
- HTMLTableSectionElement* tHead = GetTHead();
+ RefPtr<HTMLTableSectionElement> tHead = GetTHead();
if (tHead) {
- mozilla::ErrorResult rv;
+ mozilla::IgnoredErrorResult rv;
nsINode::RemoveChild(*tHead, rv);
- MOZ_ASSERT(!rv.Failed());
}
}
@@ -452,11 +451,10 @@ HTMLTableElement::CreateTFoot()
void
HTMLTableElement::DeleteTFoot()
{
- HTMLTableSectionElement* tFoot = GetTFoot();
+ RefPtr<HTMLTableSectionElement> tFoot = GetTFoot();
if (tFoot) {
- mozilla::ErrorResult rv;
+ mozilla::IgnoredErrorResult rv;
nsINode::RemoveChild(*tFoot, rv);
- MOZ_ASSERT(!rv.Failed());
}
}
@@ -483,11 +481,10 @@ HTMLTableElement::CreateCaption()
void
HTMLTableElement::DeleteCaption()
{
- HTMLTableCaptionElement* caption = GetCaption();
+ RefPtr<HTMLTableCaptionElement> caption = GetCaption();
if (caption) {
- mozilla::ErrorResult rv;
+ mozilla::IgnoredErrorResult rv;
nsINode::RemoveChild(*caption, rv);
- MOZ_ASSERT(!rv.Failed());
}
}
diff --git a/dom/html/HTMLTableSectionElement.cpp b/dom/html/HTMLTableSectionElement.cpp
index c7b0665dd..e99597636 100644
--- a/dom/html/HTMLTableSectionElement.cpp
+++ b/dom/html/HTMLTableSectionElement.cpp
@@ -122,7 +122,7 @@ HTMLTableSectionElement::DeleteRow(int32_t aValue, ErrorResult& aError)
refIndex = (uint32_t)aValue;
}
- nsINode* row = rows->Item(refIndex);
+ nsCOMPtr<nsINode> row = rows->Item(refIndex);
if (!row) {
aError.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
return;
diff --git a/dom/html/ImageDocument.cpp b/dom/html/ImageDocument.cpp
index 200bb5d46..451d989c3 100644
--- a/dom/html/ImageDocument.cpp
+++ b/dom/html/ImageDocument.cpp
@@ -40,12 +40,14 @@
#include "nsThreadUtils.h"
#include "nsIScrollableFrame.h"
#include "nsContentUtils.h"
+#include "nsCSSParser.h" // for CSS colors on the background
#include "mozilla/dom/Element.h"
#include "mozilla/Preferences.h"
#include <algorithm>
#define AUTOMATIC_IMAGE_RESIZING_PREF "browser.enable_automatic_image_resizing"
#define CLICK_IMAGE_RESIZING_PREF "browser.enable_click_image_resizing"
+#define STANDALONE_IMAGE_BACKGROUND_COLOR_PREF "browser.display.standalone_images.background_color"
//XXX A hack needed for Firefox's site specific zoom.
#define SITE_SPECIFIC_ZOOM "browser.zoom.siteSpecific"
@@ -170,6 +172,8 @@ ImageDocument::Init()
mClickResizingEnabled = Preferences::GetBool(CLICK_IMAGE_RESIZING_PREF);
mShouldResize = mResizeImageByDefault;
mFirstResize = true;
+
+ mBackgroundColor = Preferences::GetString(STANDALONE_IMAGE_BACKGROUND_COLOR_PREF);
return NS_OK;
}
@@ -655,7 +659,7 @@ ImageDocument::CreateSyntheticDocument()
NS_ENSURE_SUCCESS(rv, rv);
// Add the image element
- Element* body = GetBodyElement();
+ RefPtr<Element> body = GetBodyElement();
if (!body) {
NS_WARNING("no body on image document!");
return NS_ERROR_FAILURE;
@@ -682,9 +686,22 @@ ImageDocument::CreateSyntheticDocument()
mImageContent->SetAttr(kNameSpaceID_None, nsGkAtoms::src, srcString, false);
mImageContent->SetAttr(kNameSpaceID_None, nsGkAtoms::alt, srcString, false);
+ // Implement mechanism for custom background color from pref.
+ if (!mBackgroundColor.IsEmpty()) {
+ nsCSSValue color;
+ nsCSSParser parser;
+ if (parser.ParseColorString(mBackgroundColor, nullptr, 0, color)) {
+ nsAutoString styleAttr(NS_LITERAL_STRING("background-color: "));
+ styleAttr.Append(mBackgroundColor);
+ body->SetAttr(kNameSpaceID_None, nsGkAtoms::style, styleAttr, false);
+ }
+ }
+
body->AppendChildTo(mImageContent, false);
imageLoader->SetLoadingEnabled(true);
+ UpdateTitleAndCharset();
+
return NS_OK;
}
diff --git a/dom/html/ImageDocument.h b/dom/html/ImageDocument.h
index fdf2a00a8..945317314 100644
--- a/dom/html/ImageDocument.h
+++ b/dom/html/ImageDocument.h
@@ -112,6 +112,9 @@ protected:
float mVisibleHeight;
int32_t mImageWidth;
int32_t mImageHeight;
+
+ // Holds the custom background color for stand-alone images
+ nsAutoString mBackgroundColor;
bool mResizeImageByDefault;
bool mClickResizingEnabled;
diff --git a/dom/html/PluginDocument.cpp b/dom/html/PluginDocument.cpp
index 1c923ecc6..f6be8a915 100644
--- a/dom/html/PluginDocument.cpp
+++ b/dom/html/PluginDocument.cpp
@@ -206,7 +206,7 @@ PluginDocument::CreateSyntheticPluginDocument()
NS_ENSURE_SUCCESS(rv, rv);
// then attach our plugin
- Element* body = GetBodyElement();
+ RefPtr<Element> body = GetBodyElement();
if (!body) {
NS_WARNING("no body on plugin document!");
return NS_ERROR_FAILURE;
diff --git a/dom/html/TextTrackManager.cpp b/dom/html/TextTrackManager.cpp
index 8110dab29..7f9d32794 100644
--- a/dom/html/TextTrackManager.cpp
+++ b/dom/html/TextTrackManager.cpp
@@ -12,7 +12,6 @@
#include "mozilla/dom/TextTrackCue.h"
#include "mozilla/dom/Event.h"
#include "mozilla/ClearOnShutdown.h"
-#include "mozilla/Telemetry.h"
#include "nsComponentManagerUtils.h"
#include "nsVariant.h"
#include "nsVideoFrame.h"
@@ -30,6 +29,13 @@ namespace dom {
NS_IMPL_ISUPPORTS(TextTrackManager::ShutdownObserverProxy, nsIObserver);
+void
+TextTrackManager::ShutdownObserverProxy::Unregister()
+{
+ nsContentUtils::UnregisterShutdownObserver(this);
+ mManager = nullptr;
+}
+
CompareTextTracks::CompareTextTracks(HTMLMediaElement* aMediaElement)
{
mMediaElement = aMediaElement;
@@ -112,7 +118,6 @@ TextTrackManager::TextTrackManager(HTMLMediaElement *aMediaElement)
, mTimeMarchesOnDispatched(false)
, mUpdateCueDisplayDispatched(false)
, performedTrackSelection(false)
- , mCueTelemetryReported(false)
, mShutdown(false)
{
nsISupports* parentObject =
@@ -138,7 +143,7 @@ TextTrackManager::TextTrackManager(HTMLMediaElement *aMediaElement)
TextTrackManager::~TextTrackManager()
{
WEBVTT_LOG("%p ~TextTrackManager",this);
- nsContentUtils::UnregisterShutdownObserver(mShutdownProxy);
+ mShutdownProxy->Unregister();
}
TextTrackList*
@@ -164,7 +169,6 @@ TextTrackManager::AddTextTrack(TextTrackKind aKind, const nsAString& aLabel,
mTextTracks->AddTextTrack(aKind, aLabel, aLanguage, aMode, aReadyState,
aTextTrackSource, CompareTextTracks(mMediaElement));
AddCues(track);
- ReportTelemetryForTrack(track);
if (aTextTrackSource == TextTrackSource::Track) {
RefPtr<nsIRunnable> task =
@@ -184,7 +188,6 @@ TextTrackManager::AddTextTrack(TextTrack* aTextTrack)
WEBVTT_LOG("%p AddTextTrack TextTrack %p",this, aTextTrack);
mTextTracks->AddTextTrack(aTextTrack, CompareTextTracks(mMediaElement));
AddCues(aTextTrack);
- ReportTelemetryForTrack(aTextTrack);
if (aTextTrack->GetTextTrackSource() == TextTrackSource::Track) {
RefPtr<nsIRunnable> task =
@@ -303,7 +306,6 @@ TextTrackManager::NotifyCueAdded(TextTrackCue& aCue)
mNewCues->AddCue(aCue);
}
DispatchTimeMarchesOn();
- ReportTelemetryForCue();
}
void
@@ -821,28 +823,5 @@ TextTrackManager::NotifyReset()
mLastTimeMarchesOnCalled = 0.0;
}
-void
-TextTrackManager::ReportTelemetryForTrack(TextTrack* aTextTrack) const
-{
- MOZ_ASSERT(NS_IsMainThread());
- MOZ_ASSERT(aTextTrack);
- MOZ_ASSERT(mTextTracks->Length() > 0);
-
- TextTrackKind kind = aTextTrack->Kind();
- Telemetry::Accumulate(Telemetry::WEBVTT_TRACK_KINDS, uint32_t(kind));
-}
-
-void
-TextTrackManager::ReportTelemetryForCue()
-{
- MOZ_ASSERT(NS_IsMainThread());
- MOZ_ASSERT(!mNewCues->IsEmpty() || !mLastActiveCues->IsEmpty());
-
- if (!mCueTelemetryReported) {
- Telemetry::Accumulate(Telemetry::WEBVTT_USED_VTT_CUES, 1);
- mCueTelemetryReported = true;
- }
-}
-
} // namespace dom
} // namespace mozilla
diff --git a/dom/html/TextTrackManager.h b/dom/html/TextTrackManager.h
index d20707346..2375aa4bb 100644
--- a/dom/html/TextTrackManager.h
+++ b/dom/html/TextTrackManager.h
@@ -148,13 +148,6 @@ private:
nsTArray<TextTrack*>& aTextTracks);
bool TrackIsDefault(TextTrack* aTextTrack);
- void ReportTelemetryForTrack(TextTrack* aTextTrack) const;
- void ReportTelemetryForCue();
-
- // If there is at least one cue has been added to the cue list once, we would
- // report the usage of cue to Telemetry.
- bool mCueTelemetryReported;
-
class ShutdownObserverProxy final : public nsIObserver
{
NS_DECL_ISUPPORTS
@@ -170,11 +163,15 @@ private:
{
MOZ_ASSERT(NS_IsMainThread());
if (strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0) {
- nsContentUtils::UnregisterShutdownObserver(this);
- mManager->NotifyShutdown();
+ if (mManager) {
+ mManager->NotifyShutdown();
+ }
+ Unregister();
}
return NS_OK;
}
+
+ void Unregister();
private:
~ShutdownObserverProxy() {};
diff --git a/dom/html/VideoDocument.cpp b/dom/html/VideoDocument.cpp
index 1bd898564..76b2e326f 100644
--- a/dom/html/VideoDocument.cpp
+++ b/dom/html/VideoDocument.cpp
@@ -90,7 +90,7 @@ VideoDocument::CreateSyntheticVideoDocument(nsIChannel* aChannel,
nsresult rv = MediaDocument::CreateSyntheticDocument();
NS_ENSURE_SUCCESS(rv, rv);
- Element* body = GetBodyElement();
+ RefPtr<Element> body = GetBodyElement();
if (!body) {
NS_WARNING("no body on video document!");
return NS_ERROR_FAILURE;
diff --git a/dom/html/nsDOMStringMap.cpp b/dom/html/nsDOMStringMap.cpp
index 42725bc6f..6d2bc424d 100644
--- a/dom/html/nsDOMStringMap.cpp
+++ b/dom/html/nsDOMStringMap.cpp
@@ -19,7 +19,6 @@ using namespace mozilla::dom;
NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMStringMap)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDOMStringMap)
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mElement)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
diff --git a/dom/html/nsGenericHTMLElement.h b/dom/html/nsGenericHTMLElement.h
index 0635c27e1..24a7a3652 100644
--- a/dom/html/nsGenericHTMLElement.h
+++ b/dom/html/nsGenericHTMLElement.h
@@ -396,13 +396,6 @@ public:
}
NS_IMETHOD InsertAdjacentHTML(const nsAString& position,
const nsAString& text) final override;
- NS_IMETHOD ScrollIntoView(bool top, uint8_t _argc) final override {
- if (!_argc) {
- top = true;
- }
- mozilla::dom::Element::ScrollIntoView(top);
- return NS_OK;
- }
NS_IMETHOD GetOffsetParent(nsIDOMElement** aOffsetParent)
final override {
mozilla::dom::Element* offsetParent = GetOffsetParent();
diff --git a/dom/html/nsTextEditorState.cpp b/dom/html/nsTextEditorState.cpp
index 187afb66d..25be6016c 100644
--- a/dom/html/nsTextEditorState.cpp
+++ b/dom/html/nsTextEditorState.cpp
@@ -47,7 +47,6 @@
#include "mozilla/dom/HTMLInputElement.h"
#include "nsNumberControlFrame.h"
#include "nsFrameSelection.h"
-#include "mozilla/Telemetry.h"
#include "mozilla/layers/ScrollInputMethods.h"
using namespace mozilla;
@@ -585,9 +584,6 @@ nsTextInputSelectionImpl::CompleteScroll(bool aForward)
if (!mScrollFrame)
return NS_ERROR_NOT_INITIALIZED;
- mozilla::Telemetry::Accumulate(mozilla::Telemetry::SCROLL_INPUT_METHODS,
- (uint32_t) ScrollInputMethod::MainThreadCompleteScroll);
-
mScrollFrame->ScrollBy(nsIntPoint(0, aForward ? 1 : -1),
nsIScrollableFrame::WHOLE,
nsIScrollableFrame::INSTANT);
@@ -640,9 +636,6 @@ nsTextInputSelectionImpl::ScrollPage(bool aForward)
if (!mScrollFrame)
return NS_ERROR_NOT_INITIALIZED;
- mozilla::Telemetry::Accumulate(mozilla::Telemetry::SCROLL_INPUT_METHODS,
- (uint32_t) ScrollInputMethod::MainThreadScrollPage);
-
mScrollFrame->ScrollBy(nsIntPoint(0, aForward ? 1 : -1),
nsIScrollableFrame::PAGES,
nsIScrollableFrame::SMOOTH);
@@ -655,9 +648,6 @@ nsTextInputSelectionImpl::ScrollLine(bool aForward)
if (!mScrollFrame)
return NS_ERROR_NOT_INITIALIZED;
- mozilla::Telemetry::Accumulate(mozilla::Telemetry::SCROLL_INPUT_METHODS,
- (uint32_t) ScrollInputMethod::MainThreadScrollLine);
-
mScrollFrame->ScrollBy(nsIntPoint(0, aForward ? 1 : -1),
nsIScrollableFrame::LINES,
nsIScrollableFrame::SMOOTH);
@@ -670,9 +660,6 @@ nsTextInputSelectionImpl::ScrollCharacter(bool aRight)
if (!mScrollFrame)
return NS_ERROR_NOT_INITIALIZED;
- mozilla::Telemetry::Accumulate(mozilla::Telemetry::SCROLL_INPUT_METHODS,
- (uint32_t) ScrollInputMethod::MainThreadScrollCharacter);
-
mScrollFrame->ScrollBy(nsIntPoint(aRight ? 1 : -1, 0),
nsIScrollableFrame::LINES,
nsIScrollableFrame::SMOOTH);
@@ -2268,7 +2255,11 @@ nsTextEditorState::UpdatePlaceholderText(bool aNotify)
nsCOMPtr<nsIContent> content = do_QueryInterface(mTextCtrlElement);
content->GetAttr(kNameSpaceID_None, nsGkAtoms::placeholder, placeholderValue);
- nsContentUtils::RemoveNewlines(placeholderValue);
+ if (mTextCtrlElement->IsTextArea()) { // <textarea>s preserve newlines...
+ nsContentUtils::PlatformToDOMLineBreaks(placeholderValue);
+ } else { // ...<input>s don't
+ nsContentUtils::RemoveNewlines(placeholderValue);
+ }
NS_ASSERTION(mPlaceholderDiv->GetFirstChild(), "placeholder div has no child");
mPlaceholderDiv->GetFirstChild()->SetText(placeholderValue, aNotify);
}
diff --git a/dom/html/test/mochitest.ini b/dom/html/test/mochitest.ini
index 0c0ba847c..1059bc5d0 100644
--- a/dom/html/test/mochitest.ini
+++ b/dom/html/test/mochitest.ini
@@ -553,7 +553,6 @@ skip-if = true # Disabled for timeouts.
[test_viewport.html]
[test_documentAll.html]
[test_document-element-inserted.html]
-[test_document.watch.html]
[test_bug445004.html]
skip-if = true || toolkit == 'android' # Disabled permanently (bug 559932).
[test_bug446483.html]
diff --git a/dom/html/test/test_document.watch.html b/dom/html/test/test_document.watch.html
deleted file mode 100644
index 54509823b..000000000
--- a/dom/html/test/test_document.watch.html
+++ /dev/null
@@ -1,129 +0,0 @@
-<!DOCTYPE html>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=903332
--->
-<head>
- <meta charset="utf-8">
- <title>Test for Bug 903332</title>
- <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
- <script type="application/javascript">
-
- /** Test for Bug 903332 **/
-
- var watch1Called;
- function watch1(prop, oldValue, newValue)
- {
- is(watch1Called, false, "watch1Called not reset properly?");
- watch1Called = true;
-
- is(prop, "cookie", "wrong property name passed to watch1");
- return newValue;
- }
-
- var watch2Called;
- function watch2(prop, oldValue, newValue)
- {
- is(watch2Called, false, "watch2Called not reset properly?");
- watch2Called = true;
-
- is(prop, "cookie", "wrong property name passed to watch2");
- return newValue;
- }
-
- // Just in case subsequent tests depend on a particular value...
- var originalValue = document.cookie;
- ok(true, "originalValue: " + originalValue);
-
- var originalPrefix = originalValue.length > 0 ? originalValue + "; " : "";
-
- try
- {
- // trial set (no watch) to verify things work
- document.cookie = "first=set";
- is(document.cookie, originalPrefix + "first=set",
- "first value correct");
-
- // add a watch
- document.watch("cookie", watch1);
-
- // set, check for watch invoked
- watch1Called = false;
- document.cookie = "second=set";
- is(watch1Called, true, "watch1 function should be called");
- is(document.cookie, originalPrefix + "first=set; second=set",
- "second value correct");
-
- // and a second time, just in case
- watch1Called = false;
- document.cookie = "third=set";
- is(watch1Called, true, "watch1 function should be called");
- is(document.cookie, originalPrefix + "first=set; second=set; third=set",
- "third value correct");
-
- // overwrite the current watch with a new one
- document.watch("cookie", watch2);
-
- // set, check for watch invoked
- watch1Called = false;
- watch2Called = false;
- document.cookie = "fourth=set";
- is(watch1Called, false, "watch1 invoked erroneously");
- is(watch2Called, true, "watch2 function should be called");
- is(document.cookie, originalPrefix + "first=set; second=set; third=set; fourth=set",
- "fourth value correct");
-
- // and a second time, just in case
- watch1Called = false;
- watch2Called = false;
- document.cookie = "fifth=set";
- is(watch1Called, false, "watch1 invoked erroneously");
- is(watch2Called, true, "watch2 function should be called");
- is(document.cookie, originalPrefix + "first=set; second=set; third=set; fourth=set; fifth=set",
- "fifth value correct");
-
- // remove the watch
- document.unwatch("cookie");
-
- // check for non-invocation now
- watch1Called = false;
- watch2Called = false;
- document.cookie = "sixth=set";
- is(watch1Called, false, "watch1 shouldn't be called");
- is(watch2Called, false, "watch2 shouldn't be called");
- is(document.cookie, originalPrefix + "first=set; second=set; third=set; fourth=set; fifth=set; sixth=set",
- "sixth value correct");
- }
- finally
- {
- // reset
- document.unwatch("cookie"); // harmless, should be no-op except if bugs
-
- var d = new Date();
- d.setTime(0);
- var suffix = "=; expires=" + d.toGMTString();
-
- document.cookie = "first" + suffix;
- document.cookie = "second" + suffix;
- document.cookie = "third" + suffix;
- document.cookie = "fourth" + suffix;
- document.cookie = "fifth" + suffix;
- document.cookie = "sixth" + suffix;
- }
-
- is(document.cookie, originalValue,
- "document.cookie isn't what it was initially! expect bustage further " +
- "down the line");
- </script>
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=903332">Mozilla Bug 903332</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-
-</div>
-<pre id="test">
-</pre>
-</body>
-</html>