Bug 174842

Summary: Web Inspector: Don't output "No message" for multi-value logs like console.log(x, y)
Product: WebKit Reporter: Joseph Pecoraro <joepeck>
Component: Web InspectorAssignee: Joseph Pecoraro <joepeck>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, inspector-bugzilla-changes, joepeck, mattbaker
Priority: P2    
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
[PATCH] Proposed Fix
none
[PATCH] Proposed Fix
mattbaker: review+, joepeck: commit-queue-
[PATCH] For Landing none

Description Joseph Pecoraro 2017-07-25 16:15:03 PDT
Don't output "No message" for multi-value logs like console.log(x, y)

Test:
console.log(100, 200)

Expected:
[Log] 100 – 200

Actual:
[Log] No Message – 100 – 200
Comment 1 Joseph Pecoraro 2017-07-25 16:28:09 PDT
Created attachment 316404 [details]
[PATCH] Proposed Fix
Comment 2 Joseph Pecoraro 2017-07-25 16:32:21 PDT
Created attachment 316405 [details]
[PATCH] Proposed Fix

Now that commit-queue has caught up to the rest of the world.
Comment 3 Matt Baker 2017-07-25 16:49:14 PDT
Comment on attachment 316405 [details]
[PATCH] Proposed Fix

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

r=me

> Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js:476
> +                    }

I know it's only in two places, but a helper might be nice:

function createDivider() {
    let divider = document.createElement("span");
    divider.textContent = ` ${enDash} `;
    divider.classList.add("console-message-preview-divider");
    return divider;
}

if (needsDivider) {
    builderElement.appendChild(createDivider());
Comment 4 Joseph Pecoraro 2017-07-25 18:48:04 PDT
Comment on attachment 316405 [details]
[PATCH] Proposed Fix

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

>> Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js:476
>> +                    }
> 
> I know it's only in two places, but a helper might be nice:
> 
> function createDivider() {
>     let divider = document.createElement("span");
>     divider.textContent = ` ${enDash} `;
>     divider.classList.add("console-message-preview-divider");
>     return divider;
> }
> 
> if (needsDivider) {
>     builderElement.appendChild(createDivider());

This actually exposed an issue, in the case below `enclosedElement` is used later on to add the "inline-lossless" class if it is needed.

I extracted this out into an: `appendDividerIfNeeded` method which then makes it easy to correct the code below as well.
Comment 5 Joseph Pecoraro 2017-07-25 18:48:47 PDT
Created attachment 316417 [details]
[PATCH] For Landing
Comment 6 WebKit Commit Bot 2017-07-25 19:27:11 PDT
Comment on attachment 316417 [details]
[PATCH] For Landing

Clearing flags on attachment: 316417

Committed r219900: <http://trac.webkit.org/changeset/219900>