зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1682030 - Remove OSX interposer. r=haik
Removes the mac plugin_interposer (and the related NSCursorInfo behavior), as part of removing all of NPAPI plugin support, since it has no other clients. Differential Revision: https://phabricator.services.mozilla.com/D107142
This commit is contained in:
Родитель
45f5dd79ff
Коммит
5a231c1001
3
CLOBBER
3
CLOBBER
|
@ -22,4 +22,5 @@
|
|||
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
|
||||
# don't change CLOBBER for WebIDL changes any more.
|
||||
|
||||
Merge day clobber
|
||||
Merge day clobber
|
||||
Bug 1682030 - OSX builds complain about TestPlugin after that product is removed from tree
|
|
@ -90,7 +90,6 @@
|
|||
#endif
|
||||
#ifdef XP_MACOSX
|
||||
@BINPATH@/@MOZ_CHILD_PROCESS_NAME@.app/
|
||||
@BINPATH@/@DLL_PREFIX@plugin_child_interpose@DLL_SUFFIX@
|
||||
#else
|
||||
@BINPATH@/@MOZ_CHILD_PROCESS_NAME@
|
||||
#endif
|
||||
|
|
|
@ -12,7 +12,6 @@ include protocol PFunctionBroker;
|
|||
using NPError from "npapi.h";
|
||||
using NPNVariable from "npapi.h";
|
||||
using mozilla::dom::NativeThreadId from "mozilla/dom/NativeThreadId.h";
|
||||
using class mac_plugin_interposing::NSCursorInfo from "mozilla/plugins/PluginMessageUtils.h";
|
||||
using struct nsID from "nsID.h";
|
||||
using struct mozilla::plugins::NPAudioDeviceChangeDetailsIPC from "mozilla/plugins/PluginMessageUtils.h";
|
||||
using struct mozilla::plugins::NPAudioDeviceStateChangedIPC from "mozilla/plugins/PluginMessageUtils.h";
|
||||
|
@ -127,12 +126,6 @@ parent:
|
|||
double aWidth, double aHeight);
|
||||
async PluginHideWindow(uint32_t aWindowId);
|
||||
|
||||
// OS X Specific calls to allow the plugin to manage the cursor.
|
||||
async SetCursor(NSCursorInfo cursorInfo);
|
||||
async ShowCursor(bool show);
|
||||
async PushCursor(NSCursorInfo cursorInfo);
|
||||
async PopCursor();
|
||||
|
||||
sync NPN_SetException(nsCString message);
|
||||
|
||||
async NPN_ReloadPlugins(bool aReloadPages);
|
||||
|
|
|
@ -1,137 +0,0 @@
|
|||
// vim:set ts=2 sts=2 sw=2 et cin:
|
||||
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#ifndef DOM_PLUGINS_IPC_PLUGININTERPOSEOSX_H
|
||||
#define DOM_PLUGINS_IPC_PLUGININTERPOSEOSX_H
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "nsPoint.h"
|
||||
#include "npapi.h"
|
||||
|
||||
// Make this includable from non-Objective-C code.
|
||||
#ifndef __OBJC__
|
||||
class NSCursor;
|
||||
#else
|
||||
# import <Cocoa/Cocoa.h>
|
||||
#endif
|
||||
|
||||
// The header file QuickdrawAPI.h is missing on OS X 10.7 and up (though the
|
||||
// QuickDraw APIs defined in it are still present) -- so we need to supply the
|
||||
// relevant parts of its contents here. It's likely that Apple will eventually
|
||||
// remove the APIs themselves (probably in OS X 10.8), so we need to make them
|
||||
// weak imports, and test for their presence before using them.
|
||||
#if !defined(__QUICKDRAWAPI__)
|
||||
|
||||
typedef short Bits16[16];
|
||||
struct Cursor {
|
||||
Bits16 data;
|
||||
Bits16 mask;
|
||||
Point hotSpot;
|
||||
};
|
||||
typedef struct Cursor Cursor;
|
||||
|
||||
#endif /* __QUICKDRAWAPI__ */
|
||||
|
||||
namespace mac_plugin_interposing {
|
||||
|
||||
// Class used to serialize NSCursor objects over IPC between processes.
|
||||
class NSCursorInfo {
|
||||
public:
|
||||
enum Type {
|
||||
TypeCustom,
|
||||
TypeArrow,
|
||||
TypeClosedHand,
|
||||
TypeContextualMenu, // Only supported on OS X 10.6 and up
|
||||
TypeCrosshair,
|
||||
TypeDisappearingItem,
|
||||
TypeDragCopy, // Only supported on OS X 10.6 and up
|
||||
TypeDragLink, // Only supported on OS X 10.6 and up
|
||||
TypeIBeam,
|
||||
TypeNotAllowed, // Only supported on OS X 10.6 and up
|
||||
TypeOpenHand,
|
||||
TypePointingHand,
|
||||
TypeResizeDown,
|
||||
TypeResizeLeft,
|
||||
TypeResizeLeftRight,
|
||||
TypeResizeRight,
|
||||
TypeResizeUp,
|
||||
TypeResizeUpDown,
|
||||
TypeTransparent // Special type
|
||||
};
|
||||
|
||||
NSCursorInfo();
|
||||
explicit NSCursorInfo(NSCursor* aCursor);
|
||||
explicit NSCursorInfo(const Cursor* aCursor);
|
||||
~NSCursorInfo();
|
||||
|
||||
NSCursor* GetNSCursor() const;
|
||||
Type GetType() const;
|
||||
const char* GetTypeName() const;
|
||||
nsPoint GetHotSpot() const;
|
||||
uint8_t* GetCustomImageData() const;
|
||||
uint32_t GetCustomImageDataLength() const;
|
||||
|
||||
void SetType(Type aType);
|
||||
void SetHotSpot(nsPoint aHotSpot);
|
||||
void SetCustomImageData(uint8_t* aData, uint32_t aDataLength);
|
||||
|
||||
static bool GetNativeCursorsSupported();
|
||||
|
||||
private:
|
||||
NSCursor* GetTransparentCursor() const;
|
||||
|
||||
Type mType;
|
||||
// The hot spot's coordinate system is the cursor's coordinate system, and
|
||||
// has an upper-left origin (in both Cocoa and pre-Cocoa systems).
|
||||
nsPoint mHotSpot;
|
||||
uint8_t* mCustomImageData;
|
||||
uint32_t mCustomImageDataLength;
|
||||
static int32_t mNativeCursorsSupported;
|
||||
};
|
||||
|
||||
namespace parent {
|
||||
|
||||
void OnPluginShowWindow(uint32_t window_id, CGRect window_bounds, bool modal);
|
||||
void OnPluginHideWindow(uint32_t window_id, pid_t aPluginPid);
|
||||
void OnSetCursor(const NSCursorInfo& cursorInfo);
|
||||
void OnShowCursor(bool show);
|
||||
void OnPushCursor(const NSCursorInfo& cursorInfo);
|
||||
void OnPopCursor();
|
||||
|
||||
} // namespace parent
|
||||
|
||||
namespace child {
|
||||
|
||||
void SetUpCocoaInterposing();
|
||||
|
||||
} // namespace child
|
||||
|
||||
} // namespace mac_plugin_interposing
|
||||
|
||||
#endif /* DOM_PLUGINS_IPC_PLUGININTERPOSEOSX_H */
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -25,15 +25,6 @@
|
|||
#include "mozilla/Logging.h"
|
||||
#include "nsHashKeys.h"
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
# include "PluginInterposeOSX.h"
|
||||
#else
|
||||
namespace mac_plugin_interposing {
|
||||
class NSCursorInfo {};
|
||||
} // namespace mac_plugin_interposing
|
||||
#endif
|
||||
using mac_plugin_interposing::NSCursorInfo;
|
||||
|
||||
namespace mozilla {
|
||||
namespace plugins {
|
||||
|
||||
|
@ -454,97 +445,6 @@ struct ParamTraits<NPNSString*> {
|
|||
};
|
||||
#endif
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
template <>
|
||||
struct ParamTraits<NSCursorInfo> {
|
||||
typedef NSCursorInfo paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
NSCursorInfo::Type type = aParam.GetType();
|
||||
|
||||
aMsg->WriteInt(type);
|
||||
|
||||
nsPoint hotSpot = aParam.GetHotSpot();
|
||||
WriteParam(aMsg, hotSpot.x);
|
||||
WriteParam(aMsg, hotSpot.y);
|
||||
|
||||
uint32_t dataLength = aParam.GetCustomImageDataLength();
|
||||
WriteParam(aMsg, dataLength);
|
||||
if (dataLength == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t* buffer = (uint8_t*)moz_xmalloc(dataLength);
|
||||
memcpy(buffer, aParam.GetCustomImageData(), dataLength);
|
||||
aMsg->WriteBytes(buffer, dataLength);
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
NSCursorInfo::Type type;
|
||||
if (!aMsg->ReadInt(aIter, (int*)&type)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nscoord hotSpotX, hotSpotY;
|
||||
if (!ReadParam(aMsg, aIter, &hotSpotX) ||
|
||||
!ReadParam(aMsg, aIter, &hotSpotY)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t dataLength;
|
||||
if (!ReadParam(aMsg, aIter, &dataLength)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto data = mozilla::MakeUnique<uint8_t[]>(dataLength);
|
||||
if (dataLength != 0) {
|
||||
if (!aMsg->ReadBytesInto(aIter, data.get(), dataLength)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
aResult->SetType(type);
|
||||
aResult->SetHotSpot(nsPoint(hotSpotX, hotSpotY));
|
||||
aResult->SetCustomImageData(data.get(), dataLength);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void Log(const paramType& aParam, std::wstring* aLog) {
|
||||
const char* typeName = aParam.GetTypeName();
|
||||
nsPoint hotSpot = aParam.GetHotSpot();
|
||||
int hotSpotX, hotSpotY;
|
||||
# ifdef NS_COORD_IS_FLOAT
|
||||
hotSpotX = rint(hotSpot.x);
|
||||
hotSpotY = rint(hotSpot.y);
|
||||
# else
|
||||
hotSpotX = hotSpot.x;
|
||||
hotSpotY = hotSpot.y;
|
||||
# endif
|
||||
uint32_t dataLength = aParam.GetCustomImageDataLength();
|
||||
uint8_t* data = aParam.GetCustomImageData();
|
||||
|
||||
aLog->append(StringPrintf(L"[%s, (%i %i), %u, %p]", typeName, hotSpotX,
|
||||
hotSpotY, dataLength, data));
|
||||
}
|
||||
};
|
||||
#else
|
||||
template <>
|
||||
struct ParamTraits<NSCursorInfo> {
|
||||
typedef NSCursorInfo paramType;
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
MOZ_CRASH("NSCursorInfo isn't meaningful on this platform");
|
||||
}
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
MOZ_CRASH("NSCursorInfo isn't meaningful on this platform");
|
||||
return false;
|
||||
}
|
||||
};
|
||||
#endif // #ifdef XP_MACOSX
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::plugins::IPCByteRange> {
|
||||
typedef mozilla::plugins::IPCByteRange paramType;
|
||||
|
|
|
@ -50,7 +50,6 @@
|
|||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_COCOA
|
||||
# include "PluginInterposeOSX.h"
|
||||
# include "PluginUtilsOSX.h"
|
||||
#endif
|
||||
|
||||
|
@ -123,12 +122,6 @@ PluginModuleChild::PluginModuleChild(bool aIsChrome)
|
|||
MOZ_ASSERT(!gChromeInstance);
|
||||
gChromeInstance = this;
|
||||
}
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
if (aIsChrome) {
|
||||
mac_plugin_interposing::child::SetUpCocoaInterposing();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
PluginModuleChild::~PluginModuleChild() {
|
||||
|
|
|
@ -23,10 +23,6 @@
|
|||
# include "nsTHashSet.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_COCOA
|
||||
# include "PluginInterposeOSX.h"
|
||||
#endif
|
||||
|
||||
#include "mozilla/plugins/PPluginModuleChild.h"
|
||||
#include "mozilla/plugins/PluginInstanceChild.h"
|
||||
#include "mozilla/plugins/PluginMessageUtils.h"
|
||||
|
@ -176,14 +172,6 @@ class PluginModuleChild : public PPluginModuleChild {
|
|||
|
||||
void PluginHideWindow(uint32_t window_id) { SendPluginHideWindow(window_id); }
|
||||
|
||||
void SetCursor(NSCursorInfo& cursorInfo) { SendSetCursor(cursorInfo); }
|
||||
|
||||
void ShowCursor(bool show) { SendShowCursor(show); }
|
||||
|
||||
void PushCursor(NSCursorInfo& cursorInfo) { SendPushCursor(cursorInfo); }
|
||||
|
||||
void PopCursor() { SendPopCursor(); }
|
||||
|
||||
bool GetNativeCursorsSupported() {
|
||||
return Settings().nativeCursorsSupported();
|
||||
}
|
||||
|
|
|
@ -58,7 +58,6 @@
|
|||
#ifdef MOZ_WIDGET_GTK
|
||||
# include <glib.h>
|
||||
#elif XP_MACOSX
|
||||
# include "PluginInterposeOSX.h"
|
||||
# include "PluginUtilsOSX.h"
|
||||
#endif
|
||||
|
||||
|
@ -2278,80 +2277,16 @@ void PluginModuleParent::ProcessRemoteNativeEventsInInterruptCall() {
|
|||
mozilla::ipc::IPCResult PluginModuleParent::RecvPluginShowWindow(
|
||||
const uint32_t& aWindowId, const bool& aModal, const int32_t& aX,
|
||||
const int32_t& aY, const double& aWidth, const double& aHeight) {
|
||||
PLUGIN_LOG_DEBUG(("%s", FULLFUNCTION));
|
||||
#if defined(XP_MACOSX)
|
||||
CGRect windowBound = ::CGRectMake(aX, aY, aWidth, aHeight);
|
||||
mac_plugin_interposing::parent::OnPluginShowWindow(aWindowId, windowBound,
|
||||
aModal);
|
||||
return IPC_OK();
|
||||
#else
|
||||
MOZ_ASSERT_UNREACHABLE(
|
||||
"PluginInstanceParent::RecvPluginShowWindow not implemented!");
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult PluginModuleParent::RecvPluginHideWindow(
|
||||
const uint32_t& aWindowId) {
|
||||
PLUGIN_LOG_DEBUG(("%s", FULLFUNCTION));
|
||||
#if defined(XP_MACOSX)
|
||||
mac_plugin_interposing::parent::OnPluginHideWindow(aWindowId, OtherPid());
|
||||
return IPC_OK();
|
||||
#else
|
||||
MOZ_ASSERT_UNREACHABLE(
|
||||
"PluginInstanceParent::RecvPluginHideWindow not implemented!");
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult PluginModuleParent::RecvSetCursor(
|
||||
const NSCursorInfo& aCursorInfo) {
|
||||
PLUGIN_LOG_DEBUG(("%s", FULLFUNCTION));
|
||||
#if defined(XP_MACOSX)
|
||||
mac_plugin_interposing::parent::OnSetCursor(aCursorInfo);
|
||||
return IPC_OK();
|
||||
#else
|
||||
MOZ_ASSERT_UNREACHABLE(
|
||||
"PluginInstanceParent::RecvSetCursor not implemented!");
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult PluginModuleParent::RecvShowCursor(const bool& aShow) {
|
||||
PLUGIN_LOG_DEBUG(("%s", FULLFUNCTION));
|
||||
#if defined(XP_MACOSX)
|
||||
mac_plugin_interposing::parent::OnShowCursor(aShow);
|
||||
return IPC_OK();
|
||||
#else
|
||||
MOZ_ASSERT_UNREACHABLE(
|
||||
"PluginInstanceParent::RecvShowCursor not implemented!");
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult PluginModuleParent::RecvPushCursor(
|
||||
const NSCursorInfo& aCursorInfo) {
|
||||
PLUGIN_LOG_DEBUG(("%s", FULLFUNCTION));
|
||||
#if defined(XP_MACOSX)
|
||||
mac_plugin_interposing::parent::OnPushCursor(aCursorInfo);
|
||||
return IPC_OK();
|
||||
#else
|
||||
MOZ_ASSERT_UNREACHABLE(
|
||||
"PluginInstanceParent::RecvPushCursor not implemented!");
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult PluginModuleParent::RecvPopCursor() {
|
||||
PLUGIN_LOG_DEBUG(("%s", FULLFUNCTION));
|
||||
#if defined(XP_MACOSX)
|
||||
mac_plugin_interposing::parent::OnPopCursor();
|
||||
return IPC_OK();
|
||||
#else
|
||||
MOZ_ASSERT_UNREACHABLE(
|
||||
"PluginInstanceParent::RecvPopCursor not implemented!");
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult PluginModuleParent::RecvNPN_SetException(
|
||||
|
|
|
@ -127,14 +127,6 @@ class PluginModuleParent : public PPluginModuleParent,
|
|||
|
||||
mozilla::ipc::IPCResult RecvPluginHideWindow(const uint32_t& aWindowId);
|
||||
|
||||
mozilla::ipc::IPCResult RecvSetCursor(const NSCursorInfo& aCursorInfo);
|
||||
|
||||
mozilla::ipc::IPCResult RecvShowCursor(const bool& aShow);
|
||||
|
||||
mozilla::ipc::IPCResult RecvPushCursor(const NSCursorInfo& aCursorInfo);
|
||||
|
||||
mozilla::ipc::IPCResult RecvPopCursor();
|
||||
|
||||
mozilla::ipc::IPCResult RecvNPN_SetException(const nsCString& aMessage);
|
||||
|
||||
mozilla::ipc::IPCResult RecvNPN_ReloadPlugins(const bool& aReloadPages);
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
SharedLibrary("plugin_child_interpose")
|
||||
|
||||
UNIFIED_SOURCES += ["%s.mm" % (LIBRARY_NAME)]
|
||||
|
||||
OS_LIBS += ["-framework Carbon"]
|
||||
|
||||
DIST_INSTALL = True
|
|
@ -1,129 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// Use "dyld interposing" to hook methods imported from other libraries in the
|
||||
// plugin child process. The basic technique is described at
|
||||
// http://books.google.com/books?id=K8vUkpOXhN4C&pg=PA73&lpg=PA73&dq=__interpose&source=bl&ots=OJnnXZYpZC&sig=o7I3lXvoduUi13SrPfOON7o3do4&hl=en&ei=AoehS9brCYGQNrvsmeUM&sa=X&oi=book_result&ct=result&resnum=6&ved=0CBsQ6AEwBQ#v=onepage&q=__interpose&f=false.
|
||||
// The idea of doing it for the plugin child process comes from Chromium code,
|
||||
// particularly from plugin_carbon_interpose_mac.cc
|
||||
// (http://codesearch.google.com/codesearch/p?hl=en#OAMlx_jo-ck/src/chrome/browser/plugin_carbon_interpose_mac.cc&q=nscursor&exact_package=chromium&d=1&l=168)
|
||||
// and from PluginProcessHost::Init() in plugin_process_host.cc
|
||||
// (http://codesearch.google.com/codesearch/p?hl=en#OAMlx_jo-ck/src/content/browser/plugin_process_host.cc&q=nscursor&exact_package=chromium&d=1&l=222).
|
||||
|
||||
// These hooks are needed to make certain OS calls work from the child process
|
||||
// (a background process) that would normally only work when called in the
|
||||
// parent process (the foreground process). They allow us to serialize
|
||||
// information from the child process to the parent process, so that the same
|
||||
// (or equivalent) calls can be made from the parent process.
|
||||
|
||||
// This file lives in a seperate module (libplugin_child_interpose.dylib),
|
||||
// which will get loaded by the OS before any other modules when the plugin
|
||||
// child process is launched (from GeckoChildProcessHost::
|
||||
// PerformAsyncLaunch()). For this reason it shouldn't link in other
|
||||
// browser modules when loaded. Instead it should use dlsym() to load
|
||||
// pointers to the methods it wants to call in other modules.
|
||||
|
||||
#if !defined(__LP64__)
|
||||
|
||||
# include <dlfcn.h>
|
||||
# import <Carbon/Carbon.h>
|
||||
|
||||
// The header file QuickdrawAPI.h is missing on OS X 10.7 and up (though the
|
||||
// QuickDraw APIs defined in it are still present) -- so we need to supply the
|
||||
// relevant parts of its contents here. It's likely that Apple will eventually
|
||||
// remove the APIs themselves (probably in OS X 10.8), so we need to make them
|
||||
// weak imports, and test for their presence before using them.
|
||||
# if !defined(__QUICKDRAWAPI__)
|
||||
|
||||
struct Cursor;
|
||||
extern "C" void SetCursor(const Cursor* crsr) __attribute__((weak_import));
|
||||
|
||||
# endif /* __QUICKDRAWAPI__ */
|
||||
|
||||
BOOL (*OnSetThemeCursorPtr)(ThemeCursor) = NULL;
|
||||
BOOL (*OnSetCursorPtr)(const Cursor*) = NULL;
|
||||
BOOL (*OnHideCursorPtr)() = NULL;
|
||||
BOOL (*OnShowCursorPtr)() = NULL;
|
||||
|
||||
static BOOL loadXULPtrs() {
|
||||
if (!OnSetThemeCursorPtr) {
|
||||
// mac_plugin_interposing_child_OnSetThemeCursor(ThemeCursor cursor) is in
|
||||
// PluginInterposeOSX.mm
|
||||
OnSetThemeCursorPtr =
|
||||
(BOOL(*)(ThemeCursor))dlsym(RTLD_DEFAULT, "mac_plugin_interposing_child_OnSetThemeCursor");
|
||||
}
|
||||
if (!OnSetCursorPtr) {
|
||||
// mac_plugin_interposing_child_OnSetCursor(const Cursor* cursor) is in
|
||||
// PluginInterposeOSX.mm
|
||||
OnSetCursorPtr =
|
||||
(BOOL(*)(const Cursor*))dlsym(RTLD_DEFAULT, "mac_plugin_interposing_child_OnSetCursor");
|
||||
}
|
||||
if (!OnHideCursorPtr) {
|
||||
// mac_plugin_interposing_child_OnHideCursor() is in PluginInterposeOSX.mm
|
||||
OnHideCursorPtr = (BOOL(*)())dlsym(RTLD_DEFAULT, "mac_plugin_interposing_child_OnHideCursor");
|
||||
}
|
||||
if (!OnShowCursorPtr) {
|
||||
// mac_plugin_interposing_child_OnShowCursor() is in PluginInterposeOSX.mm
|
||||
OnShowCursorPtr = (BOOL(*)())dlsym(RTLD_DEFAULT, "mac_plugin_interposing_child_OnShowCursor");
|
||||
}
|
||||
return (OnSetCursorPtr && OnSetThemeCursorPtr && OnHideCursorPtr && OnShowCursorPtr);
|
||||
}
|
||||
|
||||
static OSStatus MacPluginChildSetThemeCursor(ThemeCursor cursor) {
|
||||
if (loadXULPtrs()) {
|
||||
OnSetThemeCursorPtr(cursor);
|
||||
}
|
||||
return ::SetThemeCursor(cursor);
|
||||
}
|
||||
|
||||
static void MacPluginChildSetCursor(const Cursor* cursor) {
|
||||
if (::SetCursor) {
|
||||
if (loadXULPtrs()) {
|
||||
OnSetCursorPtr(cursor);
|
||||
}
|
||||
::SetCursor(cursor);
|
||||
}
|
||||
}
|
||||
|
||||
static CGError MacPluginChildCGDisplayHideCursor(CGDirectDisplayID display) {
|
||||
if (loadXULPtrs()) {
|
||||
OnHideCursorPtr();
|
||||
}
|
||||
return ::CGDisplayHideCursor(display);
|
||||
}
|
||||
|
||||
static CGError MacPluginChildCGDisplayShowCursor(CGDirectDisplayID display) {
|
||||
if (loadXULPtrs()) {
|
||||
OnShowCursorPtr();
|
||||
}
|
||||
return ::CGDisplayShowCursor(display);
|
||||
}
|
||||
|
||||
# pragma mark -
|
||||
|
||||
struct interpose_substitution {
|
||||
const void* replacement;
|
||||
const void* original;
|
||||
};
|
||||
|
||||
# define INTERPOSE_FUNCTION(function) \
|
||||
{ \
|
||||
reinterpret_cast<const void*>(MacPluginChild##function), \
|
||||
reinterpret_cast<const void*>(function) \
|
||||
}
|
||||
|
||||
__attribute__((used)) static const interpose_substitution substitutions[]
|
||||
__attribute__((section("__DATA, __interpose"))) = {
|
||||
INTERPOSE_FUNCTION(SetThemeCursor),
|
||||
INTERPOSE_FUNCTION(CGDisplayHideCursor),
|
||||
INTERPOSE_FUNCTION(CGDisplayShowCursor),
|
||||
// SetCursor() and other QuickDraw APIs will probably be removed in OS X
|
||||
// 10.8. But this will make 'SetCursor' NULL, which will just stop the OS
|
||||
// from interposing it (tested using an INTERPOSE_FUNCTION_BROKEN macro
|
||||
// that just sets the second address of each tuple to NULL).
|
||||
INTERPOSE_FUNCTION(SetCursor),
|
||||
};
|
||||
|
||||
#endif // !__LP64__
|
|
@ -4,9 +4,6 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
if CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa":
|
||||
DIRS += ["interpose"]
|
||||
|
||||
EXPORTS.mozilla += [
|
||||
"PluginLibrary.h",
|
||||
]
|
||||
|
@ -53,11 +50,6 @@ if CONFIG["OS_ARCH"] == "WINNT":
|
|||
"hangui",
|
||||
]
|
||||
|
||||
if CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa":
|
||||
EXPORTS.mozilla.plugins += [
|
||||
"PluginInterposeOSX.h",
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
"BrowserStreamChild.cpp",
|
||||
"BrowserStreamParent.cpp",
|
||||
|
@ -85,7 +77,6 @@ SOURCES += [
|
|||
|
||||
if CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa":
|
||||
UNIFIED_SOURCES += [
|
||||
"PluginInterposeOSX.mm",
|
||||
"PluginUtilsOSX.mm",
|
||||
]
|
||||
|
||||
|
|
|
@ -1142,25 +1142,13 @@ bool PosixProcessLauncher::DoSetup() {
|
|||
|
||||
# elif OS_MACOSX // defined(OS_LINUX) || defined(OS_BSD)
|
||||
mLaunchOptions->env_map["DYLD_LIBRARY_PATH"] = path.get();
|
||||
// XXX DYLD_INSERT_LIBRARIES should only be set when launching a plugin
|
||||
// process, and has no effect on other subprocesses (the hooks in
|
||||
// libplugin_child_interpose.dylib become noops). But currently it
|
||||
// gets set when launching any kind of subprocess.
|
||||
//
|
||||
// Trigger "dyld interposing" for the dylib that contains
|
||||
// plugin_child_interpose.mm. This allows us to hook OS calls in the
|
||||
// plugin process (ones that don't work correctly in a background
|
||||
// process). Don't break any other "dyld interposing" that has already
|
||||
// been set up by whatever may have launched the browser.
|
||||
const char* prevInterpose = PR_GetEnv("DYLD_INSERT_LIBRARIES");
|
||||
nsCString interpose;
|
||||
if (prevInterpose && strlen(prevInterpose) > 0) {
|
||||
interpose.Assign(prevInterpose);
|
||||
interpose.Append(':');
|
||||
|
||||
// DYLD_INSERT_LIBRARIES is currently unused by default but we allow
|
||||
// it to be set by the external environment.
|
||||
const char* interpose = PR_GetEnv("DYLD_INSERT_LIBRARIES");
|
||||
if (interpose && strlen(interpose) > 0) {
|
||||
mLaunchOptions->env_map["DYLD_INSERT_LIBRARIES"] = interpose;
|
||||
}
|
||||
interpose.Append(path.get());
|
||||
interpose.AppendLiteral("/libplugin_child_interpose.dylib");
|
||||
mLaunchOptions->env_map["DYLD_INSERT_LIBRARIES"] = interpose.get();
|
||||
|
||||
// Prevent connection attempts to diagnosticd(8) to save cycles. Log
|
||||
// messages can trigger these connection attempts, but access to
|
||||
|
|
Загрузка…
Ссылка в новой задаче