Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
skip wpt tests cause of missing File api
  • Loading branch information
Ethan-Arrowood committed Aug 13, 2021
commit 1ed93ddd1edf87b7b3946f1742c047bb99d796b8
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,5 +362,6 @@ module.exports = {
btoa: 'readable',
atob: 'readable',
performance: 'readable',
structuredClone: 'readable'
Comment thread
Ethan-Arrowood marked this conversation as resolved.
Outdated
},
};
5 changes: 3 additions & 2 deletions lib/internal/structured_clone.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

const { MessageChannel, receiveMessageOnPort } = require('internal/worker/io');

const channel = new MessageChannel();
channel.unref();

function structuredClone(value, transfer) {
const channel = new MessageChannel();
Comment thread
Ethan-Arrowood marked this conversation as resolved.
Outdated
Comment thread
Ethan-Arrowood marked this conversation as resolved.
Outdated
channel.port1.unref();
channel.port2.unref();
channel.port1.postMessage(value, transfer);
return receiveMessageOnPort(channel.port2).message;
}
Expand Down
1 change: 1 addition & 0 deletions test/parallel/test-global.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ builtinModules.forEach((moduleName) => {
'setImmediate',
'setInterval',
'setTimeout',
'structuredClone'
Comment thread
Ethan-Arrowood marked this conversation as resolved.
Outdated
];
assert.deepStrictEqual(new Set(Object.keys(global)), new Set(expected));
}
Expand Down
18 changes: 18 additions & 0 deletions test/parallel/test-structuredClone-global.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Flags: --expose-internals
'use strict';
/* eslint-disable no-global-assign */

require('../common');

const { structuredClone: _structuredClone } = require('internal/structuredClone');
Comment thread
Ethan-Arrowood marked this conversation as resolved.
Outdated
const {
strictEqual
} = require('assert');

Comment thread
Ethan-Arrowood marked this conversation as resolved.
strictEqual(globalThis.structuredClone, _structuredClone);
structuredClone = undefined;
strictEqual(globalThis.structuredClone, undefined);
strictEqual(typeof perf_hooks.performance.now, 'function');

// Restore the value of performance for the known globals check
Comment thread
Ethan-Arrowood marked this conversation as resolved.
Outdated
structuredClone = _structuredClone;
6 changes: 5 additions & 1 deletion test/wpt/status/html/webappapis/structured-clone.json
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
{}
{
"structured-clone.any.js": {
"skip": "Missing File API"
}
}
Comment thread
Ethan-Arrowood marked this conversation as resolved.
Outdated