Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 : /* This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this
5 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 : #include "mozilla/EventStates.h"
8 : #include "mozilla/dom/HTMLFormSubmission.h"
9 : #include "mozilla/dom/HTMLObjectElement.h"
10 : #include "mozilla/dom/HTMLObjectElementBinding.h"
11 : #include "mozilla/dom/ElementInlines.h"
12 : #include "nsAttrValueInlines.h"
13 : #include "nsGkAtoms.h"
14 : #include "nsError.h"
15 : #include "nsIDocument.h"
16 : #include "nsIPluginDocument.h"
17 : #include "nsIDOMDocument.h"
18 : #include "nsIObjectFrame.h"
19 : #include "nsNPAPIPluginInstance.h"
20 : #include "nsIWidget.h"
21 : #include "nsContentUtils.h"
22 : #ifdef XP_MACOSX
23 : #include "mozilla/EventDispatcher.h"
24 : #include "mozilla/dom/Event.h"
25 : #include "nsFocusManager.h"
26 : #endif
27 :
28 : namespace mozilla {
29 : namespace dom {
30 :
31 0 : HTMLObjectElement::HTMLObjectElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
32 0 : FromParser aFromParser)
33 : : nsGenericHTMLFormElement(aNodeInfo, NS_FORM_OBJECT),
34 0 : mIsDoneAddingChildren(!aFromParser)
35 : {
36 0 : RegisterActivityObserver();
37 0 : SetIsNetworkCreated(aFromParser == FROM_PARSER_NETWORK);
38 :
39 : // <object> is always barred from constraint validation.
40 0 : SetBarredFromConstraintValidation(true);
41 :
42 : // By default we're in the loading state
43 0 : AddStatesSilently(NS_EVENT_STATE_LOADING);
44 0 : }
45 :
46 0 : HTMLObjectElement::~HTMLObjectElement()
47 : {
48 : #ifdef XP_MACOSX
49 : OnFocusBlurPlugin(this, false);
50 : #endif
51 0 : UnregisterActivityObserver();
52 0 : DestroyImageLoadingContent();
53 0 : }
54 :
55 : bool
56 0 : HTMLObjectElement::IsInteractiveHTMLContent(bool aIgnoreTabindex) const
57 : {
58 0 : return HasAttr(kNameSpaceID_None, nsGkAtoms::usemap) ||
59 0 : nsGenericHTMLFormElement::IsInteractiveHTMLContent(aIgnoreTabindex);
60 : }
61 :
62 : void
63 0 : HTMLObjectElement::AsyncEventRunning(AsyncEventDispatcher* aEvent)
64 : {
65 0 : nsImageLoadingContent::AsyncEventRunning(aEvent);
66 0 : }
67 :
68 : bool
69 0 : HTMLObjectElement::IsDoneAddingChildren()
70 : {
71 0 : return mIsDoneAddingChildren;
72 : }
73 :
74 : void
75 0 : HTMLObjectElement::DoneAddingChildren(bool aHaveNotified)
76 : {
77 0 : mIsDoneAddingChildren = true;
78 :
79 : // If we're already in a document, we need to trigger the load
80 : // Otherwise, BindToTree takes care of that.
81 0 : if (IsInComposedDoc()) {
82 0 : StartObjectLoad(aHaveNotified, false);
83 : }
84 0 : }
85 :
86 : NS_IMPL_CYCLE_COLLECTION_CLASS(HTMLObjectElement)
87 :
88 0 : NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(HTMLObjectElement,
89 : nsGenericHTMLFormElement)
90 0 : NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mValidity)
91 0 : nsObjectLoadingContent::Traverse(tmp, cb);
92 0 : NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
93 :
94 0 : NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(HTMLObjectElement,
95 : nsGenericHTMLFormElement)
96 0 : NS_IMPL_CYCLE_COLLECTION_UNLINK(mValidity)
97 0 : NS_IMPL_CYCLE_COLLECTION_UNLINK_END
98 :
99 0 : NS_IMPL_ADDREF_INHERITED(HTMLObjectElement, Element)
100 0 : NS_IMPL_RELEASE_INHERITED(HTMLObjectElement, Element)
101 :
102 0 : NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLObjectElement)
103 0 : NS_INTERFACE_TABLE_INHERITED(HTMLObjectElement,
104 : nsIDOMHTMLObjectElement,
105 : imgINotificationObserver,
106 : nsIRequestObserver,
107 : nsIStreamListener,
108 : nsIFrameLoaderOwner,
109 : nsIObjectLoadingContent,
110 : nsIImageLoadingContent,
111 : imgIOnloadBlocker,
112 : nsIChannelEventSink,
113 : nsIConstraintValidation)
114 0 : NS_INTERFACE_TABLE_TAIL_INHERITING(nsGenericHTMLFormElement)
115 :
116 0 : NS_IMPL_ELEMENT_CLONE(HTMLObjectElement)
117 :
118 : // nsIConstraintValidation
119 0 : NS_IMPL_NSICONSTRAINTVALIDATION(HTMLObjectElement)
120 :
121 : #ifdef XP_MACOSX
122 :
123 : static nsIWidget* GetWidget(Element* aElement)
124 : {
125 : return nsContentUtils::WidgetForDocument(aElement->OwnerDoc());
126 : }
127 :
128 : Element* HTMLObjectElement::sLastFocused = nullptr; // Weak
129 :
130 : class PluginFocusSetter : public Runnable
131 : {
132 : public:
133 : PluginFocusSetter(nsIWidget* aWidget, Element* aElement)
134 : : Runnable("PluginFocusSetter")
135 : , mWidget(aWidget)
136 : , mElement(aElement)
137 : {
138 : }
139 :
140 : NS_IMETHOD Run() override
141 : {
142 : if (mElement) {
143 : HTMLObjectElement::sLastFocused = mElement;
144 : bool value = true;
145 : mWidget->SetPluginFocused(value);
146 : } else if (!HTMLObjectElement::sLastFocused) {
147 : bool value = false;
148 : mWidget->SetPluginFocused(value);
149 : }
150 :
151 : return NS_OK;
152 : }
153 :
154 : private:
155 : nsCOMPtr<nsIWidget> mWidget;
156 : nsCOMPtr<Element> mElement;
157 : };
158 :
159 : void
160 : HTMLObjectElement::OnFocusBlurPlugin(Element* aElement, bool aFocus)
161 : {
162 : // In general we don't want to call nsIWidget::SetPluginFocused() for any
163 : // Element that doesn't have a plugin running. But if SetPluginFocused(true)
164 : // was just called for aElement while it had a plugin running, we want to
165 : // make sure nsIWidget::SetPluginFocused(false) gets called for it now, even
166 : // if aFocus is true.
167 : if (aFocus) {
168 : nsCOMPtr<nsIObjectLoadingContent> olc = do_QueryInterface(aElement);
169 : bool hasRunningPlugin = false;
170 : if (olc) {
171 : hasRunningPlugin =
172 : static_cast<nsObjectLoadingContent*>(olc.get())->HasRunningPlugin();
173 : }
174 : if (!hasRunningPlugin) {
175 : aFocus = false;
176 : }
177 : }
178 :
179 : if (aFocus || aElement == sLastFocused) {
180 : if (!aFocus) {
181 : sLastFocused = nullptr;
182 : }
183 : nsIWidget* widget = GetWidget(aElement);
184 : if (widget) {
185 : nsContentUtils::AddScriptRunner(
186 : new PluginFocusSetter(widget, aFocus ? aElement : nullptr));
187 : }
188 : }
189 : }
190 :
191 : void
192 : HTMLObjectElement::HandlePluginCrashed(Element* aElement)
193 : {
194 : OnFocusBlurPlugin(aElement, false);
195 : }
196 :
197 : void
198 : HTMLObjectElement::HandlePluginInstantiated(Element* aElement)
199 : {
200 : // If aElement is already focused when a plugin is instantiated, we need
201 : // to initiate a call to nsIWidget::SetPluginFocused(true). Otherwise
202 : // keyboard input won't work in a click-to-play plugin until aElement
203 : // loses focus and regains it.
204 : nsIContent* focusedContent = nullptr;
205 : nsFocusManager *fm = nsFocusManager::GetFocusManager();
206 : if (fm) {
207 : focusedContent = fm->GetFocusedContent();
208 : }
209 : if (SameCOMIdentity(focusedContent, aElement)) {
210 : OnFocusBlurPlugin(aElement, true);
211 : }
212 : }
213 :
214 : void
215 : HTMLObjectElement::HandleFocusBlurPlugin(Element* aElement,
216 : WidgetEvent* aEvent)
217 : {
218 : if (!aEvent->IsTrusted()) {
219 : return;
220 : }
221 : switch (aEvent->mMessage) {
222 : case eFocus: {
223 : OnFocusBlurPlugin(aElement, true);
224 : break;
225 : }
226 : case eBlur: {
227 : OnFocusBlurPlugin(aElement, false);
228 : break;
229 : }
230 : default:
231 : break;
232 : }
233 : }
234 :
235 : NS_IMETHODIMP
236 : HTMLObjectElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
237 : {
238 : HandleFocusBlurPlugin(this, aVisitor.mEvent);
239 : return NS_OK;
240 : }
241 :
242 : #endif // #ifdef XP_MACOSX
243 :
244 : NS_IMETHODIMP
245 0 : HTMLObjectElement::GetForm(nsIDOMHTMLFormElement **aForm)
246 : {
247 0 : return nsGenericHTMLFormElement::GetForm(aForm);
248 : }
249 :
250 : nsresult
251 0 : HTMLObjectElement::BindToTree(nsIDocument *aDocument,
252 : nsIContent *aParent,
253 : nsIContent *aBindingParent,
254 : bool aCompileEventHandlers)
255 : {
256 0 : nsresult rv = nsGenericHTMLFormElement::BindToTree(aDocument, aParent,
257 : aBindingParent,
258 0 : aCompileEventHandlers);
259 0 : NS_ENSURE_SUCCESS(rv, rv);
260 :
261 0 : rv = nsObjectLoadingContent::BindToTree(aDocument, aParent,
262 : aBindingParent,
263 0 : aCompileEventHandlers);
264 0 : NS_ENSURE_SUCCESS(rv, rv);
265 :
266 : // Don't kick off load from being bound to a plugin document - the plugin
267 : // document will call nsObjectLoadingContent::InitializeFromChannel() for the
268 : // initial load.
269 0 : nsCOMPtr<nsIPluginDocument> pluginDoc = do_QueryInterface(aDocument);
270 :
271 : // If we already have all the children, start the load.
272 0 : if (mIsDoneAddingChildren && !pluginDoc) {
273 0 : void (HTMLObjectElement::*start)() = &HTMLObjectElement::StartObjectLoad;
274 0 : nsContentUtils::AddScriptRunner(
275 0 : NewRunnableMethod("dom::HTMLObjectElement::BindToTree", this, start));
276 : }
277 :
278 0 : return NS_OK;
279 : }
280 :
281 : void
282 0 : HTMLObjectElement::UnbindFromTree(bool aDeep,
283 : bool aNullParent)
284 : {
285 : #ifdef XP_MACOSX
286 : // When a page is reloaded (when an nsIDocument's content is removed), the
287 : // focused element isn't necessarily sent an eBlur event. See
288 : // nsFocusManager::ContentRemoved(). This means that a widget may think it
289 : // still contains a focused plugin when it doesn't -- which in turn can
290 : // disable text input in the browser window. See bug 1137229.
291 : OnFocusBlurPlugin(this, false);
292 : #endif
293 0 : nsObjectLoadingContent::UnbindFromTree(aDeep, aNullParent);
294 0 : nsGenericHTMLFormElement::UnbindFromTree(aDeep, aNullParent);
295 0 : }
296 :
297 : nsresult
298 0 : HTMLObjectElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
299 : const nsAttrValue* aValue,
300 : const nsAttrValue* aOldValue, bool aNotify)
301 : {
302 0 : nsresult rv = AfterMaybeChangeAttr(aNamespaceID, aName, aNotify);
303 0 : NS_ENSURE_SUCCESS(rv, rv);
304 :
305 0 : return nsGenericHTMLFormElement::AfterSetAttr(aNamespaceID, aName, aValue,
306 0 : aOldValue, aNotify);
307 : }
308 :
309 : nsresult
310 0 : HTMLObjectElement::OnAttrSetButNotChanged(int32_t aNamespaceID, nsIAtom* aName,
311 : const nsAttrValueOrString& aValue,
312 : bool aNotify)
313 : {
314 0 : nsresult rv = AfterMaybeChangeAttr(aNamespaceID, aName, aNotify);
315 0 : NS_ENSURE_SUCCESS(rv, rv);
316 :
317 0 : return nsGenericHTMLFormElement::OnAttrSetButNotChanged(aNamespaceID, aName,
318 0 : aValue, aNotify);
319 : }
320 :
321 : nsresult
322 0 : HTMLObjectElement::AfterMaybeChangeAttr(int32_t aNamespaceID, nsIAtom* aName,
323 : bool aNotify)
324 : {
325 0 : if (aNamespaceID == kNameSpaceID_None) {
326 : // if aNotify is false, we are coming from the parser or some such place;
327 : // we'll get bound after all the attributes have been set, so we'll do the
328 : // object load from BindToTree/DoneAddingChildren.
329 : // Skip the LoadObject call in that case.
330 : // We also don't want to start loading the object when we're not yet in
331 : // a document, just in case that the caller wants to set additional
332 : // attributes before inserting the node into the document.
333 0 : if (aNotify && IsInComposedDoc() && mIsDoneAddingChildren &&
334 0 : aName == nsGkAtoms::data && !BlockEmbedOrObjectContentLoading()) {
335 0 : return LoadObject(aNotify, true);
336 : }
337 : }
338 :
339 0 : return NS_OK;
340 : }
341 :
342 : bool
343 0 : HTMLObjectElement::IsFocusableForTabIndex()
344 : {
345 0 : nsIDocument* doc = GetComposedDoc();
346 0 : if (!doc || doc->HasFlag(NODE_IS_EDITABLE)) {
347 0 : return false;
348 : }
349 :
350 0 : return IsEditableRoot() ||
351 0 : ((Type() == eType_Document || Type() == eType_FakePlugin) &&
352 0 : nsContentUtils::IsSubDocumentTabbable(this));
353 : }
354 :
355 : bool
356 0 : HTMLObjectElement::IsHTMLFocusable(bool aWithMouse,
357 : bool *aIsFocusable, int32_t *aTabIndex)
358 : {
359 : // TODO: this should probably be managed directly by IsHTMLFocusable.
360 : // See bug 597242.
361 0 : nsIDocument *doc = GetComposedDoc();
362 0 : if (!doc || doc->HasFlag(NODE_IS_EDITABLE)) {
363 0 : if (aTabIndex) {
364 0 : GetTabIndex(aTabIndex);
365 : }
366 :
367 0 : *aIsFocusable = false;
368 :
369 0 : return false;
370 : }
371 :
372 : // This method doesn't call nsGenericHTMLFormElement intentionally.
373 : // TODO: It should probably be changed when bug 597242 will be fixed.
374 0 : if (Type() == eType_Plugin || IsEditableRoot() ||
375 0 : ((Type() == eType_Document || Type() == eType_FakePlugin) &&
376 0 : nsContentUtils::IsSubDocumentTabbable(this))) {
377 : // Has plugin content: let the plugin decide what to do in terms of
378 : // internal focus from mouse clicks
379 0 : if (aTabIndex) {
380 0 : GetTabIndex(aTabIndex);
381 : }
382 :
383 0 : *aIsFocusable = true;
384 :
385 0 : return false;
386 : }
387 :
388 : // TODO: this should probably be managed directly by IsHTMLFocusable.
389 : // See bug 597242.
390 0 : const nsAttrValue* attrVal = mAttrsAndChildren.GetAttr(nsGkAtoms::tabindex);
391 :
392 0 : *aIsFocusable = attrVal && attrVal->Type() == nsAttrValue::eInteger;
393 :
394 0 : if (aTabIndex && *aIsFocusable) {
395 0 : *aTabIndex = attrVal->GetIntegerValue();
396 : }
397 :
398 0 : return false;
399 : }
400 :
401 : nsIContent::IMEState
402 0 : HTMLObjectElement::GetDesiredIMEState()
403 : {
404 0 : if (Type() == eType_Plugin) {
405 0 : return IMEState(IMEState::PLUGIN);
406 : }
407 :
408 0 : return nsGenericHTMLFormElement::GetDesiredIMEState();
409 : }
410 :
411 : NS_IMETHODIMP
412 0 : HTMLObjectElement::Reset()
413 : {
414 0 : return NS_OK;
415 : }
416 :
417 : NS_IMETHODIMP
418 0 : HTMLObjectElement::SubmitNamesValues(HTMLFormSubmission *aFormSubmission)
419 : {
420 0 : nsAutoString name;
421 0 : if (!GetAttr(kNameSpaceID_None, nsGkAtoms::name, name)) {
422 : // No name, don't submit.
423 :
424 0 : return NS_OK;
425 : }
426 :
427 0 : nsIFrame* frame = GetPrimaryFrame();
428 :
429 0 : nsIObjectFrame *objFrame = do_QueryFrame(frame);
430 0 : if (!objFrame) {
431 : // No frame, nothing to submit.
432 :
433 0 : return NS_OK;
434 : }
435 :
436 0 : RefPtr<nsNPAPIPluginInstance> pi;
437 0 : objFrame->GetPluginInstance(getter_AddRefs(pi));
438 0 : if (!pi)
439 0 : return NS_OK;
440 :
441 0 : nsAutoString value;
442 0 : nsresult rv = pi->GetFormValue(value);
443 0 : NS_ENSURE_SUCCESS(rv, rv);
444 :
445 0 : return aFormSubmission->AddNameValuePair(name, value);
446 : }
447 :
448 0 : NS_IMPL_STRING_ATTR(HTMLObjectElement, Align, align)
449 0 : NS_IMPL_STRING_ATTR(HTMLObjectElement, Archive, archive)
450 0 : NS_IMPL_STRING_ATTR(HTMLObjectElement, Border, border)
451 0 : NS_IMPL_STRING_ATTR(HTMLObjectElement, Code, code)
452 0 : NS_IMPL_URI_ATTR(HTMLObjectElement, CodeBase, codebase)
453 0 : NS_IMPL_STRING_ATTR(HTMLObjectElement, CodeType, codetype)
454 0 : NS_IMPL_URI_ATTR_WITH_BASE(HTMLObjectElement, Data, data, codebase)
455 0 : NS_IMPL_BOOL_ATTR(HTMLObjectElement, Declare, declare)
456 0 : NS_IMPL_STRING_ATTR(HTMLObjectElement, Height, height)
457 0 : NS_IMPL_INT_ATTR(HTMLObjectElement, Hspace, hspace)
458 0 : NS_IMPL_STRING_ATTR(HTMLObjectElement, Name, name)
459 0 : NS_IMPL_STRING_ATTR(HTMLObjectElement, Standby, standby)
460 0 : NS_IMPL_STRING_ATTR(HTMLObjectElement, Type, type)
461 0 : NS_IMPL_STRING_ATTR(HTMLObjectElement, UseMap, usemap)
462 0 : NS_IMPL_INT_ATTR(HTMLObjectElement, Vspace, vspace)
463 0 : NS_IMPL_STRING_ATTR(HTMLObjectElement, Width, width)
464 :
465 : int32_t
466 0 : HTMLObjectElement::TabIndexDefault()
467 : {
468 0 : return IsFocusableForTabIndex() ? 0 : -1;
469 : }
470 :
471 : NS_IMETHODIMP
472 0 : HTMLObjectElement::GetContentDocument(nsIDOMDocument **aContentDocument)
473 : {
474 0 : NS_ENSURE_ARG_POINTER(aContentDocument);
475 :
476 : nsCOMPtr<nsIDOMDocument> domDoc =
477 0 : do_QueryInterface(GetContentDocument(*nsContentUtils::SubjectPrincipal()));
478 0 : domDoc.forget(aContentDocument);
479 0 : return NS_OK;
480 : }
481 :
482 : nsPIDOMWindowOuter*
483 0 : HTMLObjectElement::GetContentWindow(nsIPrincipal& aSubjectPrincipal)
484 : {
485 0 : nsIDocument* doc = GetContentDocument(aSubjectPrincipal);
486 0 : if (doc) {
487 0 : return doc->GetWindow();
488 : }
489 :
490 0 : return nullptr;
491 : }
492 :
493 : bool
494 0 : HTMLObjectElement::ParseAttribute(int32_t aNamespaceID,
495 : nsIAtom *aAttribute,
496 : const nsAString &aValue,
497 : nsAttrValue &aResult)
498 : {
499 0 : if (aNamespaceID == kNameSpaceID_None) {
500 0 : if (aAttribute == nsGkAtoms::align) {
501 0 : return ParseAlignValue(aValue, aResult);
502 : }
503 0 : if (ParseImageAttribute(aAttribute, aValue, aResult)) {
504 0 : return true;
505 : }
506 : }
507 :
508 0 : return nsGenericHTMLFormElement::ParseAttribute(aNamespaceID, aAttribute,
509 0 : aValue, aResult);
510 : }
511 :
512 : void
513 0 : HTMLObjectElement::MapAttributesIntoRule(const nsMappedAttributes *aAttributes,
514 : GenericSpecifiedValues *aData)
515 : {
516 0 : nsGenericHTMLFormElement::MapImageAlignAttributeInto(aAttributes, aData);
517 0 : nsGenericHTMLFormElement::MapImageBorderAttributeInto(aAttributes, aData);
518 0 : nsGenericHTMLFormElement::MapImageMarginAttributeInto(aAttributes, aData);
519 0 : nsGenericHTMLFormElement::MapImageSizeAttributesInto(aAttributes, aData);
520 0 : nsGenericHTMLFormElement::MapCommonAttributesInto(aAttributes, aData);
521 0 : }
522 :
523 : NS_IMETHODIMP_(bool)
524 0 : HTMLObjectElement::IsAttributeMapped(const nsIAtom *aAttribute) const
525 : {
526 : static const MappedAttributeEntry* const map[] = {
527 : sCommonAttributeMap,
528 : sImageMarginSizeAttributeMap,
529 : sImageBorderAttributeMap,
530 : sImageAlignAttributeMap,
531 : };
532 :
533 0 : return FindAttributeDependence(aAttribute, map);
534 : }
535 :
536 :
537 : nsMapRuleToAttributesFunc
538 0 : HTMLObjectElement::GetAttributeMappingFunction() const
539 : {
540 0 : return &MapAttributesIntoRule;
541 : }
542 :
543 : void
544 0 : HTMLObjectElement::StartObjectLoad(bool aNotify, bool aForce)
545 : {
546 : // BindToTree can call us asynchronously, and we may be removed from the tree
547 : // in the interim
548 0 : if (!IsInComposedDoc() || !OwnerDoc()->IsActive() ||
549 0 : BlockEmbedOrObjectContentLoading()) {
550 0 : return;
551 : }
552 :
553 0 : LoadObject(aNotify, aForce);
554 0 : SetIsNetworkCreated(false);
555 : }
556 :
557 : EventStates
558 0 : HTMLObjectElement::IntrinsicState() const
559 : {
560 0 : return nsGenericHTMLFormElement::IntrinsicState() | ObjectState();
561 : }
562 :
563 : uint32_t
564 0 : HTMLObjectElement::GetCapabilities() const
565 : {
566 0 : return nsObjectLoadingContent::GetCapabilities() | eSupportClassID;
567 : }
568 :
569 : void
570 0 : HTMLObjectElement::DestroyContent()
571 : {
572 0 : nsObjectLoadingContent::DestroyContent();
573 0 : nsGenericHTMLFormElement::DestroyContent();
574 0 : }
575 :
576 : nsresult
577 0 : HTMLObjectElement::CopyInnerTo(Element* aDest, bool aPreallocateChildren)
578 : {
579 0 : nsresult rv = nsGenericHTMLFormElement::CopyInnerTo(aDest,
580 0 : aPreallocateChildren);
581 0 : NS_ENSURE_SUCCESS(rv, rv);
582 :
583 0 : if (aDest->OwnerDoc()->IsStaticDocument()) {
584 0 : CreateStaticClone(static_cast<HTMLObjectElement*>(aDest));
585 : }
586 :
587 0 : return rv;
588 : }
589 :
590 : JSObject*
591 0 : HTMLObjectElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
592 : {
593 : JS::Rooted<JSObject*> obj(aCx,
594 0 : HTMLObjectElementBinding::Wrap(aCx, this, aGivenProto));
595 0 : if (!obj) {
596 0 : return nullptr;
597 : }
598 0 : SetupProtoChain(aCx, obj);
599 0 : return obj;
600 : }
601 :
602 : } // namespace dom
603 : } // namespace mozilla
604 :
605 0 : NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(Object)
|