diff --git a/dom/plugins/ipc/PluginProcessChild.cpp b/dom/plugins/ipc/PluginProcessChild.cpp index ad2df0248458..3dc2610cd6ea 100644 --- a/dom/plugins/ipc/PluginProcessChild.cpp +++ b/dom/plugins/ipc/PluginProcessChild.cpp @@ -13,6 +13,13 @@ #include "base/string_util.h" #include "chrome/common/chrome_switches.h" +#if defined(XP_MACOSX) +#include "nsCocoaFeatures.h" +// An undocumented CoreGraphics framework method, present in the same form +// since at least OS X 10.5. +extern "C" CGError CGSSetDebugOptions(int options); +#endif + #ifdef XP_WIN #include bool ShouldProtectPluginCurrentDirectory(char16ptr_t pluginFilePath); @@ -119,9 +126,21 @@ PluginProcessChild::Init() return false; } - return mPlugin.InitForChrome(pluginFilename, ParentHandle(), - IOThreadChild::message_loop(), - IOThreadChild::channel()); + bool retval = mPlugin.InitForChrome(pluginFilename, ParentHandle(), + IOThreadChild::message_loop(), + IOThreadChild::channel()); +#if defined(XP_MACOSX) + if (nsCocoaFeatures::OnYosemiteOrLater()) { + // Explicitly turn off CGEvent logging. This works around bug 1092855. + // If there are already CGEvents in the log, turning off logging also + // causes those events to be written to disk. But at this point no + // CGEvents have yet been processed. CGEvents are events (usually + // input events) pulled from the WindowServer. An option of 0x80000008 + // turns on CGEvent logging. + CGSSetDebugOptions(0x80000007); + } +#endif + return retval; } void diff --git a/widget/cocoa/nsAppShell.mm b/widget/cocoa/nsAppShell.mm index 5f096ad5093f..2d14edea2c7b 100644 --- a/widget/cocoa/nsAppShell.mm +++ b/widget/cocoa/nsAppShell.mm @@ -221,6 +221,11 @@ RemoveScreenWakeLockListener() sWakeLockListener = nullptr; } } + +// An undocumented CoreGraphics framework method, present in the same form +// since at least OS X 10.5. +extern "C" CGError CGSSetDebugOptions(int options); + // Init // // Loads the nib (see bug 316076c21) and sets up the CFRunLoopSource used to @@ -304,6 +309,16 @@ nsAppShell::Init() gAppShellMethodsSwizzled = true; } + if (nsCocoaFeatures::OnYosemiteOrLater()) { + // Explicitly turn off CGEvent logging. This works around bug 1092855. + // If there are already CGEvents in the log, turning off logging also + // causes those events to be written to disk. But at this point no + // CGEvents have yet been processed. CGEvents are events (usually + // input events) pulled from the WindowServer. An option of 0x80000008 + // turns on CGEvent logging. + CGSSetDebugOptions(0x80000007); + } + [localPool release]; return rv;