Skip to content

Commit d68661e

Browse files
committed
Backed out 24 changesets (bug 1682030) for bustage on ProcessHangMonitor.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)
1 parent 98d8b11 commit d68661e

File tree

459 files changed

+66549
-763
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

459 files changed

+66549
-763
lines changed

CLOBBER

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,4 @@
2222
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
2323
# don't change CLOBBER for WebIDL changes any more.
2424

25-
Merge day clobber
26-
Bug 1682030 - OSX builds complain about TestPlugin after that product is removed from tree
25+
Merge day clobber

accessible/base/nsAccessibilityService.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
#ifdef XP_WIN
4949
# include "mozilla/a11y/Compatibility.h"
5050
# include "mozilla/dom/ContentChild.h"
51+
# include "HTMLWin32ObjectAccessible.h"
5152
# include "mozilla/StaticPtr.h"
5253
#endif
5354

accessible/ipc/DocAccessibleParent.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -909,6 +909,35 @@ void DocAccessibleParent::SetEmulatedWindowHandle(HWND aWindowHandle) {
909909
mEmulatedWindowHandle = aWindowHandle;
910910
}
911911

912+
mozilla::ipc::IPCResult DocAccessibleParent::RecvGetWindowedPluginIAccessible(
913+
const WindowsHandle& aHwnd, IAccessibleHolder* aPluginCOMProxy) {
914+
# if defined(MOZ_SANDBOX)
915+
// We don't actually want the accessible object for aHwnd, but rather the
916+
// one that belongs to its child (see HTMLWin32ObjectAccessible).
917+
HWND childWnd = ::GetWindow(reinterpret_cast<HWND>(aHwnd), GW_CHILD);
918+
if (!childWnd) {
919+
// We're seeing this in the wild - the plugin is windowed but we no longer
920+
// have a window.
921+
return IPC_OK();
922+
}
923+
924+
IAccessible* rawAccPlugin = nullptr;
925+
HRESULT hr = ::AccessibleObjectFromWindow(
926+
childWnd, OBJID_WINDOW, IID_IAccessible, (void**)&rawAccPlugin);
927+
if (FAILED(hr)) {
928+
// This might happen if the plugin doesn't handle WM_GETOBJECT properly.
929+
// We should not consider that a failure.
930+
return IPC_OK();
931+
}
932+
933+
aPluginCOMProxy->Set(IAccessibleHolder::COMPtrType(rawAccPlugin));
934+
935+
return IPC_OK();
936+
# else
937+
return IPC_FAIL(this, "Message unsupported in this build configuration");
938+
# endif
939+
}
940+
912941
mozilla::ipc::IPCResult DocAccessibleParent::RecvFocusEvent(
913942
const uint64_t& aID, const LayoutDeviceIntRect& aCaretRect) {
914943
if (mShutdown) {

accessible/ipc/DocAccessibleParent.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,9 @@ class DocAccessibleParent : public RemoteAccessible,
234234
*/
235235
void SendParentCOMProxy(LocalAccessible* aOuterDoc);
236236

237+
virtual mozilla::ipc::IPCResult RecvGetWindowedPluginIAccessible(
238+
const WindowsHandle& aHwnd, IAccessibleHolder* aPluginCOMProxy) override;
239+
237240
/**
238241
* Set emulated native window handle for a document.
239242
* @param aWindowHandle emulated native window handle

accessible/ipc/win/PDocAccessible.ipdl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ parent:
8686
*/
8787
async BindChildDoc(PDocAccessible aChildDoc, uint64_t aID);
8888

89+
sync GetWindowedPluginIAccessible(WindowsHandle aHwnd)
90+
returns (IAccessibleHolder aPluginCOMProxy);
91+
8992
child:
9093
/**
9194
* We use IDispatchHolder instead of IAccessibleHolder for the following two

accessible/tests/mochitest/common.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -997,6 +997,21 @@ function getMainChromeWindow(aWindow) {
997997
return aWindow.browsingContext.topChromeWindow;
998998
}
999999

1000+
/** Sets the test plugin(s) initially expected enabled state.
1001+
* It will automatically be reset to it's previous value after the test
1002+
* ends.
1003+
* @param aNewEnabledState [in] the enabled state, e.g. SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED
1004+
* @param aPluginName [in, optional] The name of the plugin, defaults to "Test Plug-in"
1005+
*/
1006+
function setTestPluginEnabledState(aNewEnabledState, aPluginName) {
1007+
var plugin = getTestPluginTag(aPluginName);
1008+
var oldEnabledState = plugin.enabledState;
1009+
plugin.enabledState = aNewEnabledState;
1010+
SimpleTest.registerCleanupFunction(function() {
1011+
getTestPluginTag(aPluginName).enabledState = oldEnabledState;
1012+
});
1013+
}
1014+
10001015
// //////////////////////////////////////////////////////////////////////////////
10011016
// Private
10021017
// //////////////////////////////////////////////////////////////////////////////
@@ -1032,6 +1047,22 @@ function getObjAddress(aObj) {
10321047
return aObj.toString();
10331048
}
10341049

1050+
function getTestPluginTag(aPluginName) {
1051+
var ph = SpecialPowers.Cc["@mozilla.org/plugin/host;1"].getService(
1052+
SpecialPowers.Ci.nsIPluginHost
1053+
);
1054+
var tags = ph.getPluginTags();
1055+
var name = aPluginName || "Test Plug-in";
1056+
for (var tag of tags) {
1057+
if (tag.name == name) {
1058+
return tag;
1059+
}
1060+
}
1061+
1062+
ok(false, "Could not find plugin tag with plugin name '" + name + "'");
1063+
return null;
1064+
}
1065+
10351066
function normalizeAccTreeObj(aObj) {
10361067
var key = Object.keys(aObj)[0];
10371068
var roleName = "ROLE_" + key;
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2+
/* This Source Code Form is subject to the terms of the Mozilla Public
3+
* License, v. 2.0. If a copy of the MPL was not distributed with this
4+
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5+
6+
#include "HTMLWin32ObjectAccessible.h"
7+
8+
#include "Role.h"
9+
#include "States.h"
10+
11+
using namespace mozilla::a11y;
12+
13+
////////////////////////////////////////////////////////////////////////////////
14+
// HTMLWin32ObjectOwnerAccessible
15+
////////////////////////////////////////////////////////////////////////////////
16+
17+
HTMLWin32ObjectOwnerAccessible::HTMLWin32ObjectOwnerAccessible(
18+
nsIContent* aContent, DocAccessible* aDoc, void* aHwnd)
19+
: AccessibleWrap(aContent, aDoc), mHwnd(aHwnd) {
20+
mStateFlags |= eNoKidsFromDOM;
21+
22+
// Our only child is a HTMLWin32ObjectAccessible object.
23+
if (mHwnd) {
24+
mNativeAccessible = new HTMLWin32ObjectAccessible(mHwnd, aDoc);
25+
AppendChild(mNativeAccessible);
26+
}
27+
}
28+
29+
////////////////////////////////////////////////////////////////////////////////
30+
// HTMLWin32ObjectOwnerAccessible: LocalAccessible implementation
31+
32+
void HTMLWin32ObjectOwnerAccessible::Shutdown() {
33+
AccessibleWrap::Shutdown();
34+
mNativeAccessible = nullptr;
35+
}
36+
37+
role HTMLWin32ObjectOwnerAccessible::NativeRole() const {
38+
return roles::EMBEDDED_OBJECT;
39+
}
40+
41+
bool HTMLWin32ObjectOwnerAccessible::NativelyUnavailable() const {
42+
// XXX: No HWND means this is windowless plugin which is not accessible in
43+
// the meantime.
44+
return !mHwnd;
45+
}
46+
47+
////////////////////////////////////////////////////////////////////////////////
48+
// HTMLWin32ObjectAccessible
49+
////////////////////////////////////////////////////////////////////////////////
50+
51+
HTMLWin32ObjectAccessible::HTMLWin32ObjectAccessible(void* aHwnd,
52+
DocAccessible* aDoc)
53+
: DummyAccessible(aDoc) {
54+
mHwnd = aHwnd;
55+
if (mHwnd) {
56+
#if defined(MOZ_SANDBOX)
57+
if (XRE_IsContentProcess()) {
58+
DocAccessibleChild* ipcDoc = aDoc->IPCDoc();
59+
MOZ_ASSERT(ipcDoc);
60+
if (!ipcDoc) {
61+
return;
62+
}
63+
64+
IAccessibleHolder proxyHolder;
65+
if (!ipcDoc->SendGetWindowedPluginIAccessible(
66+
reinterpret_cast<uintptr_t>(mHwnd), &proxyHolder)) {
67+
return;
68+
}
69+
70+
mCOMProxy.reset(proxyHolder.Release());
71+
return;
72+
}
73+
#endif
74+
75+
// The plugin is not windowless. In this situation we use
76+
// use its inner child owned by the plugin so that we don't get
77+
// in an infinite loop, where the WM_GETOBJECT's get forwarded
78+
// back to us and create another HTMLWin32ObjectAccessible
79+
mHwnd = ::GetWindow((HWND)aHwnd, GW_CHILD);
80+
}
81+
}
82+
83+
void HTMLWin32ObjectAccessible::GetNativeInterface(void** aNativeAccessible) {
84+
#if defined(MOZ_SANDBOX)
85+
if (XRE_IsContentProcess()) {
86+
RefPtr<IAccessible> addRefed = mCOMProxy.get();
87+
addRefed.forget(aNativeAccessible);
88+
return;
89+
}
90+
#endif
91+
92+
if (mHwnd) {
93+
::AccessibleObjectFromWindow(static_cast<HWND>(mHwnd), OBJID_WINDOW,
94+
IID_IAccessible, aNativeAccessible);
95+
}
96+
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2+
/* This Source Code Form is subject to the terms of the Mozilla Public
3+
* License, v. 2.0. If a copy of the MPL was not distributed with this
4+
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5+
6+
#ifndef mozilla_a11y_HTMLWin32ObjectAccessible_h_
7+
#define mozilla_a11y_HTMLWin32ObjectAccessible_h_
8+
9+
#include "BaseAccessibles.h"
10+
11+
#if defined(MOZ_SANDBOX)
12+
# include "mozilla/mscom/Ptr.h"
13+
#endif
14+
15+
struct IAccessible;
16+
17+
namespace mozilla {
18+
namespace a11y {
19+
20+
class HTMLWin32ObjectOwnerAccessible : public AccessibleWrap {
21+
public:
22+
// This will own the HTMLWin32ObjectAccessible. We create this where the
23+
// <object> or <embed> exists in the tree, so that get_accNextSibling() etc.
24+
// will still point to Gecko accessible sibling content. This is necessary
25+
// because the native plugin accessible doesn't know where it exists in the
26+
// Mozilla tree, and returns null for previous and next sibling. This would
27+
// have the effect of cutting off all content after the plugin.
28+
HTMLWin32ObjectOwnerAccessible(nsIContent* aContent, DocAccessible* aDoc,
29+
void* aHwnd);
30+
virtual ~HTMLWin32ObjectOwnerAccessible() {}
31+
32+
// LocalAccessible
33+
virtual void Shutdown();
34+
virtual mozilla::a11y::role NativeRole() const override;
35+
virtual bool NativelyUnavailable() const;
36+
37+
protected:
38+
void* mHwnd;
39+
RefPtr<LocalAccessible> mNativeAccessible;
40+
};
41+
42+
/**
43+
* This class is used only internally, we never! send out an IAccessible linked
44+
* back to this object. This class is used to represent a plugin object when
45+
* referenced as a child or sibling of another Accessible node. We need
46+
* only a limited portion of the Accessible interface implemented here. The
47+
* in depth accessible information will be returned by the actual IAccessible
48+
* object returned by us in Accessible::NewAccessible() that gets the
49+
* IAccessible from the windows system from the window handle.
50+
*/
51+
class HTMLWin32ObjectAccessible : public DummyAccessible {
52+
public:
53+
HTMLWin32ObjectAccessible(void* aHwnd, DocAccessible* aDoc);
54+
virtual ~HTMLWin32ObjectAccessible() {}
55+
56+
virtual void GetNativeInterface(void** aNativeAccessible) override;
57+
58+
protected:
59+
void* mHwnd;
60+
#if defined(MOZ_SANDBOX)
61+
mscom::ProxyUniquePtr<IAccessible> mCOMProxy;
62+
#endif
63+
};
64+
65+
} // namespace a11y
66+
} // namespace mozilla
67+
68+
#endif

accessible/windows/msaa/moz.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ UNIFIED_SOURCES += [
2727
"EnumVariant.cpp",
2828
"GeckoCustom.cpp",
2929
"HTMLTableAccessibleWrap.cpp",
30+
"HTMLWin32ObjectAccessible.cpp",
3031
"HyperTextAccessibleWrap.cpp",
3132
"ImageAccessibleWrap.cpp",
3233
"IUnknownImpl.cpp",

browser/actors/AboutPluginsParent.jsm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const NEEDED_PROPS = [
2121
"isActive",
2222
"blocklistState",
2323
"description",
24+
"pluginMimeTypes",
2425
];
2526

2627
class AboutPluginsParent extends JSWindowActorParent {

browser/actors/ContextMenuChild.jsm

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,18 @@ class ContextMenuChild extends JSWindowActorChild {
261261
imageName: null,
262262
});
263263
}
264+
265+
case "ContextMenu:PluginCommand": {
266+
let target = ContentDOMReference.resolve(message.data.targetIdentifier);
267+
let actor = this.manager.getActor("Plugin");
268+
let { command } = message.data;
269+
if (command == "play") {
270+
actor.showClickToPlayNotification(target, true);
271+
} else if (command == "hide") {
272+
actor.hideClickToPlayOverlay(target);
273+
}
274+
break;
275+
}
264276
}
265277

