Bug 1079222 - deny fullscreen from the forget button, r=dolske, a=dolske
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Tue, 21 Oct 2014 04:19:40 +0100
changeset 218143 914bed88291e
parent 218142 c55d0a927772
child 218144 48f2446e0b8b
push id553
push userryanvm@gmail.com
push date2014-10-29 12:21 +0000
treeherdermozilla-release@766b4b4fa7c7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdolske, dolske
bugs1079222
milestone33.0.2
Bug 1079222 - deny fullscreen from the forget button, r=dolske, a=dolske
browser/base/content/sanitize.js
--- a/browser/base/content/sanitize.js
+++ b/browser/base/content/sanitize.js
@@ -499,29 +499,46 @@ Sanitizer.prototype = {
 
         // First create a new window. We do this first so that on non-mac, we don't
         // accidentally close the app by closing all the windows.
         let handler = Cc["@mozilla.org/browser/clh;1"].getService(Ci.nsIBrowserHandler);
         let defaultArgs = handler.defaultArgs;
         let features = "chrome,all,dialog=no," + this.privateStateForNewWindow;
         let newWindow = existingWindow.openDialog("chrome://browser/content/", "_blank",
                                                   features, defaultArgs);
+#ifdef XP_MACOSX
+        function onFullScreen(e) {
+          newWindow.removeEventListener("fullscreen", onFullScreen);
+          let docEl = newWindow.document.documentElement;
+          let sizemode = docEl.getAttribute("sizemode");
+          if (!newWindow.fullScreen && sizemode == "fullscreen") {
+            docEl.setAttribute("sizemode", "normal");
+            e.preventDefault();
+            e.stopPropagation();
+            return false;
+          }
+        }
+        newWindow.addEventListener("fullscreen", onFullScreen);
+#endif
 
         // Window creation and destruction is asynchronous. We need to wait
         // until all existing windows are fully closed, and the new window is
         // fully open, before continuing. Otherwise the rest of the sanitizer
         // could run too early (and miss new cookies being set when a page
         // closes) and/or run too late (and not have a fully-formed window yet
         // in existence). See bug 1088137.
         let newWindowOpened = false;
         function onWindowOpened(subject, topic, data) {
           if (subject != newWindow)
             return;
 
           Services.obs.removeObserver(onWindowOpened, "browser-delayed-startup-finished");
+#ifdef XP_MACOSX
+          newWindow.removeEventListener("fullscreen", onFullScreen);
+#endif
           newWindowOpened = true;
           // If we're the last thing to happen, invoke callback.
           if (numWindowsClosing == 0)
             aCallback();
         }
 
         let numWindowsClosing = windowList.length;
         function onWindowClosed() {