Bug 880997 part 3. Change crossOrigin reflection to allow null values and be a limited enumerated attribute. r=smaug
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 05 Sep 2014 22:42:33 -0400
changeset 227206 388133d2384ea6c7ddc82f0443a5d0094fec2d57
parent 227205 ecb7ecf902813d1aabb0cc21126a66ae5a2d4f2a
child 227207 fc2a4c5ac0889e5f08229276d6e33d383bcfea0a
push idunknown
push userunknown
push dateunknown
reviewerssmaug
bugs880997
milestone35.0a1
Bug 880997 part 3. Change crossOrigin reflection to allow null values and be a limited enumerated attribute. r=smaug
content/base/public/Element.h
content/base/src/Element.cpp
content/html/content/public/HTMLMediaElement.h
content/html/content/src/HTMLImageElement.cpp
content/html/content/src/HTMLImageElement.h
content/html/content/src/HTMLLinkElement.cpp
content/html/content/src/HTMLLinkElement.h
content/html/content/src/HTMLMediaElement.cpp
content/html/content/src/HTMLScriptElement.cpp
content/html/content/src/HTMLScriptElement.h
content/html/content/src/nsGenericHTMLElement.h
content/html/content/test/test_img_attributes_reflection.html
content/html/content/test/test_link_attributes_reflection.html
content/svg/content/src/SVGScriptElement.cpp
content/svg/content/src/SVGScriptElement.h
dom/interfaces/html/nsIDOMHTMLImageElement.idl
dom/interfaces/html/nsIDOMHTMLLinkElement.idl
dom/interfaces/html/nsIDOMHTMLMediaElement.idl
dom/interfaces/html/nsIDOMHTMLScriptElement.idl
dom/webidl/HTMLImageElement.webidl
dom/webidl/HTMLLinkElement.webidl
dom/webidl/HTMLMediaElement.webidl
dom/webidl/HTMLScriptElement.webidl
dom/webidl/SVGScriptElement.webidl
--- a/content/base/public/Element.h
+++ b/content/base/public/Element.h
@@ -998,26 +998,53 @@ public:
 
   /**
    * Helper method for NS_IMPL_ENUM_ATTR_DEFAULT_MISSING_INVALID_VALUES.
    * Gets the enum value string of an attribute and using the default missing
    * value if the attribute is missing or the default invalid value if the
    * string is an invalid enum value.
    *
    * @param aType            the name of the attribute.
-   * @param aDefaultMissing  the default value if the attribute is missing.
+   * @param aDefaultMissing  the default value if the attribute is missing.  If
+                             null and the attribute is missing, aResult will be
+                             set to the null DOMString; this only matters for
+                             cases in which we're reflecting a nullable string.
    * @param aDefaultInvalid  the default value if the attribute is invalid.
    * @param aResult          string corresponding to the value [out].
    */
   void GetEnumAttr(nsIAtom* aAttr,
                    const char* aDefaultMissing,
                    const char* aDefaultInvalid,
                    nsAString& aResult) const;
 
   /**
+   * Unset an attribute.
+   */
+  void UnsetAttr(nsIAtom* aAttr, ErrorResult& aError)
+  {
+    aError = UnsetAttr(kNameSpaceID_None, aAttr, true);
+  }
+
+  /**
+   * Set an attribute in the simplest way possible.
+   */
+  void SetAttr(nsIAtom* aAttr, const nsAString& aValue, ErrorResult& aError)
+  {
+    aError = SetAttr(kNameSpaceID_None, aAttr, aValue, true);
+  }
+
+  /**
+   * Set a content attribute via a reflecting nullable string IDL
+   * attribute (e.g. a CORS attribute).  If DOMStringIsNull(aValue),
+   * this will actually remove the content attribute.
+   */
+  void SetOrRemoveNullableStringAttr(nsIAtom* aName, const nsAString& aValue,
+                                     ErrorResult& aError);
+
+  /**
    * Retrieve the ratio of font-size-inflated text font size to computed font
    * size for this element. This will query the element for its primary frame,
    * and then use this to get font size inflation information about the frame.
    *
    * @returns The font size inflation ratio (inflated font size to uninflated
    *          font size) for the primary frame of this element. Returns 1.0
    *          by default if font size inflation is not enabled. Returns -1
    *          if the element does not have a primary frame.
--- a/content/base/src/Element.cpp
+++ b/content/base/src/Element.cpp
@@ -3123,26 +3123,39 @@ Element::GetEnumAttr(nsIAtom* aAttr,
 {
   const nsAttrValue* attrVal = mAttrsAndChildren.GetAttr(aAttr);
 
   aResult.Truncate();
 
   if (!attrVal) {
     if (aDefaultMissing) {
       AppendASCIItoUTF16(nsDependentCString(aDefaultMissing), aResult);
+    } else {
+      SetDOMStringToNull(aResult);
     }
   } else {
     if (attrVal->Type() == nsAttrValue::eEnum) {
       attrVal->GetEnumString(aResult, true);
     } else if (aDefaultInvalid) {
       AppendASCIItoUTF16(nsDependentCString(aDefaultInvalid), aResult);
     }
   }
 }
 
+void
+Element::SetOrRemoveNullableStringAttr(nsIAtom* aName, const nsAString& aValue,
+                                       ErrorResult& aError)
+{
+  if (DOMStringIsNull(aValue)) {
+    UnsetAttr(aName, aError);
+  } else {
+    SetAttr(aName, aValue, aError);
+  }
+}
+
 Directionality
 Element::GetComputedDirectionality() const
 {
   nsIFrame* frame = GetPrimaryFrame();
   if (frame) {
     return frame->StyleVisibility()->mDirection == NS_STYLE_DIRECTION_LTR
              ? eDir_LTR : eDir_RTL;
   }
--- a/content/html/content/public/HTMLMediaElement.h
+++ b/content/html/content/public/HTMLMediaElement.h
@@ -358,20 +358,26 @@ public:
   // XPCOM GetSrc() is OK
   void SetSrc(const nsAString& aSrc, ErrorResult& aRv)
   {
     SetHTMLAttr(nsGkAtoms::src, aSrc, aRv);
   }
 
   // XPCOM GetCurrentSrc() is OK
 
-  // XPCOM GetCrossorigin() is OK
-  void SetCrossOrigin(const nsAString& aValue, ErrorResult& aRv)
+  void GetCrossOrigin(nsAString& aResult)
   {
-    SetHTMLAttr(nsGkAtoms::crossorigin, aValue, aRv);
+    // Null for both missing and invalid defaults is ok, since we
+    // always parse to an enum value, so we don't need an invalid
+    // default, and we _want_ the missing default to be null.
+    GetEnumAttr(nsGkAtoms::crossorigin, nullptr, aResult);
+  }
+  void SetCrossOrigin(const nsAString& aCrossOrigin, ErrorResult& aError)
+  {
+    SetOrRemoveNullableStringAttr(nsGkAtoms::crossorigin, aCrossOrigin, aError);
   }
 
   uint16_t NetworkState() const
   {
     return mNetworkState;
   }
 
   // Called by the media decoder object, on the main thread,
--- a/content/html/content/src/HTMLImageElement.cpp
+++ b/content/html/content/src/HTMLImageElement.cpp
@@ -146,21 +146,16 @@ HTMLImageElement::GetItemValueText(nsASt
 }
 
 void
 HTMLImageElement::SetItemValueText(const nsAString& aValue)
 {
   SetSrc(aValue);
 }
 
-// crossorigin is not "limited to only known values" per spec, so it's
-// just a string attr purposes of the DOM crossOrigin property.
-// TODO: It is now (bug 880997).
-NS_IMPL_STRING_ATTR(HTMLImageElement, CrossOrigin, crossorigin)
-
 bool
 HTMLImageElement::Draggable() const
 {
   // images may be dragged unless the draggable attribute is false
   return !AttrValueIs(kNameSpaceID_None, nsGkAtoms::draggable,
                       nsGkAtoms::_false, eIgnoreCase);
 }
 
--- a/content/html/content/src/HTMLImageElement.h
+++ b/content/html/content/src/HTMLImageElement.h
@@ -137,19 +137,26 @@ public:
   void SetSrc(const nsAString& aSrc, ErrorResult& aError)
   {
     SetHTMLAttr(nsGkAtoms::src, aSrc, aError);
   }
   void SetSrcset(const nsAString& aSrcset, ErrorResult& aError)
   {
     SetHTMLAttr(nsGkAtoms::srcset, aSrcset, aError);
   }
+  void GetCrossOrigin(nsAString& aResult)
+  {
+    // Null for both missing and invalid defaults is ok, since we
+    // always parse to an enum value, so we don't need an invalid
+    // default, and we _want_ the missing default to be null.
+    GetEnumAttr(nsGkAtoms::crossorigin, nullptr, aResult);
+  }
   void SetCrossOrigin(const nsAString& aCrossOrigin, ErrorResult& aError)
   {
-    SetHTMLAttr(nsGkAtoms::crossorigin, aCrossOrigin, aError);
+    SetOrRemoveNullableStringAttr(nsGkAtoms::crossorigin, aCrossOrigin, aError);
   }
   void SetUseMap(const nsAString& aUseMap, ErrorResult& aError)
   {
     SetHTMLAttr(nsGkAtoms::usemap, aUseMap, aError);
   }
   void SetName(const nsAString& aName, ErrorResult& aError)
   {
     SetHTMLAttr(nsGkAtoms::name, aName, aError);
--- a/content/html/content/src/HTMLLinkElement.cpp
+++ b/content/html/content/src/HTMLLinkElement.cpp
@@ -112,17 +112,16 @@ HTMLLinkElement::SetMozDisabled(bool aDi
 NS_IMPL_STRING_ATTR(HTMLLinkElement, Charset, charset)
 NS_IMPL_URI_ATTR(HTMLLinkElement, Href, href)
 NS_IMPL_STRING_ATTR(HTMLLinkElement, Hreflang, hreflang)
 NS_IMPL_STRING_ATTR(HTMLLinkElement, Media, media)
 NS_IMPL_STRING_ATTR(HTMLLinkElement, Rel, rel)
 NS_IMPL_STRING_ATTR(HTMLLinkElement, Rev, rev)
 NS_IMPL_STRING_ATTR(HTMLLinkElement, Target, target)
 NS_IMPL_STRING_ATTR(HTMLLinkElement, Type, type)
-NS_IMPL_STRING_ATTR(HTMLLinkElement, CrossOrigin, crossorigin)
 
 void
 HTMLLinkElement::GetItemValueText(nsAString& aValue)
 {
   GetHref(aValue);
 }
 
 void
--- a/content/html/content/src/HTMLLinkElement.h
+++ b/content/html/content/src/HTMLLinkElement.h
@@ -85,20 +85,26 @@ public:
   // WebIDL
   bool Disabled();
   void SetDisabled(bool aDisabled);
   // XPCOM GetHref is fine.
   void SetHref(const nsAString& aHref, ErrorResult& aRv)
   {
     SetHTMLAttr(nsGkAtoms::href, aHref, aRv);
   }
-  // XPCOM GetCrossOrigin is fine.
-  void SetCrossOrigin(const nsAString& aCrossOrigin, ErrorResult& aRv)
+  void GetCrossOrigin(nsAString& aResult)
   {
-    SetHTMLAttr(nsGkAtoms::crossorigin, aCrossOrigin, aRv);
+    // Null for both missing and invalid defaults is ok, since we
+    // always parse to an enum value, so we don't need an invalid
+    // default, and we _want_ the missing default to be null.
+    GetEnumAttr(nsGkAtoms::crossorigin, nullptr, aResult);
+  }
+  void SetCrossOrigin(const nsAString& aCrossOrigin, ErrorResult& aError)
+  {
+    SetOrRemoveNullableStringAttr(nsGkAtoms::crossorigin, aCrossOrigin, aError);
   }
   // XPCOM GetRel is fine.
   void SetRel(const nsAString& aRel, ErrorResult& aRv)
   {
     SetHTMLAttr(nsGkAtoms::rel, aRel, aRv);
   }
   nsDOMTokenList* RelList();
   // XPCOM GetMedia is fine.
--- a/content/html/content/src/HTMLMediaElement.cpp
+++ b/content/html/content/src/HTMLMediaElement.cpp
@@ -465,17 +465,16 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(HTMLMediaElement)
   NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLMediaElement)
   NS_INTERFACE_MAP_ENTRY(nsIObserver)
   NS_INTERFACE_MAP_ENTRY(nsIAudioChannelAgentCallback)
 NS_INTERFACE_MAP_END_INHERITING(nsGenericHTMLElement)
 
 // nsIDOMHTMLMediaElement
 NS_IMPL_URI_ATTR(HTMLMediaElement, Src, src)
-NS_IMPL_STRING_ATTR(HTMLMediaElement, CrossOrigin, crossorigin)
 NS_IMPL_BOOL_ATTR(HTMLMediaElement, Controls, controls)
 NS_IMPL_BOOL_ATTR(HTMLMediaElement, Autoplay, autoplay)
 NS_IMPL_BOOL_ATTR(HTMLMediaElement, Loop, loop)
 NS_IMPL_BOOL_ATTR(HTMLMediaElement, DefaultMuted, muted)
 NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(HTMLMediaElement, Preload, preload, nullptr)
 
 NS_IMETHODIMP
 HTMLMediaElement::GetMozAudioChannelType(nsAString& aValue)
--- a/content/html/content/src/HTMLScriptElement.cpp
+++ b/content/html/content/src/HTMLScriptElement.cpp
@@ -132,17 +132,16 @@ HTMLScriptElement::SetText(const nsAStri
 
 
 NS_IMPL_STRING_ATTR(HTMLScriptElement, Charset, charset)
 NS_IMPL_BOOL_ATTR(HTMLScriptElement, Defer, defer)
 NS_IMPL_URI_ATTR(HTMLScriptElement, Src, src)
 NS_IMPL_STRING_ATTR(HTMLScriptElement, Type, type)
 NS_IMPL_STRING_ATTR(HTMLScriptElement, HtmlFor, _for)
 NS_IMPL_STRING_ATTR(HTMLScriptElement, Event, event)
-NS_IMPL_STRING_ATTR(HTMLScriptElement, CrossOrigin, crossorigin)
 
 void
 HTMLScriptElement::SetCharset(const nsAString& aCharset, ErrorResult& rv)
 {
   SetHTMLAttr(nsGkAtoms::charset, aCharset, rv);
 }
 
 void
@@ -176,22 +175,16 @@ HTMLScriptElement::SetHtmlFor(const nsAS
 }
 
 void
 HTMLScriptElement::SetEvent(const nsAString& aEvent, ErrorResult& rv)
 {
   SetHTMLAttr(nsGkAtoms::event, aEvent, rv);
 }
 
-void
-HTMLScriptElement::SetCrossOrigin(const nsAString& aCrossOrigin, ErrorResult& rv)
-{
-  SetHTMLAttr(nsGkAtoms::crossorigin, aCrossOrigin, rv);
-}
-
 nsresult
 HTMLScriptElement::GetAsync(bool* aValue)
 {
   *aValue = Async();
   return NS_OK;
 }
 
 bool
--- a/content/html/content/src/HTMLScriptElement.h
+++ b/content/html/content/src/HTMLScriptElement.h
@@ -63,17 +63,27 @@ public:
   void SetText(const nsAString& aValue, ErrorResult& rv);
   void SetCharset(const nsAString& aCharset, ErrorResult& rv);
   void SetDefer(bool aDefer, ErrorResult& rv);
   bool Defer();
   void SetSrc(const nsAString& aSrc, ErrorResult& rv);
   void SetType(const nsAString& aType, ErrorResult& rv);
   void SetHtmlFor(const nsAString& aHtmlFor, ErrorResult& rv);
   void SetEvent(const nsAString& aEvent, ErrorResult& rv);
-  void SetCrossOrigin(const nsAString& aCrossOrigin, ErrorResult& rv);
+  void GetCrossOrigin(nsAString& aResult)
+  {
+    // Null for both missing and invalid defaults is ok, since we
+    // always parse to an enum value, so we don't need an invalid
+    // default, and we _want_ the missing default to be null.
+    GetEnumAttr(nsGkAtoms::crossorigin, nullptr, aResult);
+  }
+  void SetCrossOrigin(const nsAString& aCrossOrigin, ErrorResult& aError)
+  {
+    SetOrRemoveNullableStringAttr(nsGkAtoms::crossorigin, aCrossOrigin, aError);
+  }
   bool Async();
   void SetAsync(bool aValue, ErrorResult& rv);
 
 protected:
   virtual ~HTMLScriptElement();
 
   virtual JSObject* WrapNode(JSContext *aCx) MOZ_OVERRIDE;
   // nsScriptElement
--- a/content/html/content/src/nsGenericHTMLElement.h
+++ b/content/html/content/src/nsGenericHTMLElement.h
@@ -1006,21 +1006,21 @@ protected:
   }
 
   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);
+    mozilla::dom::Element::SetAttr(aName, aValue, aError);
   }
   void UnsetHTMLAttr(nsIAtom* aName, mozilla::ErrorResult& aError)
   {
-    aError = UnsetAttr(kNameSpaceID_None, aName, true);
+    mozilla::dom::Element::UnsetAttr(aName, aError);
   }
   void SetHTMLBoolAttr(nsIAtom* aName, bool aValue, mozilla::ErrorResult& aError)
   {
     if (aValue) {
       SetHTMLAttr(aName, EmptyString(), aError);
     } else {
       UnsetHTMLAttr(aName, aError);
     }
--- a/content/html/content/test/test_img_attributes_reflection.html
+++ b/content/html/content/test/test_img_attributes_reflection.html
@@ -21,25 +21,27 @@ reflectString({
 
 reflectURL({
   element: document.createElement("img"),
   attribute: "src",
 })
 
 todo("srcset" in document.createElement("img"), "Should implement srcset")
 
-// TODO: Bug 880997 - Make crossOrigin a limited enumerated attribute.
-reflectString({
+reflectLimitedEnumerated({
   element: document.createElement("img"),
   attribute: "crossOrigin",
-  otherValues: [
-    "", "anonymous", "ANONYMOUS", "  aNOnYmous    ",
-    "use-credentials", "USE-CREDENTIALS", "   UsE-CreDEntIALS      ",
-    "foobar", "FOOBAR", "  fOoBaR  "
-  ]
+  // "" is a valid value per spec, but gets mapped to the "anonymous" state,
+  // just like invalid values, so just list it under invalidValues
+  validValues: [ "anonymous", "use-credentials" ],
+  invalidValues: [
+    "", "  aNOnYmous   ", "  UsE-CreDEntIALS  ", "foobar", "FOOBAR", " fOoBaR  "
+  ],
+  defaultValue: { invalid: "anonymous", missing: null },
+  nullable: true,
 })
 
 reflectString({
   element: document.createElement("img"),
   attribute: "useMap",
 })
 
 reflectBoolean({
--- a/content/html/content/test/test_link_attributes_reflection.html
+++ b/content/html/content/test/test_link_attributes_reflection.html
@@ -16,22 +16,29 @@
 /** Test for HTMLLinkElement attributes reflection **/
 
 // .href (URL)
 reflectURL({
   element: document.createElement("link"),
   attribute: "href",
 });
 
