From edfa91f7597714fa3df28d3c4a045bf10e3882f1 Mon Sep 17 00:00:00 2001 From: Krzysztof Modras Date: Fri, 15 Nov 2024 22:59:28 +0100 Subject: [PATCH] Define extact from zip --- index.bs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/index.bs b/index.bs index 9f5c0c9c..f1350280 100644 --- a/index.bs +++ b/index.bs @@ -11439,6 +11439,17 @@ The webExtension.install command installs a web e +
+To extract a zip archive given |bytes|: + +1. Perform implementation defined steps to decode |bytes| using the zip compression algorithm. TODO: Find a better reference for zip decoding. + +1. If the previous step failed (e.g. because |bytes| did not represent valid zip-compressed data) then return [=error=] with error code [=invalid web extension=]. Otherwise let |entry| be a [=directory entry=] containing the extracted filesystem entries. + +1. Return |entry|. + +
+
To expand a web extension data spec given |extension data spec|: @@ -11457,12 +11468,13 @@ To expand a web extension data spec given |extension data spec|:
|type| is the string "archivePath"
1. Let |archive path| be |extension data spec|["path"]. - 1. Perform implementation-defined steps to extract ZIP from |archive path|. If this fails return [=error=] with [=error code=] [=invalid web extension=]. Otherwise let |entry| be a [=directory entry=] representing the extraction result. + 1. Perform implementation defined steps to read |bytes| from a file located at |archive path|. + 1. Let |entry| be the result of [=trying=] to [=extract a zip archive=] given |bytes|.
|type| is the string "base64"
1. Let |bytes| be [=forgiving-base64 decode=] |extension data spec|["path"]. - 1. Perform any implementation-defined steps to extract the archive from |bytes| by using the ZIP algorithm, and let |entry| by a [=directory entry=] representing the extraction path, if this fails return [=error=] with [=error code=] [=invalid web extension=]. + 1. Let |entry| be the result of [=trying=] to [=extract a zip archive=] given |bytes|.