RESOLVED FIXED Bug 43286
Remove setNodeToDump from dump-as-markup.js
https://bugs.webkit.org/show_bug.cgi?id=43286
Summary Remove setNodeToDump from dump-as-markup.js
Ryosuke Niwa
Reported 2010-07-30 16:31:22 PDT
Now that noAutoDump is added, setNodeToDump is redundant. We should make dump a little smarter not to print out the optional description, and remove setNodeToDump.
Attachments
Patch (8.69 KB, patch)
2010-07-30 18:20 PDT, Ryosuke Niwa
no flags
Fixed per Ojan's comment. Asked him to take a look again (8.93 KB, patch)
2010-08-02 15:41 PDT, Ryosuke Niwa
ojan: review+
Ryosuke Niwa
Comment 1 2010-07-30 18:20:17 PDT
Ojan Vafai
Comment 2 2010-08-02 11:12:23 PDT
Comment on attachment 63134 [details] Patch Just a few nits. > +++ LayoutTests/resources/dump-as-markup.js (working copy) > - // If dump is not called by notifyDone, then print out optional description > - // because this test is manually calling dump. > - if (!Markup._done || opt_description) { > + if (Markup._dumpCalls > 1 || opt_description) { > if (!opt_description) > opt_description = "Dump of markup " + Markup._dumpCalls > if (Markup._dumpCalls > 1) > - markup += '\n'; > + markup += '\n' Missing semi-colon. > markup += '\n' + opt_description + ':\n'; > + } else { > + Markup._firstCallDidNotHaveDescription = true; > } Single-line else statement should not use brackets. > + if (Markup._dumpCalls > 1 && Markup._firstCallDidNotHaveDescription) { > + Markup._container.insertBefore( > + document.createTextNode('\nDump of markup 1:\n'), > + Markup._container.firstChild.nextSibling); This looks to me like it will only work on tests that have descriptions, no? How about wrapping the first dump in a span with an ID? Then you can getElementById instead of relying on the DOM structure. Or you could give each dump a classname and get do getElementsByClassName(class)[0]. Relying on the DOM structure is too fragile I think.
Ryosuke Niwa
Comment 3 2010-08-02 15:41:24 PDT
Created attachment 63271 [details] Fixed per Ojan's comment. Asked him to take a look again
Ojan Vafai
Comment 4 2010-08-02 15:45:47 PDT
Comment on attachment 63271 [details] Fixed per Ojan's comment. Asked him to take a look again > + if (Markup._dumpCalls == 2 && Markup._firstCallDidNotHaveDescription) { > + var wrapper = document.getElementById('dump-as-markup-1'); > + wrapper.insertBefore(document.createTextNode('\nDump of markup 1:\n'), wrapper.firstChild); > + } > - Markup._container.appendChild(document.createTextNode(markup)); > + if (Markup._test_description && Markup._dumpCalls == 1) > + Markup._container.appendChild(document.createTextNode(Markup._test_description + '\n')) > + > + var wrapper = document.createElement('span'); > + wrapper.setAttribute('id', 'dump-as-markup-' + Markup._dumpCalls); Nit: No need to use setAttribute with IDs. Can just do: wrapper.id = 'dump-as-markup-' + Markup._dumpCalls; Also, we could use classes instead of IDs. Then you can get the first one by calling document.getElementsByClassName(class)[0].
Ryosuke Niwa
Comment 5 2010-08-02 17:00:56 PDT
WebKit Review Bot
Comment 6 2010-08-02 17:32:00 PDT
http://trac.webkit.org/changeset/64507 might have broken GTK Linux 64-bit Debug The following changes are on the blame list: http://trac.webkit.org/changeset/64506 http://trac.webkit.org/changeset/64507
Note You need to log in before you can comment on or make changes to this bug.