⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 118620 in webkit


Ignore:
Timestamp:
May 26, 2012, 6:51:03 PM (14 years ago)
Author:
commit-queue@webkit.org
Message:

[FileAPI] The result attribute of FileReader shuold use null to replace empty string
https://bugs.webkit.org/show_bug.cgi?id=87578

Patch by Li Yin <li.yin@intel.com> on 2012-05-26
Reviewed by Kentaro Hara.

Source/WebCore:

From Spec: http://www.w3.org/TR/FileAPI/#filedata-attr
Before read method has been called or an error in reading has occurred,
the result attribute should be null, not empty string.

Currently, Firefox, Opera and IE 10 follows the spec, but Webkit based
browser don't.
WebKit should change the returned value empty string into null to keep
conformance with the spec.

Tests: fast/files/read-file-async.html

fast/files/blob-slice-test.html
fast/files/read-blob-async.html
fast/files/workers/worker-read-blob-async.html
fast/files/workers/worker-read-file-async.html

  • fileapi/FileReader.cpp:

(WebCore::FileReader::stringResult):

LayoutTests:

From Spec: http://www.w3.org/TR/FileAPI/#filedata-attr
Before read method has been called or an error in reading has occurred,
the result attribute should be null, not empty string.
WebKit should change the returned value empty string into null to keep
conformance with the spec.

  • fast/files/blob-slice-test-expected.txt:
  • fast/files/read-blob-async-expected.txt:
  • fast/files/read-file-async-expected.txt:
  • fast/files/resources/read-common.js:

