Bug 827158 part 10. Implement the WebIDL API for <object>. r=peterv,johns
authorBoris Zbarsky <bzbarsky@mit.edu>
Mon, 04 Mar 2013 14:08:24 -0500
changeset 123719 2873561bfe40c3c086075f29a6f7ec8a8a49c87b
parent 123718 194ff1cc47b1119ded34e025115aec5aa9743809
child 123720 f22f257f73305c40f7ad5405048d4a4e8162c7a3
push id24008
push userbzbarsky@mozilla.com
push dateMon, 04 Mar 2013 19:09:00 +0000
treeherdermozilla-inbound@b30d6c68b8a3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspeterv, johns
bugs827158
milestone22.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 827158 part 10. Implement the WebIDL API for <object>. r=peterv,johns
content/base/public/nsIImageLoadingContent.idl
content/base/public/nsIObjectLoadingContent.idl
content/base/src/nsObjectLoadingContent.cpp
content/base/src/nsObjectLoadingContent.h
content/html/content/src/HTMLObjectElement.cpp
content/html/content/src/HTMLObjectElement.h
content/html/content/src/nsGenericHTMLElement.h
dom/webidl/HTMLImageElement.webidl
dom/webidl/HTMLObjectElement.webidl
dom/webidl/SVGImageElement.webidl
--- a/content/base/public/nsIImageLoadingContent.idl
+++ b/content/base/public/nsIImageLoadingContent.idl
@@ -28,18 +28,18 @@ interface nsIFrame;
  * become current only when the image is loaded.  It is the responsibility of
  * observers to check which request they are getting notifications for.
  *
  * Observers added in mid-load will not get any notifications they
  * missed.  We should NOT freeze this interface without considering
  * this issue.  (It could be that the image status on imgIRequest is
  * sufficient, when combined with the imageBlockingStatus information.)
  *