266278
return undefined;
@@ -518,6 +530,22 @@ class ContextMenuChild extends JSWindowActorChild {
518530
!aEvent.composedTarget.nodePrincipal.isSystemPrincipal &&
519531
!Services.prefs.getBoolPref("dom.event.contextmenu.enabled")
520532
) {
533+
let plugin = null;
534+
535+
try {
536+
plugin = aEvent.composedTarget.QueryInterface(
537+
Ci.nsIObjectLoadingContent
538+
);
539+
} catch (e) {}
540+
541+
if (
542+
plugin &&
543+
plugin.displayedType == Ci.nsIObjectLoadingContent.TYPE_PLUGIN
544+
) {
545+
// Don't open a context menu for plugins.
546+
return;
547+
}
548+
521549
defaultPrevented = false;
522550
}
523551

@@ -849,6 +877,7 @@ class ContextMenuChild extends JSWindowActorChild {
849877
context.onAudio = false;
850878
context.onCanvas = false;
851879
context.onCompletedImage = false;
880+
context.onCTPPlugin = false;
852881
context.onDRMMedia = false;
853882
context.onPiPVideo = false;
854883
context.onEditable = false;
@@ -1082,6 +1111,15 @@ class ContextMenuChild extends JSWindowActorChild {
10821111
);
10831112
}
10841113
}
1114+
} else if (
1115+
(context.target instanceof this.contentWindow.HTMLEmbedElement ||
1116+
context.target instanceof this.contentWindow.HTMLObjectElement) &&
1117+
context.target.displayedType ==
1118+
this.contentWindow.HTMLObjectElement.TYPE_NULL &&
1119+
context.target.pluginFallbackType ==
1120+
this.contentWindow.HTMLObjectElement.PLUGIN_CLICK_TO_PLAY
1121+
) {
1122+
context.onCTPPlugin = true;
10851123
}
10861124

10871125
context.canSpellCheck = this._isSpellCheckEnabled(context.target);

browser/actors/ContextMenuParent.jsm

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,11 @@ class ContextMenuParent extends JSWindowActorParent {
8888
handlingUserInput,
8989
});
9090
}
91+
92+
pluginCommand(command, targetIdentifier) {
93+
this.sendAsyncMessage("ContextMenu:PluginCommand", {
94+
command,
95+
targetIdentifier,
96+
});
97+
}
9198
}

0 commit comments

Comments
 (0)