Title: [277574] trunk
Revision
277574
Author
wei...@apple.com
Date
2021-05-16 15:00:30 -0700 (Sun, 16 May 2021)

Log Message

Support serializing ImageData object colorSpace property in SerializedScriptValue
https://bugs.webkit.org/show_bug.cgi?id=225854

Reviewed by Chris Dumez.

Source/WebCore:

Test: storage/indexeddb/structured-clone-image-data-display-p3.html

Update SerializedScriptValue schema to version 8 and add serialization
of the colorSpace property.

* bindings/js/SerializedScriptValue.cpp:
(WebCore::PredefinedColorSpaceTag):
Add copy of the PredefinedColorSpace values that are guaranteed to
stay consistent forever.

(WebCore::CloneSerializer::dumpIfTerminal):
Add encoding of the colorSpace when serializing ImageData.

(WebCore::CloneSerializer::write):
(WebCore::CloneDeserializer::read):
Add coders for PredefinedColorSpaceTag.

(WebCore::CloneDeserializer::getJSValue):
Replace multiple overloads with one perfect forwarding overload which does
what we want and works with r-values.

(WebCore::CloneDeserializer::readImageBitmap):
Use auto in two places.

(WebCore::CloneDeserializer::readTerminal):
Add decoding of the colorSpace when deserializing ImageData. For prior versions,
the colorSpace defaults to sRGB, which was the only color space supported.

LayoutTests:

Updates existing tests for new serialization version (version 8) and support
for serializing color space in ImageData.

To avoid multiple result files due to lack of support for display-p3, testing
that the display-p3 color space is serialized correctly was put into its own
test that is skipped on non-supporting platforms.

* platform/glib/TestExpectations:
* platform/win/TestExpectations:
Skip structured-clone-image-data-display-p3.html on platforms that don't support
display-p3 color spaces.

* fast/storage/serialized-script-value.html:
Bump version to version 8.

* storage/indexeddb/resources/structured-clone.js:
* storage/indexeddb/structured-clone-expected.txt:
Add tests for ImageData colorSpace round tripping.

* storage/indexeddb/structured-clone-image-data-display-p3-expected.txt: Added.
* storage/indexeddb/structured-clone-image-data-display-p3.html: Added.
Add test for ImageData display-p3 colorSpace round tripping as its own test
to allow targetted skipping by non-supporting platforms.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (277573 => 277574)


--- trunk/LayoutTests/ChangeLog	2021-05-16 20:32:30 UTC (rev 277573)
+++ trunk/LayoutTests/ChangeLog	2021-05-16 22:00:30 UTC (rev 277574)
@@ -1,5 +1,36 @@
 2021-05-16  Sam Weinig  <wei...@apple.com>
 
+        Support serializing ImageData object colorSpace property in SerializedScriptValue
+        https://bugs.webkit.org/show_bug.cgi?id=225854
+
+        Reviewed by Chris Dumez.
+
+        Updates existing tests for new serialization version (version 8) and support
+        for serializing color space in ImageData.
+
+        To avoid multiple result files due to lack of support for display-p3, testing
+        that the display-p3 color space is serialized correctly was put into its own
+        test that is skipped on non-supporting platforms.
+
+        * platform/glib/TestExpectations:
+        * platform/win/TestExpectations:
+        Skip structured-clone-image-data-display-p3.html on platforms that don't support
+        display-p3 color spaces.
+
+        * fast/storage/serialized-script-value.html:
+        Bump version to version 8.
+
+        * storage/indexeddb/resources/structured-clone.js:
+        * storage/indexeddb/structured-clone-expected.txt:
+        Add tests for ImageData colorSpace round tripping.
+
+        * storage/indexeddb/structured-clone-image-data-display-p3-expected.txt: Added.
+        * storage/indexeddb/structured-clone-image-data-display-p3.html: Added.
+        Add test for ImageData display-p3 colorSpace round tripping as its own test
+        to allow targetted skipping by non-supporting platforms.
+
+2021-05-16  Sam Weinig  <wei...@apple.com>
+
         Add support for creating/accessing/setting non-sRGB ImageData via canvas
         https://bugs.webkit.org/show_bug.cgi?id=225841
 

Modified: trunk/LayoutTests/fast/storage/serialized-script-value.html (277573 => 277574)


--- trunk/LayoutTests/fast/storage/serialized-script-value.html	2021-05-16 20:32:30 UTC (rev 277573)
+++ trunk/LayoutTests/fast/storage/serialized-script-value.html	2021-05-16 22:00:30 UTC (rev 277574)
@@ -6,7 +6,7 @@
     <body>
         <script>
 
-const currentVersion = 0x07;
+const currentVersion = 0x08;
 
 // Here's a little Q&D helper for future adventurers needing to rebaseline this.
 

Modified: trunk/LayoutTests/platform/glib/TestExpectations (277573 => 277574)


--- trunk/LayoutTests/platform/glib/TestExpectations	2021-05-16 20:32:30 UTC (rev 277573)
+++ trunk/LayoutTests/platform/glib/TestExpectations	2021-05-16 22:00:30 UTC (rev 277574)
@@ -2357,10 +2357,13 @@
 # It was a flaky crash until r275516, but it's still a timeout flaky.
 webkit.org/b/224112 media/video-as-img-output-pts.html [ Timeout Pass ]
 
-webkit.org/b/225423 fast/canvas/canvas-color-space-display-p3.html [ ImageOnlyFailure ]
-webkit.org/b/225423 fast/canvas/canvas-color-space-display-p3-ImageData.html [ Failure ]
 webkit.org/b/225423 fast/canvas/canvas-composite-text-alpha.html [ Failure ]
 
+# Non-sRGB color spaces are not currently supported by the glib ports.
+fast/canvas/canvas-color-space-display-p3.html [ Skip ]
+fast/canvas/canvas-color-space-display-p3-ImageData.html [ Skip ]
+storage/indexeddb/structured-clone-image-data-display-p3.html [ Skip ]
+
 # Failing after r277073.
 webkit.org/b/225462 imported/w3c/web-platform-tests/css/css-backgrounds/background-repeat-space-10.html [ ImageOnlyFailure ]
 webkit.org/b/225462 imported/w3c/web-platform-tests/css/css-backgrounds/background-repeat-space-1a.html [ ImageOnlyFailure ]

Modified: trunk/LayoutTests/platform/win/TestExpectations (277573 => 277574)


--- trunk/LayoutTests/platform/win/TestExpectations	2021-05-16 20:32:30 UTC (rev 277573)
+++ trunk/LayoutTests/platform/win/TestExpectations	2021-05-16 22:00:30 UTC (rev 277574)
@@ -4635,6 +4635,7 @@
 
 fast/text/line-break-with-locale.html [ ImageOnlyFailure ]
 
-# Non-SRGB color spaces are not currently supported by the Windows port.
+# Non-sRGB color spaces are not currently supported by the Windows port.
 fast/canvas/canvas-color-space-display-p3.html [ Skip ]
 fast/canvas/canvas-color-space-display-p3-ImageData.html [ Skip ]
+storage/indexeddb/structured-clone-image-data-display-p3.html [ Skip ]

Modified: trunk/LayoutTests/storage/indexeddb/resources/structured-clone.js (277573 => 277574)


