Skip to content

Commit

Permalink
Backed out 24 changesets (bug 1682030) for bustage on ProcessHangMoni…
Browse files Browse the repository at this point in the history
…tor.cpp and nsCOMPtr.h. CLOSED TREE

Backed out changeset 5b1644096477 (bug 1682030)
Backed out changeset 35ae60eea3c7 (bug 1682030)
Backed out changeset 3eca76a6d639 (bug 1682030)
Backed out changeset 259c45447ad9 (bug 1682030)
Backed out changeset de9222dc8c31 (bug 1682030)
Backed out changeset 2986c7e14349 (bug 1682030)
Backed out changeset 6af3410bdb93 (bug 1682030)
Backed out changeset 42b0621c2927 (bug 1682030)
Backed out changeset 366e3e371858 (bug 1682030)
Backed out changeset 9adb2865adea (bug 1682030)
Backed out changeset 6af6af3bc03a (bug 1682030)
Backed out changeset da94a91b35ae (bug 1682030)
Backed out changeset 9143da258d0e (bug 1682030)
Backed out changeset 5e20d06952ba (bug 1682030)
Backed out changeset 6253d7e1ce7d (bug 1682030)
Backed out changeset 0e06ddeea3e2 (bug 1682030)
Backed out changeset 9c58d57c9e44 (bug 1682030)
Backed out changeset e90edd89430e (bug 1682030)
Backed out changeset 5861b8166b10 (bug 1682030)
Backed out changeset b4b88cdc7993 (bug 1682030)
Backed out changeset b80054e9805c (bug 1682030)
Backed out changeset 580d857674c0 (bug 1682030)
Backed out changeset a9cdf93c2662 (bug 1682030)
Backed out changeset 9c9c8b4998e2 (bug 1682030)
  • Loading branch information
ncsoregi committed Apr 6, 2021
1 parent 98d8b11 commit d68661e
Show file tree
Hide file tree
Showing 459 changed files with 66,549 additions and 763 deletions.
3 changes: 1 addition & 2 deletions CLOBBER
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@
# 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
Bug 1682030 - OSX builds complain about TestPlugin after that product is removed from tree
Merge day clobber
1 change: 1 addition & 0 deletions accessible/base/nsAccessibilityService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
#ifdef XP_WIN
# include "mozilla/a11y/Compatibility.h"
# include "mozilla/dom/ContentChild.h"
# include "HTMLWin32ObjectAccessible.h"
# include "mozilla/StaticPtr.h"
#endif

Expand Down
29 changes: 29 additions & 0 deletions accessible/ipc/DocAccessibleParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,35 @@ void DocAccessibleParent::SetEmulatedWindowHandle(HWND aWindowHandle) {
mEmulatedWindowHandle = aWindowHandle;
}

mozilla::ipc::IPCResult DocAccessibleParent::RecvGetWindowedPluginIAccessible(
const WindowsHandle& aHwnd, IAccessibleHolder* aPluginCOMProxy) {
# if defined(MOZ_SANDBOX)
// We don't actually want the accessible object for aHwnd, but rather the
// one that belongs to its child (see HTMLWin32ObjectAccessible).
HWND childWnd = ::GetWindow(reinterpret_cast<HWND>(aHwnd), GW_CHILD);
if (!childWnd) {
// We're seeing this in the wild - the plugin is windowed but we no longer
// have a window.
return IPC_OK();
}

IAccessible* rawAccPlugin = nullptr;
HRESULT hr = ::AccessibleObjectFromWindow(
childWnd, OBJID_WINDOW, IID_IAccessible, (void**)&rawAccPlugin);
if (FAILED(hr)) {
// This might happen if the plugin doesn't handle WM_GETOBJECT properly.
// We should not consider that a failure.
return IPC_OK();
}

aPluginCOMProxy->Set(IAccessibleHolder::COMPtrType(rawAccPlugin));

return IPC_OK();
# else
return IPC_FAIL(this, "Message unsupported in this build configuration");
# endif
}

mozilla::ipc::IPCResult DocAccessibleParent::RecvFocusEvent(
const uint64_t& aID, const LayoutDeviceIntRect& aCaretRect) {
if (mShutdown) {
Expand Down
3 changes: 3 additions & 0 deletions accessible/ipc/DocAccessibleParent.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,9 @@ class DocAccessibleParent : public RemoteAccessible,
*/
void SendParentCOMProxy(LocalAccessible* aOuterDoc);

virtual mozilla::ipc::IPCResult RecvGetWindowedPluginIAccessible(
const WindowsHandle& aHwnd, IAccessibleHolder* aPluginCOMProxy) override;

/**
* Set emulated native window handle for a document.
* @param aWindowHandle emulated native window handle
Expand Down
3 changes: 3 additions & 0 deletions accessible/ipc/win/PDocAccessible.ipdl
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ parent:
*/
async BindChildDoc(PDocAccessible aChildDoc, uint64_t aID);

sync GetWindowedPluginIAccessible(WindowsHandle aHwnd)
returns (IAccessibleHolder aPluginCOMProxy);

child:
/**
* We use IDispatchHolder instead of IAccessibleHolder for the following two
Expand Down
31 changes: 31 additions & 0 deletions accessible/tests/mochitest/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -997,6 +997,21 @@ function getMainChromeWindow(aWindow) {
return aWindow.browsingContext.topChromeWindow;
}

/** Sets the test plugin(s) initially expected enabled state.
* It will automatically be reset to it's previous value after the test
* ends.
* @param aNewEnabledState [in] the enabled state, e.g. SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED
* @param aPluginName [in, optional] The name of the plugin, defaults to "Test Plug-in"
*/
function setTestPluginEnabledState(aNewEnabledState, aPluginName) {
var plugin = getTestPluginTag(aPluginName);
var oldEnabledState = plugin.enabledState;
plugin.enabledState = aNewEnabledState;
SimpleTest.registerCleanupFunction(function() {
getTestPluginTag(aPluginName).enabledState = oldEnabledState;
});
}

// //////////////////////////////////////////////////////////////////////////////
// Private
// //////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -1032,6 +1047,22 @@ function getObjAddress(aObj) {
return aObj.toString();
}

function getTestPluginTag(aPluginName) {
var ph = SpecialPowers.Cc["@mozilla.org/plugin/host;1"].getService(
SpecialPowers.Ci.nsIPluginHost
);
var tags = ph.getPluginTags();
var name = aPluginName || "Test Plug-in";
for (var tag of tags) {
if (tag.name == name) {
return tag;
}
}

ok(false, "Could not find plugin tag with plugin name '" + name + "'");
return null;
}

function normalizeAccTreeObj(aObj) {
var key = Object.keys(aObj)[0];
var roleName = "ROLE_" + key;
Expand Down
96 changes: 96 additions & 0 deletions accessible/windows/msaa/HTMLWin32ObjectAccessible.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/* -*- Mode: C++; tab-width: 2; 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/. */

#include "HTMLWin32ObjectAccessible.h"

#include "Role.h"
#include "States.h"

using namespace mozilla::a11y;

////////////////////////////////////////////////////////////////////////////////
// HTMLWin32ObjectOwnerAccessible
////////////////////////////////////////////////////////////////////////////////

HTMLWin32ObjectOwnerAccessible::HTMLWin32ObjectOwnerAccessible(
nsIContent* aContent, DocAccessible* aDoc, void* aHwnd)
: AccessibleWrap(aContent, aDoc), mHwnd(aHwnd) {
mStateFlags |= eNoKidsFromDOM;

// Our only child is a HTMLWin32ObjectAccessible object.
if (mHwnd) {
mNativeAccessible = new HTMLWin32ObjectAccessible(mHwnd, aDoc);
AppendChild(mNativeAccessible);
}
}

////////////////////////////////////////////////////////////////////////////////
// HTMLWin32ObjectOwnerAccessible: LocalAccessible implementation

void HTMLWin32ObjectOwnerAccessible::Shutdown() {
AccessibleWrap::Shutdown();
mNativeAccessible = nullptr;
}

role HTMLWin32ObjectOwnerAccessible::NativeRole() const {
return roles::EMBEDDED_OBJECT;
}

bool HTMLWin32ObjectOwnerAccessible::NativelyUnavailable() const {
// XXX: No HWND means this is windowless plugin which is not accessible in
// the meantime.
return !mHwnd;
}

////////////////////////////////////////////////////////////////////////////////
// HTMLWin32ObjectAccessible
////////////////////////////////////////////////////////////////////////////////

HTMLWin32ObjectAccessible::HTMLWin32ObjectAccessible(void* aHwnd,
DocAccessible* aDoc)
: DummyAccessible(aDoc) {
mHwnd = aHwnd;
if (mHwnd) {
#if defined(MOZ_SANDBOX)
if (XRE_IsContentProcess()) {
DocAccessibleChild* ipcDoc = aDoc->IPCDoc();
MOZ_ASSERT(ipcDoc);
if (!ipcDoc) {
return;
}

IAccessibleHolder proxyHolder;
if (!ipcDoc->SendGetWindowedPluginIAccessible(
reinterpret_cast<uintptr_t>(mHwnd), &proxyHolder)) {
return;
}

mCOMProxy.reset(proxyHolder.Release());
return;
}
#endif

// The plugin is not windowless. In this situation we use
// use its inner child owned by the plugin so that we don't get
// in an infinite loop, where the WM_GETOBJECT's get forwarded
// back to us and create another HTMLWin32ObjectAccessible
mHwnd = ::GetWindow((HWND)aHwnd, GW_CHILD);
}
}

void HTMLWin32ObjectAccessible::GetNativeInterface(void** aNativeAccessible) {
#if defined(MOZ_SANDBOX)
if (XRE_IsContentProcess()) {
RefPtr<IAccessible> addRefed = mCOMProxy.get();
addRefed.forget(aNativeAccessible);
return;
}
#endif

if (mHwnd) {
::AccessibleObjectFromWindow(static_cast<HWND>(mHwnd), OBJID_WINDOW,
IID_IAccessible, aNativeAccessible);
}
}
68 changes: 68 additions & 0 deletions accessible/windows/msaa/HTMLWin32ObjectAccessible.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/* -*- Mode: C++; tab-width: 2; 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/. */

#ifndef mozilla_a11y_HTMLWin32ObjectAccessible_h_
#define mozilla_a11y_HTMLWin32ObjectAccessible_h_

#include "BaseAccessibles.h"

#if defined(MOZ_SANDBOX)
# include "mozilla/mscom/Ptr.h"
#endif

struct IAccessible;

namespace mozilla {
namespace a11y {

class HTMLWin32ObjectOwnerAccessible : public AccessibleWrap {
public:
// This will own the HTMLWin32ObjectAccessible. We create this where the
// <object> or <embed> exists in the tree, so that get_accNextSibling() etc.
// will still point to Gecko accessible sibling content. This is necessary
// because the native plugin accessible doesn't know where it exists in the
// Mozilla tree, and returns null for previous and next sibling. This would
// have the effect of cutting off all content after the plugin.
HTMLWin32ObjectOwnerAccessible(nsIContent* aContent, DocAccessible* aDoc,
void* aHwnd);
virtual ~HTMLWin32ObjectOwnerAccessible() {}

// LocalAccessible
virtual void Shutdown();
virtual mozilla::a11y::role NativeRole() const override;
virtual bool NativelyUnavailable() const;

protected:
void* mHwnd;
RefPtr<LocalAccessible> mNativeAccessible;
};

/**
* This class is used only internally, we never! send out an IAccessible linked
* back to this object. This class is used to represent a plugin object when
* referenced as a child or sibling of another Accessible node. We need
* only a limited portion of the Accessible interface implemented here. The
* in depth accessible information will be returned by the actual IAccessible
* object returned by us in Accessible::NewAccessible() that gets the
* IAccessible from the windows system from the window handle.
*/
class HTMLWin32ObjectAccessible : public DummyAccessible {
public:
HTMLWin32ObjectAccessible(void* aHwnd, DocAccessible* aDoc);
virtual ~HTMLWin32ObjectAccessible() {}

virtual void GetNativeInterface(void** aNativeAccessible) override;

protected:
void* mHwnd;
#if defined(MOZ_SANDBOX)
mscom::ProxyUniquePtr<IAccessible> mCOMProxy;
#endif
};

} // namespace a11y
} // namespace mozilla

#endif
1 change: 1 addition & 0 deletions accessible/windows/msaa/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ UNIFIED_SOURCES += [
"EnumVariant.cpp",
"GeckoCustom.cpp",
"HTMLTableAccessibleWrap.cpp",
"HTMLWin32ObjectAccessible.cpp",
"HyperTextAccessibleWrap.cpp",
"ImageAccessibleWrap.cpp",
"IUnknownImpl.cpp",
Expand Down
1 change: 1 addition & 0 deletions browser/actors/AboutPluginsParent.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const NEEDED_PROPS = [
"isActive",
"blocklistState",
"description",
"pluginMimeTypes",
];

class AboutPluginsParent extends JSWindowActorParent {
Expand Down
38 changes: 38 additions & 0 deletions browser/actors/ContextMenuChild.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,18 @@ class ContextMenuChild extends JSWindowActorChild {
imageName: null,
});
}

case "ContextMenu:PluginCommand": {
let target = ContentDOMReference.resolve(message.data.targetIdentifier);
let actor = this.manager.getActor("Plugin");
let { command } = message.data;
if (command == "play") {
actor.showClickToPlayNotification(target, true);
} else if (command == "hide") {
actor.hideClickToPlayOverlay(target);
}
break;
}
}

return undefined;
Expand Down Expand Up @@ -518,6 +530,22 @@ class ContextMenuChild extends JSWindowActorChild {
!aEvent.composedTarget.nodePrincipal.isSystemPrincipal &&
!Services.prefs.getBoolPref("dom.event.contextmenu.enabled")
) {
let plugin = null;

try {
plugin = aEvent.composedTarget.QueryInterface(
Ci.nsIObjectLoadingContent
);
} catch (e) {}

if (
plugin &&
plugin.displayedType == Ci.nsIObjectLoadingContent.TYPE_PLUGIN
) {
// Don't open a context menu for plugins.
return;
}

defaultPrevented = false;
}

Expand Down Expand Up @@ -849,6 +877,7 @@ class ContextMenuChild extends JSWindowActorChild {
context.onAudio = false;
context.onCanvas = false;
context.onCompletedImage = false;
context.onCTPPlugin = false;
context.onDRMMedia = false;
context.onPiPVideo = false;
context.onEditable = false;
Expand Down Expand Up @@ -1082,6 +1111,15 @@ class ContextMenuChild extends JSWindowActorChild {
);
}
}
} else if (
(context.target instanceof this.contentWindow.HTMLEmbedElement ||
context.target instanceof this.contentWindow.HTMLObjectElement) &&
context.target.displayedType ==
this.contentWindow.HTMLObjectElement.TYPE_NULL &&
context.target.pluginFallbackType ==
this.contentWindow.HTMLObjectElement.PLUGIN_CLICK_TO_PLAY
) {
context.onCTPPlugin = true;
}

context.canSpellCheck = this._isSpellCheckEnabled(context.target);
Expand Down
7 changes: 7 additions & 0 deletions browser/actors/ContextMenuParent.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,11 @@ class ContextMenuParent extends JSWindowActorParent {
handlingUserInput,
});
}

pluginCommand(command, targetIdentifier) {
this.sendAsyncMessage("ContextMenu:PluginCommand", {
command,
targetIdentifier,
});
}
}
Loading

0 comments on commit d68661e

Please sign in to comment.