mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-20 22:27:31 +09:00
Issue #65 - Remove AppConstants from toolkit/content
This commit is contained in:
parent
ef27cc7fd0
commit
cf41a9dd87
8 changed files with 88 additions and 96 deletions
|
|
@ -8,7 +8,6 @@ const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
|
||||||
|
|
||||||
Cu.import('resource://gre/modules/Services.jsm');
|
Cu.import('resource://gre/modules/Services.jsm');
|
||||||
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
|
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||||
Cu.import('resource://gre/modules/AppConstants.jsm');
|
|
||||||
|
|
||||||
XPCOMUtils.defineLazyServiceGetter(
|
XPCOMUtils.defineLazyServiceGetter(
|
||||||
this,
|
this,
|
||||||
|
|
@ -130,12 +129,13 @@ function display(profileData) {
|
||||||
if (dir) {
|
if (dir) {
|
||||||
td.appendChild(document.createTextNode(' '));
|
td.appendChild(document.createTextNode(' '));
|
||||||
let button = document.createElement('button');
|
let button = document.createElement('button');
|
||||||
|
#ifdef XP_WIN
|
||||||
|
let string = 'winOpenDir2';
|
||||||
|
#elifdef XP_MACOSX
|
||||||
|
let string = 'macOpenDir';
|
||||||
|
#else
|
||||||
let string = 'openDir';
|
let string = 'openDir';
|
||||||
if (AppConstants.platform == "win") {
|
#endif
|
||||||
string = 'winOpenDir2';
|
|
||||||
} else if (AppConstants.platform == "macosx") {
|
|
||||||
string = 'macOpenDir';
|
|
||||||
}
|
|
||||||
let buttonText = document.createTextNode(bundle.GetStringFromName(string));
|
let buttonText = document.createTextNode(bundle.GetStringFromName(string));
|
||||||
button.appendChild(buttonText);
|
button.appendChild(buttonText);
|
||||||
td.appendChild(button);
|
td.appendChild(button);
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
Cu.import("resource://gre/modules/Services.jsm");
|
Cu.import("resource://gre/modules/Services.jsm");
|
||||||
Cu.import("resource://gre/modules/Troubleshoot.jsm");
|
Cu.import("resource://gre/modules/Troubleshoot.jsm");
|
||||||
Cu.import("resource://gre/modules/ResetProfile.jsm");
|
Cu.import("resource://gre/modules/ResetProfile.jsm");
|
||||||
Cu.import("resource://gre/modules/AppConstants.jsm");
|
|
||||||
|
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "PluralForm",
|
XPCOMUtils.defineLazyModuleGetter(this, "PluralForm",
|
||||||
"resource://gre/modules/PluralForm.jsm");
|
"resource://gre/modules/PluralForm.jsm");
|
||||||
|
|
@ -42,7 +41,7 @@ var snapshotFormatters = {
|
||||||
$("os-box").textContent = data.osVersion;
|
$("os-box").textContent = data.osVersion;
|
||||||
$("binary-box").textContent = Services.dirsvc.get("XREExeF", Ci.nsIFile).path;
|
$("binary-box").textContent = Services.dirsvc.get("XREExeF", Ci.nsIFile).path;
|
||||||
$("supportLink").href = data.supportURL;
|
$("supportLink").href = data.supportURL;
|
||||||
let version = AppConstants.MOZ_APP_VERSION_DISPLAY;
|
let version = Services.appinfo.version;
|
||||||
if (data.versionArch) {
|
if (data.versionArch) {
|
||||||
version += " (" + data.versionArch + ")";
|
version += " (" + data.versionArch + ")";
|
||||||
}
|
}
|
||||||
|
|
@ -197,23 +196,23 @@ var snapshotFormatters = {
|
||||||
delete data.info;
|
delete data.info;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AppConstants.NIGHTLY_BUILD) {
|
#ifdef NIGHTLY_BUILD
|
||||||
let windowUtils = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
let windowUtils = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
.getInterface(Ci.nsIDOMWindowUtils);
|
.getInterface(Ci.nsIDOMWindowUtils);
|
||||||
let gpuProcessPid = windowUtils.gpuProcessPid;
|
let gpuProcessPid = windowUtils.gpuProcessPid;
|
||||||
|
|
||||||
if (gpuProcessPid != -1) {
|
if (gpuProcessPid != -1) {
|
||||||
let gpuProcessKillButton = $.new("button");
|
let gpuProcessKillButton = $.new("button");
|
||||||
|
|
||||||
gpuProcessKillButton.addEventListener("click", function() {
|
gpuProcessKillButton.addEventListener("click", function() {
|
||||||
windowUtils.terminateGPUProcess();
|
windowUtils.terminateGPUProcess();
|
||||||
});
|
});
|
||||||
|
|
||||||
gpuProcessKillButton.textContent = strings.GetStringFromName("gpuProcessKillButton");
|
gpuProcessKillButton.textContent = strings.GetStringFromName("gpuProcessKillButton");
|
||||||
addRow("diagnostics", "GPUProcessPid", gpuProcessPid);
|
addRow("diagnostics", "GPUProcessPid", gpuProcessPid);
|
||||||
addRow("diagnostics", "GPUProcess", [gpuProcessKillButton]);
|
addRow("diagnostics", "GPUProcess", [gpuProcessKillButton]);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// graphics-failures-tbody tbody
|
// graphics-failures-tbody tbody
|
||||||
if ("failures" in data) {
|
if ("failures" in data) {
|
||||||
|
|
@ -583,15 +582,15 @@ function copyRawDataToClipboard(button) {
|
||||||
Cc["@mozilla.org/widget/clipboard;1"].
|
Cc["@mozilla.org/widget/clipboard;1"].
|
||||||
getService(Ci.nsIClipboard).
|
getService(Ci.nsIClipboard).
|
||||||
setData(transferable, null, Ci.nsIClipboard.kGlobalClipboard);
|
setData(transferable, null, Ci.nsIClipboard.kGlobalClipboard);
|
||||||
if (AppConstants.platform == "android") {
|
#ifdef MOZ_WIDGET_ANDROID
|
||||||
// Present a toast notification.
|
// Present a toast notification.
|
||||||
let message = {
|
let message = {
|
||||||
type: "Toast:Show",
|
type: "Toast:Show",
|
||||||
message: stringBundle().GetStringFromName("rawDataCopied"),
|
message: stringBundle().GetStringFromName("rawDataCopied"),
|
||||||
duration: "short"
|
duration: "short"
|
||||||
};
|
};
|
||||||
Services.androidBridge.handleGeckoMessage(message);
|
Services.androidBridge.handleGeckoMessage(message);
|
||||||
}
|
#endif
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
|
|
@ -637,15 +636,15 @@ function copyContentsToClipboard() {
|
||||||
.getService(Ci.nsIClipboard);
|
.getService(Ci.nsIClipboard);
|
||||||
clipboard.setData(transferable, null, clipboard.kGlobalClipboard);
|
clipboard.setData(transferable, null, clipboard.kGlobalClipboard);
|
||||||
|
|
||||||
if (AppConstants.platform == "android") {
|
#ifdef MOZ_WIDGET_ANDROID
|
||||||
// Present a toast notification.
|
// Present a toast notification.
|
||||||
let message = {
|
let message = {
|
||||||
type: "Toast:Show",
|
type: "Toast:Show",
|
||||||
message: stringBundle().GetStringFromName("textCopied"),
|
message: stringBundle().GetStringFromName("textCopied"),
|
||||||
duration: "short"
|
duration: "short"
|
||||||
};
|
};
|
||||||
Services.androidBridge.handleGeckoMessage(message);
|
Services.androidBridge.handleGeckoMessage(message);
|
||||||
}
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the plain text representation of an element. Do a little bit
|
// Return the plain text representation of an element. Do a little bit
|
||||||
|
|
@ -654,10 +653,10 @@ function createTextForElement(elem) {
|
||||||
let serializer = new Serializer();
|
let serializer = new Serializer();
|
||||||
let text = serializer.serialize(elem);
|
let text = serializer.serialize(elem);
|
||||||
|
|
||||||
|
#ifdef XP_WIN
|
||||||
// Actual CR/LF pairs are needed for some Windows text editors.
|
// Actual CR/LF pairs are needed for some Windows text editors.
|
||||||
if (AppConstants.platform == "win") {
|
text = text.replace(/\n/g, "\r\n");
|
||||||
text = text.replace(/\n/g, "\r\n");
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,6 @@ Cu.import("resource://gre/modules/Preferences.jsm");
|
||||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
Cu.import("resource://gre/modules/Task.jsm");
|
Cu.import("resource://gre/modules/Task.jsm");
|
||||||
|
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "AppConstants",
|
|
||||||
"resource://gre/modules/AppConstants.jsm");
|
|
||||||
|
|
||||||
const Telemetry = Services.telemetry;
|
const Telemetry = Services.telemetry;
|
||||||
const bundle = Services.strings.createBundle(
|
const bundle = Services.strings.createBundle(
|
||||||
"chrome://global/locale/aboutTelemetry.properties");
|
"chrome://global/locale/aboutTelemetry.properties");
|
||||||
|
|
@ -236,17 +233,17 @@ var Settings = {
|
||||||
let elements = document.getElementsByClassName("change-data-choices-link");
|
let elements = document.getElementsByClassName("change-data-choices-link");
|
||||||
for (let el of elements) {
|
for (let el of elements) {
|
||||||
el.addEventListener("click", function() {
|
el.addEventListener("click", function() {
|
||||||
if (AppConstants.platform == "android") {
|
#ifdef MOZ_WIDGET_ANDROID
|
||||||
Cu.import("resource://gre/modules/Messaging.jsm");
|
Cu.import("resource://gre/modules/Messaging.jsm");
|
||||||
Messaging.sendRequest({
|
Messaging.sendRequest({
|
||||||
type: "Settings:Show",
|
type: "Settings:Show",
|
||||||
resource: "preferences_privacy",
|
resource: "preferences_privacy",
|
||||||
});
|
});
|
||||||
} else {
|
#else
|
||||||
// Show the data choices preferences on desktop.
|
// Show the data choices preferences on desktop.
|
||||||
let mainWindow = getMainWindowWithPreferencesPane();
|
let mainWindow = getMainWindowWithPreferencesPane();
|
||||||
mainWindow.openAdvancedPreferences("dataChoicesTab");
|
mainWindow.openAdvancedPreferences("dataChoicesTab");
|
||||||
}
|
#endif
|
||||||
}, false);
|
}, false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ var Ci = Components.interfaces;
|
||||||
var Cu = Components.utils;
|
var Cu = Components.utils;
|
||||||
var Cr = Components.results;
|
var Cr = Components.results;
|
||||||
|
|
||||||
Cu.import("resource://gre/modules/AppConstants.jsm");
|
|
||||||
Cu.import("resource://gre/modules/BrowserUtils.jsm");
|
Cu.import("resource://gre/modules/BrowserUtils.jsm");
|
||||||
Cu.import("resource://gre/modules/Services.jsm");
|
Cu.import("resource://gre/modules/Services.jsm");
|
||||||
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
|
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "Task",
|
||||||
"resource://gre/modules/Task.jsm");
|
"resource://gre/modules/Task.jsm");
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "Deprecated",
|
XPCOMUtils.defineLazyModuleGetter(this, "Deprecated",
|
||||||
"resource://gre/modules/Deprecated.jsm");
|
"resource://gre/modules/Deprecated.jsm");
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "AppConstants",
|
|
||||||
"resource://gre/modules/AppConstants.jsm");
|
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
|
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
|
||||||
"resource://gre/modules/NetUtil.jsm");
|
"resource://gre/modules/NetUtil.jsm");
|
||||||
|
|
||||||
|
|
@ -1161,10 +1159,10 @@ function getNormalizedLeafName(aFile, aDefaultExtension)
|
||||||
if (!aDefaultExtension)
|
if (!aDefaultExtension)
|
||||||
return aFile;
|
return aFile;
|
||||||
|
|
||||||
if (AppConstants.platform == "win") {
|
#ifdef XP_WIN
|
||||||
// Remove trailing dots and spaces on windows
|
// Remove trailing dots and spaces on windows
|
||||||
aFile = aFile.replace(/[\s.]+$/, "");
|
aFile = aFile.replace(/[\s.]+$/, "");
|
||||||
}
|
#endif
|
||||||
|
|
||||||
// Remove leading dots
|
// Remove leading dots
|
||||||
aFile = aFile.replace(/^\.+/, "");
|
aFile = aFile.replace(/^\.+/, "");
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ var gToolboxSheet = false;
|
||||||
var gPaletteBox = null;
|
var gPaletteBox = null;
|
||||||
|
|
||||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||||
Components.utils.import("resource://gre/modules/AppConstants.jsm");
|
|
||||||
|
|
||||||
function onLoad()
|
function onLoad()
|
||||||
{
|
{
|
||||||
|
|
@ -213,10 +212,10 @@ function wrapToolbarItems()
|
||||||
{
|
{
|
||||||
forEachCustomizableToolbar(function (toolbar) {
|
forEachCustomizableToolbar(function (toolbar) {
|
||||||
Array.forEach(toolbar.childNodes, function (item) {
|
Array.forEach(toolbar.childNodes, function (item) {
|
||||||
if (AppConstants.platform == "macosx") {
|
#ifdef XP_MACOSX
|
||||||
if (item.firstChild && item.firstChild.localName == "menubar")
|
if (item.firstChild && item.firstChild.localName == "menubar")
|
||||||
return;
|
return;
|
||||||
}
|
#endif
|
||||||
if (isToolbarItem(item)) {
|
if (isToolbarItem(item)) {
|
||||||
let wrapper = wrapToolbarItem(item);
|
let wrapper = wrapToolbarItem(item);
|
||||||
cleanupItemForToolbar(item, wrapper);
|
cleanupItemForToolbar(item, wrapper);
|
||||||
|
|
|
||||||
|
|
@ -4,32 +4,32 @@
|
||||||
|
|
||||||
function closeWindow(aClose, aPromptFunction)
|
function closeWindow(aClose, aPromptFunction)
|
||||||
{
|
{
|
||||||
let { AppConstants } = Components.utils.import("resource://gre/modules/AppConstants.jsm");
|
#ifdef XP_MACOSX
|
||||||
|
|
||||||
// Closing the last window doesn't quit the application on OS X.
|
// Closing the last window doesn't quit the application on OS X.
|
||||||
if (AppConstants.platform != "macosx") {
|
if (typeof(aPromptFunction) == "function" && !aPromptFunction()) {
|
||||||
var windowCount = 0;
|
|
||||||
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
|
|
||||||
.getService(Components.interfaces.nsIWindowMediator);
|
|
||||||
var e = wm.getEnumerator(null);
|
|
||||||
|
|
||||||
while (e.hasMoreElements()) {
|
|
||||||
var w = e.getNext();
|
|
||||||
if (w.closed) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (++windowCount == 2)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we're down to the last window and someone tries to shut down, check to make sure we can!
|
|
||||||
if (windowCount == 1 && !canQuitApplication("lastwindow"))
|
|
||||||
return false;
|
|
||||||
if (windowCount != 1 && typeof(aPromptFunction) == "function" && !aPromptFunction())
|
|
||||||
return false;
|
|
||||||
} else if (typeof(aPromptFunction) == "function" && !aPromptFunction()) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
var windowCount = 0;
|
||||||
|
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
|
||||||
|
.getService(Components.interfaces.nsIWindowMediator);
|
||||||
|
var e = wm.getEnumerator(null);
|
||||||
|
|
||||||
|
while (e.hasMoreElements()) {
|
||||||
|
var w = e.getNext();
|
||||||
|
if (w.closed) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (++windowCount == 2)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we're down to the last window and someone tries to shut down, check to make sure we can!
|
||||||
|
if (windowCount == 1 && !canQuitApplication("lastwindow"))
|
||||||
|
return false;
|
||||||
|
if (windowCount != 1 && typeof(aPromptFunction) == "function" && !aPromptFunction())
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (aClose) {
|
if (aClose) {
|
||||||
window.close();
|
window.close();
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ toolkit.jar:
|
||||||
content/global/aboutNetworking.js
|
content/global/aboutNetworking.js
|
||||||
content/global/aboutNetworking.xhtml
|
content/global/aboutNetworking.xhtml
|
||||||
#ifndef ANDROID
|
#ifndef ANDROID
|
||||||
content/global/aboutProfiles.js
|
* content/global/aboutProfiles.js
|
||||||
content/global/aboutProfiles.xhtml
|
content/global/aboutProfiles.xhtml
|
||||||
#endif
|
#endif
|
||||||
content/global/aboutServiceWorkers.js
|
content/global/aboutServiceWorkers.js
|
||||||
|
|
@ -32,18 +32,18 @@ toolkit.jar:
|
||||||
#endif
|
#endif
|
||||||
* content/global/aboutSupport.js
|
* content/global/aboutSupport.js
|
||||||
* content/global/aboutSupport.xhtml
|
* content/global/aboutSupport.xhtml
|
||||||
content/global/aboutTelemetry.js
|
* content/global/aboutTelemetry.js
|
||||||
content/global/aboutTelemetry.xhtml
|
content/global/aboutTelemetry.xhtml
|
||||||
content/global/aboutTelemetry.css
|
content/global/aboutTelemetry.css
|
||||||
content/global/directionDetector.html
|
content/global/directionDetector.html
|
||||||
content/global/plugins.html
|
content/global/plugins.html
|
||||||
content/global/plugins.css
|
content/global/plugins.css
|
||||||
content/global/browser-child.js
|
* content/global/browser-child.js
|
||||||
content/global/browser-content.js
|
content/global/browser-content.js
|
||||||
* content/global/buildconfig.html
|
* content/global/buildconfig.html
|
||||||
content/global/contentAreaUtils.js
|
* content/global/contentAreaUtils.js
|
||||||
content/global/customizeToolbar.css
|
content/global/customizeToolbar.css
|
||||||
content/global/customizeToolbar.js
|
* content/global/customizeToolbar.js
|
||||||
content/global/customizeToolbar.xul
|
content/global/customizeToolbar.xul
|
||||||
content/global/datepicker.xhtml
|
content/global/datepicker.xhtml
|
||||||
content/global/editMenuOverlay.js
|
content/global/editMenuOverlay.js
|
||||||
|
|
@ -52,7 +52,7 @@ toolkit.jar:
|
||||||
* content/global/finddialog.xul
|
* content/global/finddialog.xul
|
||||||
content/global/findUtils.js
|
content/global/findUtils.js
|
||||||
content/global/filepicker.properties
|
content/global/filepicker.properties
|
||||||
content/global/globalOverlay.js
|
* content/global/globalOverlay.js
|
||||||
content/global/mozilla.xhtml
|
content/global/mozilla.xhtml
|
||||||
#ifdef MOZ_PHOENIX
|
#ifdef MOZ_PHOENIX
|
||||||
content/global/logopage.xhtml
|
content/global/logopage.xhtml
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue