Bug 1403127 - Don't try to pass fullscreen element through IPC. r?jaws draft
authorXidorn Quan <me@upsuper.org>
Wed, 27 Sep 2017 16:27:36 +1000
changeset 670907 65f49ff4e1f57db094055a29ea5a4828a3564f62
parent 670906 5243f1c506dad55164cd293cb1231dbf4d790532
child 733361 81029c0ed80a71a74e87e5cd33c6790d93bcc2c6
push id81765
push userxquan@mozilla.com
push dateWed, 27 Sep 2017 06:28:18 +0000
reviewersjaws
bugs1403127
milestone58.0a1
Bug 1403127 - Don't try to pass fullscreen element through IPC. r?jaws MozReview-Commit-ID: DaiBNVdqAOh
browser/base/content/nsContextMenu.js
browser/modules/ContextMenu.jsm
--- a/browser/base/content/nsContextMenu.js
+++ b/browser/base/content/nsContextMenu.js
@@ -374,17 +374,17 @@ nsContextMenu.prototype = {
     this.showItem("context-stop", stopReloadItem == "stop");
 
     // XXX: Stop is determined in browser.js; the canStop broadcaster is broken
     // this.setItemAttrFromNode( "context-stop", "disabled", "canStop" );
   },
 
   initLeaveDOMFullScreenItems: function CM_initLeaveFullScreenItem() {
     // only show the option if the user is in DOM fullscreen
-    var shouldShow = (this.target.ownerDocument.fullscreenElement != null);
+    var shouldShow = this.target.ownerDocument.fullscreen;
     this.showItem("context-leave-dom-fullscreen", shouldShow);
 
     // Explicitly show if in DOM fullscreen, but do not hide it has already been shown
     if (shouldShow)
         this.showItem("context-media-sep-commands", true);
   },
 
   initSaveItems: function CM_initSaveItems() {
@@ -638,17 +638,17 @@ nsContextMenu.prototype = {
     this.showItem("context-media-play", onMedia && (this.target.paused || this.target.ended));
     this.showItem("context-media-pause", onMedia && !this.target.paused && !this.target.ended);
     this.showItem("context-media-mute", onMedia && !this.target.muted);
     this.showItem("context-media-unmute", onMedia && this.target.muted);
     this.showItem("context-media-playbackrate", onMedia && this.target.duration != Number.POSITIVE_INFINITY);
     this.showItem("context-media-loop", onMedia);
     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);
+    this.showItem("context-video-fullscreen", this.onVideo && !this.target.ownerDocument.fullscreen);
     this.showItem("context-media-eme-learnmore", this.onDRMMedia);
     this.showItem("context-media-eme-separator", this.onDRMMedia);
 
     // Disable them when there isn't a valid media source loaded.
     if (onMedia) {
       this.setItemAttr("context-media-playbackrate-050x", "checked", this.target.playbackRate == 0.5);
       this.setItemAttr("context-media-playbackrate-100x", "checked", this.target.playbackRate == 1.0);
       this.setItemAttr("context-media-playbackrate-125x", "checked", this.target.playbackRate == 1.25);
--- a/browser/modules/ContextMenu.jsm
+++ b/browser/modules/ContextMenu.jsm
@@ -643,17 +643,17 @@ class ContextMenu {
    */
   _cleanContext(aEvent) {
     const context = this.context;
     const cleanTarget = Object.create(null);
 
     cleanTarget.ownerDocument = {
       // used for nsContextMenu.initLeaveDOMFullScreenItems and
       // nsContextMenu.initMediaPlayerItems
-      fullscreenElement: context.target.ownerDocument.fullscreenElement,
+      fullscreen: context.target.ownerDocument.fullscreen,
 
       // used for nsContextMenu.initMiscItems
       contentType: context.target.ownerDocument.contentType,
 
       // used for nsContextMenu.saveLink
       isPrivate: context.target.ownerDocument.isPrivate,
     };