mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 05:37:11 +00:00
3c4a44c16e
- Bug 1132874 - Improve protections against sending a parent plugin protocol shutdown message to the child after the child has torn down. r=aklotz (b80b45fa7) - Bug 1103036 - Follow-up to initial patch; r=jchen (51337c2dc) - Bug 1132874 - Simplify PPluginWidget protocol handling, and avoid sending async messages from the parent. Addresses a problem with sub protocols that are torn down randomly from either side of the connection. r=aklotz (3ad936e84) - Bug 1128214 - Avoid a crash when attempting to render windows titlebar specific theme elements with e10s. r=roc (b6f17da09) - Bug 1139368 - Set FilterTypeSet dependency in improveThisTypesForCall. r=h4writer (422de7271) - Bug 864041 - Remove Firefox 2+3 compat code from about:sessionrestore. r=mak (4cfc6fe9a) - Bug 1009599 - Restoring from about:sessionrestore fails when there is more than one tab in the window r=smacleod (88ca1cfbc) - Bug 1146052 - Fix empty about:sessionrestore after crash as well as empty about:welcomeback after resetting the profile r=smacleod (211b50396) - Bug 1043797: extended popup notifications to create a generic doorhanger for all security notifications incl. mixed content r=adw (f7c2d5ded) - Bug 900845 - We aren't using the NetUtil module in SessionStore.jsm. (3f5ddd133) - Bug 898755 - Remove _resume_session_once_on_shutdown code from SessionStore; r=yoric (eb159fec9) - Bug 902727 - [Session Restore] Remove legacy _writeFileEncoder; r=smacleod (8e375c529) - space cleanup (cbd71ce91) - Bug 968923 - part 1 - add infrastructure for defining use counters from UseCounters.conf; original-author=heycam; r=heycam,gfritzsche,mshal (d0dea9997) - Bug 968923 - part 2 - change MappedAttrParser to store a nsSVGElement directly, instead of its nsIPrincipal; r=smaug (4eff86d7f) - Merge branch 'devel' of https://github.com/rmottola/Arctic-Fox into devel (feb4378e6)
155 lines
3.8 KiB
C++
155 lines
3.8 KiB
C++
/* 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/. */
|
|
|
|
#include "PluginWidgetProxy.h"
|
|
#include "mozilla/dom/TabChild.h"
|
|
#include "mozilla/plugins/PluginWidgetChild.h"
|
|
#include "nsDebug.h"
|
|
|
|
#define PWLOG(...)
|
|
// #define PWLOG(...) printf_stderr(__VA_ARGS__)
|
|
|
|
/* static */
|
|
already_AddRefed<nsIWidget>
|
|
nsIWidget::CreatePluginProxyWidget(TabChild* aTabChild,
|
|
mozilla::plugins::PluginWidgetChild* aActor)
|
|
{
|
|
nsCOMPtr<nsIWidget> widget =
|
|
new mozilla::widget::PluginWidgetProxy(aTabChild, aActor);
|
|
return widget.forget();
|
|
}
|
|
|
|
namespace mozilla {
|
|
namespace widget {
|
|
|
|
NS_IMPL_ISUPPORTS_INHERITED(PluginWidgetProxy, PuppetWidget, nsIWidget)
|
|
|
|
#define ENSURE_CHANNEL do { \
|
|
if (!mActor) { \
|
|
NS_WARNING("called on an invalid channel."); \
|
|
return NS_ERROR_FAILURE; \
|
|
} \
|
|
} while (0)
|
|
|
|
PluginWidgetProxy::PluginWidgetProxy(dom::TabChild* aTabChild,
|
|
mozilla::plugins::PluginWidgetChild* aActor) :
|
|
PuppetWidget(aTabChild),
|
|
mActor(aActor)
|
|
{
|
|
// See ChannelDestroyed() in the header
|
|
mActor->SetWidget(this);
|
|
}
|
|
|
|
PluginWidgetProxy::~PluginWidgetProxy()
|
|
{
|
|
PWLOG("PluginWidgetProxy::~PluginWidgetProxy()\n");
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
PluginWidgetProxy::Create(nsIWidget* aParent,
|
|
nsNativeWidget aNativeParent,
|
|
const nsIntRect& aRect,
|
|
nsWidgetInitData* aInitData)
|
|
{
|
|
ENSURE_CHANNEL;
|
|
PWLOG("PluginWidgetProxy::Create()\n");
|
|
|
|
nsresult rv = NS_ERROR_UNEXPECTED;
|
|
mActor->SendCreate(&rv);
|
|
if (NS_FAILED(rv)) {
|
|
NS_WARNING("failed to create chrome widget, plugins won't paint.");
|
|
return rv;
|
|
}
|
|
|
|
BaseCreate(aParent, aRect, aInitData);
|
|
|
|
mBounds = aRect;
|
|
mEnabled = true;
|
|
mVisible = true;
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
PluginWidgetProxy::SetParent(nsIWidget* aNewParent)
|
|
{
|
|
mParent = aNewParent;
|
|
|
|
nsCOMPtr<nsIWidget> kungFuDeathGrip(this);
|
|
nsIWidget* parent = GetParent();
|
|
if (parent) {
|
|
parent->RemoveChild(this);
|
|
}
|
|
if (aNewParent) {
|
|
aNewParent->AddChild(this);
|
|
}
|
|
return NS_OK;
|
|
}
|
|
|
|
nsIWidget*
|
|
PluginWidgetProxy::GetParent(void)
|
|
{
|
|
return mParent.get();
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
PluginWidgetProxy::Destroy()
|
|
{
|
|
PWLOG("PluginWidgetProxy::Destroy()\n");
|
|
|
|
if (mActor) {
|
|
// Communicate that the layout widget has been torn down before the sub
|
|
// protocol.
|
|
mActor->ProxyShutdown();
|
|
mActor = nullptr;
|
|
}
|
|
|
|
return PuppetWidget::Destroy();
|
|
}
|
|
|
|
void
|
|
PluginWidgetProxy::GetWindowClipRegion(nsTArray<nsIntRect>* aRects)
|
|
{
|
|
if (mClipRects && mClipRectCount) {
|
|
aRects->AppendElements(mClipRects.get(), mClipRectCount);
|
|
}
|
|
}
|
|
|
|
void*
|
|
PluginWidgetProxy::GetNativeData(uint32_t aDataType)
|
|
{
|
|
if (!mActor) {
|
|
return nullptr;
|
|
}
|
|
auto tab = static_cast<mozilla::dom::TabChild*>(mActor->Manager());
|
|
if (tab && tab->IsDestroyed()) {
|
|
return nullptr;
|
|
}
|
|
switch (aDataType) {
|
|
case NS_NATIVE_PLUGIN_PORT:
|
|
case NS_NATIVE_WINDOW:
|
|
case NS_NATIVE_SHAREABLE_WINDOW:
|
|
break;
|
|
default:
|
|
NS_WARNING("PluginWidgetProxy::GetNativeData received request for unsupported data type.");
|
|
return nullptr;
|
|
}
|
|
uintptr_t value = 0;
|
|
mActor->SendGetNativePluginPort(&value);
|
|
PWLOG("PluginWidgetProxy::GetNativeData %p\n", (void*)value);
|
|
return (void*)value;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
PluginWidgetProxy::SetFocus(bool aRaise)
|
|
{
|
|
ENSURE_CHANNEL;
|
|
PWLOG("PluginWidgetProxy::SetFocus(%d)\n", aRaise);
|
|
mActor->SendSetFocus(aRaise);
|
|
return NS_OK;
|
|
}
|
|
|
|
} // namespace widget
|
|
} // namespace mozilla
|