Bug 146964 - Web Inspector: update $$() to return an Array
Summary: Web Inspector: update $$() to return an Array
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Joseph Pecoraro
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-07-15 01:58 PDT by Masataka Yakura
Modified: 2015-07-16 16:22 PDT (History)
9 users (show)

See Also:


Attachments
[PATCH] Proposed Fix (9.78 KB, patch)
2015-07-15 12:32 PDT, Joseph Pecoraro
burg: review+
joepeck: commit-queue-
Details | Formatted Diff | Diff
[PATCH] For Landing (9.99 KB, patch)
2015-07-15 19:27 PDT, Joseph Pecoraro
commit-queue: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from webkit-cq-02 for mac-mavericks (550.80 KB, application/zip)
2015-07-15 20:34 PDT, WebKit Commit Bot
no flags Details
[PATCH] For Landing (9.99 KB, patch)
2015-07-15 23:00 PDT, Joseph Pecoraro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Masataka Yakura 2015-07-15 01:58:23 PDT
Lately Mozilla changed their `$$()` function to return an Array instead of NoteList [1] and Chromium followed [2].
It would be great if Web Inspector could do the same!

[1] http://hg.mozilla.org/mozilla-central/rev/c71df86eb2f7
[2] https://chromium.googlesource.com/chromium/blink/+/23126107f2
Comment 1 Radar WebKit Bug Importer 2015-07-15 01:58:54 PDT
<rdar://problem/21831568>
Comment 2 Joseph Pecoraro 2015-07-15 12:30:12 PDT
Sounds good. It also helps us catch an issue with $$'s second parameter causing an exception.
Comment 3 Joseph Pecoraro 2015-07-15 12:32:03 PDT
Created attachment 256850 [details]
[PATCH] Proposed Fix
Comment 4 Brian Burg 2015-07-15 18:51:56 PDT
Comment on attachment 256850 [details]
[PATCH] Proposed Fix

View in context: https://bugs.webkit.org/attachment.cgi?id=256850&action=review

r=me

> LayoutTests/inspector/console/command-line-api-expected.txt:31
> +[object HTMLParagraphElement],[object HTMLParagraphElement]

Are NodeList instances printed out any differently than Array instances?

> LayoutTests/inspector/console/command-line-api.html:23
> +    {

nit, should be on same line?

> LayoutTests/inspector/console/command-line-api.html:50
> +                InspectorTest.log("DOM node not found.");

It seems like this case should be a test failure, right? I guess we don't have InspectorTest.error(), though throwing an exception should have the same effect as this.
Comment 5 Joseph Pecoraro 2015-07-15 19:22:00 PDT
Comment on attachment 256850 [details]
[PATCH] Proposed Fix

View in context: https://bugs.webkit.org/attachment.cgi?id=256850&action=review

> LayoutTests/inspector/console/command-line-api-expected.txt:16
> +STEP: String($0)
> +[object HTMLParagraphElement]
> +CONSOLE: The console function $() has changed from $=getElementById(id) to $=querySelector(selector). You might try $("#%s")
> +
> +STEP: String($('foo'))
> +null

I'm going to try and update the test to reorder this. I want the CONSOLE messages to be next to the $('foo') line.

>> LayoutTests/inspector/console/command-line-api-expected.txt:31
>> +[object HTMLParagraphElement],[object HTMLParagraphElement]
> 
> Are NodeList instances printed out any differently than Array instances?

Yep, a NodeList would have been printed out like [object NodeList]

>> LayoutTests/inspector/console/command-line-api.html:50
>> +                InspectorTest.log("DOM node not found.");
> 
> It seems like this case should be a test failure, right? I guess we don't have InspectorTest.error(), though throwing an exception should have the same effect as this.

Yeah, it won't match the results. This could be InspectorTest.assert(false, "DOM Node not found") but in any case this is just to detect an error that shouldn't happen.
Comment 6 Joseph Pecoraro 2015-07-15 19:27:37 PDT
Created attachment 256888 [details]
[PATCH] For Landing
Comment 7 WebKit Commit Bot 2015-07-15 20:34:46 PDT
Comment on attachment 256888 [details]
[PATCH] For Landing

Rejecting attachment 256888 [details] from commit-queue.

New failing tests:
inspector/console/command-line-api.html
Full output: http://webkit-queues.appspot.com/results/6394659504914432
Comment 8 WebKit Commit Bot 2015-07-15 20:34:48 PDT
Created attachment 256890 [details]
Archive of layout-test-results from webkit-cq-02 for mac-mavericks

The attached test failures were seen while running run-webkit-tests on the commit-queue.
Bot: webkit-cq-02  Port: mac-mavericks  Platform: Mac OS X 10.9.5
Comment 9 Joseph Pecoraro 2015-07-15 22:59:39 PDT
(In reply to comment #8)
> Created attachment 256890 [details]
> Archive of layout-test-results from webkit-cq-02 for mac-mavericks
> 
> The attached test failures were seen while running run-webkit-tests on the
> commit-queue.
> Bot: webkit-cq-02  Port: mac-mavericks  Platform: Mac OS X 10.9.5

lol, I forgot to update the results.
Comment 10 Joseph Pecoraro 2015-07-15 23:00:32 PDT
Created attachment 256892 [details]
[PATCH] For Landing
Comment 11 WebKit Commit Bot 2015-07-16 01:58:26 PDT
Comment on attachment 256892 [details]
[PATCH] For Landing

Clearing flags on attachment: 256892

Committed r186891: <http://trac.webkit.org/changeset/186891>