(logResult):

  • fast/files/workers/worker-read-blob-async-expected.txt:
  • fast/files/workers/worker-read-file-async-expected.txt:
Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r118618 r118620  
     12012-05-26  Li Yin  <li.yin@intel.com>
     2
     3        [FileAPI] The result attribute of FileReader shuold use null to replace empty string
     4        https://bugs.webkit.org/show_bug.cgi?id=87578
     5
     6        Reviewed by Kentaro Hara.
     7
     8        From Spec: http://www.w3.org/TR/FileAPI/#filedata-attr
     9        Before read method has been called or an error in reading has occurred,
     10        the result attribute should be null, not empty string.
     11        WebKit should change the returned value empty string into null to keep
     12        conformance with the spec.
     13
     14        * fast/files/blob-slice-test-expected.txt:
     15        * fast/files/read-blob-async-expected.txt:
     16        * fast/files/read-file-async-expected.txt:
     17        * fast/files/resources/read-common.js:
     18        (logResult):
     19        * fast/files/workers/worker-read-blob-async-expected.txt:
     20        * fast/files/workers/worker-read-file-async-expected.txt:
     21
    1222012-05-26  Nate Chapin  <japhet@chromium.org>
    223
  • trunk/LayoutTests/fast/files/blob-slice-test-expected.txt

    r87181 r118620  
    11Slicing from 2 to 3: 2
    22Slicing from 2 to 12: 23456789
    3 Slicing from 2 to 2:
    4 Slicing from 2 to 1:
    5 Slicing from 2 to -12:
     3Slicing from 2 to 2: null
     4Slicing from 2 to 1: null
     5Slicing from 2 to -12: null
    66Slicing from 2 to 2147483647: 23456789
    7 Slicing from 2 to -2147483648:
     7Slicing from 2 to -2147483648: null
    88Slicing from 2 to 9223372036854775000: 23456789
    9 Slicing from 2 to -9223372036854775000:
     9Slicing from 2 to -9223372036854775000: null
    1010Slicing from -2 to -1: 8
    11 Slicing from -2 to -2:
    12 Slicing from -2 to -3:
    13 Slicing from -2 to -12:
     11Slicing from -2 to -2: null
     12Slicing from -2 to -3: null
     13Slicing from -2 to -12: null
    1414Slicing from -2 to 2147483647: 89
    15 Slicing from -2 to -2147483648:
     15Slicing from -2 to -2147483648: null
    1616Slicing from -2 to 9223372036854775000: 89
    17 Slicing from -2 to -9223372036854775000:
     17Slicing from -2 to -9223372036854775000: null
    1818Slicing from 0: 0123456789
    1919Slicing from 2: 23456789
    2020Slicing from -2: 89
    21 Slicing from 12:
     21Slicing from 12: null
    2222Slicing from -12: 0123456789
    23 Slicing from 2147483647:
     23Slicing from 2147483647: null
    2424Slicing from -2147483648: 0123456789
    25 Slicing from 9223372036854775000:
     25Slicing from 9223372036854775000: null
    2626Slicing from -9223372036854775000: 0123456789
    2727Slicing without parameters: 0123456789
  • trunk/LayoutTests/fast/files/read-blob-async-expected.txt

    r70488 r118620  
    1818Received load event
    1919readyState: 2
    20 result size: 0
    21 result:
     20result: null
    2221Received loadend event
    2322Test reading a blob containing empty text
     
    2726Received load event
    2827readyState: 2
    29 result size: 0
    30 result:
     28result: null
    3129Received loadend event
    3230Test reading a blob containing empty files and empty texts
     
    3634Received load event
    3735readyState: 2
    38 result size: 0
    39 result:
     36result: null
    4037Received loadend event
    4138Test reading a blob containing single file
  • trunk/LayoutTests/fast/files/read-file-async-expected.txt

    r87961 r118620  
    3939Received load event
    4040readyState: 2
    41 result size: 0
    42 result:
     41result: null
    4342Received loadend event
    4443Test reading an empty file as text
     
    4847Received load event
    4948readyState: 2
    50 result size: 0
    51 result:
     49result: null
    5250Received loadend event
    5351Test reading an empty file as data URL
     
    191189Received loadend event
    192190readyState after recalling read method: 1
    193 result after recalling read method:
     191result after recalling read method: null
    194192error after recalling read method: null
    195193Received loadstart event
     
    207205Received loadend event
    208206readyState after recalling read method: 1
    209 result after recalling read method:
     207result after recalling read method: null
    210208error after recalling read method: null
    211209Received loadstart event
  • trunk/LayoutTests/fast/files/resources/read-common.js

    r115582 r118620  
    169169}
    170170
    171 // 'result' can be either an ArrayBuffer object or a string.
     171// 'result' can be an ArrayBuffer object, a string or null.
    172172function logResult(result)
    173173{
     174    if (result === null) {
     175        log("result: null");
     176        return;
     177    }
    174178    if (typeof result == 'object') {
    175179        log("result size: " + result.byteLength);
  • trunk/LayoutTests/fast/files/workers/worker-read-blob-async-expected.txt

    r70488 r118620  
    1919Received load event
    2020readyState: 2
    21 result size: 0
    22 result:
     21result: null
    2322Received loadend event
    2423Test reading a blob containing empty text
     
    2827Received load event
    2928readyState: 2
    30 result size: 0
    31 result:
     29result: null
    3230Received loadend event
    3331Test reading a blob containing empty files and empty texts
     
    3735Received load event
    3836readyState: 2
    39 result size: 0
    40 result:
     37result: null
    4138Received loadend event
    4239Test reading a blob containing single file
  • trunk/LayoutTests/fast/files/workers/worker-read-file-async-expected.txt

    r87961 r118620  
    4040Received load event
    4141readyState: 2
    42 result size: 0
    43 result:
     42result: null
    4443Received loadend event
    4544Test reading an empty file as text
     
    4948Received load event
    5049readyState: 2
    51 result size: 0
    52 result:
     50result: null
    5351Received loadend event
    5452Test reading an empty file as data URL
     
    192190Received loadend event
    193191readyState after recalling read method: 1
    194 result after recalling read method:
     192result after recalling read method: null
    195193error after recalling read method: null
    196194Received loadstart event
     
    208206Received loadend event
    209207readyState after recalling read method: 1
    210 result after recalling read method:
     208result after recalling read method: null
    211209error after recalling read method: null
    212210Received loadstart event
  • trunk/Source/WebCore/ChangeLog

    r118619 r118620  
     12012-05-26  Li Yin  <li.yin@intel.com>
     2
     3        [FileAPI] The result attribute of FileReader shuold use null to replace empty string
     4        https://bugs.webkit.org/show_bug.cgi?id=87578
     5
     6        Reviewed by Kentaro Hara.
     7
     8        From Spec: http://www.w3.org/TR/FileAPI/#filedata-attr
     9        Before read method has been called or an error in reading has occurred,
     10        the result attribute should be null, not empty string.
     11
     12        Currently, Firefox, Opera and IE 10 follows the spec, but Webkit based
     13        browser don't.
     14        WebKit should change the returned value empty string into null to keep
     15        conformance with the spec.
     16
     17        Tests: fast/files/read-file-async.html
     18               fast/files/blob-slice-test.html
     19               fast/files/read-blob-async.html
     20               fast/files/workers/worker-read-blob-async.html
     21               fast/files/workers/worker-read-file-async.html
     22
     23        * fileapi/FileReader.cpp:
     24        (WebCore::FileReader::stringResult):
     25
    1262012-05-26  Andy Estes  <aestes@apple.com>
    227
  • trunk/Source/WebCore/fileapi/FileReader.cpp

    r118394 r118620  
    255255String FileReader::stringResult()
    256256{
    257     return m_loader ? m_loader->stringResult() : "";
     257    String ret =  m_loader ? m_loader->stringResult() : "";
     258    if (ret.isEmpty())
     259        return String();
     260    return ret;
    258261}
    259262
Note: See TracChangeset for help on using the changeset viewer.