-// .crossOrigin (String)
-reflectString({
+// .crossOrigin (String or null)
+reflectLimitedEnumerated({
   element: document.createElement("link"),
   attribute: "crossOrigin",
-  otherValues: ["anonymous", "use-credentials"],
-});
+  // "" is a valid value per spec, but gets mapped to the "anonymous" state,
+  // just like invalid values, so just list it under invalidValues
+  validValues: [ "anonymous", "use-credentials" ],
+  invalidValues: [
+    "", "  aNOnYmous   ", "  UsE-CreDEntIALS  ", "foobar", "FOOBAR", " fOoBaR  "
+  ],
+  defaultValue: { invalid: "anonymous", missing: null },
+  nullable: true,
+})
 
 // .rel (String)
 reflectString({
   element: document.createElement("link"),
   attribute: "rel",
 });
 
 // .media (String)
--- a/content/svg/content/src/SVGScriptElement.cpp
+++ b/content/svg/content/src/SVGScriptElement.cpp
@@ -86,25 +86,29 @@ SVGScriptElement::GetType(nsAString & aT
 
 void
 SVGScriptElement::SetType(const nsAString & aType, ErrorResult& rv)
 {
   rv = SetAttr(kNameSpaceID_None, nsGkAtoms::type, aType, true);
 }
 
 void
-SVGScriptElement::GetCrossOrigin(nsAString & aOrigin)
+SVGScriptElement::GetCrossOrigin(nsAString & aCrossOrigin)
 {
-  GetAttr(kNameSpaceID_None, nsGkAtoms::crossorigin, aOrigin);
+  // Null for both missing and invalid defaults is ok, since we
+  // always parse to an enum value, so we don't need an invalid
+  // default, and we _want_ the missing default to be null.
+  GetEnumAttr(nsGkAtoms::crossorigin, nullptr, aCrossOrigin);
 }
 
 void
-SVGScriptElement::SetCrossOrigin(const nsAString & aOrigin, ErrorResult& rv)
+SVGScriptElement::SetCrossOrigin(const nsAString & aCrossOrigin,
+                                 ErrorResult& aError)
 {
-  rv = SetAttr(kNameSpaceID_None, nsGkAtoms::crossorigin, aOrigin, true);
+  SetOrRemoveNullableStringAttr(nsGkAtoms::crossorigin, aCrossOrigin, aError);
 }
 
 already_AddRefed<SVGAnimatedString>
 SVGScriptElement::Href()
 {
   return mStringAttributes[HREF].ToDOMAnimatedString(this);
 }
 
--- a/content/svg/content/src/SVGScriptElement.h
+++ b/content/svg/content/src/SVGScriptElement.h
@@ -61,18 +61,18 @@ public:
                               const nsAString& aValue,
                               nsAttrValue& aResult) MOZ_OVERRIDE;
 
   virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
 
   // WebIDL
   void GetType(nsAString & aType);
   void SetType(const nsAString & aType, ErrorResult& rv);
