mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 11:55:49 +00:00
Bug 843627 part 3. Enable WebIDL bindings for <embed> and <applet>. r=peterv
This commit is contained in:
parent
e89e9effb4
commit
00e6500f00
@ -24,7 +24,7 @@
|
||||
function test1() {
|
||||
let plugin = document.getElementById('plugin');
|
||||
ok(plugin, 'got plugin element');
|
||||
let objLC = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
let objLC = SpecialPowers.wrap(plugin);
|
||||
ok(!objLC.activated, 'plugin should not be activated');
|
||||
|
||||
synthesizeMouseAtCenter(plugin, {});
|
||||
|
@ -5,6 +5,8 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/dom/HTMLSharedObjectElement.h"
|
||||
#include "mozilla/dom/HTMLEmbedElementBinding.h"
|
||||
#include "mozilla/dom/HTMLAppletElementBinding.h"
|
||||
#include "mozilla/Util.h"
|
||||
|
||||
#include "nsIDocument.h"
|
||||
@ -34,6 +36,8 @@ HTMLSharedObjectElement::HTMLSharedObjectElement(already_AddRefed<nsINodeInfo> a
|
||||
|
||||
// By default we're in the loading state
|
||||
AddStatesSilently(NS_EVENT_STATE_LOADING);
|
||||
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
void
|
||||
@ -361,5 +365,32 @@ HTMLSharedObjectElement::CopyInnerTo(Element* aDest)
|
||||
return rv;
|
||||
}
|
||||
|
||||
JSObject*
|
||||
HTMLSharedObjectElement::WrapNode(JSContext* aCx, JSObject* aScope)
|
||||
{
|
||||
JSObject* obj;
|
||||
if (mNodeInfo->Equals(nsGkAtoms::applet)) {
|
||||
obj = HTMLAppletElementBinding::Wrap(aCx, aScope, this);
|
||||
} else {
|
||||
MOZ_ASSERT(mNodeInfo->Equals(nsGkAtoms::embed));
|
||||
obj = HTMLEmbedElementBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
if (!obj) {
|
||||
return nullptr;
|
||||
}
|
||||
SetupProtoChain(aCx, obj);
|
||||
return obj;
|
||||
}
|
||||
|
||||
JSObject*
|
||||
HTMLSharedObjectElement::GetCanonicalPrototype(JSContext* aCx, JSObject* aGlobal)
|
||||
{
|
||||
if (mNodeInfo->Equals(nsGkAtoms::applet)) {
|
||||
return HTMLAppletElementBinding::GetProtoObject(aCx, aGlobal);
|
||||
}
|
||||
MOZ_ASSERT(mNodeInfo->Equals(nsGkAtoms::embed));
|
||||
return HTMLEmbedElementBinding::GetProtoObject(aCx, aGlobal);
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
@ -244,6 +244,10 @@ private:
|
||||
|
||||
virtual void GetItemValueText(nsAString& text);
|
||||
virtual void SetItemValueText(const nsAString& text);
|
||||
|
||||
virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope) MOZ_OVERRIDE;
|
||||
virtual JSObject* GetCanonicalPrototype(JSContext* aCx,
|
||||
JSObject* aGlobal) MOZ_OVERRIDE;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
@ -22,6 +22,9 @@
|
||||
|
||||
#include "mozilla/dom/HTMLObjectElement.h"
|
||||
#include "mozilla/dom/HTMLObjectElementBinding.h"
|
||||
#include "mozilla/dom/HTMLSharedObjectElement.h"
|
||||
#include "mozilla/dom/HTMLEmbedElementBinding.h"
|
||||
#include "mozilla/dom/HTMLAppletElementBinding.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -1533,9 +1536,20 @@ ReparentWrapper(JSContext* aCx, JSObject* aObj)
|
||||
MOZ_CRASH();
|
||||
}
|
||||
|
||||
HTMLObjectElement* htmlobject;
|
||||
nsObjectLoadingContent* htmlobject;
|
||||
nsresult rv = UnwrapObject<HTMLObjectElement>(aCx, aObj, htmlobject);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (NS_FAILED(rv)) {
|
||||
rv = UnwrapObject<prototypes::id::HTMLEmbedElement,
|
||||
HTMLSharedObjectElement>(aCx, aObj, htmlobject);
|
||||
if (NS_FAILED(rv)) {
|
||||
rv = UnwrapObject<prototypes::id::HTMLAppletElement,
|
||||
HTMLSharedObjectElement>(aCx, aObj, htmlobject);
|
||||
if (NS_FAILED(rv)) {
|
||||
htmlobject = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (htmlobject) {
|
||||
htmlobject->SetupProtoChain(aCx, aObj);
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
||||
|
||||
function go() {
|
||||
var plugin = document.getElementById('plugin');
|
||||
var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
var objLoadingContent = SpecialPowers.wrap(plugin);
|
||||
ok(!objLoadingContent.activated, "plugin should not be activated");
|
||||
|
||||
SimpleTest.waitForFocus(afterWindowFocus);
|
||||
@ -55,7 +55,7 @@
|
||||
|
||||
function afterPluginActivation() {
|
||||
var plugin = document.getElementById('plugin');
|
||||
var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
var objLoadingContent = SpecialPowers.wrap(plugin);
|
||||
ok(objLoadingContent.activated, "plugin should be activated now");
|
||||
|
||||
// Triggering a paint and waiting for it to be flushed makes sure
|
||||
|
@ -66,6 +66,7 @@ webidl_files = \
|
||||
Function.webidl \
|
||||
GainNode.webidl \
|
||||
HTMLAnchorElement.webidl \
|
||||
HTMLAppletElement.webidl \
|
||||
HTMLAreaElement.webidl \
|
||||
HTMLBaseElement.webidl \
|
||||
HTMLBodyElement.webidl \
|
||||
@ -79,6 +80,7 @@ webidl_files = \
|
||||
HTMLDListElement.webidl \
|
||||
HTMLDocument.webidl \
|
||||
HTMLElement.webidl \
|
||||
HTMLEmbedElement.webidl \
|
||||
HTMLFieldSetElement.webidl \
|
||||
HTMLFontElement.webidl \
|
||||
HTMLFrameElement.webidl \
|
||||
|
Loading…
Reference in New Issue
Block a user