Bug 1338172 part B - remove the ancient carbon detection on Mac which is no longer used, r?jimm
MozReview-Commit-ID: 9UEAfPHg7fP
--- a/dom/plugins/base/nsNPAPIPluginInstance.cpp
+++ b/dom/plugins/base/nsNPAPIPluginInstance.cpp
@@ -1584,59 +1584,16 @@ nsNPAPIPluginInstance::FinalizeAsyncSurf
void
nsNPAPIPluginInstance::SetCurrentAsyncSurface(NPAsyncSurface *surface, NPRect *changed)
{
if (mOwner) {
mOwner->SetCurrentAsyncSurface(surface, changed);
}
}
-class CarbonEventModelFailureEvent : public Runnable {
-public:
- nsCOMPtr<nsIContent> mContent;
-
- explicit CarbonEventModelFailureEvent(nsIContent* aContent)
- : mContent(aContent)
- {}
-
- ~CarbonEventModelFailureEvent() {}
-
- NS_IMETHOD Run();
-};
-
-NS_IMETHODIMP
-CarbonEventModelFailureEvent::Run()
-{
- nsString type = NS_LITERAL_STRING("npapi-carbon-event-model-failure");
- nsContentUtils::DispatchTrustedEvent(mContent->GetComposedDoc(), mContent,
- type, true, true);
- return NS_OK;
-}
-
-void
-nsNPAPIPluginInstance::CarbonNPAPIFailure()
-{
- nsCOMPtr<nsIDOMElement> element;
- GetDOMElement(getter_AddRefs(element));
- if (!element) {
- return;
- }
-
- nsCOMPtr<nsIContent> content(do_QueryInterface(element));
- if (!content) {
- return;
- }
-
- nsCOMPtr<nsIRunnable> e = new CarbonEventModelFailureEvent(content);
- nsresult rv = NS_DispatchToCurrentThread(e);
- if (NS_FAILED(rv)) {
- NS_WARNING("Failed to dispatch CarbonEventModelFailureEvent.");
- }
-}
-
static bool
GetJavaVersionFromMimetype(nsPluginTag* pluginTag, nsCString& version)
{
for (uint32_t i = 0; i < pluginTag->MimeTypes().Length(); ++i) {
nsCString type = pluginTag->MimeTypes()[i];
nsAutoCString jpi("application/x-java-applet;jpi-version=");
int32_t idx = type.Find(jpi, false, 0, -1);
--- a/dom/plugins/base/nsNPAPIPluginInstance.h
+++ b/dom/plugins/base/nsNPAPIPluginInstance.h
@@ -296,20 +296,16 @@ public:
void URLRedirectResponse(void* notifyData, NPBool allow);
NPError InitAsyncSurface(NPSize *size, NPImageFormat format,
void *initData, NPAsyncSurface *surface);
NPError FinalizeAsyncSurface(NPAsyncSurface *surface);
void SetCurrentAsyncSurface(NPAsyncSurface *surface, NPRect *changed);
- // Called when the instance fails to instantiate beceause the Carbon
- // event model is not supported.
- void CarbonNPAPIFailure();
-
// Returns the contents scale factor of the screen the plugin is drawn on.
double GetContentsScaleFactor();
// Returns the css zoom factor of the document the plugin is drawn on.
float GetCSSZoomFactor();
nsresult GetRunID(uint32_t *aRunID);
--- a/dom/plugins/ipc/PPluginInstance.ipdl
+++ b/dom/plugins/ipc/PPluginInstance.ipdl
@@ -257,21 +257,16 @@ parent:
returns (nsCString username, nsCString password, NPError result);
intr NPN_ConvertPoint(double sourceX, bool ignoreDestX, double sourceY, bool ignoreDestY, NPCoordinateSpace sourceSpace,
NPCoordinateSpace destSpace)
returns (double destX, double destY, bool result);
async RedrawPlugin();
- // Send notification that a plugin tried to negotiate Carbon NPAPI so that
- // users can be notified that restarting the browser in i386 mode may allow
- // them to use the plugin.
- sync NegotiatedCarbon();
-
// Notifies the parent of its NPP_New result code.
async AsyncNPP_NewResult(NPError aResult);
// Sends a native window to be adopted by the native window that would be
// returned by NPN_GetValue_NPNVnetscapeWindow. Only used on Windows.
async SetNetscapeWindowAsParent(NativeWindowHandle childWindow);
sync GetCompositionString(uint32_t aType)
--- a/dom/plugins/ipc/PluginInstanceChild.cpp
+++ b/dom/plugins/ipc/PluginInstanceChild.cpp
@@ -259,35 +259,19 @@ PluginInstanceChild::DoNPP_New()
NPP npp = GetNPP();
NPError rv = mPluginIface->newp((char*)NullableStringGet(mMimeType), npp,
mMode, argc, argn.get(), argv.get(), 0);
if (NPERR_NO_ERROR != rv) {
return rv;
}
- Initialize();
-
-#if defined(XP_MACOSX) && defined(__i386__)
- // If an i386 Mac OS X plugin has selected the Carbon event model then
- // we have to fail. We do not support putting Carbon event model plugins
- // out of process. Note that Carbon is the default model so out of process
- // plugins need to actively negotiate something else in order to work
- // out of process.
- if (EventModel() == NPEventModelCarbon) {
- // Send notification that a plugin tried to negotiate Carbon NPAPI so that
- // users can be notified that restarting the browser in i386 mode may allow
- // them to use the plugin.
- SendNegotiatedCarbon();
-
- // Fail to instantiate.
- rv = NPERR_MODULE_LOAD_FAILED_ERROR;
- }
-#endif
-
+ if (!Initialize()) {
+ rv = NPERR_MODULE_LOAD_FAILED_ERROR;
+ }
return rv;
}
int
PluginInstanceChild::GetQuirks()
{
return PluginModuleChild::GetChrome()->GetQuirks();
}
@@ -384,22 +368,24 @@ PluginInstanceChild::NPN_GetValue(NPNVar
#if defined(MOZ_X11)
case NPNVToolkit:
*((NPNToolkitType*)aValue) = NPNVGtk2;
return NPERR_NO_ERROR;
case NPNVxDisplay:
if (!mWsInfo.display) {
// We are called before Initialize() so we have to call it now.
- Initialize();
+ if (!Initialize()) {
+ return NPERR_GENERIC_ERROR;
+ }
NS_ASSERTION(mWsInfo.display, "We should have a valid display!");
}
*(void **)aValue = mWsInfo.display;
return NPERR_NO_ERROR;
-
+
#elif defined(OS_WIN)
case NPNVToolkit:
return NPERR_GENERIC_ERROR;
#endif
case NPNVprivateModeBool: {
bool v = false;
NPError result;
if (!CallNPN_GetValue_NPNVprivateModeBool(&v, &result)) {
@@ -1425,17 +1411,17 @@ PluginInstanceChild::AnswerNPP_SetWindow
bool
PluginInstanceChild::Initialize()
{
#ifdef MOZ_WIDGET_GTK
NPError rv;
if (mWsInfo.display) {
// Already initialized
- return false;
+ return true;
}
// Request for windowless plugins is set in newp(), before this call.
if (mWindow.type == NPWindowTypeWindow) {
AnswerNPP_GetValue_NPPVpluginNeedsXEmbed(&mXEmbed, &rv);
// Set up Xt loop for windowed plugins without XEmbed support
if (!mXEmbed) {
@@ -1445,17 +1431,28 @@ PluginInstanceChild::Initialize()
// Use default GTK display for XEmbed and windowless plugins
if (mXEmbed || mWindow.type != NPWindowTypeWindow) {
mWsInfo.display = DefaultXDisplay();
}
else {
mWsInfo.display = xt_client_get_display();
}
-#endif
+#endif
+
+#if defined(XP_MACOSX) && defined(__i386__)
+ // If an i386 Mac OS X plugin has selected the Carbon event model then
+ // we have to fail. We do not support putting Carbon event model plugins
+ // out of process. Note that Carbon is the default model so out of process
+ // plugins need to actively negotiate something else in order to work
+ // out of process.
+ if (EventModel() == NPEventModelCarbon) {
+ return false;
+ }
+#endif
return true;
}
mozilla::ipc::IPCResult
PluginInstanceChild::RecvHandledWindowedPluginKeyEvent(
const NativeEventData& aKeyEventData,
const bool& aIsConsumed)
--- a/dom/plugins/ipc/PluginInstanceParent.cpp
+++ b/dom/plugins/ipc/PluginInstanceParent.cpp
@@ -2081,27 +2081,16 @@ PluginInstanceParent::RecvRedrawPlugin()
if (!inst) {
return IPC_FAIL_NO_REASON(this);
}
inst->RedrawPlugin();
return IPC_OK();
}
-mozilla::ipc::IPCResult
-PluginInstanceParent::RecvNegotiatedCarbon()
-{
- nsNPAPIPluginInstance *inst = static_cast<nsNPAPIPluginInstance*>(mNPP->ndata);
- if (!inst) {
- return IPC_FAIL_NO_REASON(this);
- }
- inst->CarbonNPAPIFailure();
- return IPC_OK();
-}
-
nsPluginInstanceOwner*
PluginInstanceParent::GetOwner()
{
nsNPAPIPluginInstance* inst = static_cast<nsNPAPIPluginInstance*>(mNPP->ndata);
if (!inst) {
return nullptr;
}
return inst->GetOwner();
--- a/dom/plugins/ipc/PluginInstanceParent.h
+++ b/dom/plugins/ipc/PluginInstanceParent.h
@@ -247,19 +247,16 @@ public:
double *destX,
double *destY,
bool *result) override;
virtual mozilla::ipc::IPCResult
RecvRedrawPlugin() override;
virtual mozilla::ipc::IPCResult
- RecvNegotiatedCarbon() override;
-
- virtual mozilla::ipc::IPCResult
RecvAsyncNPP_NewResult(const NPError& aResult) override;
virtual mozilla::ipc::IPCResult
RecvSetNetscapeWindowAsParent(const NativeWindowHandle& childWindow) override;
NPError NPP_SetWindow(const NPWindow* aWindow);
NPError NPP_GetValue(NPPVariable variable, void* retval);