-  void GetCrossOrigin(nsAString & aOrigin);
-  void SetCrossOrigin(const nsAString & aOrigin, ErrorResult& rv);
+  void GetCrossOrigin(nsAString & aCrossOrigin);
+  void SetCrossOrigin(const nsAString & aCrossOrigin, ErrorResult& aError);
   already_AddRefed<SVGAnimatedString> Href();
 
 protected:
   ~SVGScriptElement();
 
   virtual StringAttributesInfo GetStringInfo() MOZ_OVERRIDE;
 
   enum { HREF };
--- a/dom/interfaces/html/nsIDOMHTMLImageElement.idl
+++ b/dom/interfaces/html/nsIDOMHTMLImageElement.idl
@@ -11,24 +11,23 @@
  *
  * This interface is trying to follow the DOM Level 2 HTML specification:
  * http://www.w3.org/TR/DOM-Level-2-HTML/
  *
  * with changes from the work-in-progress WHATWG HTML specification:
  * http://www.whatwg.org/specs/web-apps/current-work/
  */
 
-[uuid(e83e726a-0aef-4292-938b-253fec691e2f)]
+[uuid(ec18e71c-4f5c-4cc3-aa36-5273168644dc)]
 interface nsIDOMHTMLImageElement : nsISupports
 {
            attribute DOMString        alt;
            attribute DOMString        src;
            attribute DOMString        srcset;
            attribute DOMString        sizes;
-           attribute DOMString        crossOrigin;
            attribute DOMString        useMap;
            attribute boolean          isMap;
            attribute unsigned long    width;
            attribute unsigned long    height;
   readonly attribute unsigned long    naturalWidth;
   readonly attribute unsigned long    naturalHeight;
   readonly attribute boolean          complete;
 
--- a/dom/interfaces/html/nsIDOMHTMLLinkElement.idl
+++ b/dom/interfaces/html/nsIDOMHTMLLinkElement.idl
@@ -11,23 +11,22 @@
  *
  * This interface is trying to follow the DOM Level 2 HTML specification:
  * http://www.w3.org/TR/DOM-Level-2-HTML/
  *
  * with changes from the work-in-progress WHATWG HTML specification:
  * http://www.whatwg.org/specs/web-apps/current-work/
  */
 
-[uuid(95d6ec66-2754-45bd-a068-49ac1fb45004)]
+[uuid(ee50b7ab-0015-4fbe-89e0-e3feacd4ffde)]
 interface nsIDOMHTMLLinkElement : nsISupports
 {
            [binaryname(MozDisabled)]
            attribute boolean          disabled;
            attribute DOMString        charset;
            attribute DOMString        href;
            attribute DOMString        hreflang;
            attribute DOMString        media;
            attribute DOMString        rel;
            attribute DOMString        rev;
            attribute DOMString        target;
            attribute DOMString        type;
-           attribute DOMString        crossOrigin;
 };
--- a/dom/interfaces/html/nsIDOMHTMLMediaElement.idl
+++ b/dom/interfaces/html/nsIDOMHTMLMediaElement.idl
@@ -22,27 +22,26 @@ interface nsIDOMMediaStream;
 
 // undef the GetCurrentTime macro defined in WinBase.h from the MS Platform SDK
 %{C++
 #ifdef GetCurrentTime
 #undef GetCurrentTime
 #endif
 %}
 
-[uuid(0e14e6ad-2074-48b7-a247-e545a3a15131)]
+[uuid(c041d76c-15ce-47ad-b61d-e8755a6db638)]
 interface nsIDOMHTMLMediaElement : nsISupports
 {
   // error state
   readonly attribute nsIDOMMediaError error;
 
   // network state
            attribute DOMString src;
            attribute nsIDOMMediaStream mozSrcObject;
   readonly attribute DOMString currentSrc;
-           attribute DOMString crossOrigin;
   const unsigned short NETWORK_EMPTY = 0;
   const unsigned short NETWORK_IDLE = 1;
   const unsigned short NETWORK_LOADING = 2;
   const unsigned short NETWORK_NO_SOURCE = 3;
   readonly attribute unsigned short networkState;
            attribute DOMString preload;
   readonly attribute nsIDOMTimeRanges buffered;
   void load();
--- a/dom/interfaces/html/nsIDOMHTMLScriptElement.idl
+++ b/dom/interfaces/html/nsIDOMHTMLScriptElement.idl
@@ -11,22 +11,21 @@
  *
  * This interface is trying to follow the DOM Level 2 HTML specification:
  * http://www.w3.org/TR/DOM-Level-2-HTML/
  *
  * with changes from the work-in-progress WHATWG HTML specification:
  * http://www.whatwg.org/specs/web-apps/current-work/
  */
 
-[uuid(4627336e-3070-4e73-8f67-3851b54cc0eb)]
+[uuid(fe96dc1c-40e4-4974-9354-e3fce663c3d5)]
 interface nsIDOMHTMLScriptElement : nsISupports
 {
            attribute DOMString        src;
            attribute boolean          async;
            attribute boolean          defer;
            attribute DOMString        type;
            attribute DOMString        charset;
            attribute DOMString        text;
 
            attribute DOMString        htmlFor;
            attribute DOMString        event;
-           attribute DOMString        crossOrigin;
 };
--- a/dom/webidl/HTMLImageElement.webidl
+++ b/dom/webidl/HTMLImageElement.webidl
@@ -21,17 +21,17 @@ interface nsIStreamListener;
 interface HTMLImageElement : HTMLElement {
            [SetterThrows]
            attribute DOMString alt;
            [SetterThrows]
            attribute DOMString src;
            [SetterThrows, Pref="dom.image.srcset.enabled"]
            attribute DOMString srcset;
            [SetterThrows]
-           attribute DOMString crossOrigin;
+           attribute DOMString? crossOrigin;
            [SetterThrows]
            attribute DOMString useMap;
            [SetterThrows]
            attribute boolean isMap;
            [SetterThrows]
            attribute unsigned long width;
            [SetterThrows]
            attribute unsigned long height;
--- a/dom/webidl/HTMLLinkElement.webidl
+++ b/dom/webidl/HTMLLinkElement.webidl
@@ -13,17 +13,17 @@
 
 // http://www.whatwg.org/specs/web-apps/current-work/#the-link-element
 interface HTMLLinkElement : HTMLElement {
   [Pure]
            attribute boolean disabled;
   [SetterThrows, Pure]
            attribute DOMString href;
   [SetterThrows, Pure]
-           attribute DOMString crossOrigin;
+           attribute DOMString? crossOrigin;
   [SetterThrows, Pure]
            attribute DOMString rel;
   readonly attribute DOMTokenList relList;
   [SetterThrows, Pure]
            attribute DOMString media;
   [SetterThrows, Pure]
            attribute DOMString hreflang;
   [SetterThrows, Pure]
--- a/dom/webidl/HTMLMediaElement.webidl
+++ b/dom/webidl/HTMLMediaElement.webidl
@@ -17,17 +17,17 @@ interface HTMLMediaElement : HTMLElement
   readonly attribute MediaError? error;
 
   // network state
   [SetterThrows]
            attribute DOMString src;
   readonly attribute DOMString currentSrc;
 
   [SetterThrows]
-           attribute DOMString crossOrigin;
+           attribute DOMString? crossOrigin;
   const unsigned short NETWORK_EMPTY = 0;
   const unsigned short NETWORK_IDLE = 1;
   const unsigned short NETWORK_LOADING = 2;
   const unsigned short NETWORK_NO_SOURCE = 3;
   readonly attribute unsigned short networkState;
   [SetterThrows]
            attribute DOMString preload;
   [NewObject]
--- a/dom/webidl/HTMLScriptElement.webidl
+++ b/dom/webidl/HTMLScriptElement.webidl
@@ -15,17 +15,17 @@ interface HTMLScriptElement : HTMLElemen
   attribute DOMString type;
   [SetterThrows]
   attribute DOMString charset;
   [SetterThrows]
   attribute boolean async;
   [SetterThrows]
   attribute boolean defer;
   [SetterThrows]
-  attribute DOMString crossOrigin;
+  attribute DOMString? crossOrigin;
   [SetterThrows]
   attribute DOMString text;
 };
 
 // http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
 partial interface HTMLScriptElement {
   [SetterThrows]
   attribute DOMString event;
--- a/dom/webidl/SVGScriptElement.webidl
+++ b/dom/webidl/SVGScriptElement.webidl
@@ -11,13 +11,13 @@
  */
 
 interface SVGScriptElement : SVGElement {
   [SetterThrows]
   attribute DOMString type;
 
   // CORS attribute
   [SetterThrows]
-  attribute DOMString crossOrigin;
+  attribute DOMString? crossOrigin;
 };
 
 SVGScriptElement implements SVGURIReference;