--- trunk/LayoutTests/storage/indexeddb/resources/structured-clone.js	2021-05-16 20:32:30 UTC (rev 277573)
+++ trunk/LayoutTests/storage/indexeddb/resources/structured-clone.js	2021-05-16 22:00:30 UTC (rev 277574)
@@ -312,29 +312,38 @@
 function testImageData(callback)
 {
     debug("Testing ImageData");
-    evalAndLog("canvas = document.createElement('canvas')");
-    evalAndLog("canvas.width = 8");
-    evalAndLog("canvas.height = 8");
-    evalAndLog("test_data = canvas.getContext('2d').getImageData(0, 0, 8, 8)");
+    function testImageData(colorSpace, callback) {
+        debug(`Testing ImageData: { colorSpace: ${colorSpace} }`);
+        evalAndLog("canvas = document.createElement('canvas')");
+        evalAndLog("canvas.width = 8");
+        evalAndLog("canvas.height = 8");
+        evalAndLog(`test_data = canvas.getContext('2d').getImageData(0, 0, 8, 8, { colorSpace: ${colorSpace} })`);
 
-    for (var i = 0; i < 256; ++i) {
-        test_data.data[i] = i;
+        for (var i = 0; i < 256; ++i) {
+            test_data.data[i] = i;
+        }
+
+        testValue(test_data, function(result) {
+            self.result = result;
+            shouldBeTrue("test_data !== result");
+            shouldBeEqualToString("Object.prototype.toString.call(result)", "[object ImageData]");
+            shouldBe("result.width", "test_data.width");
+            shouldBe("result.height", "test_data.height");
+            shouldBe("result.data.length", "test_data.data.length");
+            shouldBe("result.colorSpace", "test_data.colorSpace");
+            if (arrayCompare(test_data.data, result.data)) {
+                testPassed("result data matches");
+            } else {
+                testFailed("result data doesn't match");
+            }
+            callback();
+        });
     }
 
-    testValue(test_data, function(result) {
-        self.result = result;
-        shouldBeTrue("test_data !== result");
-        shouldBeEqualToString("Object.prototype.toString.call(result)", "[object ImageData]");
-        shouldBe("result.width", "test_data.width");
-        shouldBe("result.height", "test_data.height");
-        shouldBe("result.data.length", "test_data.data.length");
-        if (arrayCompare(test_data.data, result.data)) {
-            testPassed("result data matches");
-        } else {
-            testFailed("result data doesn't match");
-        }
-        callback();
-    });
+    forEachWithCallback(testImageData, [
+        `"srgb"`,
+        `undefined`
+    ], callback);
 }
 
 function readBlobAsText(blob, callback)

Modified: trunk/LayoutTests/storage/indexeddb/structured-clone-expected.txt (277573 => 277574)


--- trunk/LayoutTests/storage/indexeddb/structured-clone-expected.txt	2021-05-16 20:32:30 UTC (rev 277573)
+++ trunk/LayoutTests/storage/indexeddb/structured-clone-expected.txt	2021-05-16 22:00:30 UTC (rev 277574)
@@ -583,10 +583,11 @@
 
 
 Testing ImageData
+Testing ImageData: { colorSpace: "srgb" }
 canvas = document.createElement('canvas')
 canvas.width = 8
 canvas.height = 8
-test_data = canvas.getContext('2d').getImageData(0, 0, 8, 8)
+test_data = canvas.getContext('2d').getImageData(0, 0, 8, 8, { colorSpace: "srgb" })
 transaction = db.transaction('storeName', 'readwrite')
 store = transaction.objectStore('storeName')
 store.put(value, 'key')
@@ -596,7 +597,24 @@
 PASS result.width is test_data.width
 PASS result.height is test_data.height
 PASS result.data.length is test_data.data.length
+PASS result.colorSpace is test_data.colorSpace
 PASS result data matches
+Testing ImageData: { colorSpace: undefined }
+canvas = document.createElement('canvas')
+canvas.width = 8
+canvas.height = 8
+test_data = canvas.getContext('2d').getImageData(0, 0, 8, 8, { colorSpace: undefined })
+transaction = db.transaction('storeName', 'readwrite')
+store = transaction.objectStore('storeName')
+store.put(value, 'key')
+store.get('key')
+PASS test_data !== result is true
+PASS Object.prototype.toString.call(result) is "[object ImageData]"
+PASS result.width is test_data.width
+PASS result.height is test_data.height
+PASS result.data.length is test_data.data.length
+PASS result.colorSpace is test_data.colorSpace
+PASS result data matches
 
 Testing Blob
 PASS FileReader != null is true

Added: trunk/LayoutTests/storage/indexeddb/structured-clone-image-data-display-p3-expected.txt (0 => 277574)


--- trunk/LayoutTests/storage/indexeddb/structured-clone-image-data-display-p3-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/structured-clone-image-data-display-p3-expected.txt	2021-05-16 22:00:30 UTC (rev 277574)
@@ -0,0 +1,33 @@
+Test structured clone of ImageData with a display-p3 colorSpace.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
+store = db.createObjectStore('storeName')
+This index is not used, but evaluating key path on each put() call will exercise (de)serialization:
+store.createIndex('indexName', 'dummyKeyPath')
+
+Testing ImageData: { colorSpace: "display-p3" }
+canvas = document.createElement('canvas')
+canvas.width = 8
+canvas.height = 8
+test_data = canvas.getContext('2d').getImageData(0, 0, 8, 8, { colorSpace: "display-p3" })
+transaction = db.transaction('storeName', 'readwrite')
+store = transaction.objectStore('storeName')
+store.put(value, 'key')
+store.get('key')
+PASS test_data !== result is true
+PASS Object.prototype.toString.call(result) is "[object ImageData]"
+PASS result.width is test_data.width
+PASS result.height is test_data.height
+PASS result.data.length is test_data.data.length
+PASS result.colorSpace is test_data.colorSpace
+PASS result data matches
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/storage/indexeddb/structured-clone-image-data-display-p3.html (0 => 277574)


--- trunk/LayoutTests/storage/indexeddb/structured-clone-image-data-display-p3.html	                        (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/structured-clone-image-data-display-p3.html	2021-05-16 22:00:30 UTC (rev 277574)
@@ -0,0 +1,93 @@
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+<script>
+    description("Test structured clone of ImageData with a display-p3 colorSpace.");
+
+    indexedDBTest(prepareDatabase, startTests);
+
+    function prepareDatabase()
+    {
+        db = event.target.result;
+        evalAndLog("store = db.createObjectStore('storeName')");
+        debug("This index is not used, but evaluating key path on each put() call will exercise (de)serialization:");
+        evalAndLog("store.createIndex('indexName', 'dummyKeyPath')");
+    }
+    
+    function testValue(value, callback)
+    {
+        // One transaction per test, since some tests require asynchronous
+        // operations to verify the result (e.g. via FileReader)
+        evalAndLog("transaction = db.transaction('storeName', 'readwrite')");
+        transaction._onerror_ = unexpectedErrorCallback;
+        transaction._onabort_ = unexpectedAbortCallback;
+        evalAndLog("store = transaction.objectStore('storeName')");
+
+        self.value = value;
+        request = evalAndLog("store.put(value, 'key')");
+        request._onerror_ = unexpectedErrorCallback;
+        request._onsuccess_ = function(e) {
+            request = evalAndLog("store.get('key')");
+            request._onerror_ = unexpectedErrorCallback;
+            request._onsuccess_ = function(e) {
+                callback(request.result);
+            };
+        };
+    }
+
+    // Identity testing, sensitive to NaN and -0
+    function is(x, y) {
+        if (x === y) {
+            return x !== 0 || 1 / x === 1 / y;
+        }
+        return x !== x && y !== y;
+    }
+
+    function arrayCompare(a, b) {
+        if (a.length !== b.length) {
+            return false;
+        }
+        for (var i = 0; i < a.length; ++i) {
+            if (!is(a[i], b[i])) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    function startTests()
+    {
+        debug("");
+        debug(`Testing ImageData: { colorSpace: "display-p3" }`);
+        evalAndLog("canvas = document.createElement('canvas')");
+        evalAndLog("canvas.width = 8");
+        evalAndLog("canvas.height = 8");
+        evalAndLog(`test_data = canvas.getContext('2d').getImageData(0, 0, 8, 8, { colorSpace: "display-p3" })`);
+    
+        for (var i = 0; i < 256; ++i) {
+            test_data.data[i] = i;
+        }
+
+        testValue(test_data, function(result) {
+            self.result = result;
+            shouldBeTrue("test_data !== result");
+            shouldBeEqualToString("Object.prototype.toString.call(result)", "[object ImageData]");
+            shouldBe("result.width", "test_data.width");
+            shouldBe("result.height", "test_data.height");
+            shouldBe("result.data.length", "test_data.data.length");
+            shouldBe("result.colorSpace", "test_data.colorSpace");
+            if (arrayCompare(test_data.data, result.data)) {
+                testPassed("result data matches");
+            } else {
+                testFailed("result data doesn't match");
+            }
+            
+            finishJSTest();
+        });
+    }
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (277573 => 277574)


--- trunk/Source/WebCore/ChangeLog	2021-05-16 20:32:30 UTC (rev 277573)
+++ trunk/Source/WebCore/ChangeLog	2021-05-16 22:00:30 UTC (rev 277574)
@@ -1,3 +1,38 @@
+2021-05-16  Sam Weinig  <wei...@apple.com>
+
+        Support serializing ImageData object colorSpace property in SerializedScriptValue
+        https://bugs.webkit.org/show_bug.cgi?id=225854
+
+        Reviewed by Chris Dumez.
+
+        Test: storage/indexeddb/structured-clone-image-data-display-p3.html
+
+        Update SerializedScriptValue schema to version 8 and add serialization
+        of the colorSpace property.
+
+        * bindings/js/SerializedScriptValue.cpp:
+        (WebCore::PredefinedColorSpaceTag):
+        Add copy of the PredefinedColorSpace values that are guaranteed to
+        stay consistent forever.
+
+        (WebCore::CloneSerializer::dumpIfTerminal):
+        Add encoding of the colorSpace when serializing ImageData.
+
+        (WebCore::CloneSerializer::write):
+        (WebCore::CloneDeserializer::read):
+        Add coders for PredefinedColorSpaceTag.
+
+        (WebCore::CloneDeserializer::getJSValue):
+        Replace multiple overloads with one perfect forwarding overload which does
+        what we want and works with r-values.
+
+        (WebCore::CloneDeserializer::readImageBitmap):
+        Use auto in two places.
+
+        (WebCore::CloneDeserializer::readTerminal):
+        Add decoding of the colorSpace when deserializing ImageData. For prior versions,
+        the colorSpace defaults to sRGB, which was the only color space supported.
+
 2021-05-14  Jer Noble  <jer.no...@apple.com>
 
         MediaSessionCoordinator survives page reload/navigation

Modified: trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp (277573 => 277574)


--- trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp	2021-05-16 20:32:30 UTC (rev 277573)
+++ trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp	2021-05-16 22:00:30 UTC (rev 277574)
@@ -233,9 +233,15 @@
     default:
         return 0;
     }
-
 }
 
+enum class PredefinedColorSpaceTag : uint8_t {
+    SRGB = 0
+#if ENABLE(DESTINATION_COLOR_SPACE_DISPLAY_P3)
+    , DisplayP3 = 1
+#endif
+};
+
 #if ENABLE(WEB_CRYPTO)
 
 const uint32_t currentKeyFormatVersion = 1;
@@ -314,8 +320,9 @@
  * Version 5. added support for Map and Set types.
  * Version 6. added support for 8-bit strings.
  * Version 7. added support for File's lastModified attribute.
+ * Version 8. added support for ImageData's colorSpace attribute.
  */
-static const unsigned CurrentVersion = 7;
+static const unsigned CurrentVersion = 8;
 static const unsigned TerminatorTag = 0xFFFFFFFF;
 static const unsigned StringPoolTag = 0xFFFFFFFE;
 static const unsigned NonIndexPropertiesTag = 0xFFFFFFFD;
@@ -423,7 +430,7 @@
  *    FileListTag <length:uint32_t>(<file:FileData>){length}
  *
  * ImageData :-
- *    ImageDataTag <width:int32_t><height:int32_t><length:uint32_t><data:uint8_t{length}>
+ *    ImageDataTag <width:int32_t> <height:int32_t> <length:uint32_t> <data:uint8_t{length}> <colorSpace:PredefinedColorSpaceTag>
  *
  * Blob :-
  *    BlobTag <url:StringData><type:StringData><size:long long>
@@ -1229,6 +1236,7 @@
                 write(data->height());
                 write(data->data().length());
                 write(data->data().data(), data->data().length());
+                write(data->colorSpace());
                 return true;
             }
             if (auto* regExp = jsDynamicCast<RegExpObject*>(vm, obj)) {
@@ -1558,6 +1566,20 @@
         write(static_cast<double>(file.lastModifiedOverride().valueOr(-1)));
     }
 
+    void write(PredefinedColorSpace colorSpace)
+    {
+        switch (colorSpace) {
+        case PredefinedColorSpace::SRGB:
+            writeLittleEndian<uint8_t>(m_buffer, static_cast<uint8_t>(PredefinedColorSpaceTag::SRGB));
+            break;
+#if ENABLE(DESTINATION_COLOR_SPACE_DISPLAY_P3)
+        case PredefinedColorSpace::DisplayP3:
+            writeLittleEndian<uint8_t>(m_buffer, static_cast<uint8_t>(PredefinedColorSpaceTag::DisplayP3));
+            break;
+#endif
+        }
+    }
+
 #if ENABLE(WEB_CRYPTO)
     void write(CryptoAlgorithmIdentifier algorithm)
     {
@@ -2537,6 +2559,26 @@
         return true;
     }
 
+    bool read(PredefinedColorSpace& result)
+    {
+        uint8_t tag;
+        if (!read(tag))
+            return false;
+
+        switch (static_cast<PredefinedColorSpaceTag>(tag)) {
+        case PredefinedColorSpaceTag::SRGB:
+            result = PredefinedColorSpace::SRGB;
+            return true;
+#if ENABLE(DESTINATION_COLOR_SPACE_DISPLAY_P3)
+        case PredefinedColorSpaceTag::DisplayP3:
+            result = PredefinedColorSpace::DisplayP3;
+            return true;
+#endif
+        default:
+            return false;
+        }
+    }
+
 #if ENABLE(WEB_CRYPTO)
     bool read(CryptoAlgorithmIdentifier& result)
     {
@@ -2864,18 +2906,12 @@
 #endif
 
     template<class T>
-    JSValue getJSValue(T* nativeObj)
+    JSValue getJSValue(T&& nativeObj)
     {
-        return toJS(m_lexicalGlobalObject, jsCast<JSDOMGlobalObject*>(m_globalObject), nativeObj);
+        return toJS(m_lexicalGlobalObject, jsCast<JSDOMGlobalObject*>(m_globalObject), std::forward<T>(nativeObj));
     }
 
     template<class T>
-    JSValue getJSValue(T& nativeObj)
-    {
-        return toJS(m_lexicalGlobalObject, jsCast<JSDOMGlobalObject*>(m_globalObject), nativeObj);
-    }
-
-    template<class T>
     JSValue readDOMPoint()
     {
         double x;
@@ -3141,8 +3177,8 @@
             return JSValue();
         }
 
-        IntSize logicalSize = IntSize(logicalWidth, logicalHeight);
-        IntSize imageDataSize = logicalSize;
+        auto logicalSize = IntSize(logicalWidth, logicalHeight);
+        auto imageDataSize = logicalSize;
         imageDataSize.scale(resolutionScale);
 
         auto buffer = ImageBitmap::createImageBuffer(*scriptExecutionContextFromExecState(m_lexicalGlobalObject), logicalSize, RenderingMode::Unaccelerated, resolutionScale);
@@ -3374,23 +3410,33 @@
                 fail();
                 return JSValue();
             }
-            if (!m_isDOMGlobalObject) {
-                m_ptr += length;
-                return jsNull();
+            auto bufferStart = m_ptr;
+            m_ptr += length;
+
+            auto resultColorSpace = PredefinedColorSpace::SRGB;
+            if (m_version > 7) {
+                if (!read(resultColorSpace))
+                    return JSValue();
             }
-            IntSize imageSize(width, height);
-            RELEASE_ASSERT(!length || (imageSize.area() * 4).unsafeGet() <= length);
-            auto result = ImageData::create(imageSize);
-            if (!result) {
+
+            if (length && (IntSize(width, height).area() * 4).unsafeGet() != length) {
                 fail();
                 return JSValue();
             }
+
+            if (!m_isDOMGlobalObject)
+                return jsNull();
+
+            auto result = ImageData::createUninitialized(width, height, resultColorSpace);
+            if (result.hasException()) {
+                fail();
+                return JSValue();
+            }
             if (length)
-                memcpy(result->data().data(), m_ptr, length);
+                memcpy(result.returnValue()->data().data(), bufferStart, length);
             else
-                result->data().zeroFill();
-            m_ptr += length;
-            return getJSValue(result.get());
+                result.returnValue()->data().zeroFill();
+            return getJSValue(result.releaseReturnValue());
         }
         case BlobTag: {
             CachedStringRef url;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to