2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2013-03-17 18:42:01 +04:00
|
|
|
/* 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/. */
|
|
|
|
|
2014-04-03 08:18:36 +04:00
|
|
|
#include "mozilla/EventStates.h"
|
2013-03-17 18:42:01 +04:00
|
|
|
#include "mozilla/dom/HTMLSharedObjectElement.h"
|
2013-03-17 18:42:05 +04:00
|
|
|
#include "mozilla/dom/HTMLEmbedElementBinding.h"
|
|
|
|
#include "mozilla/dom/HTMLAppletElementBinding.h"
|
2013-10-03 00:09:18 +04:00
|
|
|
#include "mozilla/dom/ElementInlines.h"
|
2013-03-17 18:42:01 +04:00
|
|
|
|
|
|
|
#include "nsIDocument.h"
|
|
|
|
#include "nsIPluginDocument.h"
|
|
|
|
#include "nsIDOMDocument.h"
|
|
|
|
#include "nsThreadUtils.h"
|
|
|
|
#include "nsIScriptError.h"
|
|
|
|
#include "nsIWidget.h"
|
|
|
|
#include "nsContentUtils.h"
|
2015-02-20 19:37:02 +03:00
|
|
|
#ifdef XP_MACOSX
|
|
|
|
#include "mozilla/EventDispatcher.h"
|
|
|
|
#include "mozilla/dom/Event.h"
|
|
|
|
#include "mozilla/dom/HTMLObjectElement.h"
|
|
|
|
#endif
|
2013-03-17 18:42:01 +04:00
|
|
|
|
|
|
|
NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(SharedObject)
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2014-06-20 06:01:40 +04:00
|
|
|
HTMLSharedObjectElement::HTMLSharedObjectElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
|
2013-03-17 18:42:01 +04:00
|
|
|
FromParser aFromParser)
|
|
|
|
: nsGenericHTMLElement(aNodeInfo),
|
|
|
|
mIsDoneAddingChildren(mNodeInfo->Equals(nsGkAtoms::embed) || !aFromParser)
|
|
|
|
{
|
2014-06-19 06:09:35 +04:00
|
|
|
RegisterActivityObserver();
|
2013-03-17 18:42:01 +04:00
|
|
|
SetIsNetworkCreated(aFromParser == FROM_PARSER_NETWORK);
|
|
|
|
|
|
|
|
// By default we're in the loading state
|
|
|
|
AddStatesSilently(NS_EVENT_STATE_LOADING);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-02-13 04:27:39 +03:00
|
|
|
HTMLSharedObjectElement::GetItemValueText(DOMString& aValue)
|
2013-03-17 18:42:01 +04:00
|
|
|
{
|
|
|
|
if (mNodeInfo->Equals(nsGkAtoms::applet)) {
|
|
|
|
nsGenericHTMLElement::GetItemValueText(aValue);
|
|
|
|
} else {
|
|
|
|
GetSrc(aValue);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
HTMLSharedObjectElement::SetItemValueText(const nsAString& aValue)
|
|
|
|
{
|
|
|
|
if (mNodeInfo->Equals(nsGkAtoms::applet)) {
|
|
|
|
nsGenericHTMLElement::SetItemValueText(aValue);
|
|
|
|
} else {
|
|
|
|
SetSrc(aValue);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
HTMLSharedObjectElement::~HTMLSharedObjectElement()
|
|
|
|
{
|
2015-03-25 01:02:52 +03:00
|
|
|
#ifdef XP_MACOSX
|
|
|
|
HTMLObjectElement::OnFocusBlurPlugin(this, false);
|
|
|
|
#endif
|
2014-06-19 06:09:35 +04:00
|
|
|
UnregisterActivityObserver();
|
2013-03-17 18:42:01 +04:00
|
|
|
DestroyImageLoadingContent();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
HTMLSharedObjectElement::IsDoneAddingChildren()
|
|
|
|
{
|
|
|
|
return mIsDoneAddingChildren;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
HTMLSharedObjectElement::DoneAddingChildren(bool aHaveNotified)
|
|
|
|
{
|
|
|
|
if (!mIsDoneAddingChildren) {
|
|
|
|
mIsDoneAddingChildren = true;
|
|
|
|
|
|
|
|
// If we're already in a document, we need to trigger the load
|
|
|
|
// Otherwise, BindToTree takes care of that.
|
2015-02-24 17:41:43 +03:00
|
|
|
if (IsInComposedDoc()) {
|
2013-03-17 18:42:01 +04:00
|
|
|
StartObjectLoad(aHaveNotified);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-08-02 05:29:05 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_CLASS(HTMLSharedObjectElement)
|
|
|
|
|
2013-03-17 18:42:01 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(HTMLSharedObjectElement,
|
|
|
|
nsGenericHTMLElement)
|
|
|
|
nsObjectLoadingContent::Traverse(tmp, cb);
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
|
|
|
|
|
|
|
NS_IMPL_ADDREF_INHERITED(HTMLSharedObjectElement, Element)
|
|
|
|
NS_IMPL_RELEASE_INHERITED(HTMLSharedObjectElement, Element)
|
|
|
|
|
|
|
|
NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLSharedObjectElement)
|
2014-04-27 11:06:00 +04:00
|
|
|
NS_INTERFACE_TABLE_INHERITED(HTMLSharedObjectElement,
|
|
|
|
nsIRequestObserver,
|
|
|
|
nsIStreamListener,
|
|
|
|
nsIFrameLoaderOwner,
|
|
|
|
nsIObjectLoadingContent,
|
|
|
|
imgINotificationObserver,
|
|
|
|
nsIImageLoadingContent,
|
|
|
|
imgIOnloadBlocker,
|
|
|
|
nsIChannelEventSink)
|
2013-05-21 17:38:15 +04:00
|
|
|
NS_INTERFACE_TABLE_TO_MAP_SEGUE
|
2013-03-17 18:42:01 +04:00
|
|
|
NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLAppletElement, applet)
|
|
|
|
NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLEmbedElement, embed)
|
2013-08-08 00:23:08 +04:00
|
|
|
NS_INTERFACE_MAP_END_INHERITING(nsGenericHTMLElement)
|
2013-03-17 18:42:01 +04:00
|
|
|
|
|
|
|
NS_IMPL_ELEMENT_CLONE(HTMLSharedObjectElement)
|
|
|
|
|
2015-02-20 19:37:02 +03:00
|
|
|
#ifdef XP_MACOSX
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
HTMLSharedObjectElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
|
|
|
{
|
|
|
|
HTMLObjectElement::HandleFocusBlurPlugin(this, aVisitor.mEvent);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // #ifdef XP_MACOSX
|
|
|
|
|
2013-03-17 18:42:01 +04:00
|
|
|
nsresult
|
|
|
|
HTMLSharedObjectElement::BindToTree(nsIDocument *aDocument,
|
|
|
|
nsIContent *aParent,
|
|
|
|
nsIContent *aBindingParent,
|
|
|
|
bool aCompileEventHandlers)
|
|
|
|
{
|
|
|
|
nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent,
|
|
|
|
aBindingParent,
|
|
|
|
aCompileEventHandlers);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
rv = nsObjectLoadingContent::BindToTree(aDocument, aParent,
|
|
|
|
aBindingParent,
|
|
|
|
aCompileEventHandlers);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
// Don't kick off load from being bound to a plugin document - the plugin
|
|
|
|
// document will call nsObjectLoadingContent::InitializeFromChannel() for the
|
|
|
|
// initial load.
|
|
|
|
nsCOMPtr<nsIPluginDocument> pluginDoc = do_QueryInterface(aDocument);
|
|
|
|
|
|
|
|
// If we already have all the children, start the load.
|
|
|
|
if (mIsDoneAddingChildren && !pluginDoc) {
|
|
|
|
void (HTMLSharedObjectElement::*start)() =
|
|
|
|
&HTMLSharedObjectElement::StartObjectLoad;
|
|
|
|
nsContentUtils::AddScriptRunner(NS_NewRunnableMethod(this, start));
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
HTMLSharedObjectElement::UnbindFromTree(bool aDeep,
|
|
|
|
bool aNullParent)
|
|
|
|
{
|
2015-03-25 01:02:52 +03:00
|
|
|
#ifdef XP_MACOSX
|
|
|
|
// When a page is reloaded (when an nsIDocument's content is removed), the
|
2015-09-02 09:08:00 +03:00
|
|
|
// focused element isn't necessarily sent an eBlur event. See
|
2015-03-25 01:02:52 +03:00
|
|
|
// nsFocusManager::ContentRemoved(). This means that a widget may think it
|
|
|
|
// still contains a focused plugin when it doesn't -- which in turn can
|
|
|
|
// disable text input in the browser window. See bug 1137229.
|
|
|
|
HTMLObjectElement::OnFocusBlurPlugin(this, false);
|
|
|
|
#endif
|
2013-03-17 18:42:01 +04:00
|
|
|
nsObjectLoadingContent::UnbindFromTree(aDeep, aNullParent);
|
|
|
|
nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
HTMLSharedObjectElement::SetAttr(int32_t aNameSpaceID, nsIAtom *aName,
|
|
|
|
nsIAtom *aPrefix, const nsAString &aValue,
|
|
|
|
bool aNotify)
|
|
|
|
{
|
|
|
|
nsresult rv = nsGenericHTMLElement::SetAttr(aNameSpaceID, aName, aPrefix,
|
|
|
|
aValue, aNotify);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
// if aNotify is false, we are coming from the parser or some such place;
|
|
|
|
// we'll get bound after all the attributes have been set, so we'll do the
|
|
|
|
// object load from BindToTree/DoneAddingChildren.
|
|
|
|
// Skip the LoadObject call in that case.
|
|
|
|
// We also don't want to start loading the object when we're not yet in
|
|
|
|
// a document, just in case that the caller wants to set additional
|
|
|
|
// attributes before inserting the node into the document.
|
2015-02-24 17:41:43 +03:00
|
|
|
if (aNotify && IsInComposedDoc() && mIsDoneAddingChildren &&
|
2013-03-17 18:42:01 +04:00
|
|
|
aNameSpaceID == kNameSpaceID_None && aName == URIAttrName()) {
|
|
|
|
return LoadObject(aNotify, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
HTMLSharedObjectElement::IsHTMLFocusable(bool aWithMouse,
|
|
|
|
bool *aIsFocusable,
|
|
|
|
int32_t *aTabIndex)
|
|
|
|
{
|
|
|
|
if (mNodeInfo->Equals(nsGkAtoms::embed) || Type() == eType_Plugin) {
|
|
|
|
// Has plugin content: let the plugin decide what to do in terms of
|
|
|
|
// internal focus from mouse clicks
|
|
|
|
if (aTabIndex) {
|
|
|
|
GetTabIndex(aTabIndex);
|
|
|
|
}
|
|
|
|
|
|
|
|
*aIsFocusable = true;
|
|
|
|
|
|
|
|
// Let the plugin decide, so override.
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return nsGenericHTMLElement::IsHTMLFocusable(aWithMouse, aIsFocusable, aTabIndex);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsIContent::IMEState
|
|
|
|
HTMLSharedObjectElement::GetDesiredIMEState()
|
|
|
|
{
|
|
|
|
if (Type() == eType_Plugin) {
|
|
|
|
return IMEState(IMEState::PLUGIN);
|
|
|
|
}
|
|
|
|
|
|
|
|
return nsGenericHTMLElement::GetDesiredIMEState();
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMPL_STRING_ATTR(HTMLSharedObjectElement, Align, align)
|
|
|
|
NS_IMPL_STRING_ATTR(HTMLSharedObjectElement, Alt, alt)
|
|
|
|
NS_IMPL_STRING_ATTR(HTMLSharedObjectElement, Archive, archive)
|
|
|
|
NS_IMPL_STRING_ATTR(HTMLSharedObjectElement, Code, code)
|
|
|
|
NS_IMPL_URI_ATTR(HTMLSharedObjectElement, CodeBase, codebase)
|
|
|
|
NS_IMPL_STRING_ATTR(HTMLSharedObjectElement, Height, height)
|
|
|
|
NS_IMPL_INT_ATTR(HTMLSharedObjectElement, Hspace, hspace)
|
|
|
|
NS_IMPL_STRING_ATTR(HTMLSharedObjectElement, Name, name)
|
|
|
|
NS_IMPL_URI_ATTR_WITH_BASE(HTMLSharedObjectElement, Object, object, codebase)
|
|
|
|
NS_IMPL_URI_ATTR(HTMLSharedObjectElement, Src, src)
|
|
|
|
NS_IMPL_STRING_ATTR(HTMLSharedObjectElement, Type, type)
|
|
|
|
NS_IMPL_INT_ATTR(HTMLSharedObjectElement, Vspace, vspace)
|
|
|
|
NS_IMPL_STRING_ATTR(HTMLSharedObjectElement, Width, width)
|
|
|
|
|
|
|
|
int32_t
|
|
|
|
HTMLSharedObjectElement::TabIndexDefault()
|
|
|
|
{
|
2013-06-12 08:56:26 +04:00
|
|
|
return -1;
|
2013-03-17 18:42:01 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
HTMLSharedObjectElement::ParseAttribute(int32_t aNamespaceID,
|
|
|
|
nsIAtom *aAttribute,
|
|
|
|
const nsAString &aValue,
|
|
|
|
nsAttrValue &aResult)
|
|
|
|
{
|
|
|
|
if (aNamespaceID == kNameSpaceID_None) {
|
|
|
|
if (aAttribute == nsGkAtoms::align) {
|
|
|
|
return ParseAlignValue(aValue, aResult);
|
|
|
|
}
|
|
|
|
if (ParseImageAttribute(aAttribute, aValue, aResult)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
|
|
|
|
aResult);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-07-11 18:39:18 +04:00
|
|
|
MapAttributesIntoRuleBase(const nsMappedAttributes *aAttributes,
|
|
|
|
nsRuleData *aData)
|
2013-03-17 18:42:01 +04:00
|
|
|
{
|
|
|
|
nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aData);
|
|
|
|
nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData);
|
|
|
|
nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData);
|
|
|
|
nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aData);
|
2013-07-11 18:39:18 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
MapAttributesIntoRuleExceptHidden(const nsMappedAttributes *aAttributes,
|
|
|
|
nsRuleData *aData)
|
|
|
|
{
|
|
|
|
MapAttributesIntoRuleBase(aAttributes, aData);
|
|
|
|
nsGenericHTMLElement::MapCommonAttributesIntoExceptHidden(aAttributes, aData);
|
|
|
|
}
|
|
|
|
|
2013-11-19 23:21:29 +04:00
|
|
|
void
|
|
|
|
HTMLSharedObjectElement::MapAttributesIntoRule(const nsMappedAttributes *aAttributes,
|
|
|
|
nsRuleData *aData)
|
2013-07-11 18:39:18 +04:00
|
|
|
{
|
|
|
|
MapAttributesIntoRuleBase(aAttributes, aData);
|
2013-03-17 18:42:01 +04:00
|
|
|
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP_(bool)
|
|
|
|
HTMLSharedObjectElement::IsAttributeMapped(const nsIAtom *aAttribute) const
|
|
|
|
{
|
|
|
|
static const MappedAttributeEntry* const map[] = {
|
|
|
|
sCommonAttributeMap,
|
|
|
|
sImageMarginSizeAttributeMap,
|
|
|
|
sImageBorderAttributeMap,
|
|
|
|
sImageAlignAttributeMap,
|
|
|
|
};
|
|
|
|
|
|
|
|
return FindAttributeDependence(aAttribute, map);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
nsMapRuleToAttributesFunc
|
|
|
|
HTMLSharedObjectElement::GetAttributeMappingFunction() const
|
|
|
|
{
|
2013-07-11 18:39:18 +04:00
|
|
|
if (mNodeInfo->Equals(nsGkAtoms::embed)) {
|
|
|
|
return &MapAttributesIntoRuleExceptHidden;
|
|
|
|
}
|
|
|
|
|
2013-03-17 18:42:01 +04:00
|
|
|
return &MapAttributesIntoRule;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
HTMLSharedObjectElement::StartObjectLoad(bool aNotify)
|
|
|
|
{
|
|
|
|
// BindToTree can call us asynchronously, and we may be removed from the tree
|
|
|
|
// in the interim
|
2015-02-24 17:41:43 +03:00
|
|
|
if (!IsInComposedDoc() || !OwnerDoc()->IsActive()) {
|
2013-03-17 18:42:01 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
LoadObject(aNotify);
|
|
|
|
SetIsNetworkCreated(false);
|
|
|
|
}
|
|
|
|
|
2014-04-03 08:18:36 +04:00
|
|
|
EventStates
|
2013-03-17 18:42:01 +04:00
|
|
|
HTMLSharedObjectElement::IntrinsicState() const
|
|
|
|
{
|
|
|
|
return nsGenericHTMLElement::IntrinsicState() | ObjectState();
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t
|
|
|
|
HTMLSharedObjectElement::GetCapabilities() const
|
|
|
|
{
|
|
|
|
uint32_t capabilities = eSupportPlugins | eAllowPluginSkipChannel;
|
|
|
|
if (mNodeInfo->Equals(nsGkAtoms::embed)) {
|
2016-01-14 07:42:25 +03:00
|
|
|
capabilities |= eSupportSVG | eSupportImages | eSupportDocuments;
|
2016-01-06 11:01:59 +03:00
|
|
|
}
|
2013-03-17 18:42:01 +04:00
|
|
|
|
|
|
|
return capabilities;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
HTMLSharedObjectElement::DestroyContent()
|
|
|
|
{
|
|
|
|
nsObjectLoadingContent::DestroyContent();
|
|
|
|
nsGenericHTMLElement::DestroyContent();
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
HTMLSharedObjectElement::CopyInnerTo(Element* aDest)
|
|
|
|
{
|
|
|
|
nsresult rv = nsGenericHTMLElement::CopyInnerTo(aDest);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
if (aDest->OwnerDoc()->IsStaticDocument()) {
|
|
|
|
CreateStaticClone(static_cast<HTMLSharedObjectElement*>(aDest));
|
|
|
|
}
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2013-03-17 18:42:05 +04:00
|
|
|
JSObject*
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 17:13:33 +03:00
|
|
|
HTMLSharedObjectElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
2013-03-17 18:42:05 +04:00
|
|
|
{
|
|
|
|
JSObject* obj;
|
|
|
|
if (mNodeInfo->Equals(nsGkAtoms::applet)) {
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 17:13:33 +03:00
|
|
|
obj = HTMLAppletElementBinding::Wrap(aCx, this, aGivenProto);
|
2013-03-17 18:42:05 +04:00
|
|
|
} else {
|
|
|
|
MOZ_ASSERT(mNodeInfo->Equals(nsGkAtoms::embed));
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 17:13:33 +03:00
|
|
|
obj = HTMLEmbedElementBinding::Wrap(aCx, this, aGivenProto);
|
2013-03-17 18:42:05 +04:00
|
|
|
}
|
|
|
|
if (!obj) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
2013-05-02 13:12:45 +04:00
|
|
|
JS::Rooted<JSObject*> rootedObj(aCx, obj);
|
|
|
|
SetupProtoChain(aCx, rootedObj);
|
|
|
|
return rootedObj;
|
2013-03-17 18:42:05 +04:00
|
|
|
}
|
|
|
|
|
2015-07-18 18:51:00 +03:00
|
|
|
nsContentPolicyType
|
|
|
|
HTMLSharedObjectElement::GetContentPolicyType() const
|
|
|
|
{
|
|
|
|
if (mNodeInfo->Equals(nsGkAtoms::applet)) {
|
|
|
|
// We use TYPE_INTERNAL_OBJECT for applet too, since it is not exposed
|
|
|
|
// through RequestContext yet.
|
|
|
|
return nsIContentPolicy::TYPE_INTERNAL_OBJECT;
|
|
|
|
} else {
|
|
|
|
MOZ_ASSERT(mNodeInfo->Equals(nsGkAtoms::embed));
|
|
|
|
return nsIContentPolicy::TYPE_INTERNAL_EMBED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-17 18:42:01 +04:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|