- * Please make sure to update the HTMLImageElement and SVGImageElement
- * Web IDL interfaces to mirror this interface when changing it.
+ * Please make sure to update the MozImageLoadingContent WebIDL
+ * interface to mirror this interface when changing it.
  */
 
 [scriptable, builtinclass, uuid(e3968acd-b796-4ca3-aec0-e7f0880f2219)]
 interface nsIImageLoadingContent : imgINotificationObserver
 {
   /**
    * Request types.  Image loading content nodes attempt to do atomic
    * image changes when the image url is changed.  This means that
--- a/content/base/public/nsIObjectLoadingContent.idl
+++ b/content/base/public/nsIObjectLoadingContent.idl
@@ -15,16 +15,19 @@ interface nsIURI;
 
 %{C++
 #include "nsNPAPIPluginInstance.h"
 %}
 [ptr] native nsNPAPIPluginInstancePtr(nsNPAPIPluginInstance);
 
 /**
  * This interface represents a content node that loads objects.
+ *
+ * Please make sure to update the MozObjectLoadingContent WebIDL
+ * interface to mirror this interface when changing it.
  */
 
 [scriptable, uuid(e9102696-4bb4-4a98-a31f-be9da5a3d18e)]
 interface nsIObjectLoadingContent : nsISupports
 {
   /**
    * See notes in nsObjectLoadingContent.h
    */
--- a/content/base/src/nsObjectLoadingContent.cpp
+++ b/content/base/src/nsObjectLoadingContent.cpp
@@ -71,16 +71,19 @@
 #include "nsWrapperCacheInlines.h"
 
 #include "nsWidgetsCID.h"
 #include "nsContentCID.h"
 #include "mozilla/dom/BindingUtils.h"
 
 static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
 
+using namespace mozilla;
+using namespace mozilla::dom;
+
 #ifdef PR_LOGGING
 static PRLogModuleInfo*
 GetObjectLog()
 {
   static PRLogModuleInfo *sLog;
   if (!sLog)
     sLog = PR_NewLogModule("objlc");
   return sLog;
@@ -955,17 +958,17 @@ nsObjectLoadingContent::GetActualType(ns
 {
   aType = mContentType;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsObjectLoadingContent::GetDisplayedType(uint32_t* aType)
 {
-  *aType = mType;
+  *aType = DisplayedType();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsObjectLoadingContent::HasNewFrame(nsIObjectFrame* aFrame)
 {
   if (mType == eType_Plugin) {
     if (!mInstanceOwner) {
@@ -2388,17 +2391,17 @@ nsObjectLoadingContent::AsyncStartPlugin
   }
 
   return rv;
 }
 
 NS_IMETHODIMP
 nsObjectLoadingContent::GetSrcURI(nsIURI** aURI)
 {
-  NS_IF_ADDREF(*aURI = mURI);
+  NS_IF_ADDREF(*aURI = GetSrcURI());
   return NS_OK;
 }
 
 static bool
 DoDelayedStop(nsPluginInstanceOwner* aInstanceOwner,
               nsObjectLoadingContent* aContent,
               bool aDelayedStop)
 {
@@ -2625,17 +2628,17 @@ nsObjectLoadingContent::PlayPlugin()
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsObjectLoadingContent::GetActivated(bool *aActivated)
 {
-  *aActivated = mActivated;
+  *aActivated = Activated();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsObjectLoadingContent::GetPluginFallbackType(uint32_t* aPluginFallbackType)
 {
   NS_ENSURE_TRUE(nsContentUtils::IsCallerChrome(), NS_ERROR_NOT_AVAILABLE);
   *aPluginFallbackType = mFallbackType;
@@ -2755,16 +2758,96 @@ nsObjectLoadingContent::ShouldPlay(Fallb
       !mPlayPreviewCanceled && !ignoreCTP) {
     // play preview in click-to-play mode is shown instead of standard CTP UI
     aReason = eFallbackPlayPreview;
   }
 
   return allowPerm;
 }
 
+nsIDocument*
+nsObjectLoadingContent::GetContentDocument()
+{
+  nsCOMPtr<nsIContent> thisContent =
+    do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
+
+  if (!thisContent->IsInDoc()) {
+    return nullptr;
+  }
+
+  // XXXbz should this use GetCurrentDoc()?  sXBL/XBL2 issue!
+  nsIDocument *sub_doc = thisContent->OwnerDoc()->GetSubDocumentFor(thisContent);
+  if (!sub_doc) {
+    return nullptr;
+  }
+
+  return sub_doc;
+}
+
+JS::Value
+nsObjectLoadingContent::LegacyCall(JSContext* aCx,
+                                   JS::Value aThisVal,
+                                   const Sequence<JS::Value>& aArguments,
+                                   ErrorResult& aRv)
+{
+  nsCOMPtr<nsIContent> thisContent =
+    do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
+  JSObject* obj = thisContent->GetWrapper();
+  MOZ_ASSERT(obj, "How did we get called?");
+
+  // Make sure we're not dealing with an Xray.  Our DoCall code can't handle
+  // random cross-compartment wrappers, so we're going to have to wrap
+  // everything up into our compartment, but that means we need to check that
+  // this is not an Xray situation by hand.
+  if (!JS_WrapObject(aCx, &obj)) {
+    aRv.Throw(NS_ERROR_UNEXPECTED);
+    return JS::UndefinedValue();
+  }
+
+  if (nsDOMClassInfo::ObjectIsNativeWrapper(aCx, obj)) {
+    aRv.Throw(NS_ERROR_NOT_AVAILABLE);
+    return JS::UndefinedValue();
+  }
+
+  obj = thisContent->GetWrapper();
+  // Now wrap things up into the compartment of "obj"
+  JSAutoCompartment ac(aCx, obj);
+  nsTArray<JS::Value> args(aArguments);
+  for (JS::Value *arg = args.Elements(), *arg_end = arg + args.Length();
+       arg != arg_end;
+       ++arg) {
+    if (!JS_WrapValue(aCx, arg)) {
+      aRv.Throw(NS_ERROR_UNEXPECTED);
+      return JS::UndefinedValue();
+    }
+  }
+
+  if (!JS_WrapValue(aCx, &aThisVal)) {
+    aRv.Throw(NS_ERROR_UNEXPECTED);
+    return JS::UndefinedValue();
+  }
+
+  JS::Value retval;
+  bool otherRetval;
+  nsresult rv =
+    nsHTMLPluginObjElementSH::DoCall(nullptr, aCx, obj, args.Length(),
+                                     args.Elements(), &retval, aThisVal,
+                                     &otherRetval);
+  if (NS_FAILED(rv)) {
+    aRv.Throw(rv);
+    return JS::UndefinedValue();
+  }
+
+  if (!otherRetval) {
+    aRv.Throw(NS_ERROR_FAILURE);
+    return JS::UndefinedValue();
+  }
+  return retval;
+}
+
 void
 nsObjectLoadingContent::SetupProtoChain(JSContext* aCx, JSObject* aObject)
 {
   // We get called on random compartments here for some reason
   // (perhaps because WrapObject can happen on a random compartment?)
   // so make sure to enter the compartment of aObject.
   JSAutoCompartment ac(aCx, aObject);
   MOZ_ASSERT(nsCOMPtr<nsIContent>(do_QueryInterface(
--- a/content/base/src/nsObjectLoadingContent.h
+++ b/content/base/src/nsObjectLoadingContent.h
@@ -26,16 +26,17 @@
 
 class nsAsyncInstantiateEvent;
 class nsStopPluginRunnable;
 class AutoNotifier;
 class AutoFallback;
 class AutoSetInstantiatingToFalse;
 class nsObjectFrame;
 class nsFrameLoader;
+class nsXULElement;
 
 class nsObjectLoadingContent : public nsImageLoadingContent
                              , public nsIStreamListener
                              , public nsIFrameLoaderOwner
                              , public nsIObjectLoadingContent
                              , public nsIInterfaceRequestor
                              , public nsIChannelEventSink
 {
@@ -161,16 +162,58 @@ class nsObjectLoadingContent : public ns
 
     // Helper for WebIDL node wrapping
     void SetupProtoChain(JSContext* aCx, JSObject* aObject);
 
     // Helper for WebIDL newResolve
     bool DoNewResolve(JSContext* aCx, JSHandleObject aObject, JSHandleId aId,
                       unsigned aFlags, JSMutableHandleObject aObjp);
 
+    // WebIDL API
+    nsIDocument* GetContentDocument();
+    void GetActualType(nsAString& aType) const
+    {
+      CopyUTF8toUTF16(mContentType, aType);
+    }
+    uint32_t DisplayedType() const
+    {
+      return mType;
+    }
+    uint32_t GetContentTypeForMIMEType(const nsAString& aMIMEType)
+    {
+      return GetTypeOfContent(NS_ConvertUTF16toUTF8(aMIMEType));
+    }
+    void PlayPlugin(mozilla::ErrorResult& aRv)
+    {
+      aRv = PlayPlugin();
+    }
+    bool Activated() const
+    {
+      return mActivated;
+    }
+    nsIURI* GetSrcURI() const
+    {
+      return mURI;
+    }
+    uint32_t PluginFallbackType() const
+    {
+      return mFallbackType;
+    }
+    void CancelPlayPreview(mozilla::ErrorResult& aRv)
+    {
+      aRv = CancelPlayPreview();
+    }
+    void SwapFrameLoaders(nsXULElement& aOtherOwner, mozilla::ErrorResult& aRv)
+    {
+      aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
+    }
+    JS::Value LegacyCall(JSContext* aCx, JS::Value aThisVal,
+                         const mozilla::dom::Sequence<JS::Value>& aArguments,
+                         mozilla::ErrorResult& aRv);
+
   protected:
     /**
      * Begins loading the object when called
      *
      * Attributes of |this| QI'd to nsIContent will be inspected, depending on
      * the node type. This function currently assumes it is a <applet>,
      * <object>, or <embed> tag.
      *
--- a/content/html/content/src/HTMLObjectElement.cpp
+++ b/content/html/content/src/HTMLObjectElement.cpp
@@ -327,29 +327,30 @@ HTMLObjectElement::TabIndexDefault()
   return IsFocusableForTabIndex() ? 0 : -1;
 }
 
 NS_IMETHODIMP
 HTMLObjectElement::GetContentDocument(nsIDOMDocument **aContentDocument)
 {
   NS_ENSURE_ARG_POINTER(aContentDocument);
 
-  *aContentDocument = nullptr;
+  nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(GetContentDocument());
+  domDoc.forget(aContentDocument);
+  return NS_OK;
+}
 
-  if (!IsInDoc()) {
-    return NS_OK;
+nsIDOMWindow*
+HTMLObjectElement::GetContentWindow()
+{
+  nsIDocument* doc = GetContentDocument();
+  if (doc) {
+    return doc->GetWindow();
   }
 
-  // XXXbz should this use GetCurrentDoc()?  sXBL/XBL2 issue!
-  nsIDocument *sub_doc = OwnerDoc()->GetSubDocumentFor(this);
-  if (!sub_doc) {
-    return NS_OK;
-  }
-
-  return CallQueryInterface(sub_doc, aContentDocument);
+  return nullptr;
 }
 
 NS_IMETHODIMP
 HTMLObjectElement::GetSVGDocument(nsIDOMDocument **aResult)
 {
   return GetContentDocument(aResult);
 }
 
--- a/content/html/content/src/HTMLObjectElement.h
+++ b/content/html/content/src/HTMLObjectElement.h
@@ -18,18 +18,16 @@ namespace dom {
 
 class HTMLObjectElement MOZ_FINAL : public nsGenericHTMLFormElement
                                   , public nsObjectLoadingContent
                                   , public nsIDOMHTMLObjectElement
                                   , public nsIConstraintValidation
                                   , public nsIDOMGetSVGDocument
 {
 public:
-  using nsIConstraintValidation::GetValidationMessage;
-
   HTMLObjectElement(already_AddRefed<nsINodeInfo> aNodeInfo,
                     FromParser aFromParser = NOT_FROM_PARSER);
   virtual ~HTMLObjectElement();
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIDOMNode
@@ -96,16 +94,147 @@ public:
   void StartObjectLoad() { StartObjectLoad(true); }
 
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLObjectElement,
                                            nsGenericHTMLFormElement)
 
   virtual nsXPCClassInfo* GetClassInfo();
 
   virtual nsIDOMNode* AsDOMNode() { return this; }
+
+  // Web IDL binding methods
+  // XPCOM GetData is ok; note that it's a URI attribute with a weird base URI
+  void SetData(const nsAString& aValue, ErrorResult& aRv)
+  {
+    SetHTMLAttr(nsGkAtoms::data, aValue, aRv);
+  }
+  void GetType(DOMString& aValue)
+  {
+    GetHTMLAttr(nsGkAtoms::type, aValue);
+  }
+  void SetType(const nsAString& aValue, ErrorResult& aRv)
+  {
+    SetHTMLAttr(nsGkAtoms::type, aValue, aRv);
+  }
+  void GetName(DOMString& aValue)
+  {
+    GetHTMLAttr(nsGkAtoms::name, aValue);
+  }
+  void SetName(const nsAString& aValue, ErrorResult& aRv)
+  {
+    SetHTMLAttr(nsGkAtoms::name, aValue, aRv);
+  }
+  void GetUseMap(DOMString& aValue)
+  {
+    GetHTMLAttr(nsGkAtoms::usemap, aValue);
+  }
+  void SetUseMap(const nsAString& aValue, ErrorResult& aRv)
+  {
+    SetHTMLAttr(nsGkAtoms::usemap, aValue, aRv);
+  }
+  using nsGenericHTMLFormElement::GetForm;
+  void GetWidth(DOMString& aValue)
+  {
+    GetHTMLAttr(nsGkAtoms::width, aValue);
+  }
+  void SetWidth(const nsAString& aValue, ErrorResult& aRv)
+  {
+    SetHTMLAttr(nsGkAtoms::width, aValue, aRv);
+  }
+  void GetHeight(DOMString& aValue)
+  {
+    GetHTMLAttr(nsGkAtoms::height, aValue);
+  }
+  void SetHeight(const nsAString& aValue, ErrorResult& aRv)
+  {
+    SetHTMLAttr(nsGkAtoms::height, aValue, aRv);
+  }
+  using nsObjectLoadingContent::GetContentDocument;
+  nsIDOMWindow* GetContentWindow();
+  using nsIConstraintValidation::CheckValidity;
+  using nsIConstraintValidation::GetValidationMessage;
+  void GetAlign(DOMString& aValue)
+  {
+    GetHTMLAttr(nsGkAtoms::align, aValue);
+  }
+  void SetAlign(const nsAString& aValue, ErrorResult& aRv)
+  {
+    SetHTMLAttr(nsGkAtoms::align, aValue, aRv);
+  }
+  void GetArchive(DOMString& aValue)
+  {
+    GetHTMLAttr(nsGkAtoms::archive, aValue);
+  }
+  void SetArchive(const nsAString& aValue, ErrorResult& aRv)
+  {
+    SetHTMLAttr(nsGkAtoms::archive, aValue, aRv);
+  }
+  // XPCOM GetCode is ok; note that it's a URI attribute with a weird base URI
+  void SetCode(const nsAString& aValue, ErrorResult& aRv)
+  {
+    SetHTMLAttr(nsGkAtoms::code, aValue, aRv);
+  }
+  bool Declare()
+  {
+    return GetBoolAttr(nsGkAtoms::declare);
+  }
+  void SetDeclare(bool aValue, ErrorResult& aRv)
+  {
+    SetHTMLBoolAttr(nsGkAtoms::declare, aValue, aRv);
+  }
+  uint32_t Hspace()
+  {
+    return GetHTMLUnsignedIntAttr(nsGkAtoms::hspace, 0);
+  }
+  void SetHspace(uint32_t aValue, ErrorResult& aRv)
+  {
+    SetHTMLUnsignedIntAttr(nsGkAtoms::hspace, aValue, aRv);
+  }
+  void GetStandby(DOMString& aValue)
+  {
+    GetHTMLAttr(nsGkAtoms::standby, aValue);
+  }
+  void SetStandby(const nsAString& aValue, ErrorResult& aRv)
+  {
+    SetHTMLAttr(nsGkAtoms::standby, aValue, aRv);
+  }
+  uint32_t Vspace()
+  {
+    return GetHTMLUnsignedIntAttr(nsGkAtoms::vspace, 0);
+  }
+  void SetVspace(uint32_t aValue, ErrorResult& aRv)
+  {
+    SetHTMLUnsignedIntAttr(nsGkAtoms::vspace, aValue, aRv);
+  }
+  // XPCOM GetCodebase is ok; note that it's a URI attribute
+  void SetCodeBase(const nsAString& aValue, ErrorResult& aRv)
+  {
+    SetHTMLAttr(nsGkAtoms::codebase, aValue, aRv);
+  }
+  void GetCodeType(DOMString& aValue)
+  {
+    GetHTMLAttr(nsGkAtoms::codetype, aValue);
+  }
+  void SetCodeType(const nsAString& aValue, ErrorResult& aRv)
+  {
+    SetHTMLAttr(nsGkAtoms::codetype, aValue, aRv);
+  }
+  void GetBorder(DOMString& aValue)
+  {
+    GetHTMLAttr(nsGkAtoms::border, aValue);
+  }
+  void SetBorder(const nsAString& aValue, ErrorResult& aRv)
+  {
+    SetHTMLAttr(nsGkAtoms::border, aValue, aRv);
+  }
+  nsIDocument* GetSVGDocument()
+  {
+    return GetContentDocument();
+  }
+
 private:
   /**
    * Calls LoadObject with the correct arguments to start the plugin load.
    */
   NS_HIDDEN_(void) StartObjectLoad(bool aNotify);
 
   /**
    * Returns if the element is currently focusable regardless of it's tabindex
--- a/content/html/content/src/nsGenericHTMLElement.h
+++ b/content/html/content/src/nsGenericHTMLElement.h
@@ -791,16 +791,22 @@ protected:
   void GetHTMLEnumAttr(nsIAtom* aName, nsAString& aResult) const
   {
     GetEnumAttr(aName, nullptr, aResult);
   }
   void GetHTMLURIAttr(nsIAtom* aName, nsAString& aResult) const
   {
     GetURIAttr(aName, nullptr, aResult);
   }
+  uint32_t GetHTMLUnsignedIntAttr(nsIAtom* aName, uint32_t aDefault)
+  {
+    uint32_t result;
+    GetUnsignedIntAttr(aName, aDefault, &result);
+    return result;
+  }
 
   void SetHTMLAttr(nsIAtom* aName, const nsAString& aValue)
   {
     SetAttr(kNameSpaceID_None, aName, aValue, true);
   }
   void SetHTMLAttr(nsIAtom* aName, const nsAString& aValue, mozilla::ErrorResult& aError)
   {
     aError = SetAttr(kNameSpaceID_None, aName, aValue, true);
--- a/dom/webidl/HTMLImageElement.webidl
+++ b/dom/webidl/HTMLImageElement.webidl
@@ -48,17 +48,20 @@ partial interface HTMLImageElement {
            [SetterThrows]
            attribute unsigned long hspace;
            [SetterThrows]
            attribute unsigned long vspace;
            [SetterThrows]
            attribute DOMString longDesc;
 
   [TreatNullAs=EmptyString,SetterThrows] attribute DOMString border;
+};
 
+[NoInterfaceObject]
+interface MozImageLoadingContent {
   // Mirrored chrome-only nsIImageLoadingContent methods.  Please make sure
   // to update this list if nsIImageLoadingContent changes.
   [ChromeOnly]
   const long UNKNOWN_REQUEST = -1;
   [ChromeOnly]
   const long CURRENT_REQUEST = 0;
   [ChromeOnly]
   const long PENDING_REQUEST = 1;
@@ -79,8 +82,10 @@ partial interface HTMLImageElement {
   readonly attribute URI? currentURI;
   [ChromeOnly,Throws]
   nsIStreamListener? loadImageWithChannel(MozChannel aChannel);
   [ChromeOnly,Throws]
   void forceReload();
   [ChromeOnly]
   void forceImageState(boolean aForce, unsigned long long aState);
 };
+
+HTMLImageElement implements MozImageLoadingContent;
new file mode 100644
--- /dev/null
+++ b/dom/webidl/HTMLObjectElement.webidl
@@ -0,0 +1,191 @@
+/* -*- Mode: IDL; 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/.
+ *
+ * The origin of this IDL file is
+ * http://www.whatwg.org/specs/web-apps/current-work/#the-object-element
+ * http://www.whatwg.org/specs/web-apps/current-work/#HTMLObjectElement-partial
+ *
+ * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
+ * Opera Software ASA. You are granted a license to use, reproduce
+ * and create derivative works of this document.
+ */
+
+// http://www.whatwg.org/specs/web-apps/current-work/#the-object-element
+[NeedNewResolve]
+interface HTMLObjectElement : HTMLElement {
+  [Pure, SetterThrows]
+           attribute DOMString data;
+  [Pure, SetterThrows]
+           attribute DOMString type;
+//           attribute boolean typeMustMatch;
+  [Pure, SetterThrows]
+           attribute DOMString name;
+  [Pure, SetterThrows]
+           attribute DOMString useMap;
+  [Pure]
+  readonly attribute HTMLFormElement? form;
+  [Pure, SetterThrows]
+           attribute DOMString width;
+  [Pure, SetterThrows]
+           attribute DOMString height;
+  // Not pure: can trigger about:blank instantiation
+  readonly attribute Document? contentDocument;
+  // Not pure: can trigger about:blank instantiation
+  readonly attribute WindowProxy? contentWindow;
+
+  readonly attribute boolean willValidate;
+  readonly attribute ValidityState validity;
+  readonly attribute DOMString validationMessage;
+  boolean checkValidity();
+  void setCustomValidity(DOMString error);
+
+  [Throws]
+  legacycaller any (any... arguments);
+};
+
+// http://www.whatwg.org/specs/web-apps/current-work/#HTMLObjectElement-partial
+partial interface HTMLObjectElement {
+  [Pure, SetterThrows]
+           attribute DOMString align;
+  [Pure, SetterThrows]
+           attribute DOMString archive;
+  [Pure, SetterThrows]
+           attribute DOMString code;
+  [Pure, SetterThrows]
+           attribute boolean declare;
+  [Pure, SetterThrows]
+           attribute unsigned long hspace;
+  [Pure, SetterThrows]
+           attribute DOMString standby;
+  [Pure, SetterThrows]
+           attribute unsigned long vspace;
+  [Pure, SetterThrows]
+           attribute DOMString codeBase;
+  [Pure, SetterThrows]
+           attribute DOMString codeType;
+
+  [TreatNullAs=EmptyString, Pure, SetterThrows]
+           attribute DOMString border;
+};
+
+partial interface HTMLObjectElement {
+  // nsIDOMGetSVGDocument
+  Document? getSVGDocument();
+};
+
+[NoInterfaceObject]
+interface MozObjectLoadingContent {
+  // Mirrored chrome-only scriptable nsIObjectLoadingContent methods.  Please
+  // make sure to update this list if nsIObjectLoadingContent changes.  Also,
+  // make sure everything on here is [ChromeOnly].
+  [ChromeOnly]
+  const unsigned long TYPE_LOADING  = 0;
+  [ChromeOnly]
+  const unsigned long TYPE_IMAGE    = 1;
+  [ChromeOnly]
+  const unsigned long TYPE_PLUGIN   = 2;
+  [ChromeOnly]
+  const unsigned long TYPE_DOCUMENT = 3;
+  [ChromeOnly]
+  const unsigned long TYPE_NULL     = 4;
+
+  // The content type is not supported (e.g. plugin not installed)
+  [ChromeOnly]
+  const unsigned long PLUGIN_UNSUPPORTED          = 0;
+  // Showing alternate content
+  [ChromeOnly]
+  const unsigned long PLUGIN_ALTERNATE            = 1;
+  // The plugin exists, but is disabled
+  [ChromeOnly]
+  const unsigned long PLUGIN_DISABLED             = 2;
+  // The plugin is blocklisted and disabled
+  [ChromeOnly]
+  const unsigned long PLUGIN_BLOCKLISTED          = 3;
+  // The plugin is considered outdated, but not disabled
+  [ChromeOnly]
+  const unsigned long PLUGIN_OUTDATED             = 4;
+  // The plugin has crashed
+  [ChromeOnly]
+  const unsigned long PLUGIN_CRASHED              = 5;
+  // Suppressed by security policy
+  [ChromeOnly]
+  const unsigned long PLUGIN_SUPPRESSED           = 6;
+  // Blocked by content policy
+  [ChromeOnly]
+  const unsigned long PLUGIN_USER_DISABLED        = 7;
+  /// ** All values >= PLUGIN_CLICK_TO_PLAY are plugin placeholder types that
+  ///    would be replaced by a real plugin if activated (playPlugin())
+  /// ** Furthermore, values >= PLUGIN_CLICK_TO_PLAY and
+  ///    <= PLUGIN_VULNERABLE_NO_UPDATE are click-to-play types.
+  // The plugin is disabled until the user clicks on it
+  [ChromeOnly]
+  const unsigned long PLUGIN_CLICK_TO_PLAY        = 8;
+  // The plugin is vulnerable (update available)
+  [ChromeOnly]
+  const unsigned long PLUGIN_VULNERABLE_UPDATABLE = 9;
+  // The plugin is vulnerable (no update available)
+  [ChromeOnly]
+  const unsigned long PLUGIN_VULNERABLE_NO_UPDATE = 10;
+  // The plugin is in play preview mode
+  [ChromeOnly]
+  const unsigned long PLUGIN_PLAY_PREVIEW         = 11;
+
+  /**
+   * The actual mime type (the one we got back from the network
+   * request) for the element.
+   */
+  [ChromeOnly]
+  readonly attribute DOMString actualType;
+
+  /**
+   * Gets the type of the content that's currently loaded. See
+   * the constants above for the list of possible values.
+   */
+  [ChromeOnly]
+  readonly attribute unsigned long displayedType;
+
+  /**
+   * Gets the content type that corresponds to the give MIME type.  See the
+   * constants above for the list of possible values.  If nothing else fits,
+   * TYPE_NULL will be returned.
+   */
+  [ChromeOnly]
+  unsigned long getContentTypeForMIMEType(DOMString aMimeType);
+
+  /**
+   * This method will play a plugin that has been stopped by the
+   * click-to-play plugins or play-preview features.
+   */
+  [ChromeOnly, Throws]
+  void playPlugin();
+
+  /**
+   * This attribute will return true if the current content type has been
+   * activated, either explicitly or by passing checks that would have it be
+   * click-to-play or play-preview.
+   */
+  [ChromeOnly]
+  readonly attribute boolean activated;
+
+  /**
+   * The URL of the data/src loaded in the object. This may be null (i.e.
+   * an <embed> with no src).
+   */
+  [ChromeOnly]
+  readonly attribute URI? srcURI;
+
+  [ChromeOnly]
+  readonly attribute unsigned long pluginFallbackType;
+
+  /**
+   * This method will disable the play-preview plugin state.
+   */
+  [ChromeOnly, Throws]
+  void cancelPlayPreview();
+};
+
+HTMLObjectElement implements MozImageLoadingContent;
+HTMLObjectElement implements MozFrameLoaderOwner;
+HTMLObjectElement implements MozObjectLoadingContent;
--- a/dom/webidl/SVGImageElement.webidl
+++ b/dom/webidl/SVGImageElement.webidl
@@ -16,42 +16,13 @@ interface SVGImageElement : SVGGraphicsE
   [Constant]
   readonly attribute SVGAnimatedLength y;
   [Constant]
   readonly attribute SVGAnimatedLength width;
   [Constant]
   readonly attribute SVGAnimatedLength height;
   [Constant]
   readonly attribute SVGAnimatedPreserveAspectRatio preserveAspectRatio;
-
-  // Mirrored chrome-only nsIImageLoadingContent methods.  Please make sure
-  // to update this list if nsIImageLoadingContent changes.
-  [ChromeOnly]
-  const long UNKNOWN_REQUEST = -1;
-  [ChromeOnly]
-  const long CURRENT_REQUEST = 0;
-  [ChromeOnly]
-  const long PENDING_REQUEST = 1;
-
-  [ChromeOnly]
-  attribute boolean loadingEnabled;
-  [ChromeOnly]
-  readonly attribute short imageBlockingStatus;
-  [ChromeOnly]
-  void addObserver(imgINotificationObserver aObserver);
-  [ChromeOnly]
-  void removeObserver(imgINotificationObserver aObserver);
-  [ChromeOnly,Throws]
-  imgIRequest? getRequest(long aRequestType);
-  [ChromeOnly,Throws]
-  long getRequestType(imgIRequest aRequest);
-  [ChromeOnly,Throws]
-  readonly attribute URI? currentURI;
-  [ChromeOnly,Throws]
-  nsIStreamListener? loadImageWithChannel(MozChannel aChannel);
-  [ChromeOnly,Throws]
-  void forceReload();
-  [ChromeOnly]
-  void forceImageState(boolean aForce, unsigned long long aState);
 };
 
+SVGImageElement implements MozImageLoadingContent;
 SVGImageElement implements SVGURIReference;