зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1555951 - Use AppConstants.platform instead of RegExp::test(navigator.platform) in custom element scripts. r=bgrins
Differential Revision: https://phabricator.services.mozilla.com/D33926 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
ca0f8bfa73
Коммит
a0996172b6
|
@ -8,6 +8,7 @@
|
|||
// leaking to window scope.
|
||||
{
|
||||
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
const {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
|
||||
|
||||
let LazyModules = {};
|
||||
|
||||
|
@ -1537,7 +1538,8 @@ class MozBrowser extends MozElements.MozElementMixin(XULFrameElement) {
|
|||
// Exclude second-rate platforms
|
||||
this._autoScrollPopup.setAttribute("transparent", !/BeOS|OS\/2/.test(navigator.appVersion));
|
||||
// Enable translucency on Windows and Mac
|
||||
this._autoScrollPopup.setAttribute("translucent", /Win|Mac/.test(navigator.platform));
|
||||
this._autoScrollPopup.setAttribute("translucent",
|
||||
AppConstants.platform == "win" || AppConstants.platform == "macosx");
|
||||
}
|
||||
|
||||
this._autoScrollPopup.setAttribute("scrolldir", scrolldir);
|
||||
|
|
|
@ -279,7 +279,7 @@ class MozDialog extends MozXULElement {
|
|||
// so return focus to the tab itself
|
||||
initialFocusedElt.focus();
|
||||
}
|
||||
} else if (!/Mac/.test(navigator.platform) &&
|
||||
} else if (AppConstants.platform != "macosx" &&
|
||||
focusedElt.hasAttribute("dlgtype") &&
|
||||
focusedElt != defaultButton) {
|
||||
defaultButton.focus();
|
||||
|
@ -405,7 +405,7 @@ class MozDialog extends MozXULElement {
|
|||
}
|
||||
|
||||
// show the spacer on Windows only when the extra2 button is present
|
||||
if (/Win/.test(navigator.platform)) {
|
||||
if (AppConstants.platform == "win") {
|
||||
let spacer = this.shadowRoot.querySelector(".spacer");
|
||||
spacer.removeAttribute("hidden");
|
||||
spacer.setAttribute("flex", shown.extra2 ? "1" : "0");
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
// a block to prevent accidentally leaking globals onto `window`.
|
||||
{
|
||||
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
const {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
|
||||
|
||||
class MozFindbar extends XULElement {
|
||||
constructor() {
|
||||
|
@ -255,7 +256,7 @@ class MozFindbar extends XULElement {
|
|||
});
|
||||
|
||||
this._findField.addEventListener("focus", (event) => {
|
||||
if (/Mac/.test(navigator.platform)) {
|
||||
if (AppConstants.platform == "macosx") {
|
||||
this._onFindFieldFocus();
|
||||
}
|
||||
this._updateBrowserWithState();
|
||||
|
@ -1167,7 +1168,7 @@ class MozFindbar extends XULElement {
|
|||
if (aIsInitialSelection && !this._startFindDeferred)
|
||||
return;
|
||||
|
||||
if (/Mac/.test(window.navigator.platform) && aIsInitialSelection && !aSelectionString) {
|
||||
if (AppConstants.platform == "macosx" && aIsInitialSelection && !aSelectionString) {
|
||||
let clipboardSearchString = this.browser.finder.clipboardSearchString;
|
||||
if (clipboardSearchString)
|
||||
aSelectionString = clipboardSearchString;
|
||||
|
|
|
@ -3,8 +3,10 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
"use strict";
|
||||
|
||||
// This is loaded into chrome windows with the subscript loader. If you need to
|
||||
// define globals, wrap in a block to prevent leaking onto `window`.
|
||||
// This is loaded into all XUL windows. Wrap in a block to prevent
|
||||
// leaking to window scope.
|
||||
{
|
||||
const {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
|
||||
|
||||
/**
|
||||
* XUL:richlistbox element.
|
||||
|
@ -862,8 +864,9 @@ MozElements.MozRichlistitem = class MozRichlistitem extends MozElements.BaseText
|
|||
var control = this.control;
|
||||
if (!control || control.disabled)
|
||||
return;
|
||||
if ((!event.ctrlKey || (/Mac/.test(navigator.platform) && event.button == 2)) &&
|
||||
!event.shiftKey && !event.metaKey) {
|
||||
if ((!event.ctrlKey || (AppConstants.platform == "macosx" && event.button == 2)) &&
|
||||
!event.shiftKey &&
|
||||
!event.metaKey) {
|
||||
if (!this.selected) {
|
||||
control.selectItem(this);
|
||||
}
|
||||
|
@ -991,3 +994,4 @@ MozXULElement.implementCustomInterface(
|
|||
if (document.documentURI != "about:addons") {
|
||||
customElements.define("richlistitem", MozElements.MozRichlistitem);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
// a block to prevent accidentally leaking globals onto `window`.
|
||||
{
|
||||
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
const {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
|
||||
|
||||
let imports = {};
|
||||
ChromeUtils.defineModuleGetter(imports, "ShortcutUtils",
|
||||
|
@ -16,7 +17,7 @@ ChromeUtils.defineModuleGetter(imports, "ShortcutUtils",
|
|||
class MozTabbox extends MozXULElement {
|
||||
constructor() {
|
||||
super();
|
||||
this._handleMetaAltArrows = /Mac/.test(navigator.platform);
|
||||
this._handleMetaAltArrows = AppConstants.platform == "macosx";
|
||||
this.disconnectedCallback = this.disconnectedCallback.bind(this);
|
||||
}
|
||||
|
||||
|
@ -258,7 +259,7 @@ MozElements.MozTab = class MozTab extends MozElements.BaseText {
|
|||
this.addEventListener("mousedown", this);
|
||||
this.addEventListener("keydown", this);
|
||||
|
||||
this.arrowKeysShouldWrap = /Mac/.test(navigator.platform);
|
||||
this.arrowKeysShouldWrap = AppConstants.platform == "macosx";
|
||||
}
|
||||
|
||||
static get inheritedAttributes() {
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
// This is loaded into all XUL windows. Wrap in a block to prevent
|
||||
// leaking to window scope.
|
||||
{
|
||||
const {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
|
||||
|
||||
class MozTreeChildren extends MozElements.BaseControl {
|
||||
constructor() {
|
||||
super();
|
||||
|
@ -294,7 +296,7 @@
|
|||
|
||||
// On Windows multiple clicking on tree columns only cycles one time
|
||||
// every 2 clicks.
|
||||
if (/Win/.test(navigator.platform) && event.detail % 2 == 0)
|
||||
if (AppConstants.platform == "win" && event.detail % 2 == 0)
|
||||
return;
|
||||
|
||||
var tree = this.parentNode.parentNode;
|
||||
|
@ -556,7 +558,7 @@
|
|||
|
||||
this.initializeAttributeInheritance();
|
||||
|
||||
this.pageUpOrDownMovesSelection = !/Mac/.test(navigator.platform);
|
||||
this.pageUpOrDownMovesSelection = AppConstants.platform == "macosx";
|
||||
|
||||
this._inputField = null;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче