From b57a6624117227f8479fb7b7c172eb6219ce8b46 Mon Sep 17 00:00:00 2001 From: Jared Wein Date: Thu, 19 May 2016 23:30:12 -0400 Subject: [PATCH 01/28] Bug 1270853 - Remove HTML5 video controls statistics. r=gijs, r=bz for removing internal chrome/xbl attribute in webidl MozReview-Commit-ID: 53BYXvHaaB9 --- browser/base/content/browser-context.inc | 8 - browser/base/content/content.js | 7 - browser/base/content/nsContextMenu.js | 5 - .../test/general/browser_contextmenu.js | 4 - browser/modules/BrowserUITelemetry.jsm | 4 +- .../browser_dbg_event-listeners-03.js | 6 +- dom/html/HTMLMediaElement.h | 10 - dom/webidl/HTMLMediaElement.webidl | 1 - toolkit/content/widgets/videocontrols.xml | 176 ------------------ 9 files changed, 5 insertions(+), 216 deletions(-) diff --git a/browser/base/content/browser-context.inc b/browser/base/content/browser-context.inc index bfb90913dd4a..17d67833d06f 100644 --- a/browser/base/content/browser-context.inc +++ b/browser/base/content/browser-context.inc @@ -166,14 +166,6 @@ label="&mediaHideControls.label;" accesskey="&mediaHideControls.accesskey;" oncommand="gContextMenu.mediaCommand('hidecontrols');"/> - - { case "showcontrols": media.setAttribute("controls", "true"); break; - case "hidestats": - case "showstats": - let event = media.ownerDocument.createEvent("CustomEvent"); - event.initCustomEvent("media-showStatistics", false, true, - message.data.command == "showstats"); - media.dispatchEvent(event); - break; case "fullscreen": if (content.document.fullscreenEnabled) media.requestFullscreen(); diff --git a/browser/base/content/nsContextMenu.js b/browser/base/content/nsContextMenu.js index ab84d5103b68..24d691b6463e 100644 --- a/browser/base/content/nsContextMenu.js +++ b/browser/base/content/nsContextMenu.js @@ -474,9 +474,6 @@ nsContextMenu.prototype = { this.showItem("context-media-showcontrols", onMedia && !this.target.controls); this.showItem("context-media-hidecontrols", this.target.controls && (this.onVideo || (this.onAudio && !this.inSyntheticDoc))); this.showItem("context-video-fullscreen", this.onVideo && this.target.ownerDocument.fullscreenElement == null); - var statsShowing = this.onVideo && this.target.mozMediaStatisticsShowing; - this.showItem("context-video-showstats", this.onVideo && this.target.controls && !statsShowing); - this.showItem("context-video-hidestats", this.onVideo && this.target.controls && statsShowing); this.showItem("context-media-eme-learnmore", this.onDRMMedia); this.showItem("context-media-eme-separator", this.onDRMMedia); @@ -506,8 +503,6 @@ nsContextMenu.prototype = { let canSaveSnapshot = !this.onDRMMedia && this.target.readyState >= this.target.HAVE_CURRENT_DATA; this.setItemAttr("context-video-saveimage", "disabled", !canSaveSnapshot); this.setItemAttr("context-video-fullscreen", "disabled", hasError); - this.setItemAttr("context-video-showstats", "disabled", hasError); - this.setItemAttr("context-video-hidestats", "disabled", hasError); } } this.showItem("context-media-sep-commands", onMedia); diff --git a/browser/base/content/test/general/browser_contextmenu.js b/browser/base/content/test/general/browser_contextmenu.js index dca2dd34bc21..b024d0873a08 100644 --- a/browser/base/content/test/general/browser_contextmenu.js +++ b/browser/base/content/test/general/browser_contextmenu.js @@ -117,7 +117,6 @@ add_task(function* test_video_ok() { "context-media-playbackrate-200x", true], null, "context-media-loop", true, "context-media-hidecontrols", true, - "context-video-showstats", true, "context-video-fullscreen", true, "---", null, "context-viewvideo", true, @@ -165,7 +164,6 @@ add_task(function* test_video_bad() { "context-media-playbackrate-200x", false], null, "context-media-loop", true, "context-media-hidecontrols", false, - "context-video-showstats", false, "context-video-fullscreen", false, "---", null, "context-viewvideo", true, @@ -192,7 +190,6 @@ add_task(function* test_video_bad2() { "context-media-playbackrate-200x", false], null, "context-media-loop", true, "context-media-hidecontrols", false, - "context-video-showstats", false, "context-video-fullscreen", false, "---", null, "context-viewvideo", false, @@ -253,7 +250,6 @@ add_task(function* test_video_in_iframe() { "context-media-playbackrate-200x", true], null, "context-media-loop", true, "context-media-hidecontrols", true, - "context-video-showstats", true, "context-video-fullscreen", true, "---", null, "context-viewvideo", true, diff --git a/browser/modules/BrowserUITelemetry.jsm b/browser/modules/BrowserUITelemetry.jsm index 88fe61cb82f5..986e73e25616 100644 --- a/browser/modules/BrowserUITelemetry.jsm +++ b/browser/modules/BrowserUITelemetry.jsm @@ -699,8 +699,8 @@ this.BrowserUITelemetry = { "media-mute", "media-unmute", "media-playbackrate", "media-playbackrate-050x", "media-playbackrate-100x", "media-playbackrate-125x", "media-playbackrate-150x", "media-playbackrate-200x", - "media-showcontrols", "media-hidecontrols", "video-showstats", - "video-hidestats", "video-fullscreen", "leave-dom-fullscreen", + "media-showcontrols", "media-hidecontrols", + "video-fullscreen", "leave-dom-fullscreen", "reloadimage", "viewimage", "viewvideo", "copyimage-contents", "copyimage", "copyvideourl", "copyaudiourl", "saveimage", "shareimage", "sendimage", "setDesktopBackground", "viewimageinfo", "viewimagedesc", "savevideo", diff --git a/devtools/client/debugger/test/mochitest/browser_dbg_event-listeners-03.js b/devtools/client/debugger/test/mochitest/browser_dbg_event-listeners-03.js index 8538621924a5..f031266ba185 100644 --- a/devtools/client/debugger/test/mochitest/browser_dbg_event-listeners-03.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg_event-listeners-03.js @@ -68,9 +68,9 @@ function testEventListeners(aThreadClient) { return; } - // There are 4 event listeners in the page: button.onclick, window.onload - // and two more from the video element controls. - is(aPacket.listeners.length, 4, "Found all event listeners."); + // There are 3 event listeners in the page: button.onclick, window.onload + // and one more from the video element controls. + is(aPacket.listeners.length, 3, "Found all event listeners."); aThreadClient.resume(deferred.resolve); }); diff --git a/dom/html/HTMLMediaElement.h b/dom/html/HTMLMediaElement.h index eadf98bf956b..9b83da569c33 100644 --- a/dom/html/HTMLMediaElement.h +++ b/dom/html/HTMLMediaElement.h @@ -580,16 +580,6 @@ public: SetHTMLBoolAttr(nsGkAtoms::muted, aMuted, aRv); } - bool MozMediaStatisticsShowing() const - { - return mStatsShowing; - } - - void SetMozMediaStatisticsShowing(bool aShow) - { - mStatsShowing = aShow; - } - bool MozAllowCasting() const { return mAllowCasting; diff --git a/dom/webidl/HTMLMediaElement.webidl b/dom/webidl/HTMLMediaElement.webidl index 92ce2d63653b..55f8724a3395 100644 --- a/dom/webidl/HTMLMediaElement.webidl +++ b/dom/webidl/HTMLMediaElement.webidl @@ -118,7 +118,6 @@ partial interface HTMLMediaElement { readonly attribute boolean mozAutoplayEnabled; // NB: for internal use with the video controls: - [Func="IsChromeOrXBL"] attribute boolean mozMediaStatisticsShowing; [Func="IsChromeOrXBL"] attribute boolean mozAllowCasting; [Func="IsChromeOrXBL"] attribute boolean mozIsCasting; diff --git a/toolkit/content/widgets/videocontrols.xml b/toolkit/content/widgets/videocontrols.xml index 3cbe71edb5d1..205136cbe810 100644 --- a/toolkit/content/widgets/videocontrols.xml +++ b/toolkit/content/widgets/videocontrols.xml @@ -211,63 +211,6 @@ - - @@ -327,7 +270,6 @@ statusOverlay : null, controlsSpacer : null, clickToPlay : null, - stats : {}, controlsOverlay : null, fullscreenButton : null, @@ -474,13 +416,6 @@ // _volumeControlWidth, since the volume slider implementation // depends on it. this.updateVolumeControls(); - - // Preserve Statistics when toggling fullscreen mode due to bug 714071. - if (this.video.mozMediaStatisticsShowing) - this.showStatistics(true); - - this._handleCustomEventsBound = this.handleCustomEvents.bind(this); - this.video.addEventListener("media-showStatistics", this._handleCustomEventsBound, false, true); }, setupNewLoadState : function() { @@ -503,12 +438,6 @@ this.startFade(this.controlBar, shouldShow, true); }, - handleCustomEvents : function (e) { - if (!e.isTrusted) - return; - this.showStatistics(e.detail); - }, - get dynamicControls() { // Don't fade controls for