Closed Bug 840559 Opened 11 years ago Closed 11 years ago

Convert MediaError to WebIDL

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla21

People

(Reporter: baku, Assigned: baku)

References

(Blocks 1 open bug)

Details

Attachments

(2 files, 5 obsolete files)

      No description provided.
Attached patch part 1 - renaming (obsolete) — Splinter Review
What do we do for enums in webIDL? I left the nsIDOMHTMLMediaError ones.
Attachment #712964 - Flags: review?(Ms2ger)
Attached patch part 2 - webidl (obsolete) — Splinter Review
Attachment #712965 - Flags: review?(Ms2ger)
No longer blocks: 826738
Comment on attachment 712964 [details] [diff] [review]
part 1 - renaming

Review of attachment 712964 [details] [diff] [review]:
-----------------------------------------------------------------

::: content/html/content/src/nsMediaError.cpp
@@ +21,5 @@
>    NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MediaError)
>  NS_INTERFACE_MAP_END
>  
> +MediaError::MediaError(uint16_t aCode)
> +:  mCode(aCode)

Nit:

  : mCode(aCode)

(two spaces, :, one space, mCode)
Attachment #712964 - Flags: review?(Ms2ger) → review+
Comment on attachment 712965 [details] [diff] [review]
part 2 - webidl

Review of attachment 712965 [details] [diff] [review]:
-----------------------------------------------------------------

You need more CC magic, at least for the wrapper and mParent.

::: content/html/content/src/MediaError.cpp
@@ +23,5 @@
>  NS_INTERFACE_MAP_END
>  
> +MediaError::MediaError(nsHTMLMediaElement* aParent, uint16_t aCode)
> +: mParent(aParent)
> +, mCode(aCode)

Same

@@ +37,5 @@
>  }
>  
> +JSObject*
> +MediaError::WrapObject(JSContext* cx, JSObject* scope,
> +                       bool* triedToWrap)

aFoo for arguments
Attachment #712965 - Flags: review?(Ms2ger) → review-
Attachment #712964 - Attachment is obsolete: true
Attachment #712975 - Flags: review+
Attached patch part 2 - webidl (b) (obsolete) — Splinter Review
Attachment #712965 - Attachment is obsolete: true
Attachment #712978 - Flags: review?(Ms2ger)
> What do we do for enums in webIDL?

WebIDL uses string-valued enums, because numeric ones don't really make sense in JavaScript...

If we need the numeric constants on the C++ side, we can just leave it in the XPIDL as you have or put them in the C++ impl.
Attachment #712978 - Flags: review?(bugs)
Comment on attachment 712978 [details] [diff] [review]
part 2 - webidl (b)


> namespace mozilla {
> namespace dom {
> 
>-NS_IMPL_ADDREF(MediaError)
>-NS_IMPL_RELEASE(MediaError)
>+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(MediaError)
>+  NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
>+  NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mParent)
>+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
> 
>-NS_INTERFACE_MAP_BEGIN(MediaError)
>-  NS_INTERFACE_MAP_ENTRY(nsISupports)
>+NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(MediaError)
>+  NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
>+NS_IMPL_CYCLE_COLLECTION_UNLINK_END
>+
>+NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(MediaError)
>+  NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
>+NS_IMPL_CYCLE_COLLECTION_TRACE_END


NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(MediaError, mParent)
should work.
Attachment #712978 - Flags: review?(bugs) → review+
Comment on attachment 712978 [details] [diff] [review]
part 2 - webidl (b)

Review of attachment 712978 [details] [diff] [review]:
-----------------------------------------------------------------

r=me with those comments addressed and using NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1.

::: content/html/content/src/MediaError.cpp
@@ -20,2 @@
>    NS_INTERFACE_MAP_ENTRY(nsIDOMMediaError)
> -  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MediaError)

I don't think you should remove this.

@@ +36,5 @@
> +
> +
> +MediaError::MediaError(nsHTMLMediaElement* aParent, uint16_t aCode)
> +: mParent(aParent)
> +, mCode(aCode)

Should indent this by two spaces, as I mentioned.

@@ +43,5 @@
>  
>  NS_IMETHODIMP MediaError::GetCode(uint16_t* aCode)
>  {
>    if (aCode)
>      *aCode = mCode;

Make this Code()

::: content/html/content/src/MediaError.h
@@ +47,2 @@
>    // Error code
>    uint16_t mCode;

This could be const

::: dom/webidl/MediaError.webidl
@@ +3,5 @@
> + * 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://dev.w3.org/html5/spec-author-view/video.html#mediaerror

You don't want to be looking at w3.org for HTML, and definitely not at spec-author-view. Please link to <http://www.whatwg.org/html/#mediaerror>.

@@ +15,5 @@
> +  const unsigned short MEDIA_ERR_ABORTED = 1;
> +  const unsigned short MEDIA_ERR_NETWORK = 2;
> +  const unsigned short MEDIA_ERR_DECODE = 3;
> +  const unsigned short MEDIA_ERR_SRC_NOT_SUPPORTED = 4;
> +  readonly attribute unsigned short code;

Add [Constant]
Attachment #712978 - Flags: review?(Ms2ger) → review+
Attached patch part 2 - webidl (d) (obsolete) — Splinter Review
Attachment #712978 - Attachment is obsolete: true
Attachment #713402 - Flags: review+
Attached patch part 2 - webidl (obsolete) — Splinter Review
Attachment #713402 - Attachment is obsolete: true
Attachment #713883 - Flags: review?(bugs)
Comment on attachment 713883 [details] [diff] [review]
part 2 - webidl

mParent needs to be strong and it needs to be traversed/unlinked
Attachment #713883 - Flags: review?(bugs) → review-
Attached patch part 2 - webidlSplinter Review
Attachment #713883 - Attachment is obsolete: true
Attachment #713888 - Flags: review?(bugs)
Attachment #713888 - Flags: review?(bugs) → review+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/a61cbf1da700
https://hg.mozilla.org/mozilla-central/rev/d0ff1ebd9885
Status: NEW → RESOLVED
Closed: 11 years ago
Flags: in-testsuite?
Resolution: --- → FIXED
Target Milestone: --- → mozilla21
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: