Comment should be constructable

RESOLVED FIXED in mozilla24

Status

()

Core
DOM: Core & HTML
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: Erik Arvidsson, Assigned: baku)

Tracking

({dev-doc-complete})

unspecified
mozilla24
dev-doc-complete
Points:
---
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 2 obsolete attachments)

(Reporter)

Description

4 years ago
http://dom.spec.whatwg.org/#comment

Make Comment constructable so that one can do "new Comment('abc')" instead of "document.createComment('abc')"
(Assignee)

Updated

4 years ago
Assignee: nobody → amarchesini
(Assignee)

Comment 1

4 years ago
Created attachment 747919 [details] [diff] [review]
patch
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
(Assignee)

Comment 3

4 years ago
Created attachment 747928 [details] [diff] [review]
patch
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?
(Assignee)

Comment 5

4 years ago
https://tbpl.mozilla.org/?tree=Try&rev=78c025a6f8e5
(Assignee)

Comment 6

4 years ago
Created attachment 748022 [details] [diff] [review]
patch

green on try
Attachment #747928 - Attachment is obsolete: true
Attachment #747928 - Flags: review?(Ms2ger)
Attachment #748022 - Flags: review?(Ms2ger)
(Assignee)

Updated

4 years ago
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+
(Assignee)

Updated

4 years ago
Keywords: checkin-needed
https://hg.mozilla.org/integration/mozilla-inbound/rev/3411817d911f
Flags: in-testsuite+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/3411817d911f
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla24

Updated

4 years ago
Keywords: dev-doc-needed
Docs:
https://developer.mozilla.org/en-US/docs/Web/API/Comment
https://developer.mozilla.org/en-US/docs/Web/API/Comment.Comment
and
https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/24
Keywords: dev-doc-needed → dev-doc-complete
You need to log in before you can comment on or make changes to this bug.