Comment should be constructable

RESOLVED FIXED in mozilla24

Status

()

defect
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: erik, Assigned: baku)

Tracking

({dev-doc-complete})

unspecified
mozilla24
Points:
---
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 2 obsolete attachments)

http://dom.spec.whatwg.org/#comment

Make Comment constructable so that one can do "new Comment('abc')" instead of "document.createComment('abc')"
Assignee: nobody → amarchesini
Posted patch patch (obsolete) — Splinter Review
Attachment #747919 - Flags: review?(Ms2ger)
Comment on attachment 747919 [details] [diff] [review]
patch

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

::: content/base/src/Comment.cpp
@@ +64,5 @@
> +Comment::Constructor(const GlobalObject& aGlobal, const nsAString& aData,
> +                     ErrorResult& aRv)
> +{
> +  nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aGlobal.Get());
> +  nsRefPtr<Comment> comment = new Comment(window->GetDoc()->NodeInfoManager());

Null-check window and window->GetDoc()

::: content/base/test/test_bug869006.html
@@ +20,5 @@
> +
> +/** Test for Bug 869006 **/
> +
> +var c = new Comment();
> +ok(c, "Comment has been created without content");

Test c.data.

@@ +23,5 @@
> +var c = new Comment();
> +ok(c, "Comment has been created without content");
> +
> +c = new Comment('foo');
> +ok(c, "Comment has been created");

Here too
Posted patch patch (obsolete) — Splinter Review
Attachment #747919 - Attachment is obsolete: true
Attachment #747919 - Flags: review?(Ms2ger)
Attachment #747928 - Flags: review?(Ms2ger)
Once you know window and doc are not null, why not just call createComment on the doc?
Posted patch patchSplinter Review
green on try
Attachment #747928 - Attachment is obsolete: true
Attachment #747928 - Flags: review?(Ms2ger)
Attachment #748022 - Flags: review?(Ms2ger)
Summary: Comment should be consructable → Comment should be constructable
Comment on attachment 748022 [details] [diff] [review]
patch

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

lgtm
Attachment #748022 - Flags: review?(Ms2ger) → review+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/3411817d911f
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla24
You need to log in before you can comment on or make changes to this bug.