diff options
author | Kenta Moriuchi <moriken@kimamass.com> | 2023-01-06 21:45:23 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-06 21:45:23 +0900 |
commit | ff89ff4abba39ce158056d390e761495f5a7bc86 (patch) | |
tree | 03a9c71b5bb3889842db06ed41c3999074c4107a /ext/web/13_message_port.js | |
parent | 39cbaa6d34c249afc4b197836da1fa6dd143cbf9 (diff) |
perf(ext,runtime): remove using `SafeArrayIterator` from `for-of` (#17255)
Diffstat (limited to 'ext/web/13_message_port.js')
-rw-r--r-- | ext/web/13_message_port.js | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/ext/web/13_message_port.js b/ext/web/13_message_port.js index f589ac91f..8b8aa57ac 100644 --- a/ext/web/13_message_port.js +++ b/ext/web/13_message_port.js @@ -22,7 +22,6 @@ ArrayPrototypePush, ObjectPrototypeIsPrototypeOf, ObjectSetPrototypeOf, - SafeArrayIterator, Symbol, SymbolFor, SymbolIterator, @@ -205,9 +204,8 @@ const arrayBufferIdsInTransferables = []; const transferredArrayBuffers = []; - for ( - const transferable of new SafeArrayIterator(messageData.transferables) - ) { + for (let i = 0; i < messageData.transferables.length; ++i) { + const transferable = messageData.transferables[i]; switch (transferable.kind) { case "messagePort": { const port = createMessagePort(transferable.data); @@ -217,8 +215,8 @@ } case "arrayBuffer": { ArrayPrototypePush(transferredArrayBuffers, transferable.data); - const i = ArrayPrototypePush(transferables, null); - ArrayPrototypePush(arrayBufferIdsInTransferables, i); + const index = ArrayPrototypePush(transferables, null); + ArrayPrototypePush(arrayBufferIdsInTransferables, index); break; } default: @@ -274,7 +272,8 @@ const serializedTransferables = []; let arrayBufferI = 0; - for (const transferable of new SafeArrayIterator(transferables)) { + for (let i = 0; i < transferables.length; ++i) { + const transferable = transferables[i]; if (ObjectPrototypeIsPrototypeOf(MessagePortPrototype, transferable)) { webidl.assertBranded(transferable, MessagePortPrototype); const id = transferable[_id]; |