Title: [231515] trunk
Revision
231515
Author
[email protected]
Date
2018-05-08 14:53:01 -0700 (Tue, 08 May 2018)

Log Message

Consecutive messages logged as JSON are coalesced
https://bugs.webkit.org/show_bug.cgi?id=185432

Reviewed by Joseph Pecoraro.

Source/_javascript_Core:

* inspector/ConsoleMessage.cpp:
(Inspector::ConsoleMessage::isEqual const): Messages with JSON arguments are not equal.

LayoutTests:

* inspector/console/webcore-logging-expected.txt:
* inspector/console/webcore-logging.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (231514 => 231515)


--- trunk/LayoutTests/ChangeLog	2018-05-08 21:49:09 UTC (rev 231514)
+++ trunk/LayoutTests/ChangeLog	2018-05-08 21:53:01 UTC (rev 231515)
@@ -1,3 +1,13 @@
+2018-05-08  Eric Carlson  <[email protected]>
+
+        Consecutive messages logged as JSON are coalesced
+        https://bugs.webkit.org/show_bug.cgi?id=185432
+
+        Reviewed by Joseph Pecoraro.
+
+        * inspector/console/webcore-logging-expected.txt:
+        * inspector/console/webcore-logging.html:
+
 2018-05-08  Jer Noble  <[email protected]>
 
         Mute MediaElementSourceNode when tainted.

Modified: trunk/LayoutTests/inspector/console/webcore-logging-expected.txt (231514 => 231515)


--- trunk/LayoutTests/inspector/console/webcore-logging-expected.txt	2018-05-08 21:49:09 UTC (rev 231514)
+++ trunk/LayoutTests/inspector/console/webcore-logging-expected.txt	2018-05-08 21:53:01 UTC (rev 231515)
@@ -30,3 +30,14 @@
 PASS: Media logging has been enabled.
 PASS: Media log message should have source 'media'.
 
+-- Running test case: Console.Logging.LogAsJSONWithoutRepeat
+PASS: Media logging disabled.
+PASS: Verbose media logging has been enabled.
+PASS: Message logged as JSON.
+PASS: ConsoleMessage repeatCount is 1.
+PASS: Message logged as JSON.
+PASS: ConsoleMessage repeatCount is 1.
+PASS: Message logged as JSON.
+PASS: ConsoleMessage repeatCount is 1.
+Received three JSON messages.
+

Modified: trunk/LayoutTests/inspector/console/webcore-logging.html (231514 => 231515)


--- trunk/LayoutTests/inspector/console/webcore-logging.html	2018-05-08 21:49:09 UTC (rev 231514)
+++ trunk/LayoutTests/inspector/console/webcore-logging.html	2018-05-08 21:53:01 UTC (rev 231515)
@@ -27,6 +27,16 @@
     TestPage.dispatchEventToFrontend('PauseEvent', {count: 1});
 }
 
+function setupTrackTest()
+{
+    let track = document.createElement('track');
+    track.src = ''+encodeURIComponent('WEBVTT\n\n00:00:00.000 --> 00:00:00.001\nCue 1\n\n'+
+                                                '00:00:00.000 --> 00:00:00.001 line:0\nCue 2\n\n'+
+                                                '00:00:00.000 --> 00:00:00.001 line:0%\nCue 3');
+    track.track.mode = 'showing';
+    video.appendChild(track);
+}
+
 function test()
 {
     let suite = InspectorTest.createAsyncSuite("Console.Logging");
@@ -151,6 +161,48 @@
         }
     });
 
+    suite.addTestCase({
+        name: "Console.Logging.LogAsJSONWithoutRepeat",
+        description: "JSON messages logged correctly.",
+        test(resolve, reject) {
+            ConsoleAgent.clearMessages();
+
+            let channel = WI.logManager.customLoggingChannels.find(channel => channel.source === WI.ConsoleMessage.MessageSource.Media);
+            InspectorTest.expectThat(channel.level === WI.LoggingChannel.Level.Off, "Media logging disabled.");
+
+            ConsoleAgent.setLoggingChannelLevel(channel.source, WI.LoggingChannel.Level.Verbose)
+            ConsoleAgent.getLoggingChannels((error, channels) => {
+                if (error) {
+                    InspectorTest.fail(`ConsoleAgent.getLoggingChannels() failed with error ${error}`);
+                    reject();
+                }
+
+                let mediaChannel = channels.find(channel => channel.source === WI.ConsoleMessage.MessageSource.Media);
+                InspectorTest.expectThat(mediaChannel.level === WI.LoggingChannel.Level.Verbose, "Verbose media logging has been enabled.");
+
+                let messageCount = 0;
+                let logListener = WI.logManager.addEventListener(WI.LogManager.Event.MessageAdded, (event) => {
+                    let message = event.data.message;
+                    InspectorTest.assert(message instanceof WI.ConsoleMessage);
+                    InspectorTest.assert(message.source === WI.ConsoleMessage.MessageSource.Media);
+
+                    if (message.messageText.includes("LoadableTextTrack::newCuesAvailable")) {
+                        InspectorTest.expectThat(message.parameters.length > 1, "Message logged as JSON.");
+                        InspectorTest.expectThat(message.repeatCount === 1, "ConsoleMessage repeatCount is 1.");
+                        if (++messageCount === 3) {
+                            InspectorTest.log("Received three JSON messages.");
+                            WI.logManager.removeEventListener(WI.LogManager.Event.MessageAdded, logListener, null);
+                            ConsoleAgent.setLoggingChannelLevel(mediaChannel.source, WI.LoggingChannel.Level.Off)
+                            resolve();
+                        }
+                    }
+                });
+
+                InspectorTest.evaluateInPage(`setupTrackTest()`);
+            })
+        }
+    });
+
     suite.runTestCasesAndFinish();
 }
 

Modified: trunk/Source/_javascript_Core/ChangeLog (231514 => 231515)


--- trunk/Source/_javascript_Core/ChangeLog	2018-05-08 21:49:09 UTC (rev 231514)
+++ trunk/Source/_javascript_Core/ChangeLog	2018-05-08 21:53:01 UTC (rev 231515)
@@ -1,3 +1,13 @@
+2018-05-08  Eric Carlson  <[email protected]>
+
+        Consecutive messages logged as JSON are coalesced
+        https://bugs.webkit.org/show_bug.cgi?id=185432
+
+        Reviewed by Joseph Pecoraro.
+
+        * inspector/ConsoleMessage.cpp:
+        (Inspector::ConsoleMessage::isEqual const): Messages with JSON arguments are not equal.
+
 2018-05-06  Filip Pizlo  <[email protected]>
 
         InPlaceAbstractState::beginBasicBlock shouldn't have to clear any abstract values

Modified: trunk/Source/_javascript_Core/inspector/ConsoleMessage.cpp (231514 => 231515)


--- trunk/Source/_javascript_Core/inspector/ConsoleMessage.cpp	2018-05-08 21:49:09 UTC (rev 231514)
+++ trunk/Source/_javascript_Core/inspector/ConsoleMessage.cpp	2018-05-08 21:53:01 UTC (rev 231515)
@@ -300,6 +300,9 @@
     } else if (msg->m_callStack)
         return false;
 
+    if (m_jsonLogValues.size() || msg->m_jsonLogValues.size())
+        return false;
+
     return msg->m_source == m_source
         && msg->m_type == m_type
         && msg->m_level == m_level
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to