Commit 67a7df95 authored by Neil Rashbrook's avatar Neil Rashbrook
Browse files

Bug 1279911 Use content-safe platform detection r=enndeakin

parent 26819b2e
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -446,12 +446,10 @@

          var cancel = false;

          let { AppConstants } =
              Components.utils.import("resource://gre/modules/AppConstants.jsm", {});
          // Catch any keys that could potentially move the caret. Ctrl can be
          // used in combination with these keys on Windows and Linux; and Alt
          // can be used on OS X, so make sure the unused one isn't used.
          let metaKey = AppConstants.platform == "macosx" ? aEvent.ctrlKey : aEvent.altKey;
          let metaKey = /Mac/.test(navigator.platform) ? aEvent.ctrlKey : aEvent.altKey;
          if (!this.disableKeyNavigation && !metaKey) {
            switch (aEvent.keyCode) {
              case KeyEvent.DOM_VK_LEFT:
@@ -489,7 +487,7 @@
              cancel = this.mController.handleEscape();
              break;
            case KeyEvent.DOM_VK_RETURN:
              if (AppConstants.platform == "macosx") {
              if (/Mac/.test(navigator.platform)) {
                // Prevent the default action, since it will beep on Mac
                if (aEvent.metaKey)
                  aEvent.preventDefault();
@@ -503,13 +501,13 @@
              cancel = this.handleEnter(aEvent);
              break;
            case KeyEvent.DOM_VK_DELETE:
              if (AppConstants.platform == "macosx" && !aEvent.shiftKey) {
              if (/Mac/.test(navigator.platform) && !aEvent.shiftKey) {
                break;
              }
              cancel = this.handleDelete();
              break;
            case KeyEvent.DOM_VK_BACK_SPACE:
              if (AppConstants.platform == "macosx" && aEvent.shiftKey) {
              if (/Mac/.test(navigator.platform) && aEvent.shiftKey) {
                cancel = this.handleDelete();
              }
              break;
@@ -519,7 +517,7 @@
                this.toggleHistoryPopup();
              break;
            case KeyEvent.DOM_VK_F4:
              if (AppConstants.platform != "macosx") {
              if (!/Mac/.test(navigator.platform)) {
                this.toggleHistoryPopup();
              }
              break;
+2 −7
Original line number Diff line number Diff line
@@ -162,9 +162,6 @@
        <parameter name="aEvent"/>
        <body>
        <![CDATA[
          let { AppConstants } =
              Components.utils.import("resource://gre/modules/AppConstants.jsm", {});

          function focusInit() {
            const dialog = document.documentElement;
            const defaultButton = dialog.getButton(dialog.defaultButton);
@@ -190,7 +187,7 @@
                    initialFocusedElt.focus();
                  }
                }
                else if (AppConstants.platform != "macosx" &&
                else if (!/Mac/.test(navigator.platform) &&
                         focusedElt.hasAttribute("dlgtype") && focusedElt != defaultButton) {
                  defaultButton.focus();
                }
@@ -310,10 +307,8 @@
            for (dlgtype in buttons)
              buttons[dlgtype].hidden = !shown[dlgtype];

            let { AppConstants } =
                Components.utils.import("resource://gre/modules/AppConstants.jsm", {});
            // show the spacer on Windows only when the extra2 button is present
            if (AppConstants.platform == "win") {
            if (/Win/.test(navigator.platform)) {
              var spacer = document.getAnonymousElementByAttribute(this, "anonid", "spacer");
              spacer.removeAttribute("hidden");
              spacer.setAttribute("flex", shown["extra2"]?"1":"0");
+2 −4
Original line number Diff line number Diff line
@@ -51,9 +51,7 @@
        <parameter name="aFile"/>
        <body>
        <![CDATA[
          let { AppConstants } =
              Components.utils.import("resource://gre/modules/AppConstants.jsm", {});
          if (AppConstants.platform == "win") {
          if (/Win/.test(navigator.platform)) {
            var lfw = aFile.QueryInterface(Components.interfaces.nsILocalFileWin);
            try {
              return lfw.getVersionInfoField("FileDescription");
@@ -61,7 +59,7 @@
            catch (e) {
              // fall through to the filename
            }
          } else if (AppConstants.platform == "macosx") {
          } else if (/Mac/.test(navigator.platform)) {
            var lfm = aFile.QueryInterface(Components.interfaces.nsILocalFileMac);
            try {
              return lfm.bundleDisplayName;
+2 −6
Original line number Diff line number Diff line
@@ -115,9 +115,7 @@
      ]]></handler>

      <handler event="focus"><![CDATA[
        let { AppConstants } =
            Components.utils.import("resource://gre/modules/AppConstants.jsm", {});
        if (AppConstants.platform == "macosx") {
        if (/Mac/.test(navigator.platform)) {
          let findbar = this.findbar;
          findbar._onFindFieldFocus();
        }
@@ -1371,9 +1369,7 @@
          if (aIsInitialSelection && !this._startFindDeferred)
            return;

          let { AppConstants } =
              Components.utils.import("resource://gre/modules/AppConstants.jsm", {});
          if (AppConstants.platform == "macosx" && aIsInitialSelection && !aSelectionString) {
          if (/Mac/.test(navigator.platform) && aIsInitialSelection && !aSelectionString) {
            let clipboardSearchString = this.browser.finder.clipboardSearchString;
            if (clipboardSearchString)
              aSelectionString = clipboardSearchString;
+1 −3
Original line number Diff line number Diff line
@@ -966,9 +966,7 @@
        var control = this.control;
        if (!control || control.disabled)
          return;
        let { AppConstants } =
            Components.utils.import("resource://gre/modules/AppConstants.jsm", {});
        if ((!event.ctrlKey || (AppConstants.platform == "macosx" && event.button == 2)) &&
        if ((!event.ctrlKey || (/Mac/.test(navigator.platform) && event.button == 2)) &&
            !event.shiftKey && !event.metaKey) {
          if (!this.selected) {
            control.selectItem(this);
Loading