This commit is contained in:
Daniel Glazman committed 2017-03-16 16:02:04 +01:00
1 parent 674cd5a272
commit 2cf296e703
18 files changed
+4267 -2139

No files matched your search

+147 -198
View File
@@ -4,58 +4,105 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsXULAppAPI.h"
#include "mozilla/AppData.h"
#include "mozilla/XREAppData.h"
#include "application.ini.h"
#include "nsXPCOMGlue.h"
#include "mozilla/Bootstrap.h"
#if defined(XP_WIN)
#include <windows.h>
#include <stdlib.h>
#include <io.h>
#include <fcntl.h>
#elif defined(XP_UNIX)
#include <sys/resource.h>
#include <unistd.h>
#endif
#ifdef XP_MACOSX
#include "MacQuirks.h"
#endif
#include <stdio.h>
#include <stdarg.h>
#include <time.h>
#include "nsCOMPtr.h"
#include "nsIFile.h"
#include "nsStringGlue.h"
#ifdef XP_WIN
// we want a wmain entry point
#ifdef MOZ_ASAN
// ASAN requires firefox.exe to be built with -MD, and it's OK if we don't
// support Windows XP SP2 in ASAN builds.
#define XRE_DONT_SUPPORT_XPSP2
#endif
#define XRE_WANT_ENVIRON
#include "nsWindowsWMain.cpp"
#if defined(_MSC_VER) && (_MSC_VER < 1900)
#define snprintf _snprintf
#endif
#define strcasecmp _stricmp
#ifdef MOZ_SANDBOX
#include "mozilla/sandboxing/SandboxInitialization.h"
#endif
#endif
#include "BinaryPath.h"
#include "nsXPCOMPrivate.h" // for MAXPATHLEN and XPCOM_DLL
#include "mozilla/Telemetry.h"
#include "mozilla/Sprintf.h"
#include "mozilla/StartupTimeline.h"
#include "mozilla/WindowsDllBlocklist.h"
#ifdef LIBFUZZER
#include "FuzzerDefs.h"
#endif
#ifdef MOZ_LINUX_32_SSE2_STARTUP_ERROR
#include <cpuid.h>
#include "mozilla/Unused.h"
static bool
IsSSE2Available()
{
// The rest of the app has been compiled to assume that SSE2 is present
// unconditionally, so we can't use the normal copy of SSE.cpp here.
// Since SSE.cpp caches the results and we need them only transiently,
// instead of #including SSE.cpp here, let's just inline the specific check
// that's needed.
unsigned int level = 1u;
unsigned int eax, ebx, ecx, edx;
unsigned int bits = (1u<<26);
unsigned int max = __get_cpuid_max(0, nullptr);
if (level > max) {
return false;
}
__cpuid_count(level, 0, eax, ebx, ecx, edx);
return (edx & bits) == bits;
}
static const char sSSE2Message[] =
"This browser version requires a processor with the SSE2 instruction "
"set extension.\nYou may be able to obtain a version that does not "
"require SSE2 from your Linux distribution.\n";
__attribute__((constructor))
static void
SSE2Check()
{
if (IsSSE2Available()) {
return;
}
// Using write() in order to avoid jemalloc-based buffering. Ignoring return
// values, since there isn't much we could do on failure and there is no
// point in trying to recover from errors.
MOZ_UNUSED(write(STDERR_FILENO,
sSSE2Message,
MOZ_ARRAY_LENGTH(sSSE2Message) - 1));
// _exit() instead of exit() to avoid running the usual "at exit" code.
_exit(255);
}
#endif
#if !defined(MOZ_WIDGET_COCOA) && !defined(MOZ_WIDGET_ANDROID)
#define MOZ_BROWSER_CAN_BE_CONTENTPROC
#include "../../ipc/contentproc/plugin-container.cpp"
#endif
using namespace mozilla;
#ifdef XP_MACOSX
#define kOSXResourcesFolder "Resources"
#endif
#define kDesktopFolder "editor"
#define kDesktopFolder "browser"
static void Output(const char *fmt, ... )
{
@@ -117,58 +164,24 @@ static bool IsArg(const char* arg, const char* s)
return false;
}
XRE_GetFileFromPathType XRE_GetFileFromPath;
XRE_CreateAppDataType XRE_CreateAppData;
XRE_FreeAppDataType XRE_FreeAppData;
XRE_TelemetryAccumulateType XRE_TelemetryAccumulate;
XRE_StartupTimelineRecordType XRE_StartupTimelineRecord;
XRE_mainType XRE_main;
XRE_StopLateWriteChecksType XRE_StopLateWriteChecks;
XRE_XPCShellMainType XRE_XPCShellMain;
Bootstrap::UniquePtr gBootstrap;
static const nsDynamicFunctionLoad kXULFuncs[] = {
{ "XRE_GetFileFromPath", (NSFuncPtr*) &XRE_GetFileFromPath },
{ "XRE_CreateAppData", (NSFuncPtr*) &XRE_CreateAppData },
{ "XRE_FreeAppData", (NSFuncPtr*) &XRE_FreeAppData },
{ "XRE_TelemetryAccumulate", (NSFuncPtr*) &XRE_TelemetryAccumulate },
{ "XRE_StartupTimelineRecord", (NSFuncPtr*) &XRE_StartupTimelineRecord },
{ "XRE_main", (NSFuncPtr*) &XRE_main },
{ "XRE_StopLateWriteChecks", (NSFuncPtr*) &XRE_StopLateWriteChecks },
{ "XRE_XPCShellMain", (NSFuncPtr*) &XRE_XPCShellMain },
{ nullptr, nullptr }
};
static int do_main(int argc, char* argv[], char* envp[], nsIFile *xreDirectory)
static int do_main(int argc, char* argv[], char* envp[])
{
nsCOMPtr<nsIFile> appini;
nsresult rv;
uint32_t mainFlags = 0;
// Allow firefox.exe to launch XULRunner apps via -app <application.ini>
// Note that -app must be the *first* argument.
const char *appDataFile = getenv("XUL_APP_FILE");
if (appDataFile && *appDataFile) {
rv = XRE_GetFileFromPath(appDataFile, getter_AddRefs(appini));
if (NS_FAILED(rv)) {
Output("Invalid path found: '%s'", appDataFile);
return 255;
}
}
else if (argc > 1 && IsArg(argv[1], "app")) {
if ((!appDataFile || !*appDataFile) &&
(argc > 1 && IsArg(argv[1], "app"))) {
if (argc == 2) {
Output("Incorrect number of arguments passed to -app");
return 255;
}
rv = XRE_GetFileFromPath(argv[2], getter_AddRefs(appini));
if (NS_FAILED(rv)) {
Output("application.ini path not recognized: '%s'", argv[2]);
return 255;
}
appDataFile = argv[2];
char appEnv[MAXPATHLEN];
snprintf(appEnv, MAXPATHLEN, "XUL_APP_FILE=%s", argv[2]);
if (putenv(appEnv)) {
SprintfLiteral(appEnv, "XUL_APP_FILE=%s", argv[2]);
if (putenv(strdup(appEnv))) {
Output("Couldn't set %s.\n", appEnv);
return 255;
}
@@ -179,187 +192,121 @@ static int do_main(int argc, char* argv[], char* envp[], nsIFile *xreDirectory)
for (int i = 1; i < argc; i++) {
argv[i] = argv[i + 1];
}
return XRE_XPCShellMain(--argc, argv, envp);
XREShellData shellData;
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
shellData.sandboxBrokerServices =
sandboxing::GetInitializedBrokerServices();
#endif
return gBootstrap->XRE_XPCShellMain(--argc, argv, envp, &shellData);
}
if (appini) {
nsXREAppData *appData;
rv = XRE_CreateAppData(appini, &appData);
if (NS_FAILED(rv)) {
Output("Couldn't read application.ini");
return 255;
}
// xreDirectory already has a refcount from NS_NewLocalFile
appData->xreDirectory = xreDirectory;
int result = XRE_main(argc, argv, appData, mainFlags);
XRE_FreeAppData(appData);
return result;
BootstrapConfig config;
if (appDataFile && *appDataFile) {
config.appData = nullptr;
config.appDataPath = appDataFile;
} else {
// no -app flag so we use the compiled-in app data
config.appData = &sAppData;
config.appDataPath = kDesktopFolder;
}
ScopedAppData appData(&sAppData);
nsCOMPtr<nsIFile> exeFile;
rv = mozilla::BinaryPath::GetFile(argv[0], getter_AddRefs(exeFile));
if (NS_FAILED(rv)) {
Output("Couldn't find the application directory.\n");
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
sandbox::BrokerServices* brokerServices =
sandboxing::GetInitializedBrokerServices();
sandboxing::PermissionsService* permissionsService =
sandboxing::GetPermissionsService();
#if defined(MOZ_CONTENT_SANDBOX)
if (!brokerServices) {
Output("Couldn't initialize the broker services.\n");
return 255;
}
nsCOMPtr<nsIFile> greDir;
exeFile->GetParent(getter_AddRefs(greDir));
#ifdef XP_MACOSX
greDir->SetNativeLeafName(NS_LITERAL_CSTRING(kOSXResourcesFolder));
#endif
nsCOMPtr<nsIFile> appSubdir;
greDir->Clone(getter_AddRefs(appSubdir));
appSubdir->Append(NS_LITERAL_STRING(kDesktopFolder));
SetStrongPtr(appData.directory, static_cast<nsIFile*>(appSubdir.get()));
// xreDirectory already has a refcount from NS_NewLocalFile
appData.xreDirectory = xreDirectory;
return XRE_main(argc, argv, &appData, mainFlags);
}
static bool
FileExists(const char *path)
{
#ifdef XP_WIN
wchar_t wideDir[MAX_PATH];
MultiByteToWideChar(CP_UTF8, 0, path, -1, wideDir, MAX_PATH);
DWORD fileAttrs = GetFileAttributesW(wideDir);
return fileAttrs != INVALID_FILE_ATTRIBUTES;
#else
return access(path, R_OK) == 0;
config.sandboxBrokerServices = brokerServices;
config.sandboxPermissionsService = permissionsService;
#endif
#ifdef LIBFUZZER
if (getenv("LIBFUZZER"))
gBootstrap->XRE_LibFuzzerSetDriver(fuzzer::FuzzerDriver);
#endif
return gBootstrap->XRE_main(argc, argv, config);
}
static nsresult
InitXPCOMGlue(const char *argv0, nsIFile **xreDirectory)
InitXPCOMGlue(const char *argv0)
{
char exePath[MAXPATHLEN];
nsresult rv = mozilla::BinaryPath::Get(argv0, exePath);
if (NS_FAILED(rv)) {
UniqueFreePtr<char> exePath = BinaryPath::Get(argv0);
if (!exePath) {
Output("Couldn't find the application directory.\n");
return rv;
}
char *lastSlash = strrchr(exePath, XPCOM_FILE_PATH_SEPARATOR[0]);
if (!lastSlash || (size_t(lastSlash - exePath) > MAXPATHLEN -
sizeof(XPCOM_DLL) - 1))
return NS_ERROR_FAILURE;
strcpy(lastSlash + 1, XPCOM_DLL);
if (!FileExists(exePath)) {
Output("Could not find the Mozilla runtime.\n");
return NS_ERROR_FAILURE;
}
// We do this because of data in bug 771745
XPCOMGlueEnablePreload();
rv = XPCOMGlueStartup(exePath);
if (NS_FAILED(rv)) {
gBootstrap = mozilla::GetBootstrap(exePath.get());
if (!gBootstrap) {
Output("Couldn't load XPCOM.\n");
return rv;
}
rv = XPCOMGlueLoadXULFunctions(kXULFuncs);
if (NS_FAILED(rv)) {
Output("Couldn't load XRE functions.\n");
return rv;
return NS_ERROR_FAILURE;
}
// This will set this thread as the main thread.
NS_LogInit();
gBootstrap->NS_LogInit();
// chop XPCOM_DLL off exePath
*lastSlash = '\0';
#ifdef XP_MACOSX
lastSlash = strrchr(exePath, XPCOM_FILE_PATH_SEPARATOR[0]);
strcpy(lastSlash + 1, kOSXResourcesFolder);
#endif
#ifdef XP_WIN
rv = NS_NewLocalFile(NS_ConvertUTF8toUTF16(exePath), false,
xreDirectory);
#else
rv = NS_NewNativeLocalFile(nsDependentCString(exePath), false,
xreDirectory);
#endif
return rv;
return NS_OK;
}
int main(int argc, char* argv[], char* envp[])
{
mozilla::TimeStamp start = mozilla::TimeStamp::Now();
#ifdef XP_MACOSX
TriggerQuirks();
#endif
int gotCounters;
#if defined(XP_UNIX)
struct rusage initialRUsage;
gotCounters = !getrusage(RUSAGE_SELF, &initialRUsage);
#elif defined(XP_WIN)
IO_COUNTERS ioCounters;
gotCounters = GetProcessIoCounters(GetCurrentProcess(), &ioCounters);
#else
#error "Unknown platform" // having this here keeps cppcheck happy
#endif
nsIFile *xreDirectory;
#ifdef HAS_DLL_BLOCKLIST
DllBlocklist_Initialize();
#endif
#ifdef DEBUG
// In order to be effective against AppInit DLLs, the blocklist must be
// initialized before user32.dll is loaded into the process (bug 932100).
if (GetModuleHandleA("user32.dll")) {
fprintf(stderr, "DLL blocklist was unable to intercept AppInit DLLs.\n");
#ifdef MOZ_BROWSER_CAN_BE_CONTENTPROC
// We are launching as a content process, delegate to the appropriate
// main
if (argc > 1 && IsArg(argv[1], "contentproc")) {
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
// We need to initialize the sandbox TargetServices before InitXPCOMGlue
// because we might need the sandbox broker to give access to some files.
if (IsSandboxedProcess() && !sandboxing::GetInitializedTargetServices()) {
Output("Failed to initialize the sandbox target services.");
return 255;
}
#endif
nsresult rv = InitXPCOMGlue(argv[0]);
if (NS_FAILED(rv)) {
return 255;
}
int result = content_process_main(gBootstrap.get(), argc, argv);
// InitXPCOMGlue calls NS_LogInit, so we need to balance it here.
gBootstrap->NS_LogTerm();
return result;
}
#endif
#endif
nsresult rv = InitXPCOMGlue(argv[0], &xreDirectory);
nsresult rv = InitXPCOMGlue(argv[0]);
if (NS_FAILED(rv)) {
return 255;
}
XRE_StartupTimelineRecord(mozilla::StartupTimeline::START, start);
gBootstrap->XRE_StartupTimelineRecord(mozilla::StartupTimeline::START, start);
if (gotCounters) {
#if defined(XP_WIN)
XRE_TelemetryAccumulate(mozilla::Telemetry::EARLY_GLUESTARTUP_READ_OPS,
int(ioCounters.ReadOperationCount));
XRE_TelemetryAccumulate(mozilla::Telemetry::EARLY_GLUESTARTUP_READ_TRANSFER,
int(ioCounters.ReadTransferCount / 1024));
IO_COUNTERS newIoCounters;
if (GetProcessIoCounters(GetCurrentProcess(), &newIoCounters)) {
XRE_TelemetryAccumulate(mozilla::Telemetry::GLUESTARTUP_READ_OPS,
int(newIoCounters.ReadOperationCount - ioCounters.ReadOperationCount));
XRE_TelemetryAccumulate(mozilla::Telemetry::GLUESTARTUP_READ_TRANSFER,
int((newIoCounters.ReadTransferCount - ioCounters.ReadTransferCount) / 1024));
}
#elif defined(XP_UNIX)
XRE_TelemetryAccumulate(mozilla::Telemetry::EARLY_GLUESTARTUP_HARD_FAULTS,
int(initialRUsage.ru_majflt));
struct rusage newRUsage;
if (!getrusage(RUSAGE_SELF, &newRUsage)) {
XRE_TelemetryAccumulate(mozilla::Telemetry::GLUESTARTUP_HARD_FAULTS,
int(newRUsage.ru_majflt - initialRUsage.ru_majflt));
}
#else
#error "Unknown platform" // having this here keeps cppcheck happy
#ifdef MOZ_BROWSER_CAN_BE_CONTENTPROC
gBootstrap->XRE_EnableSameExecutableForContentProc();
#endif
}
int result = do_main(argc, argv, envp, xreDirectory);
int result = do_main(argc, argv, envp);
NS_LogTerm();
gBootstrap->NS_LogTerm();
#ifdef XP_MACOSX
// Allow writes again. While we would like to catch writes from static
@@ -367,8 +314,10 @@ int main(int argc, char* argv[], char* envp[])
// at least one such write that we don't control (see bug 826029). For
// now we enable writes again and early exits will have to use exit instead
// of _exit.
XRE_StopLateWriteChecks();
gBootstrap->XRE_StopLateWriteChecks();
#endif
gBootstrap.reset();
return result;
}
@@ -531,7 +531,7 @@
var _self = this;
newEditorElement.addEventListener("load", function(evt) {
if (evt.originalTarget == content.document){ _self.finishInstall(progressListener); } }, true);
if (evt.originalTarget == GetWindowContent().document){ _self.finishInstall(progressListener); } }, true);
newEditorElement.addEventListener("DOMTitleChanged", this.changeTabTitle, false);
newEditorElement.addEventListener("dblclick", function(evt) { OnDoubleClick(evt) }, true);
@@ -706,7 +706,7 @@
editors.item(i).lastChild.removeAttribute("type");
this.getCurrentEditorElement().setAttribute("type", "content-primary");
window.content.focus();
GetWindowContent().focus();
window.UpdateWindowTitle();
@@ -94,7 +94,7 @@ var AutoInsertTable = {
if (EditorUtils.isWysiwygMode()) {
editor.insertElementAtSelection(tableElement, true);
editor.selection.collapse(firstCell, 0);
window.content.focus();
GetWindowContent().focus();
}
else {
var src = style_html(tableElement.outerHTML);
+9 -9
View File
@@ -789,7 +789,7 @@ function OnKeyPressWhileChangingTag(event)
if (newTag.toLowerCase() == element.nodeName.toLowerCase())
{
// nothing to do
window.content.focus();
GetWindowContent().focus();
return;
}
@@ -815,7 +815,7 @@ function OnKeyPressWhileChangingTag(event)
editor.deleteNode(element);
editor.selectElement(newElt);
window.content.focus();
GetWindowContent().focus();
}
}
catch (e) {}
@@ -825,7 +825,7 @@ function OnKeyPressWhileChangingTag(event)
}
else if (keyCode == 27) {
// if the user hits Escape, we discard the changes
window.content.focus();
GetWindowContent().focus();
}
}
@@ -926,7 +926,7 @@ function ToggleViewMode(aElement)
deck.removeAttribute("class");
editorElement.parentNode.selectedIndex = 1;
window.content.focus();
GetWindowContent().focus();
NotifierUtils.notify("modeSwitch");
return true;
@@ -1026,7 +1026,7 @@ function ToggleViewMode(aElement)
if (mode == "liveview") {
deck.className = "liveview";
window.content.focus();
GetWindowContent().focus();
}
else {
deck.removeAttribute("class");
@@ -1105,7 +1105,7 @@ function ToggleViewMode(aElement)
deck.removeAttribute("class");
editorElement.parentNode.selectedIndex = 1;
gDialog.structurebar.style.visibility = "";
window.content.focus();
GetWindowContent().focus();
}
sourceIframe.setUserData("lastSaved", "", null);
Services.prefs.setBoolPref("bluegriffon.spellCheck.enabled", spellchecking);
@@ -1175,7 +1175,7 @@ function RebuildFromSource(aDoc, isXML, aNoReflect)
if (isXML) {
var fileExt = UrlUtils.getFileExtension( UrlUtils.getDocumentUrl());
var xhtmlExt = (fileExt == "xhtm" || fileExt == "xhtml");
var styles = aDoc.querySelectorAll("style");
var found = false, switchToCDATA = false;
for (var i = 0; i < styles.length; i++) {
@@ -1222,7 +1222,6 @@ function RebuildFromSource(aDoc, isXML, aNoReflect)
}
}
}
if (!aNoReflect)
EditorUtils.getCurrentEditorElement().parentNode.selectedIndex = 1;
var editor = EditorUtils.getCurrentEditor();
@@ -1236,6 +1235,7 @@ function RebuildFromSource(aDoc, isXML, aNoReflect)
// clone body
CloneElementContents(editor, aDoc.querySelector("body"), editor.document.body);
var valueArray = [];
if (!Services.prefs.getBoolPref("bluegriffon.display.comments"))
valueArray.push("comment");
@@ -1289,7 +1289,7 @@ function RebuildFromSource(aDoc, isXML, aNoReflect)
// the window title is updated by DOMTitleChanged event
if (!aNoReflect) {
NotifierUtils.notify("afterLeavingSourceMode");
window.content.focus();
GetWindowContent().focus();
EditorUtils.getCurrentEditorElement().focus();
}
} catch(e) {
+1 -1
View File
@@ -59,7 +59,7 @@ var ComposerCommands = {
if (this.mComposerJSCommandControllerID)
{
try {
controller = window.content.controllers.getControllerById(this.mComposerJSCommandControllerID);
controller = GetWindowContent().controllers.getControllerById(this.mComposerJSCommandControllerID);
} catch (e) {}
}
if (!controller)
@@ -102,7 +102,7 @@ var cmdMarkupCleaner =
"chrome,close,titlebar,modal");
}
catch(ex) {}
window.content.focus();
GetWindowContent().focus();
}
};
+1 -1
View File
@@ -60,7 +60,7 @@ var bgSpellingCommand =
false);
}
catch(ex) {}
window.content.focus();
GetWindowContent().focus();
}
};
+2 -2
View File
@@ -155,7 +155,7 @@ var cmdSave =
UrlUtils.isUrlOfBlankDocument(EditorUtils.getDocumentUrl()),
false,
EditorUtils.getCurrentDocumentMimeType());
window.content.focus();
GetWindowContent().focus();
}
NotifierUtils.notify("fileSaved", EditorUtils.getDocumentUrl());
window.updateCommands("style");
@@ -207,7 +207,7 @@ var cmdSaveAs =
false,
EditorUtils.getCurrentDocumentMimeType());
}
window.content.focus();
GetWindowContent().focus();
if (result) {
StoreUrlInLocationDB(EditorUtils.getDocumentUrl());
}
+2 -2
View File
@@ -121,7 +121,7 @@ function onBespinFindKeypress(aEvent)
if (!EditorUtils.isWysiwygMode())
EditorUtils.getCurrentSourceEditorElement().focus();
else {
window.content.focus();
GetWindowContent().focus();
}
}
}
@@ -268,7 +268,7 @@ function CloseFindBar()
{
gDialog.bespinToolbox1.hidden = true;
gDialog.bespinToolbox2.hidden = true;
window.content.focus();
GetWindowContent().focus();
}
function ReplaceInWysiwyg()
@@ -282,7 +282,7 @@ var cmdPagePropertiesCommand =
"chrome,close,titlebar,modal");
}
catch(ex) {}
window.content.focus();
GetWindowContent().focus();
}
};
+2 -2
View File
@@ -9,7 +9,7 @@ var gEditorDocumentObserver =
return;
var editor = EditorUtils.getCurrentEditor();
gContentWindow = window.content;
gContentWindow = GetWindowContent();
switch(aTopic)
{
case "obs_documentCreated":
@@ -68,7 +68,7 @@ var gEditorDocumentObserver =
if (editorStatus)
return;
window.content.focus();
GetWindowContent().focus();
NotifierUtils.notify("documentCreated");
break;
+1 -1
View File
@@ -9,7 +9,7 @@ function Startup()
try {
if (window.arguments && window.arguments[0]) {
var cl = window.arguments[0];
if (cl && cl instanceof Components.interfaces.nsISupportsArray) {
if (cl && cl instanceof Components.interfaces.nsIMutableArray) {
url = cl.GetElementAt(0).QueryInterface(Components.interfaces.nsISupportsString).data;
var localFile = UrlUtils.newLocalFile(url);
if (localFile) { // if localFile is null, then consider it's a remote URL
+24 -24
View File
@@ -62,7 +62,7 @@ var bgSelectTableCommand =
try {
EditorUtils.getCurrentTableEditor().selectTable();
} catch(e) {}
window.content.focus();
GetWindowContent().focus();
}
};
@@ -92,7 +92,7 @@ var bgSelectTableCaptionCommand =
try {
EditorUtils.getCurrentEditor().selectElement(element.firstElementChild);
} catch(e) {}
window.content.focus();
GetWindowContent().focus();
}
};
@@ -116,7 +116,7 @@ var bgSelectTableRowCommand =
try {
EditorUtils.getCurrentTableEditor().selectTableRow();
} catch(e) {}
window.content.focus();
GetWindowContent().focus();
}
};
@@ -140,7 +140,7 @@ var bgsSelectTableColumnCommand =
try {
EditorUtils.getCurrentTableEditor().selectTableColumn();
} catch(e) {}
window.content.focus();
GetWindowContent().focus();
}
};
@@ -164,7 +164,7 @@ var bgSelectTableCellCommand =
try {
EditorUtils.getCurrentTableEditor().selectTableCell();
} catch(e) {}
window.content.focus();
GetWindowContent().focus();
}
};
@@ -188,7 +188,7 @@ var bgSelectAllTableCellsCommand =
try {
EditorUtils.getCurrentTableEditor().selectAllTableCells();
} catch(e) {}
window.content.focus();
GetWindowContent().focus();
}
};
@@ -222,7 +222,7 @@ var bgInsertTableCaptionCommand =
EditorUtils.getCurrentEditor().insertNode(caption, element, 0);
EditorUtils.getCurrentEditor().selectElement(brNode);
} catch(e) {}
window.content.focus();
GetWindowContent().focus();
}
};
@@ -246,7 +246,7 @@ var bgInsertTableRowAboveCommand =
try {
EditorUtils.getCurrentTableEditor().insertTableRow(1, false);
} catch(e) {}
window.content.focus();
GetWindowContent().focus();
}
};
@@ -270,7 +270,7 @@ var bgInsertTableRowBelowCommand =
try {
EditorUtils.getCurrentTableEditor().insertTableRow(1, true);
} catch(e) {}
window.content.focus();
GetWindowContent().focus();
}
};
@@ -294,7 +294,7 @@ var bgInsertTableColumnBeforeCommand =
try {
EditorUtils.getCurrentTableEditor().insertTableColumn(1, false);
} catch(e) {}
window.content.focus();
GetWindowContent().focus();
}
};
@@ -318,7 +318,7 @@ var bgInsertTableColumnAfterCommand =
try {
EditorUtils.getCurrentTableEditor().insertTableColumn(1, true);
} catch(e) {}
window.content.focus();
GetWindowContent().focus();
}
};
@@ -342,7 +342,7 @@ var bgInsertTableCellBeforeCommand =
try {
EditorUtils.getCurrentTableEditor().insertTableCell(1, false);
} catch(e) {}
window.content.focus();
GetWindowContent().focus();
}
};
@@ -366,7 +366,7 @@ var bgInsertTableCellAfterCommand =
try {
EditorUtils.getCurrentTableEditor().insertTableCell(1, true);
} catch(e) {}
window.content.focus();
GetWindowContent().focus();
}
};
@@ -390,7 +390,7 @@ var bgDeleteTableCommand =
try {
EditorUtils.getCurrentTableEditor().deleteTable();
} catch(e) {}
window.content.focus();
GetWindowContent().focus();
}
};
@@ -420,7 +420,7 @@ var bgDeleteTableCaptionCommand =
try {
EditorUtils.getCurrentEditor().deleteNode(element.firstElementChild);
} catch(e) {}
window.content.focus();
GetWindowContent().focus();
}
};
@@ -525,7 +525,7 @@ var bgDeleteTableRowCommand =
rows = GetNumberOfContiguousSelectedRows();
}
} finally { editor.endTransaction(); }
window.content.focus();
GetWindowContent().focus();
}
};
@@ -562,7 +562,7 @@ var bgDeleteTableColumnCommand =
columns = GetNumberOfContiguousSelectedColumns();
}
} finally { editor.endTransaction(); }
window.content.focus();
GetWindowContent().focus();
}
};
@@ -586,7 +586,7 @@ var bgDeleteTableCellCommand =
try {
EditorUtils.getCurrentTableEditor().deleteTableCell(1);
} catch (e) {}
window.content.focus();
GetWindowContent().focus();
}
};
@@ -610,7 +610,7 @@ var bgDeleteTableCellContentsCommand =
try {
EditorUtils.getCurrentTableEditor().deleteTableCellContents();
} catch (e) {}
window.content.focus();
GetWindowContent().focus();
}
};
@@ -635,7 +635,7 @@ var bgNormalizeTableCommand =
try {
EditorUtils.getCurrentTableEditor().normalizeTable(null);
} catch (e) {}
window.content.focus();
GetWindowContent().focus();
}
};
@@ -696,7 +696,7 @@ var bgJoinTableCellsCommand =
try {
EditorUtils.getCurrentTableEditor().joinTableCells(false);
} catch (e) {alert(e)}
window.content.focus();
GetWindowContent().focus();
}
};
@@ -765,7 +765,7 @@ var bgSplitTableCellCommand =
try {
EditorUtils.getCurrentTableEditor().splitTableCell();
} catch (e) {}
window.content.focus();
GetWindowContent().focus();
}
};
@@ -832,7 +832,7 @@ var bgConvertToTable =
doCommand: function(aCommand)
{
window.openDialog("chrome://bluegriffon/content/dialogs/convertToTable.xul","_blank", "chrome,close,titlebar,modal")
window.content.focus();
GetWindowContent().focus();
}
};
@@ -856,7 +856,7 @@ var bgSelectTableColumnCommand =
try {
EditorUtils.getCurrentTableEditor().selectTableColumn();
} catch(e) {}
window.content.focus();
GetWindowContent().focus();
}
};
+4
View File
@@ -79,3 +79,7 @@ function ApplyWysiwygThemeChange(aDocument, aValue)
}
}
function GetWindowContent()
{
return EditorUtils.getCurrentEditorElement().contentWindow;
}
+4066 -1891
View File
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -1 +1 @@
f14898695ee0
ff04d410e74b
@@ -19,7 +19,7 @@ var inspector;
const kObserverServiceContractID = "@mozilla.org/observer-service;1";
const gNavigator = window.content;
const gNavigator = GetWindowContent();
//////////////////////////////////////////////////////////////////////////////
+1 -1
View File
@@ -165,7 +165,7 @@ function onElementsTreeModified(aEvent)
editor.deleteNode(target);
editor.selectElement(newElt);
window.content.focus();
GetWindowContent().focus();
}
}
catch (e) {}