Last Comment Bug 869006 - Comment should be constructable
: Comment should be constructable
Status: RESOLVED FIXED
: dev-doc-complete
Product: Core
Classification: Components
Component: DOM: Core & HTML (show other bugs)
: unspecified
: All All
: -- normal (vote)
: mozilla24
Assigned To: Andrea Marchesini (:baku)
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-05-06 07:27 PDT by Erik Arvidsson
Modified: 2013-08-13 00:48 PDT (History)
5 users (show)
ryanvm: in‑testsuite+
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
patch (3.89 KB, patch)
2013-05-10 05:03 PDT, Andrea Marchesini (:baku)
no flags Details | Diff | Review
patch (4.07 KB, patch)
2013-05-10 05:28 PDT, Andrea Marchesini (:baku)
no flags Details | Diff | Review
patch (3.98 KB, patch)
2013-05-10 09:15 PDT, Andrea Marchesini (:baku)
Ms2ger: review+
Details | Diff | Review

Description Erik Arvidsson 2013-05-06 07:27:34 PDT
http://dom.spec.whatwg.org/#comment

Make Comment constructable so that one can do "new Comment('abc')" instead of "document.createComment('abc')"
Comment 1 Andrea Marchesini (:baku) 2013-05-10 05:03:27 PDT
Created attachment 747919 [details] [diff] [review]
patch
Comment 2 :Ms2ger 2013-05-10 05:06:18 PDT
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
Comment 3 Andrea Marchesini (:baku) 2013-05-10 05:28:22 PDT
Created attachment 747928 [details] [diff] [review]
patch
Comment 4 Boris Zbarsky [:bz] (Out June 25-July 6) 2013-05-10 07:00:19 PDT
Once you know window and doc are not null, why not just call createComment on the doc?
Comment 5 Andrea Marchesini (:baku) 2013-05-10 09:07:45 PDT
https://tbpl.mozilla.org/?tree=Try&rev=78c025a6f8e5
Comment 6 Andrea Marchesini (:baku) 2013-05-10 09:15:40 PDT
Created attachment 748022 [details] [diff] [review]
patch

green on try
Comment 7 :Ms2ger 2013-05-11 02:49:49 PDT
Comment on attachment 748022 [details] [diff] [review]
patch

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

lgtm
Comment 8 Ryan VanderMeulen [:RyanVM] 2013-05-13 06:24:25 PDT
https://hg.mozilla.org/integration/mozilla-inbound/rev/3411817d911f
Comment 9 Ryan VanderMeulen [:RyanVM] 2013-05-13 13:46:15 PDT
https://hg.mozilla.org/mozilla-central/rev/3411817d911f

Note You need to log in before you can comment on or make changes to this bug.