Modern IDB: Fix logging that overwhelms python with strings of excessive length.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Jan 2016 19:47:03 +0000 (19:47 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Jan 2016 19:47:03 +0000 (19:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=153652

Reviewed by Tim Horton.

Source/WebCore:

No new tests (Two skipped tests now pass).

* Modules/indexeddb/IDBKeyData.cpp:
(WebCore::IDBKeyData::loggingString): Limit the length of the string.

* Modules/indexeddb/IDBKeyRangeData.cpp:
(WebCore::IDBKeyRangeData::loggingString): Limit the length of the string.

LayoutTests:

* platform/mac-wk1/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@195832 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/platform/mac-wk1/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/IDBKeyData.cpp
Source/WebCore/Modules/indexeddb/IDBKeyRangeData.cpp

index 0991971..be9dd87 100644 (file)
@@ -1,3 +1,12 @@
+2016-01-29  Brady Eidson  <beidson@apple.com>
+
+        Modern IDB: Fix logging that overwhelms python with strings of excessive length.
+        https://bugs.webkit.org/show_bug.cgi?id=153652
+
+        Reviewed by Tim Horton.
+
+        * platform/mac-wk1/TestExpectations:
+
 2016-01-29  Saam barati  <sbarati@apple.com>
 
         Exits from exceptions shouldn't jettison code
index 0356918..125c96a 100644 (file)
@@ -271,12 +271,8 @@ storage/indexeddb/transaction-coordination-within-database.html [ Skip ]
 
 # SQLite backend tests that crash or ASSERT
 storage/indexeddb/database-odd-names.html [ Skip ]
-storage/indexeddb/odd-strings.html [ Skip ]
-
-# SQLite backend tests that wedge the entire testing harness
-imported/w3c/indexeddb/keyorder.htm [ Skip ]
 storage/indexeddb/dont-wedge.html [ Skip ]
-storage/indexeddb/key-type-array.html [ Skip ]
+storage/indexeddb/odd-strings.html [ Skip ]
 
 ### END OF (3) IndexedDB failures with SQLite
 ########################################
index afeb7ad..6587295 100644 (file)
@@ -1,3 +1,18 @@
+2016-01-29  Brady Eidson  <beidson@apple.com>
+
+        Modern IDB: Fix logging that overwhelms python with strings of excessive length.
+        https://bugs.webkit.org/show_bug.cgi?id=153652
+
+        Reviewed by Tim Horton.
+
+        No new tests (Two skipped tests now pass).
+
+        * Modules/indexeddb/IDBKeyData.cpp:
+        (WebCore::IDBKeyData::loggingString): Limit the length of the string.
+        
+        * Modules/indexeddb/IDBKeyRangeData.cpp:
+        (WebCore::IDBKeyRangeData::loggingString): Limit the length of the string.
+
 2016-01-29  Jer Noble  <jer.noble@apple.com>
 
         Unreviewed Windows build fix; one more ResourceLoaderOptions call site which needs to
index fd36519..8982bee 100644 (file)
@@ -255,23 +255,26 @@ String IDBKeyData::loggingString() const
     if (m_isNull)
         return "<null>";
 
+    String result;
+
     switch (m_type) {
     case KeyType::Invalid:
         return "<invalid>";
-    case KeyType::Array:
-        {
-            StringBuilder result;
-            result.appendLiteral("<array> - { ");
-            for (size_t i = 0; i < m_arrayValue.size(); ++i) {
-                result.append(m_arrayValue[i].loggingString());
-                if (i < m_arrayValue.size() - 1)
-                    result.appendLiteral(", ");
-            }
-            result.appendLiteral(" }");
-            return result.toString();
+    case KeyType::Array: {
+        StringBuilder builder;
+        builder.appendLiteral("<array> - { ");
+        for (size_t i = 0; i < m_arrayValue.size(); ++i) {
+            builder.append(m_arrayValue[i].loggingString());
+            if (i < m_arrayValue.size() - 1)
+                builder.appendLiteral(", ");
         }
+        builder.appendLiteral(" }");
+        result = builder.toString();
+        break;
+    }
     case KeyType::String:
-        return "<string> - " + m_stringValue;
+        result = "<string> - " + m_stringValue;
+        break;
     case KeyType::Date:
         return String::format("Date m_type - %f", m_numberValue);
     case KeyType::Number:
@@ -283,7 +286,13 @@ String IDBKeyData::loggingString() const
     default:
         return String();
     }
-    ASSERT_NOT_REACHED();
+
+    if (result.length() > 150) {
+        result.truncate(147);
+        result.append(WTF::ASCIILiteral("..."));
+    }
+
+    return result;
 }
 #endif
 
index 0f4f29f..e361cc6 100644 (file)
@@ -116,7 +116,13 @@ bool IDBKeyRangeData::isValid() const
 #ifndef NDEBUG
 String IDBKeyRangeData::loggingString() const
 {
-    return makeString(lowerOpen ? "( " : "[ ", lowerKey.loggingString(), ", ", upperKey.loggingString(), upperOpen ? " )" : " ]");
+    auto result = makeString(lowerOpen ? "( " : "[ ", lowerKey.loggingString(), ", ", upperKey.loggingString(), upperOpen ? " )" : " ]");
+    if (result.length() > 400) {
+        result.truncate(397);
+        result.append(WTF::ASCIILiteral("..."));
+    }
+
+    return result;
 }
 #endif