Changeset 232043 in webkit


Ignore:
Timestamp:
May 21, 2018 7:24:18 PM (6 years ago)
Author:
Chris Dumez
Message:

File's structured serialization should serialize lastModified attribute
https://bugs.webkit.org/show_bug.cgi?id=185773

Reviewed by Youenn Fablet.

LayoutTests/imported/w3c:

Re-sync workers/semantics/structured-clone WPT tests after:
https://github.com/w3c/web-platform-tests/pull/9218

  • web-platform-tests/html/webappapis/structured-clone/structured-clone-battery-of-tests-harness.js: Added.

(runStructuredCloneBatteryOfTests):

  • web-platform-tests/html/webappapis/structured-clone/structured-clone-battery-of-tests-with-transferables.js: Added.

(structuredCloneBatteryOfTests.push.async.f):

  • web-platform-tests/html/webappapis/structured-clone/structured-clone-battery-of-tests.js: Renamed from LayoutTests/imported/w3c/web-platform-tests/workers/semantics/structured-clone/common.js.

(async.compare_Blob):
(get_canvas_1x1_transparent_black):
(get_canvas_1x1_non_transparent_non_black):
(compare_ImageBitmap):
(structuredCloneBatteryOfTests.push.async.f):

  • web-platform-tests/html/webappapis/structured-clone/w3c-import.log: Copied from LayoutTests/imported/w3c/web-platform-tests/workers/semantics/structured-clone/w3c-import.log.
  • web-platform-tests/workers/semantics/structured-clone/dedicated-expected.txt:
  • web-platform-tests/workers/semantics/structured-clone/dedicated.html:
  • web-platform-tests/workers/semantics/structured-clone/dedicated.js: Removed.
  • web-platform-tests/workers/semantics/structured-clone/shared-expected.txt:
  • web-platform-tests/workers/semantics/structured-clone/shared.html:
  • web-platform-tests/workers/semantics/structured-clone/shared.js: Removed.
  • web-platform-tests/workers/semantics/structured-clone/w3c-import.log:
  • web-platform-tests/workers/semantics/structured-clone/worker-common.js: Removed.

Source/WebCore:

Update our implementation for the stuctured serialization of a File to include
its lastModified attribute, as per:

No new tests, rebaselined existing test.

  • bindings/js/SerializedScriptValue.cpp:

(WebCore::CloneSerializer::write):
(WebCore::CloneDeserializer::readFile):

  • fileapi/File.cpp:

(WebCore::File::File):

  • fileapi/File.h:

LayoutTests:

Unskip structured serialization tests that no longer fail / time out.

Location:
trunk
Files:
3 added
3 deleted
14 edited
1 copied
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r232041 r232043  
     12018-05-21  Chris Dumez  <cdumez@apple.com>
     2
     3        File's structured serialization should serialize lastModified attribute
     4        https://bugs.webkit.org/show_bug.cgi?id=185773
     5
     6        Reviewed by Youenn Fablet.
     7
     8        Unskip structured serialization tests that no longer fail / time out.
     9
     10        * TestExpectations:
     11
    1122018-05-21  Jiewen Tan  <jiewen_tan@apple.com>
    213
  • trunk/LayoutTests/TestExpectations

    r232037 r232043  
    242242imported/w3c/web-platform-tests/workers/opaque-origin.html [ Skip ]
    243243imported/w3c/web-platform-tests/workers/semantics/interface-objects/003.html [ Skip ]
    244 imported/w3c/web-platform-tests/workers/semantics/structured-clone/shared.html [ Skip ]
    245 imported/w3c/web-platform-tests/workers/semantics/structured-clone/dedicated.html [ Skip ]
    246244imported/w3c/web-platform-tests/workers/semantics/multiple-workers/003.html [ Skip ]
    247245imported/w3c/web-platform-tests/workers/semantics/multiple-workers/005.html [ Skip ]
  • trunk/LayoutTests/fast/storage/serialized-script-value.html

    r232037 r232043  
    66    <body>
    77        <script>
     8
     9const currentVersion = 0x07;
    810
    911// Here's a little Q&D helper for future adventurers needing to rebaseline this.
     
    4446testSerialization({foo: 'zoo', bar: {baz: 'myNewKey'}},
    4547[
    46     0x06, 0x00, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00,
     48    currentVersion, 0x00, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00,
    4749    0x80, 0x66, 0x6f, 0x6f, 0x10, 0x03, 0x00, 0x00,
    4850    0x80, 0x7a, 0x6f, 0x6f, 0x03, 0x00, 0x00, 0x80,
     
    6769testSerialization({foo: 'zoo', bar: 'myNewKey'},
    6870[
    69     0x06, 0x00, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00,
     71    currentVersion, 0x00, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00,
    7072    0x80, 0x66, 0x6f, 0x6f, 0x10, 0x03, 0x00, 0x00,
    7173    0x80, 0x7a, 0x6f, 0x6f, 0x03, 0x00, 0x00, 0x80,
     
    7577],
    7678[
    77     0x03, 0x00, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00,
     79    currentVersion, 0x00, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00,
    7880    0x00, 0x66, 0x00, 0x6f, 0x00, 0x6f, 0x00, 0x10,
    7981    0x03, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x6f, 0x00,
     
    8789testSerialization([],
    8890[
    89     0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
     91    currentVersion, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
    9092    0x00, 0xff, 0xff, 0xff, 0xff
    9193],
     
    9698testSerialization({foo: "zoo"},
    9799[
    98     0x06, 0x00, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00,
     100    currentVersion, 0x00, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00,
    99101    0x80, 0x66, 0x6f, 0x6f, 0x10, 0x03, 0x00, 0x00,
    100102    0x80, 0x7a, 0x6f, 0x6f, 0xff, 0xff, 0xff, 0xff
     
    108110testSerialization({foo: null},
    109111[
    110     0x06, 0x00, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00,
     112    currentVersion, 0x00, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00,
    111113    0x80, 0x66, 0x6f, 0x6f, 0x04, 0xff, 0xff, 0xff,
    112114    0xff
     
    120122testSerialization({},
    121123[
    122     0x06, 0x00, 0x00, 0x00, 0x02, 0xff, 0xff, 0xff,
     124    currentVersion, 0x00, 0x00, 0x00, 0x02, 0xff, 0xff, 0xff,
    123125    0xff
    124126],
     
    130132testSerialization(undefined,
    131133[
    132     0x06, 0x00, 0x00, 0x00, 0x03
     134    currentVersion, 0x00, 0x00, 0x00, 0x03
    133135],
    134136[
     
    137139testSerialization(true,
    138140[
    139     0x06, 0x00, 0x00, 0x00, 0x09
     141    currentVersion, 0x00, 0x00, 0x00, 0x09
    140142],
    141143[
     
    144146testSerialization(false,
    145147[
    146     0x06, 0x00, 0x00, 0x00, 0x08
     148    currentVersion, 0x00, 0x00, 0x00, 0x08
    147149],
    148150[
     
    151153testSerialization(new Array(100),
    152154[
    153     0x06, 0x00, 0x00, 0x00, 0x01, 0x64, 0x00, 0x00,
     155    currentVersion, 0x00, 0x00, 0x00, 0x01, 0x64, 0x00, 0x00,
    154156    0x00, 0xff, 0xff, 0xff, 0xff
    155157],
     
    160162testSerialization(10,
    161163[
    162     0x06, 0x00, 0x00, 0x00, 0x05, 0x0a, 0x00, 0x00,
     164    currentVersion, 0x00, 0x00, 0x00, 0x05, 0x0a, 0x00, 0x00,
    163165    0x00
    164166],
     
    169171testSerialization(-10,
    170172[
    171     0x06, 0x00, 0x00, 0x00, 0x05, 0xf6, 0xff, 0xff,
     173    currentVersion, 0x00, 0x00, 0x00, 0x05, 0xf6, 0xff, 0xff,
    172174    0xff
    173175],
     
    178180testSerialization(Math.pow(2,30),
    179181[
    180     0x06, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
     182    currentVersion, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
    181183    0x40
    182184],
     
    187189testSerialization(Math.pow(2,55),
    188190[
    189     0x06, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00,
     191    currentVersion, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00,
    190192    0x00, 0x00, 0x00, 0x60, 0x43,
    191193],
     
    196198testSerialization(1.23,
    197199[
    198     0x06, 0x00, 0x00, 0x00, 0x0a, 0xae, 0x47, 0xe1,
     200    currentVersion, 0x00, 0x00, 0x00, 0x0a, 0xae, 0x47, 0xe1,
    199201    0x7a, 0x14, 0xae, 0xf3, 0x3f
    200202],
     
    205207testSerialization("",
    206208[
    207     0x06, 0x00, 0x00, 0x00, 0x11
     209    currentVersion, 0x00, 0x00, 0x00, 0x11
    208210],
    209211[
     
    212214testSerialization("abc",
    213215[
    214     0x06, 0x00, 0x00, 0x00, 0x10, 0x03, 0x00, 0x00,
     216    currentVersion, 0x00, 0x00, 0x00, 0x10, 0x03, 0x00, 0x00,
    215217    0x80, 0x61, 0x62, 0x63
    216218],
     
    221223testSerialization({integer: 123},
    222224[
    223     0x06, 0x00, 0x00, 0x00, 0x02, 0x07, 0x00, 0x00,
     225    currentVersion, 0x00, 0x00, 0x00, 0x02, 0x07, 0x00, 0x00,
    224226    0x80, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72,
    225227    0x05, 0x7b, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
     
    234236testSerialization({string: "str"},
    235237[
    236     0x06, 0x00, 0x00, 0x00, 0x02, 0x06, 0x00, 0x00,
     238    currentVersion, 0x00, 0x00, 0x00, 0x02, 0x06, 0x00, 0x00,
    237239    0x80, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x10,
    238240    0x03, 0x00, 0x00, 0x80, 0x73, 0x74, 0x72, 0xff,
     
    248250testSerialization({list: [1,2,3]},
    249251[
    250     0x06, 0x00, 0x00, 0x00, 0x02, 0x04, 0x00, 0x00,
     252    currentVersion, 0x00, 0x00, 0x00, 0x02, 0x04, 0x00, 0x00,
    251253    0x80, 0x6c, 0x69, 0x73, 0x74, 0x01, 0x03, 0x00,
    252254    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x01,
     
    267269testSerialization(null,
    268270[
    269     0x06, 0x00, 0x00, 0x00, 0x04
     271    currentVersion, 0x00, 0x00, 0x00, 0x04
    270272],
    271273[
     
    274276testSerialization(/abc/,
    275277[
    276     0x06, 0x00, 0x00, 0x00, 0x12, 0x03, 0x00, 0x00,
     278    currentVersion, 0x00, 0x00, 0x00, 0x12, 0x03, 0x00, 0x00,
    277279    0x80, 0x61, 0x62, 0x63, 0x00, 0x00, 0x00, 0x80
    278280],
     
    288290testSerialization(outerObject,
    289291[
    290     0x06, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00,
     292    currentVersion, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00,
    291293    0x80, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x02, 0x05,
    292294    0x00, 0x00, 0x80, 0x68, 0x65, 0x6c, 0x6c, 0x6f,
     
    310312testSerialization(innerObject,
    311313[
    312     0x06, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00,
     314    currentVersion, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00,
    313315    0x80, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x10, 0x05,
    314316    0x00, 0x00, 0x80, 0x74, 0x68, 0x65, 0x72, 0x65,
     
    326328testSerialization(unicodeObject,
    327329[
    328     0x06, 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00,
     330    currentVersion, 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00,
    329331    0x80, 0x61, 0x10, 0xfe, 0xff, 0xff, 0xff, 0x00,
    330332    0x01, 0x00, 0x00, 0x80, 0x75, 0x10, 0x02, 0x00,
     
    344346testSerialization(unicodeObject,
    345347[
    346     0x06, 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00,
     348    currentVersion, 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00,
    347349    0x80, 0x61, 0x10, 0x02, 0x00, 0x00, 0x80, 0x61,
    348350    0x62, 0x01, 0x00, 0x00, 0x80, 0x75, 0x10, 0x02,
     
    369371testSerialization(arrayObject,
    370372[
    371     0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
     373    currentVersion, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
    372374    0x00, 0xfd, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00,
    373375    0x80, 0x61, 0x09, 0x01, 0x00, 0x00, 0x80, 0x62,
     
    383385testSerialization(arrayObject,
    384386[
    385     0x06, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00,
     387    currentVersion, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00,
    386388    0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x03, 0x00,
    387389    0x00, 0x80, 0x66, 0x6f, 0x6f, 0x01, 0x00, 0x00,
     
    404406testSerialization(mapObject,
    405407[
    406     0x06, 0x00, 0x00, 0x00, 0x1e, 0x07, 0x05, 0x02,
     408    currentVersion, 0x00, 0x00, 0x00, 0x1e, 0x07, 0x05, 0x02,
    407409    0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00,
    408410    0x00, 0x00, 0xf8, 0x3f, 0x02, 0xff, 0xff, 0xff,
     
    425427testSerialization(setObject,
    426428[
    427     0x06, 0x00, 0x00, 0x00, 0x1d, 0x07, 0x0a, 0x00,
     429    currentVersion, 0x00, 0x00, 0x00, 0x1d, 0x07, 0x0a, 0x00,
    428430    0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x3f, 0x13,
    429431    0x00, 0x10, 0x03, 0x00, 0x00, 0x80, 0x62, 0x61,
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r232037 r232043  
     12018-05-21  Chris Dumez  <cdumez@apple.com>
     2
     3        File's structured serialization should serialize lastModified attribute
     4        https://bugs.webkit.org/show_bug.cgi?id=185773
     5
     6        Reviewed by Youenn Fablet.
     7
     8        Re-sync workers/semantics/structured-clone WPT tests after:
     9        https://github.com/w3c/web-platform-tests/pull/9218
     10
     11        * web-platform-tests/html/webappapis/structured-clone/structured-clone-battery-of-tests-harness.js: Added.
     12        (runStructuredCloneBatteryOfTests):
     13        * web-platform-tests/html/webappapis/structured-clone/structured-clone-battery-of-tests-with-transferables.js: Added.
     14        (structuredCloneBatteryOfTests.push.async.f):
     15        * web-platform-tests/html/webappapis/structured-clone/structured-clone-battery-of-tests.js: Renamed from LayoutTests/imported/w3c/web-platform-tests/workers/semantics/structured-clone/common.js.
     16        (async.compare_Blob):
     17        (get_canvas_1x1_transparent_black):
     18        (get_canvas_1x1_non_transparent_non_black):
     19        (compare_ImageBitmap):
     20        (structuredCloneBatteryOfTests.push.async.f):
     21        * web-platform-tests/html/webappapis/structured-clone/w3c-import.log: Copied from LayoutTests/imported/w3c/web-platform-tests/workers/semantics/structured-clone/w3c-import.log.
     22        * web-platform-tests/workers/semantics/structured-clone/dedicated-expected.txt:
     23        * web-platform-tests/workers/semantics/structured-clone/dedicated.html:
     24        * web-platform-tests/workers/semantics/structured-clone/dedicated.js: Removed.
     25        * web-platform-tests/workers/semantics/structured-clone/shared-expected.txt:
     26        * web-platform-tests/workers/semantics/structured-clone/shared.html:
     27        * web-platform-tests/workers/semantics/structured-clone/shared.js: Removed.
     28        * web-platform-tests/workers/semantics/structured-clone/w3c-import.log:
     29        * web-platform-tests/workers/semantics/structured-clone/worker-common.js: Removed.
     30
    1312018-05-21  Commit Queue  <commit-queue@webkit.org>
    232
  • trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/keypath-special-identifiers-expected.txt

    r232037 r232043  
    55PASS Type: Blob, identifier: type
    66PASS Type: File, identifier: name
    7 FAIL Type: File, identifier: lastModified assert_equals: Property should be used as key expected 0 but got 1
     7PASS Type: File, identifier: lastModified
    88FAIL Type: File, identifier: lastModifiedDate Provided data is inadequate.
    99
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/structured-clone/structured-clone-battery-of-tests.js

    r232042 r232043  
    1 function createWorker(msg) {
    2   // `type` is defined in the test case itself
    3   if (type == 'dedicated')
    4     return new Worker('dedicated.js#'+encodeURIComponent(msg));
    5   else if (type == 'shared')
    6     return (new SharedWorker('shared.js#'+encodeURIComponent(msg))).port;
    7   else
    8     assert_unreached('invalid or missing `type`');
    9 }
    10 
    11 function check(msg, input, callback, test_obj) {
    12   if (!test_obj)
    13     test_obj = async_test(msg);
    14   test_obj.step(function() {
    15     var w = createWorker(msg);
    16     if (typeof input === 'function')
    17       input = this.step(input);
    18     w.postMessage(input);
    19     w.onmessage = this.step_func(function(ev) { callback(ev.data, input, this); });
     1/* This file is mostly a remix of @zcorpan’s web worker test suite */
     2
     3structuredCloneBatteryOfTests = [];
     4
     5function check(description, input, callback) {
     6  testObjMock = {
     7    done() {},
     8    step_func(f) {return _ => f()},
     9  };
     10
     11  structuredCloneBatteryOfTests.push({
     12    description,
     13    async f(runner) {
     14      let newInput = input;
     15      if (typeof input === 'function') {
     16        newInput = input();
     17      }
     18      const copy = await runner.structuredClone(newInput);
     19      await callback(copy, newInput, testObjMock);
     20    }
    2021  });
    2122}
     
    262263check('Object RegExp object, RegExp new line', {'x':new RegExp('\n')}, compare_Object(enumerate_props(compare_RegExp('\\n'))));
    263264
    264 function compare_Blob(actual, input, test_obj, expect_File) {
     265async function compare_Blob(actual, input, test_obj, expect_File) {
    265266  if (typeof actual === 'string')
    266267    assert_unreached(actual);
     
    271272  assert_equals(actual.type, input.type, 'type');
    272273  assert_not_equals(actual, input);
    273   var ev_reader = new FileReader();
    274   var input_reader = new FileReader();
    275   var read_count = 0;
    276   var read_done = test_obj.step_func(function() {
    277     read_count++;
    278     if (read_count == 2) {
    279       var ev_result = ev_reader.result;
    280       var input_result = input_reader.result;
    281       assert_equals(ev_result.byteLength, input_result.byteLength, 'byteLength');
    282       var ev_view = new DataView(ev_result);
    283       var input_view = new DataView(input_result);
    284       for (var i = 0; i < ev_result.byteLength; ++i) {
    285         assert_equals(ev_view.getUint8(i), input_view.getUint8(i), 'getUint8('+i+')');
    286       }
    287       if (test_obj)
    288         test_obj.done();
    289     }
    290   });
    291   var read_error = test_obj.step_func(function() { assert_unreached('FileReader error'); });
    292   ev_reader.readAsArrayBuffer(actual);
    293   ev_reader.onload = read_done;
    294   ev_reader.onabort = ev_reader.onerror = read_error;
    295   input_reader.readAsArrayBuffer(input);
    296   input_reader.onload = read_done;
    297   input_reader.onabort = input_reader.onerror = read_error;
     274  const ab1 = new Response(actual).arrayBuffer();
     275  const ab2 = new Response(input).arrayBuffer();
     276  assert_equals(ab1.btyeLength, ab2.byteLength, 'byteLength');
     277  const ta1 = new Uint8Array(ab1);
     278  const ta2 = new Uint8Array(ab2);
     279  for(let i = 0; i < ta1.size; i++) {
     280    assert_equals(ta1[i], ta2[i]);
     281  }
    298282}
    299283function func_Blob_basic() {
     
    339323check('Blob NUL', func_Blob_NUL, compare_Blob);
    340324
    341 async_test(function(test_obj) {
    342   check(test_obj.name, [test_obj.step(func_Blob_basic)], compare_Array(enumerate_props(compare_Blob, test_obj), true), test_obj);
    343 }, 'Array Blob object, Blob basic');
    344 async_test(function(test_obj) {
    345   check(test_obj.name, [test_obj.step(func_Blob_bytes([0xD800]))], compare_Array(enumerate_props(compare_Blob, test_obj), true), test_obj);
    346 }, 'Array Blob object, Blob unpaired high surrogate (invalid utf-8)');
    347 async_test(function(test_obj) {
    348   check(test_obj.name, [test_obj.step(func_Blob_bytes([0xDC00]))], compare_Array(enumerate_props(compare_Blob, test_obj), true), test_obj);
    349 }, 'Array Blob object, Blob unpaired low surrogate (invalid utf-8)');
    350 async_test(function(test_obj) {
    351   check(test_obj.name, [test_obj.step(func_Blob_bytes([0xD800, 0xDC00]))], compare_Array(enumerate_props(compare_Blob, test_obj), true), test_obj);
    352 }, 'Array Blob object, Blob paired surrogates (invalid utf-8)');
    353 async_test(function(test_obj) {
    354   check(test_obj.name, [test_obj.step(func_Blob_empty)], compare_Array(enumerate_props(compare_Blob, test_obj), true), test_obj);
    355 }, 'Array Blob object, Blob empty');
    356 async_test(function(test_obj) {
    357   check(test_obj.name, [test_obj.step(func_Blob_NUL)], compare_Array(enumerate_props(compare_Blob, test_obj), true), test_obj);
    358 }, 'Array Blob object, Blob NUL');
    359 
    360 async_test(function(test_obj) {
    361   check(test_obj.name, {'x':test_obj.step(func_Blob_basic)}, compare_Object(enumerate_props(compare_Blob, test_obj), true), test_obj);
    362 }, 'Object Blob object, Blob basic');
    363 async_test(function(test_obj) {
    364   check(test_obj.name, {'x':test_obj.step(func_Blob_bytes([0xD800]))}, compare_Object(enumerate_props(compare_Blob, test_obj), true), test_obj);
    365 }, 'Object Blob object, Blob unpaired high surrogate (invalid utf-8)');
    366 async_test(function(test_obj) {
    367   check(test_obj.name, {'x':test_obj.step(func_Blob_bytes([0xDC00]))}, compare_Object(enumerate_props(compare_Blob, test_obj), true), test_obj);
    368 }, 'Object Blob object, Blob unpaired low surrogate (invalid utf-8)');
    369 async_test(function(test_obj) {
    370   check(test_obj.name, {'x':test_obj.step(func_Blob_bytes([0xD800, 0xDC00]))}, compare_Object(enumerate_props(compare_Blob, test_obj), true), test_obj);
    371 }, 'Object Blob object, Blob paired surrogates (invalid utf-8)');
    372 async_test(function(test_obj) {
    373   check(test_obj.name, {'x':test_obj.step(func_Blob_empty)}, compare_Object(enumerate_props(compare_Blob, test_obj), true), test_obj);
    374 }, 'Object Blob object, Blob empty');
    375 async_test(function(test_obj) {
    376   check(test_obj.name, {'x':test_obj.step(func_Blob_NUL)}, compare_Object(enumerate_props(compare_Blob, test_obj), true), test_obj);
    377 }, 'Object Blob object, Blob NUL');
     325check('Array Blob object, Blob basic', [func_Blob_basic()], compare_Array(enumerate_props(compare_Blob), true));
     326check('Array Blob object, Blob unpaired high surrogate (invalid utf-8)', [func_Blob_bytes([0xD800])()], compare_Array(enumerate_props(compare_Blob), true));
     327check('Array Blob object, Blob unpaired low surrogate (invalid utf-8)', [func_Blob_bytes([0xDC00])()], compare_Array(enumerate_props(compare_Blob), true));
     328check('Array Blob object, Blob paired surrogates (invalid utf-8)', [func_Blob_bytes([0xD800, 0xDC00])()], compare_Array(enumerate_props(compare_Blob), true));
     329check('Array Blob object, Blob empty', [func_Blob_empty()], compare_Array(enumerate_props(compare_Blob), true));
     330check('Array Blob object, Blob NUL', [func_Blob_NUL()], compare_Array(enumerate_props(compare_Blob), true));
     331
     332check('Object Blob object, Blob basic', {'x':func_Blob_basic()}, compare_Object(enumerate_props(compare_Blob), true));
     333check('Object Blob object, Blob unpaired high surrogate (invalid utf-8)', {'x':func_Blob_bytes([0xD800])()}, compare_Object(enumerate_props(compare_Blob), true));
     334check('Object Blob object, Blob unpaired low surrogate (invalid utf-8)', {'x':func_Blob_bytes([0xDC00])()}, compare_Object(enumerate_props(compare_Blob), true));
     335check('Object Blob object, Blob paired surrogates (invalid utf-8)', {'x':func_Blob_bytes([0xD800, 0xDC00])()  }, compare_Object(enumerate_props(compare_Blob), true));
     336check('Object Blob object, Blob empty', {'x':func_Blob_empty()}, compare_Object(enumerate_props(compare_Blob), true));
     337check('Object Blob object, Blob NUL', {'x':func_Blob_NUL()}, compare_Object(enumerate_props(compare_Blob), true));
    378338
    379339function compare_File(actual, input, test_obj) {
     
    405365}
    406366check('FileList empty', func_FileList_empty, compare_FileList);
    407 check('Array FileList object, FileList empty', [func_FileList_empty], compare_Array(enumerate_props(compare_FileList)));
    408 check('Object FileList object, FileList empty', {'x':func_FileList_empty}, compare_Object(enumerate_props(compare_FileList)));
     367check('Array FileList object, FileList empty', [func_FileList_empty()], compare_Array(enumerate_props(compare_FileList)));
     368check('Object FileList object, FileList empty', {'x':func_FileList_empty()}, compare_Object(enumerate_props(compare_FileList)));
    409369
    410370function compare_ArrayBufferView(view) {
     
    450410}
    451411check('ImageData 1x1 non-transparent non-black', func_ImageData_1x1_non_transparent_non_black, compare_ImageData);
    452 async_test(function(test_obj) {
    453   check(test_obj.name, [test_obj.step(func_ImageData_1x1_transparent_black)], compare_Array(enumerate_props(compare_ImageData)), test_obj);
    454 }, 'Array ImageData object, ImageData 1x1 transparent black');
    455 async_test(function(test_obj) {
    456   check(test_obj.name, [test_obj.step(func_ImageData_1x1_non_transparent_non_black)], compare_Array(enumerate_props(compare_ImageData)), test_obj);
    457 }, 'Array ImageData object, ImageData 1x1 non-transparent non-black');
    458 async_test(function(test_obj) {
    459   check(test_obj.name, {'x':test_obj.step(func_ImageData_1x1_transparent_black)}, compare_Object(enumerate_props(compare_ImageData)), test_obj);
    460 }, 'Object ImageData object, ImageData 1x1 transparent black');
    461 async_test(function(test_obj) {
    462   check(test_obj.name, {'x':test_obj.step(func_ImageData_1x1_non_transparent_non_black)}, compare_Object(enumerate_props(compare_ImageData)), test_obj);
    463 }, 'Object ImageData object, ImageData 1x1 non-transparent non-black');
    464 
    465 function compare_ImageBitmap(actual, input, test_obj) {
    466   if (typeof actual === 'string')
    467     assert_unreached(actual);
    468   assert_equals(actual instanceof ImageBitmap, 'instanceof ImageBitmap');
    469   assert_not_equals(actual, input);
    470   // XXX paint the ImageBitmap on a canvas and check the data
    471   if (test_obj)
    472     test_obj.done();
    473 }
     412check('Array ImageData object, ImageData 1x1 transparent black', [func_ImageData_1x1_transparent_black()], compare_Array(enumerate_props(compare_ImageData)));
     413check('Array ImageData object, ImageData 1x1 non-transparent non-black', [func_ImageData_1x1_non_transparent_non_black()], compare_Array(enumerate_props(compare_ImageData)));
     414check('Object ImageData object, ImageData 1x1 transparent black', {'x':func_ImageData_1x1_transparent_black()}, compare_Object(enumerate_props(compare_ImageData)));
     415check('Object ImageData object, ImageData 1x1 non-transparent non-black', {'x':func_ImageData_1x1_non_transparent_non_black()}, compare_Object(enumerate_props(compare_ImageData)));
     416
     417
     418check('Array sparse', new Array(10), compare_Array(enumerate_props(compare_primitive)));
     419check('Array with non-index property', function() {
     420  var rv = [];
     421  rv.foo = 'bar';
     422  return rv;
     423}, compare_Array(enumerate_props(compare_primitive)));
     424check('Object with index property and length', {'0':'foo', 'length':1}, compare_Object(enumerate_props(compare_primitive)));
     425function check_circular_property(prop) {
     426  return function(actual) {
     427    assert_equals(actual[prop], actual);
     428  };
     429}
     430check('Array with circular reference', function() {
     431  var rv = [];
     432  rv[0] = rv;
     433  return rv;
     434}, compare_Array(check_circular_property('0')));
     435check('Object with circular reference', function() {
     436  var rv = {};
     437  rv['x'] = rv;
     438  return rv;
     439}, compare_Object(check_circular_property('x')));
     440function check_identical_property_values(prop1, prop2) {
     441  return function(actual) {
     442    assert_equals(actual[prop1], actual[prop2]);
     443  };
     444}
     445check('Array with identical property values', function() {
     446  var obj = {}
     447  return [obj, obj];
     448}, compare_Array(check_identical_property_values('0', '1')));
     449check('Object with identical property values', function() {
     450  var obj = {}
     451  return {'x':obj, 'y':obj};
     452}, compare_Object(check_identical_property_values('x', 'y')));
     453
     454function check_absent_property(prop) {
     455  return function(actual) {
     456    assert_false(prop in actual);
     457  };
     458}
     459check('Object with property on prototype', function() {
     460  var Foo = function() {};
     461  Foo.prototype = {'foo':'bar'};
     462  return new Foo();
     463}, compare_Object(check_absent_property('foo')));
     464
     465check('Object with non-enumerable property', function() {
     466  var rv = {};
     467  Object.defineProperty(rv, 'foo', {value:'bar', enumerable:false, writable:true, configurable:true});
     468  return rv;
     469}, compare_Object(check_absent_property('foo')));
     470
     471function check_writable_property(prop) {
     472  return function(actual, input) {
     473    assert_equals(actual[prop], input[prop]);
     474    actual[prop] += ' baz';
     475    assert_equals(actual[prop], input[prop] + ' baz');
     476  };
     477}
     478check('Object with non-writable property', function() {
     479  var rv = {};
     480  Object.defineProperty(rv, 'foo', {value:'bar', enumerable:true, writable:false, configurable:true});
     481  return rv;
     482}, compare_Object(check_writable_property('foo')));
     483
     484function check_configurable_property(prop) {
     485  return function(actual, input) {
     486    assert_equals(actual[prop], input[prop]);
     487    delete actual[prop];
     488    assert_false('prop' in actual);
     489  };
     490}
     491check('Object with non-configurable property', function() {
     492  var rv = {};
     493  Object.defineProperty(rv, 'foo', {value:'bar', enumerable:true, writable:true, configurable:false});
     494  return rv;
     495}, compare_Object(check_configurable_property('foo')));
     496
     497/* The tests below are inspired by @zcorpan’s work but got some
     498more substantial changed due to their previous async setup */
     499
    474500function get_canvas_1x1_transparent_black() {
    475501  var canvas = document.createElement('canvas');
     
    478504  return canvas;
    479505}
    480 async_test(function(test_obj) {
    481   var canvas = get_canvas_1x1_transparent_black();
    482   createImageBitmap(canvas, function(image) { check(test_obj.name, image, compare_ImageBitmap, test_obj); });
    483 }, 'ImageBitmap 1x1 transparent black');
     506
    484507function get_canvas_1x1_non_transparent_non_black() {
    485508  var canvas = document.createElement('canvas');
     
    494517  return canvas;
    495518}
    496 async_test(function(test_obj) {
    497   var canvas = get_canvas_1x1_non_transparent_non_black();
    498   createImageBitmap(canvas, function(image) { check(test_obj.name, image, compare_ImageBitmap, test_obj); });
    499 }, 'ImageBitmap 1x1 non-transparent non-black');
    500 
    501 async_test(function(test_obj) {
    502   var canvas = get_canvas_1x1_transparent_black();
    503   createImageBitmap(canvas, function(image) { check(test_obj.name, [image], compare_Array(enumerate_props(compare_ImageBitmap)), test_obj); });
    504 }, 'Array ImageBitmap object, ImageBitmap 1x1 transparent black');
    505 async_test(function(test_obj) {
    506   var canvas = get_canvas_1x1_non_transparent_non_black();
    507   createImageBitmap(canvas, function(image) { check(test_obj.name, [image], compare_Array(enumerate_props(compare_ImageBitmap)), test_obj); });
    508 }, 'Array ImageBitmap object, ImageBitmap 1x1 non-transparent non-black');
    509 
    510 async_test(function(test_obj) {
    511   var canvas = get_canvas_1x1_transparent_black();
    512   createImageBitmap(canvas, function(image) { check(test_obj.name, {'x':image}, compare_Object(enumerate_props(compare_ImageBitmap)), test_obj); });
    513 }, 'Object ImageBitmap object, ImageBitmap 1x1 transparent black');
    514 async_test(function(test_obj) {
    515   var canvas = get_canvas_1x1_non_transparent_non_black();
    516   createImageBitmap(canvas, function(image) { check(test_obj.name, {'x':image}, compare_Object(enumerate_props(compare_ImageBitmap)), test_obj); });
    517 }, 'Object ImageBitmap object, ImageBitmap 1x1 non-transparent non-black');
    518 
    519 check('Array sparse', new Array(10), compare_Array(enumerate_props(compare_primitive)));
    520 check('Array with non-index property', function() {
    521   var rv = [];
    522   rv.foo = 'bar';
    523   return rv;
    524 }, compare_Array(enumerate_props(compare_primitive)));
    525 check('Object with index property and length', {'0':'foo', 'length':1}, compare_Object(enumerate_props(compare_primitive)));
    526 function check_circular_property(prop) {
    527   return function(actual) {
    528     assert_equals(actual[prop], actual);
    529   };
    530 }
    531 check('Array with circular reference', function() {
    532   var rv = [];
    533   rv[0] = rv;
    534   return rv;
    535 }, compare_Array(check_circular_property('0')));
    536 check('Object with circular reference', function() {
    537   var rv = {};
    538   rv['x'] = rv;
    539   return rv;
    540 }, compare_Object(check_circular_property('x')));
    541 function check_identical_property_values(prop1, prop2) {
    542   return function(actual) {
    543     assert_equals(actual[prop1], actual[prop2]);
    544   };
    545 }
    546 check('Array with identical property values', function() {
    547   var obj = {}
    548   return [obj, obj];
    549 }, compare_Array(check_identical_property_values('0', '1')));
    550 check('Object with identical property values', function() {
    551   var obj = {}
    552   return {'x':obj, 'y':obj};
    553 }, compare_Object(check_identical_property_values('x', 'y')));
    554 
    555 function check_absent_property(prop) {
    556   return function(actual) {
    557     assert_false(prop in actual);
    558   };
    559 }
    560 check('Object with property on prototype', function() {
    561   var Foo = function() {};
    562   Foo.prototype = {'foo':'bar'};
    563   return new Foo();
    564 }, compare_Object(check_absent_property('foo')));
    565 
    566 check('Object with non-enumerable property', function() {
    567   var rv = {};
    568   Object.defineProperty(rv, 'foo', {value:'bar', enumerable:false, writable:true, configurable:true});
    569   return rv;
    570 }, compare_Object(check_absent_property('foo')));
    571 
    572 function check_writable_property(prop) {
    573   return function(actual, input) {
    574     assert_equals(actual[prop], input[prop]);
    575     actual[prop] += ' baz';
    576     assert_equals(actual[prop], input[prop] + ' baz');
    577   };
    578 }
    579 check('Object with non-writable property', function() {
    580   var rv = {};
    581   Object.defineProperty(rv, 'foo', {value:'bar', enumerable:true, writable:false, configurable:true});
    582   return rv;
    583 }, compare_Object(check_writable_property('foo')));
    584 
    585 function check_configurable_property(prop) {
    586   return function(actual, input) {
    587     assert_equals(actual[prop], input[prop]);
    588     delete actual[prop];
    589     assert_false('prop' in actual);
    590   };
    591 }
    592 check('Object with non-configurable property', function() {
    593   var rv = {};
    594   Object.defineProperty(rv, 'foo', {value:'bar', enumerable:true, writable:true, configurable:false});
    595   return rv;
    596 }, compare_Object(check_configurable_property('foo')));
     519
     520function compare_ImageBitmap(actual, input) {
     521  if (typeof actual === 'string')
     522    assert_unreached(actual);
     523  assert_true(actual instanceof ImageBitmap, 'instanceof ImageBitmap');
     524  assert_not_equals(actual, input);
     525  // XXX paint the ImageBitmap on a canvas and check the data
     526}
     527
     528structuredCloneBatteryOfTests.push({
     529  description: 'ImageBitmap 1x1 transparent black',
     530  async f(runner) {
     531    var canvas = get_canvas_1x1_transparent_black();
     532    const bm = await createImageBitmap(canvas);
     533    const copy = await runner.structuredClone(bm);
     534    compare_ImageBitmap(bm, copy);
     535  }
     536});
     537
     538structuredCloneBatteryOfTests.push({
     539  description: 'ImageBitmap 1x1 non-transparent non-black',
     540  async f(runner) {
     541    var canvas = get_canvas_1x1_non_transparent_non_black();
     542    const bm = await createImageBitmap(canvas);
     543    const copy = await runner.structuredClone(bm);
     544    compare_ImageBitmap(bm, copy);
     545  }
     546});
     547
     548structuredCloneBatteryOfTests.push({
     549  description: 'Array ImageBitmap object, ImageBitmap 1x1 transparent black',
     550  async f(runner) {
     551    var canvas = get_canvas_1x1_transparent_black();
     552    const bm = [await createImageBitmap(canvas)];
     553    const copy = await runner.structuredClone(bm);
     554    compare_Array(enumerate_props(compare_ImageBitmap))(bm, copy);
     555  }
     556});
     557
     558structuredCloneBatteryOfTests.push({
     559  description: 'Array ImageBitmap object, ImageBitmap 1x1 transparent non-black',
     560  async f(runner) {
     561    var canvas = get_canvas_1x1_non_transparent_non_black();
     562    const bm = [await createImageBitmap(canvas)];
     563    const copy = await runner.structuredClone(bm);
     564    compare_Array(enumerate_props(compare_ImageBitmap))(bm, copy);
     565  }
     566});
     567
     568structuredCloneBatteryOfTests.push({
     569  description: 'Object ImageBitmap object, ImageBitmap 1x1 transparent black',
     570  async f(runner) {
     571    var canvas = get_canvas_1x1_transparent_black();
     572    const bm = {x: await createImageBitmap(canvas)};
     573    const copy = await runner.structuredClone(bm);
     574    compare_Object(enumerate_props(compare_ImageBitmap))(bm, copy);
     575  }
     576});
     577
     578structuredCloneBatteryOfTests.push({
     579  description: 'Object ImageBitmap object, ImageBitmap 1x1 transparent non-black',
     580  async f(runner) {
     581    var canvas = get_canvas_1x1_non_transparent_non_black();
     582    const bm = {x: await createImageBitmap(canvas)};
     583    const copy = await runner.structuredClone(bm);
     584    compare_Object(enumerate_props(compare_ImageBitmap))(bm, copy);
     585  }
     586});
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/structured-clone/w3c-import.log

    r232042 r232043  
    1515------------------------------------------------------------------------
    1616List of files:
    17 /LayoutTests/imported/w3c/web-platform-tests/workers/semantics/structured-clone/common.js
    18 /LayoutTests/imported/w3c/web-platform-tests/workers/semantics/structured-clone/dedicated.html
    19 /LayoutTests/imported/w3c/web-platform-tests/workers/semantics/structured-clone/dedicated.js
    20 /LayoutTests/imported/w3c/web-platform-tests/workers/semantics/structured-clone/shared.html
    21 /LayoutTests/imported/w3c/web-platform-tests/workers/semantics/structured-clone/shared.js
    22 /LayoutTests/imported/w3c/web-platform-tests/workers/semantics/structured-clone/worker-common.js
     17/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/structured-clone/structured-clone-battery-of-tests-harness.js
     18/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/structured-clone/structured-clone-battery-of-tests-with-transferables.js
     19/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/structured-clone/structured-clone-battery-of-tests.js
  • trunk/LayoutTests/imported/w3c/web-platform-tests/workers/semantics/structured-clone/dedicated-expected.txt

    r232037 r232043  
    1 
    2 Harness Error (TIMEOUT), message = null
    31
    42PASS primitive undefined
     
    5351PASS Object Date objects
    5452PASS RegExp flags and lastIndex
    55 FAIL RegExp sticky flag assert_unreached: FAIL: unknown test Reached unreachable code
    56 FAIL RegExp unicode flag assert_unreached: FAIL: unknown test Reached unreachable code
     53FAIL RegExp sticky flag assert_equals: sticky expected true but got false
     54FAIL RegExp unicode flag assert_equals: unicode expected true but got false
    5755PASS RegExp empty
    5856PASS RegExp slash
    5957PASS RegExp new line
    6058PASS Array RegExp object, RegExp flags and lastIndex
    61 FAIL Array RegExp object, RegExp sticky flag assert_unreached: FAIL: unknown test Reached unreachable code
    62 FAIL Array RegExp object, RegExp unicode flag assert_unreached: FAIL: unknown test Reached unreachable code
     59FAIL Array RegExp object, RegExp sticky flag assert_equals: sticky expected true but got false
     60FAIL Array RegExp object, RegExp unicode flag assert_equals: unicode expected true but got false
    6361PASS Array RegExp object, RegExp empty
    6462PASS Array RegExp object, RegExp slash
    6563PASS Array RegExp object, RegExp new line
    6664PASS Object RegExp object, RegExp flags and lastIndex
    67 FAIL Object RegExp object, RegExp sticky flag assert_unreached: FAIL: unknown test Reached unreachable code
    68 FAIL Object RegExp object, RegExp unicode flag assert_unreached: FAIL: unknown test Reached unreachable code
     65FAIL Object RegExp object, RegExp sticky flag assert_equals: sticky expected true but got false
     66FAIL Object RegExp object, RegExp unicode flag assert_equals: unicode expected true but got false
    6967PASS Object RegExp object, RegExp empty
    7068PASS Object RegExp object, RegExp slash
    7169PASS Object RegExp object, RegExp new line
    72 FAIL Blob basic assert_unreached: FAIL ReferenceError: Can't find variable: File Reached unreachable code
    73 FAIL Blob unpaired high surrogate (invalid utf-8) assert_unreached: FAIL ReferenceError: Can't find variable: File Reached unreachable code
    74 FAIL Blob unpaired low surrogate (invalid utf-8) assert_unreached: FAIL ReferenceError: Can't find variable: File Reached unreachable code
    75 FAIL Blob paired surrogates (invalid utf-8) assert_unreached: FAIL ReferenceError: Can't find variable: File Reached unreachable code
    76 FAIL Blob empty assert_unreached: FAIL ReferenceError: Can't find variable: File Reached unreachable code
    77 FAIL Blob NUL assert_unreached: FAIL ReferenceError: Can't find variable: File Reached unreachable code
    78 FAIL Array Blob object, Blob basic assert_unreached: FAIL ReferenceError: Can't find variable: File Reached unreachable code
    79 FAIL Array Blob object, Blob unpaired high surrogate (invalid utf-8) assert_unreached: FAIL ReferenceError: Can't find variable: File Reached unreachable code
    80 FAIL Array Blob object, Blob unpaired low surrogate (invalid utf-8) assert_unreached: FAIL ReferenceError: Can't find variable: File Reached unreachable code
    81 FAIL Array Blob object, Blob paired surrogates (invalid utf-8) assert_unreached: FAIL ReferenceError: Can't find variable: File Reached unreachable code
    82 FAIL Array Blob object, Blob empty assert_unreached: FAIL ReferenceError: Can't find variable: File Reached unreachable code
    83 FAIL Array Blob object, Blob NUL assert_unreached: FAIL ReferenceError: Can't find variable: File Reached unreachable code
    84 FAIL Object Blob object, Blob basic assert_unreached: FAIL ReferenceError: Can't find variable: File Reached unreachable code
    85 FAIL Object Blob object, Blob unpaired high surrogate (invalid utf-8) assert_unreached: FAIL ReferenceError: Can't find variable: File Reached unreachable code
    86 FAIL Object Blob object, Blob unpaired low surrogate (invalid utf-8) assert_unreached: FAIL ReferenceError: Can't find variable: File Reached unreachable code
    87 FAIL Object Blob object, Blob paired surrogates (invalid utf-8) assert_unreached: FAIL ReferenceError: Can't find variable: File Reached unreachable code
    88 FAIL Object Blob object, Blob empty assert_unreached: FAIL ReferenceError: Can't find variable: File Reached unreachable code
    89 FAIL Object Blob object, Blob NUL assert_unreached: FAIL ReferenceError: Can't find variable: File Reached unreachable code
    90 FAIL File basic assert_true: instanceof File expected true got false
    91 FAIL FileList empty assert_unreached: FAIL ReferenceError: Can't find variable: FileList Reached unreachable code
    92 FAIL Array FileList object, FileList empty The object can not be cloned.
    93 FAIL Object FileList object, FileList empty The object can not be cloned.
     70PASS Blob basic
     71PASS Blob unpaired high surrogate (invalid utf-8)
     72PASS Blob unpaired low surrogate (invalid utf-8)
     73PASS Blob paired surrogates (invalid utf-8)
     74PASS Blob empty
     75PASS Blob NUL
     76PASS Array Blob object, Blob basic
     77PASS Array Blob object, Blob unpaired high surrogate (invalid utf-8)
     78PASS Array Blob object, Blob unpaired low surrogate (invalid utf-8)
     79PASS Array Blob object, Blob paired surrogates (invalid utf-8)
     80PASS Array Blob object, Blob empty
     81PASS Array Blob object, Blob NUL
     82PASS Object Blob object, Blob basic
     83PASS Object Blob object, Blob unpaired high surrogate (invalid utf-8)
     84PASS Object Blob object, Blob unpaired low surrogate (invalid utf-8)
     85PASS Object Blob object, Blob paired surrogates (invalid utf-8)
     86PASS Object Blob object, Blob empty
     87PASS Object Blob object, Blob NUL
     88PASS File basic
     89PASS FileList empty
     90PASS Array FileList object, FileList empty
     91PASS Object FileList object, FileList empty
    9492PASS ImageData 1x1 transparent black
    9593PASS ImageData 1x1 non-transparent non-black
     
    9896PASS Object ImageData object, ImageData 1x1 transparent black
    9997PASS Object ImageData object, ImageData 1x1 non-transparent non-black
    100 TIMEOUT ImageBitmap 1x1 transparent black Test timed out
    101 TIMEOUT ImageBitmap 1x1 non-transparent non-black Test timed out
    102 TIMEOUT Array ImageBitmap object, ImageBitmap 1x1 transparent black Test timed out
    103 TIMEOUT Array ImageBitmap object, ImageBitmap 1x1 non-transparent non-black Test timed out
    104 TIMEOUT Object ImageBitmap object, ImageBitmap 1x1 transparent black Test timed out
    105 TIMEOUT Object ImageBitmap object, ImageBitmap 1x1 non-transparent non-black Test timed out
    10698PASS Array sparse
    10799PASS Array with non-index property
     
    115107PASS Object with non-writable property
    116108PASS Object with non-configurable property
     109FAIL ImageBitmap 1x1 transparent black promise_test: Unhandled rejection with value: object "TypeError: Type error"
     110FAIL ImageBitmap 1x1 non-transparent non-black promise_test: Unhandled rejection with value: object "TypeError: Type error"
     111FAIL Array ImageBitmap object, ImageBitmap 1x1 transparent black promise_test: Unhandled rejection with value: object "TypeError: Type error"
     112FAIL Array ImageBitmap object, ImageBitmap 1x1 transparent non-black promise_test: Unhandled rejection with value: object "TypeError: Type error"
     113FAIL Object ImageBitmap object, ImageBitmap 1x1 transparent black promise_test: Unhandled rejection with value: object "TypeError: Type error"
     114FAIL Object ImageBitmap object, ImageBitmap 1x1 transparent non-black promise_test: Unhandled rejection with value: object "TypeError: Type error"
     115PASS ArrayBuffer
     116PASS MessagePort
    117117
  • trunk/LayoutTests/imported/w3c/web-platform-tests/workers/semantics/structured-clone/dedicated.html

    r232037 r232043  
    33<script src="/resources/testharness.js"></script>
    44<script src="/resources/testharnessreport.js"></script>
     5<script src=/html/webappapis/structured-clone/structured-clone-battery-of-tests.js></script>
     6<script src=/html/webappapis/structured-clone/structured-clone-battery-of-tests-with-transferables.js></script>
     7<script src=/html/webappapis/structured-clone/structured-clone-battery-of-tests-harness.js></script>
    58<div id=log></div>
    69<script>
    7 var type = 'dedicated';
     10  runStructuredCloneBatteryOfTests({
     11    setup() {
     12      const blob = new Blob([`
     13        onmessage = ev => postMessage(ev.data, ev.data.transfer);
     14      `], {type: 'text/javascript'});
     15      this.blobURL = URL.createObjectURL(blob);
     16      this.worker = new Worker(this.blobURL);
     17    },
     18    structuredClone(data, transfer) {
     19      return new Promise(resolve => {
     20        this.worker.addEventListener('message', function f(ev) {
     21          this.worker.removeEventListener('message', f);
     22          resolve(ev.data.data);
     23        }.bind(this));
     24        this.worker.postMessage({data, transfer}, transfer);
     25      });
     26    },
     27    teardown() {
     28      this.worker.terminate();
     29      URL.revokeObjectURL(this.blobURL);
     30    }
     31  });
    832</script>
    9 <script src="common.js"></script>
  • trunk/LayoutTests/imported/w3c/web-platform-tests/workers/semantics/structured-clone/shared-expected.txt

    r232037 r232043  
     1CONSOLE MESSAGE: line 19: ReferenceError: Can't find variable: SharedWorker
    12
    2 Harness Error (TIMEOUT), message = null
     3FAIL structured clone to shared worker ReferenceError: Can't find variable: SharedWorker
    34
    4 FAIL primitive undefined Can't find variable: SharedWorker
    5 FAIL primitive null Can't find variable: SharedWorker
    6 FAIL primitive true Can't find variable: SharedWorker
    7 FAIL primitive false Can't find variable: SharedWorker
    8 FAIL primitive string, empty string Can't find variable: SharedWorker
    9 FAIL primitive string, lone high surrogate Can't find variable: SharedWorker
    10 FAIL primitive string, lone low surrogate Can't find variable: SharedWorker
    11 FAIL primitive string, NUL Can't find variable: SharedWorker
    12 FAIL primitive string, astral character Can't find variable: SharedWorker
    13 FAIL primitive number, 0.2 Can't find variable: SharedWorker
    14 FAIL primitive number, 0 Can't find variable: SharedWorker
    15 FAIL primitive number, -0 Can't find variable: SharedWorker
    16 FAIL primitive number, NaN Can't find variable: SharedWorker
    17 FAIL primitive number, Infinity Can't find variable: SharedWorker
    18 FAIL primitive number, -Infinity Can't find variable: SharedWorker
    19 FAIL primitive number, 9007199254740992 Can't find variable: SharedWorker
    20 FAIL primitive number, -9007199254740992 Can't find variable: SharedWorker
    21 FAIL primitive number, 9007199254740994 Can't find variable: SharedWorker
    22 FAIL primitive number, -9007199254740994 Can't find variable: SharedWorker
    23 FAIL Array primitives Can't find variable: SharedWorker
    24 FAIL Object primitives Can't find variable: SharedWorker
    25 FAIL Boolean true Can't find variable: SharedWorker
    26 FAIL Boolean false Can't find variable: SharedWorker
    27 FAIL Array Boolean objects Can't find variable: SharedWorker
    28 FAIL Object Boolean objects Can't find variable: SharedWorker
    29 FAIL String empty string Can't find variable: SharedWorker
    30 FAIL String lone high surrogate Can't find variable: SharedWorker
    31 FAIL String lone low surrogate Can't find variable: SharedWorker
    32 FAIL String NUL Can't find variable: SharedWorker
    33 FAIL String astral character Can't find variable: SharedWorker
    34 FAIL Array String objects Can't find variable: SharedWorker
    35 FAIL Object String objects Can't find variable: SharedWorker
    36 FAIL Number 0.2 Can't find variable: SharedWorker
    37 FAIL Number 0 Can't find variable: SharedWorker
    38 FAIL Number -0 Can't find variable: SharedWorker
    39 FAIL Number NaN Can't find variable: SharedWorker
    40 FAIL Number Infinity Can't find variable: SharedWorker
    41 FAIL Number -Infinity Can't find variable: SharedWorker
    42 FAIL Number 9007199254740992 Can't find variable: SharedWorker
    43 FAIL Number -9007199254740992 Can't find variable: SharedWorker
    44 FAIL Number 9007199254740994 Can't find variable: SharedWorker
    45 FAIL Number -9007199254740994 Can't find variable: SharedWorker
    46 FAIL Array Number objects Can't find variable: SharedWorker
    47 FAIL Object Number objects Can't find variable: SharedWorker
    48 FAIL Date 0 Can't find variable: SharedWorker
    49 FAIL Date -0 Can't find variable: SharedWorker
    50 FAIL Date -8.64e15 Can't find variable: SharedWorker
    51 FAIL Date 8.64e15 Can't find variable: SharedWorker
    52 FAIL Array Date objects Can't find variable: SharedWorker
    53 FAIL Object Date objects Can't find variable: SharedWorker
    54 FAIL RegExp flags and lastIndex Can't find variable: SharedWorker
    55 FAIL RegExp sticky flag Can't find variable: SharedWorker
    56 FAIL RegExp unicode flag Can't find variable: SharedWorker
    57 FAIL RegExp empty Can't find variable: SharedWorker
    58 FAIL RegExp slash Can't find variable: SharedWorker
    59 FAIL RegExp new line Can't find variable: SharedWorker
    60 FAIL Array RegExp object, RegExp flags and lastIndex Can't find variable: SharedWorker
    61 FAIL Array RegExp object, RegExp sticky flag Can't find variable: SharedWorker
    62 FAIL Array RegExp object, RegExp unicode flag Can't find variable: SharedWorker
    63 FAIL Array RegExp object, RegExp empty Can't find variable: SharedWorker
    64 FAIL Array RegExp object, RegExp slash Can't find variable: SharedWorker
    65 FAIL Array RegExp object, RegExp new line Can't find variable: SharedWorker
    66 FAIL Object RegExp object, RegExp flags and lastIndex Can't find variable: SharedWorker
    67 FAIL Object RegExp object, RegExp sticky flag Can't find variable: SharedWorker
    68 FAIL Object RegExp object, RegExp unicode flag Can't find variable: SharedWorker
    69 FAIL Object RegExp object, RegExp empty Can't find variable: SharedWorker
    70 FAIL Object RegExp object, RegExp slash Can't find variable: SharedWorker
    71 FAIL Object RegExp object, RegExp new line Can't find variable: SharedWorker
    72 FAIL Blob basic Can't find variable: SharedWorker
    73 FAIL Blob unpaired high surrogate (invalid utf-8) Can't find variable: SharedWorker
    74 FAIL Blob unpaired low surrogate (invalid utf-8) Can't find variable: SharedWorker
    75 FAIL Blob paired surrogates (invalid utf-8) Can't find variable: SharedWorker
    76 FAIL Blob empty Can't find variable: SharedWorker
    77 FAIL Blob NUL Can't find variable: SharedWorker
    78 FAIL Array Blob object, Blob basic Can't find variable: SharedWorker
    79 FAIL Array Blob object, Blob unpaired high surrogate (invalid utf-8) Can't find variable: SharedWorker
    80 FAIL Array Blob object, Blob unpaired low surrogate (invalid utf-8) Can't find variable: SharedWorker
    81 FAIL Array Blob object, Blob paired surrogates (invalid utf-8) Can't find variable: SharedWorker
    82 FAIL Array Blob object, Blob empty Can't find variable: SharedWorker
    83 FAIL Array Blob object, Blob NUL Can't find variable: SharedWorker
    84 FAIL Object Blob object, Blob basic Can't find variable: SharedWorker
    85 FAIL Object Blob object, Blob unpaired high surrogate (invalid utf-8) Can't find variable: SharedWorker
    86 FAIL Object Blob object, Blob unpaired low surrogate (invalid utf-8) Can't find variable: SharedWorker
    87 FAIL Object Blob object, Blob paired surrogates (invalid utf-8) Can't find variable: SharedWorker
    88 FAIL Object Blob object, Blob empty Can't find variable: SharedWorker
    89 FAIL Object Blob object, Blob NUL Can't find variable: SharedWorker
    90 FAIL File basic Can't find variable: SharedWorker
    91 FAIL FileList empty Can't find variable: SharedWorker
    92 FAIL Array FileList object, FileList empty Can't find variable: SharedWorker
    93 FAIL Object FileList object, FileList empty Can't find variable: SharedWorker
    94 FAIL ImageData 1x1 transparent black Can't find variable: SharedWorker
    95 FAIL ImageData 1x1 non-transparent non-black Can't find variable: SharedWorker
    96 FAIL Array ImageData object, ImageData 1x1 transparent black Can't find variable: SharedWorker
    97 FAIL Array ImageData object, ImageData 1x1 non-transparent non-black Can't find variable: SharedWorker
    98 FAIL Object ImageData object, ImageData 1x1 transparent black Can't find variable: SharedWorker
    99 FAIL Object ImageData object, ImageData 1x1 non-transparent non-black Can't find variable: SharedWorker
    100 TIMEOUT ImageBitmap 1x1 transparent black Test timed out
    101 TIMEOUT ImageBitmap 1x1 non-transparent non-black Test timed out
    102 TIMEOUT Array ImageBitmap object, ImageBitmap 1x1 transparent black Test timed out
    103 TIMEOUT Array ImageBitmap object, ImageBitmap 1x1 non-transparent non-black Test timed out
    104 TIMEOUT Object ImageBitmap object, ImageBitmap 1x1 transparent black Test timed out
    105 TIMEOUT Object ImageBitmap object, ImageBitmap 1x1 non-transparent non-black Test timed out
    106 FAIL Array sparse Can't find variable: SharedWorker
    107 FAIL Array with non-index property Can't find variable: SharedWorker
    108 FAIL Object with index property and length Can't find variable: SharedWorker
    109 FAIL Array with circular reference Can't find variable: SharedWorker
    110 FAIL Object with circular reference Can't find variable: SharedWorker
    111 FAIL Array with identical property values Can't find variable: SharedWorker
    112 FAIL Object with identical property values Can't find variable: SharedWorker
    113 FAIL Object with property on prototype Can't find variable: SharedWorker
    114 FAIL Object with non-enumerable property Can't find variable: SharedWorker
    115 FAIL Object with non-writable property Can't find variable: SharedWorker
    116 FAIL Object with non-configurable property Can't find variable: SharedWorker
    117 
  • trunk/LayoutTests/imported/w3c/web-platform-tests/workers/semantics/structured-clone/shared.html

    r232037 r232043  
    33<script src="/resources/testharness.js"></script>
    44<script src="/resources/testharnessreport.js"></script>
     5<script src=/html/webappapis/structured-clone/structured-clone-battery-of-tests.js></script>
     6<script src=/html/webappapis/structured-clone/structured-clone-battery-of-tests-with-transferables.js></script>
     7<script src=/html/webappapis/structured-clone/structured-clone-battery-of-tests-harness.js></script>
    58<div id=log></div>
    69<script>
    7 var type = 'shared';
     10  runStructuredCloneBatteryOfTests({
     11    setup() {
     12      const blob = new Blob([`
     13        onconnect = ev => {
     14          const port = ev.ports[0];
     15          port.onmessage = ev => port.postMessage(ev.data, ev.data.transfer);
     16        };
     17      `], {type: 'text/javascript'});
     18      this.blobURL = URL.createObjectURL(blob);
     19      this.worker = new SharedWorker(this.blobURL);
     20      this.port = this.worker.port;
     21    },
     22    structuredClone(data, transfer) {
     23      return new Promise(resolve => {
     24        this.port.addEventListener('message', function f(ev) {
     25          this.port.removeEventListener('message', f);
     26          resolve(ev.data.data);
     27        }.bind(this));
     28        this.port.start();
     29        this.port.postMessage({data, transfer}, transfer);
     30      });
     31    },
     32    teardown() {
     33      URL.revokeObjectURL(this.blobURL);
     34    }
     35  });
    836</script>
    9 <script src="common.js"></script>
  • trunk/LayoutTests/imported/w3c/web-platform-tests/workers/semantics/structured-clone/w3c-import.log

    r232037 r232043  
    1515------------------------------------------------------------------------
    1616List of files:
    17 /LayoutTests/imported/w3c/web-platform-tests/workers/semantics/structured-clone/common.js
    1817/LayoutTests/imported/w3c/web-platform-tests/workers/semantics/structured-clone/dedicated.html
    19 /LayoutTests/imported/w3c/web-platform-tests/workers/semantics/structured-clone/dedicated.js
    2018/LayoutTests/imported/w3c/web-platform-tests/workers/semantics/structured-clone/shared.html
    21 /LayoutTests/imported/w3c/web-platform-tests/workers/semantics/structured-clone/shared.js
    22 /LayoutTests/imported/w3c/web-platform-tests/workers/semantics/structured-clone/worker-common.js
  • trunk/Source/WebCore/ChangeLog

    r232042 r232043  
     12018-05-21  Chris Dumez  <cdumez@apple.com>
     2
     3        File's structured serialization should serialize lastModified attribute
     4        https://bugs.webkit.org/show_bug.cgi?id=185773
     5
     6        Reviewed by Youenn Fablet.
     7
     8        Update our implementation for the stuctured serialization of a File to include
     9        its lastModified attribute, as per:
     10        - https://w3c.github.io/FileAPI/#file-section
     11
     12        No new tests, rebaselined existing test.
     13
     14        * bindings/js/SerializedScriptValue.cpp:
     15        (WebCore::CloneSerializer::write):
     16        (WebCore::CloneDeserializer::readFile):
     17        * fileapi/File.cpp:
     18        (WebCore::File::File):
     19        * fileapi/File.h:
     20
    1212018-05-21  Zalan Bujtas  <zalan@apple.com>
    222
  • trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp

    r232037 r232043  
    279279 * Version 5. added support for Map and Set types.
    280280 * Version 6. added support for 8-bit strings.
     281 * Version 7. added support for File's lastModified attribute.
    281282 */
    282 static const unsigned CurrentVersion = 6;
     283static const unsigned CurrentVersion = 7;
    283284static const unsigned TerminatorTag = 0xFFFFFFFF;
    284285static const unsigned StringPoolTag = 0xFFFFFFFE;
     
    364365 *
    365366 * FileData :-
    366  *    <path:StringData> <url:StringData> <type:StringData> <name:StringData>
     367 *    <path:StringData> <url:StringData> <type:StringData> <name:StringData> <lastModified:double>
    367368 *
    368369 * FileList :-
     
    12371238        write(file.type());
    12381239        write(file.name());
     1240        write(static_cast<double>(file.lastModifiedOverride().value_or(-1)));
    12391241    }
    12401242
     
    20372039        if (!readStringData(name))
    20382040            return false;
     2041        std::optional<int64_t> optionalLastModified;
     2042        if (m_version > 6) {
     2043            double lastModified;
     2044            if (!read(lastModified))
     2045                return false;
     2046            if (lastModified >= 0)
     2047                optionalLastModified = lastModified;
     2048        }
    20392049
    20402050        // If the blob URL for this file has an associated blob file path, prefer that one over the "built-in" path.
     
    20442054
    20452055        if (m_isDOMGlobalObject)
    2046             file = File::deserialize(filePath, URL(URL(), url->string()), type->string(), name->string());
     2056            file = File::deserialize(filePath, URL(URL(), url->string()), type->string(), name->string(), optionalLastModified);
    20472057        return true;
    20482058    }
  • trunk/Source/WebCore/fileapi/File.cpp

    r232037 r232043  
    6464}
    6565
    66 File::File(DeserializationContructor, const String& path, const URL& url, const String& type, const String& name)
     66File::File(DeserializationContructor, const String& path, const URL& url, const String& type, const String& name, const std::optional<int64_t>& lastModified)
    6767    : Blob(deserializationContructor, url, type, -1, path)
    6868    , m_path(path)
    6969    , m_name(name)
     70    , m_lastModifiedDateOverride(lastModified)
    7071{
    7172}
     
    8182    : Blob(WTFMove(blobPartVariants), convertPropertyBag(propertyBag))
    8283    , m_name(filename)
    83     , m_overrideLastModifiedDate(propertyBag.lastModified.value_or(WallTime::now().secondsSinceEpoch().milliseconds()))
     84    , m_lastModifiedDateOverride(propertyBag.lastModified.value_or(WallTime::now().secondsSinceEpoch().milliseconds()))
    8485{
    8586}
     
    9798    , m_relativePath(file.relativePath())
    9899    , m_name(!name.isNull() ? name : file.name())
    99     , m_overrideLastModifiedDate(file.m_overrideLastModifiedDate)
     100    , m_lastModifiedDateOverride(file.m_lastModifiedDateOverride)
    100101    , m_isDirectory(file.isDirectory())
    101102{
    102103}
    103104
    104 double File::lastModified() const
     105int64_t File::lastModified() const
    105106{
    106     if (m_overrideLastModifiedDate)
    107         return m_overrideLastModifiedDate.value();
     107    if (m_lastModifiedDateOverride)
     108        return m_lastModifiedDateOverride.value();
    108109
    109     double result;
     110    int64_t result;
    110111
    111112    // FIXME: This does sync-i/o on the main thread and also recalculates every time the method is called.
  • trunk/Source/WebCore/fileapi/File.h

    r232037 r232043  
    3939public:
    4040    struct PropertyBag : BlobPropertyBag {
    41         std::optional<long long> lastModified;
     41        std::optional<int64_t> lastModified;
    4242    };
    4343
     
    5353    }
    5454
    55     static Ref<File> deserialize(const String& path, const URL& srcURL, const String& type, const String& name)
     55    static Ref<File> deserialize(const String& path, const URL& srcURL, const String& type, const String& name, const std::optional<int64_t>& lastModified = std::nullopt)
    5656    {
    57         return adoptRef(*new File(deserializationContructor, path, srcURL, type, name));
     57        return adoptRef(*new File(deserializationContructor, path, srcURL, type, name, lastModified));
    5858    }
    5959
     
    8484    void setRelativePath(const String& relativePath) { m_relativePath = relativePath; }
    8585    const String& name() const { return m_name; }
    86     WEBCORE_EXPORT double lastModified() const;
     86    WEBCORE_EXPORT int64_t lastModified() const; // Number of milliseconds since Epoch.
     87    const std::optional<int64_t>& lastModifiedOverride() const { return m_lastModifiedDateOverride; } // Number of milliseconds since Epoch.
    8788
    8889    static String contentTypeForFile(const String& path);
     
    101102    File(const File&, const String& name);
    102103
    103     File(DeserializationContructor, const String& path, const URL& srcURL, const String& type, const String& name);
     104    File(DeserializationContructor, const String& path, const URL& srcURL, const String& type, const String& name, const std::optional<int64_t>& lastModified);
    104105
    105106    static void computeNameAndContentType(const String& path, const String& nameOverride, String& effectiveName, String& effectiveContentType);
     
    112113    String m_name;
    113114
    114     std::optional<int64_t> m_overrideLastModifiedDate;
     115    std::optional<int64_t> m_lastModifiedDateOverride;
    115116    mutable std::optional<bool> m_isDirectory;
    116117};
Note: See TracChangeset for help on using the changeset viewer.