From nobody Thu Mar 09 09:49:27 2023 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PXPXm0n7qz3wSdH; Thu, 9 Mar 2023 09:49:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PXPXl5fm9z4XlD; Thu, 9 Mar 2023 09:49:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678355367; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gYpTZfNU4VuGIzxIJoRfRh+oLdYdH+kOnytAEzvpa44=; b=wbV3lrZMUZP63CWc/KBn1f09BJff4yEA6RNP78oSJDhOJwATpIp8mtS96R0lO3gnhFrg81 rqKVqWJTcgIXoK7UsTuepdJcaj3E5urN4atVzZdm+PjHp7I2Ka7oMFK172fYNyxq35nyK0 v486XrUeZklEAQqy3/g6SOQH6wuOw0/EIItBOkfIc0Xnkgcdxo+U15m1OT7NgFxpn+4de9 0VXRri3AjzD69Zm15katOSh5zwvJBVZwejwyhHUbXwl0NO9m6jWXeImYL52z/HEIbFO3pv RxBZCVbCMoHNtYJpKnZ135/35adTCMOMtGhLxmRgcoEyKa3aaez28VIrFCZObA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678355367; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gYpTZfNU4VuGIzxIJoRfRh+oLdYdH+kOnytAEzvpa44=; b=jaGRoTR5CI4ZsEXSkrJuKVF7NGay97GogiP7GyS0Ndx0liNVEdbcB9lVzUPvgAtR5+thUZ cVCogYKyJEE9TaZ52DWpIn7zOuP0O1a0RLt/3zBFG+odFfesi31uaqPDqYNMratp+Ua89U aDew9WenodI17wNBk9btbMPDTmnCHJrLbeyLI0FU2gD7KzD6fQqD+pOSKNBC58dhEoOJg0 JECzdaV56tPC1hIokoeS+wOWDtWE8FKwZR1tniKMEP22DuctOUqFQ4VOP3g+NNGs4KGjRQ NHhPzff4UoCvETn+dD2q+cPhwwmIMLO6u35wRSIm77EiWrzfp9nqXL6GK/ljQw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1678355367; a=rsa-sha256; cv=none; b=iy8+/3b4T2t6ccGR73BNhtggScv48vsZvopDDfd8g+dPiT9Xzt+DRDjYqXAfLTJQ21SNdS w00TLkJoD8atzhZJdpyCfdxu2MZj9I2OlZrFKxb8Y6wl97X/PJHmF9CBcWDFrDsbLeHP64 pyh38xgblIqu548w1xv6wZvy7DA5awTwnlVha/eVzuRW9sgpOesuIBRN255TZpA+HEruzr ANH3ezWKLwzS2edmun4tJAmhhJ7p2cskrM/42Xx2QYvMNpS0Gh/dMJ8iG/s0HXzPmy5FKz 9mom17fr4ttnKlxf0EdEBDU2axujEJdDVMLy2/97KkPxVmSNqTh4MPGd1geLig== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PXPXl4hsYz12tc; Thu, 9 Mar 2023 09:49:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 3299nRqj056613; Thu, 9 Mar 2023 09:49:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 3299nREf056612; Thu, 9 Mar 2023 09:49:27 GMT (envelope-from git) Date: Thu, 9 Mar 2023 09:49:27 GMT Message-Id: <202303090949.3299nREf056612@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Piotr Kubaj Subject: git: 16fdc23ac870 - main - www/librewolf: remove obsolete patches to fix build again on powerpc64 List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pkubaj X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 16fdc23ac87087a19e22bcfcc4ca21d1dacbe75b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by pkubaj: URL: https://cgit.FreeBSD.org/ports/commit/?id=16fdc23ac87087a19e22bcfcc4ca21d1dacbe75b commit 16fdc23ac87087a19e22bcfcc4ca21d1dacbe75b Author: Piotr Kubaj AuthorDate: 2023-03-09 09:48:57 +0000 Commit: Piotr Kubaj CommitDate: 2023-03-09 09:48:57 +0000 www/librewolf: remove obsolete patches to fix build again on powerpc64 --- www/librewolf/Makefile | 4 - www/librewolf/files/RustTabs.jsm | 1181 -------------------- www/librewolf/files/UniFFIGeneratedScaffolding.cpp | 283 ----- 3 files changed, 1468 deletions(-) diff --git a/www/librewolf/Makefile b/www/librewolf/Makefile index 6c2edbc101d1..24c0addd3dbb 100644 --- a/www/librewolf/Makefile +++ b/www/librewolf/Makefile @@ -92,10 +92,6 @@ post-patch: @${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \ ${WRKSRC}/browser/app/nsBrowserApp.cpp @${RM} ${WRKSRC}/mozconfig -.if ${ARCH} == powerpc64 - @${CP} ${PATCHDIR}/RustTabs.jsm ${WRKSRC}/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustTabs.jsm - @${CP} ${PATCHDIR}/UniFFIGeneratedScaffolding.cpp ${WRKSRC}/toolkit/components/uniffi-js/UniFFIGeneratedScaffolding.cpp -.endif post-install: ${CP} ${FIREFOX_DESKTOP} ${STAGEDIR}${PREFIX}/share/applications/librewolf.desktop diff --git a/www/librewolf/files/RustTabs.jsm b/www/librewolf/files/RustTabs.jsm deleted file mode 100644 index 95b1bd035b17..000000000000 --- a/www/librewolf/files/RustTabs.jsm +++ /dev/null @@ -1,1181 +0,0 @@ -// This file was autogenerated by the `uniffi-bindgen-gecko-js` crate. -// Trust me, you don't want to mess with it! - - - -"use strict"; - -var EXPORTED_SYMBOLS = []; - -// Write/Read data to/from an ArrayBuffer -class ArrayBufferDataStream { - constructor(arrayBuffer) { - this.dataView = new DataView(arrayBuffer); - this.pos = 0; - } - - readUint8() { - let rv = this.dataView.getUint8(this.pos); - this.pos += 1; - return rv; - } - - writeUint8(value) { - this.dataView.setUint8(this.pos, value); - this.pos += 1; - } - - readUint16() { - let rv = this.dataView.getUint16(this.pos); - this.pos += 2; - return rv; - } - - writeUint16(value) { - this.dataView.setUint16(this.pos, value); - this.pos += 2; - } - - readUint32() { - let rv = this.dataView.getUint32(this.pos); - this.pos += 4; - return rv; - } - - writeUint32(value) { - this.dataView.setUint32(this.pos, value); - this.pos += 4; - } - - readUint64() { - let rv = this.dataView.getBigUint64(this.pos); - this.pos += 8; - return Number(rv); - } - - writeUint64(value) { - this.dataView.setBigUint64(this.pos, BigInt(value)); - this.pos += 8; - } - - - readInt8() { - let rv = this.dataView.getInt8(this.pos); - this.pos += 1; - return rv; - } - - writeInt8(value) { - this.dataView.setInt8(this.pos, value); - this.pos += 1; - } - - readInt16() { - let rv = this.dataView.getInt16(this.pos); - this.pos += 2; - return rv; - } - - writeInt16(value) { - this.dataView.setInt16(this.pos, value); - this.pos += 2; - } - - readInt32() { - let rv = this.dataView.getInt32(this.pos); - this.pos += 4; - return rv; - } - - writeInt32(value) { - this.dataView.setInt32(this.pos, value); - this.pos += 4; - } - - readInt64() { - let rv = this.dataView.getBigInt64(this.pos); - this.pos += 8; - return Number(rv); - } - - writeInt64(value) { - this.dataView.setBigInt64(this.pos, BigInt(value)); - this.pos += 8; - } - - - readFloat32() { - let rv = this.dataView.getFloat32(this.pos); - this.pos += 4; - return rv; - } - - writeFloat32(value) { - this.dataView.setFloat32(this.pos, value); - this.pos += 4; - } - - readFloat64() { - let rv = this.dataView.getFloat64(this.pos); - this.pos += 8; - return rv; - } - - writeFloat64(value) { - this.dataView.setFloat64(this.pos, value); - this.pos += 8; - } - - - writeString(value) { - const encoder = new TextEncoder(); - // Note: in order to efficiently write this data, we first write the - // string data, reserving 4 bytes for the size. - const dest = new Uint8Array(this.dataView.buffer, this.pos + 4); - const encodeResult = encoder.encodeInto(value, dest); - if (encodeResult.read != value.length) { - throw new UniFFIError( - "writeString: out of space when writing to ArrayBuffer. Did the computeSize() method returned the wrong result?" - ); - } - const size = encodeResult.written; - // Next, go back and write the size before the string data - this.dataView.setUint32(this.pos, size); - // Finally, advance our position past both the size and string data - this.pos += size + 4; - } - - readString() { - const decoder = new TextDecoder(); - const size = this.readUint32(); - const source = new Uint8Array(this.dataView.buffer, this.pos, size) - const value = decoder.decode(source); - this.pos += size; - return value; - } - - // Reads a TabsStore pointer from the data stream - // UniFFI Pointers are **always** 8 bytes long. That is enforced - // by the C++ and Rust Scaffolding code. - readPointerTabsStore() { - const pointerId = 0; // tabs:TabsStore - const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos); - this.pos += 8; - return res; - } - - // Writes a TabsStore pointer into the data stream - // UniFFI Pointers are **always** 8 bytes long. That is enforced - // by the C++ and Rust Scaffolding code. - writePointerTabsStore(value) { - const pointerId = 0; // tabs:TabsStore - UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos); - this.pos += 8; - } - - - // Reads a TabsBridgedEngine pointer from the data stream - // UniFFI Pointers are **always** 8 bytes long. That is enforced - // by the C++ and Rust Scaffolding code. - readPointerTabsBridgedEngine() { - const pointerId = 1; // tabs:TabsBridgedEngine - const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos); - this.pos += 8; - return res; - } - - // Writes a TabsBridgedEngine pointer into the data stream - // UniFFI Pointers are **always** 8 bytes long. That is enforced - // by the C++ and Rust Scaffolding code. - writePointerTabsBridgedEngine(value) { - const pointerId = 1; // tabs:TabsBridgedEngine - UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos); - this.pos += 8; - } - -} - -function handleRustResult(result, liftCallback, liftErrCallback) { - switch (result.code) { - case "success": - return liftCallback(result.data); - - case "error": - throw liftErrCallback(result.data); - - case "internal-error": - let message = result.internalErrorMessage; - if (message) { - throw new UniFFIInternalError(message); - } else { - throw new UniFFIInternalError("Unknown error"); - } - - default: - throw new UniFFIError(`Unexpected status code: ${result.code}`); - } -} - -class UniFFIError { - constructor(message) { - this.message = message; - } -} - -class UniFFIInternalError extends UniFFIError {} - -// Base class for FFI converters -class FfiConverter { - static checkType(name, value) { - if (value === undefined ) { - throw TypeError(`${name} is undefined`); - } - if (value === null ) { - throw TypeError(`${name} is null`); - } - } -} - -// Base class for FFI converters that lift/lower by reading/writing to an ArrayBuffer -class FfiConverterArrayBuffer extends FfiConverter { - static lift(buf) { - return this.read(new ArrayBufferDataStream(buf)); - } - - static lower(value) { - const buf = new ArrayBuffer(this.computeSize(value)); - const dataStream = new ArrayBufferDataStream(buf); - this.write(dataStream, value); - return buf; - } -} - -// Symbols that are used to ensure that Object constructors -// can only be used with a proper UniFFI pointer -const uniffiObjectPtr = Symbol("uniffiObjectPtr"); -const constructUniffiObject = Symbol("constructUniffiObject"); - -class FfiConverterI64 extends FfiConverter { - static checkType(name, value) { - super.checkType(name, value); - if (!Number.isSafeInteger(value)) { - throw TypeError(`${name} exceeds the safe integer bounds (${value})`); - } - } - static computeSize() { - return 8; - } - static lift(value) { - return value; - } - static lower(value) { - return value; - } - static write(dataStream, value) { - dataStream.writeInt64(value) - } - static read(dataStream) { - return dataStream.readInt64() - } -} - -// Export the FFIConverter object to make external types work. -EXPORTED_SYMBOLS.push("FfiConverterI64"); - -class FfiConverterString extends FfiConverter { - static lift(buf) { - const decoder = new TextDecoder(); - const utf8Arr = new Uint8Array(buf); - return decoder.decode(utf8Arr); - } - static lower(value) { - const encoder = new TextEncoder(); - return encoder.encode(value).buffer; - } - - static write(dataStream, value) { - dataStream.writeString(value); - } - - static read(dataStream) { - return dataStream.readString(); - } - - static computeSize(value) { - const encoder = new TextEncoder(); - return 4 + encoder.encode(value).length - } -} - -// Export the FFIConverter object to make external types work. -EXPORTED_SYMBOLS.push("FfiConverterString"); - -class TabsBridgedEngine { - // Use `init` to instantiate this class. - // DO NOT USE THIS CONSTRUCTOR DIRECTLY - constructor(opts) { - if (!Object.prototype.hasOwnProperty.call(opts, constructUniffiObject)) { - throw new UniFFIError("Attempting to construct an object using the JavaScript constructor directly" + - "Please use a UDL defined constructor, or the init function for the primary constructor") - } - if (!opts[constructUniffiObject] instanceof UniFFIPointer) { - throw new UniFFIError("Attempting to create a UniFFI object with a pointer that is not an instance of UniFFIPointer") - } - this[uniffiObjectPtr] = opts[constructUniffiObject]; - } - lastSync() { - const liftResult = (result) => FfiConverterI64.lift(result); - const liftError = (data) => FfiConverterTypeTabsError.lift(data); - const functionCall = () => { - return UniFFIScaffolding.callAsync( - 7, // tabs:tabs_af8e_TabsBridgedEngine_last_sync - FfiConverterTypeTabsBridgedEngine.lower(this), - ) - } - try { - return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); - } catch (error) { - return Promise.reject(error) - }} - setLastSync(lastSync) { - const liftResult = (result) => undefined; - const liftError = (data) => FfiConverterTypeTabsError.lift(data); - const functionCall = () => { - FfiConverterI64.checkType("lastSync", lastSync); - return UniFFIScaffolding.callAsync( - 8, // tabs:tabs_af8e_TabsBridgedEngine_set_last_sync - FfiConverterTypeTabsBridgedEngine.lower(this), - FfiConverterI64.lower(lastSync), - ) - } - try { - return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); - } catch (error) { - return Promise.reject(error) - }} - syncId() { - const liftResult = (result) => FfiConverterOptionalstring.lift(result); - const liftError = (data) => FfiConverterTypeTabsError.lift(data); - const functionCall = () => { - return UniFFIScaffolding.callAsync( - 9, // tabs:tabs_af8e_TabsBridgedEngine_sync_id - FfiConverterTypeTabsBridgedEngine.lower(this), - ) - } - try { - return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); - } catch (error) { - return Promise.reject(error) - }} - resetSyncId() { - const liftResult = (result) => FfiConverterString.lift(result); - const liftError = (data) => FfiConverterTypeTabsError.lift(data); - const functionCall = () => { - return UniFFIScaffolding.callAsync( - 10, // tabs:tabs_af8e_TabsBridgedEngine_reset_sync_id - FfiConverterTypeTabsBridgedEngine.lower(this), - ) - } - try { - return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); - } catch (error) { - return Promise.reject(error) - }} - ensureCurrentSyncId(newSyncId) { - const liftResult = (result) => FfiConverterString.lift(result); - const liftError = (data) => FfiConverterTypeTabsError.lift(data); - const functionCall = () => { - FfiConverterString.checkType("newSyncId", newSyncId); - return UniFFIScaffolding.callAsync( - 11, // tabs:tabs_af8e_TabsBridgedEngine_ensure_current_sync_id - FfiConverterTypeTabsBridgedEngine.lower(this), - FfiConverterString.lower(newSyncId), - ) - } - try { - return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); - } catch (error) { - return Promise.reject(error) - }} - prepareForSync(clientData) { - const liftResult = (result) => undefined; - const liftError = (data) => FfiConverterTypeTabsError.lift(data); - const functionCall = () => { - FfiConverterString.checkType("clientData", clientData); - return UniFFIScaffolding.callAsync( - 12, // tabs:tabs_af8e_TabsBridgedEngine_prepare_for_sync - FfiConverterTypeTabsBridgedEngine.lower(this), - FfiConverterString.lower(clientData), - ) - } - try { - return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); - } catch (error) { - return Promise.reject(error) - }} - syncStarted() { - const liftResult = (result) => undefined; - const liftError = (data) => FfiConverterTypeTabsError.lift(data); - const functionCall = () => { - return UniFFIScaffolding.callAsync( - 13, // tabs:tabs_af8e_TabsBridgedEngine_sync_started - FfiConverterTypeTabsBridgedEngine.lower(this), - ) - } - try { - return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); - } catch (error) { - return Promise.reject(error) - }} - storeIncoming(incomingEnvelopesAsJson) { - const liftResult = (result) => undefined; - const liftError = (data) => FfiConverterTypeTabsError.lift(data); - const functionCall = () => { - FfiConverterSequencestring.checkType("incomingEnvelopesAsJson", incomingEnvelopesAsJson); - return UniFFIScaffolding.callAsync( - 14, // tabs:tabs_af8e_TabsBridgedEngine_store_incoming - FfiConverterTypeTabsBridgedEngine.lower(this), - FfiConverterSequencestring.lower(incomingEnvelopesAsJson), - ) - } - try { - return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); - } catch (error) { - return Promise.reject(error) - }} - apply() { - const liftResult = (result) => FfiConverterSequencestring.lift(result); - const liftError = (data) => FfiConverterTypeTabsError.lift(data); - const functionCall = () => { - return UniFFIScaffolding.callAsync( - 15, // tabs:tabs_af8e_TabsBridgedEngine_apply - FfiConverterTypeTabsBridgedEngine.lower(this), - ) - } - try { - return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); - } catch (error) { - return Promise.reject(error) - }} - setUploaded(newTimestamp,uploadedIds) { - const liftResult = (result) => undefined; - const liftError = (data) => FfiConverterTypeTabsError.lift(data); - const functionCall = () => { - FfiConverterI64.checkType("newTimestamp", newTimestamp); - FfiConverterSequenceTypeTabsGuid.checkType("uploadedIds", uploadedIds); - return UniFFIScaffolding.callAsync( - 16, // tabs:tabs_af8e_TabsBridgedEngine_set_uploaded - FfiConverterTypeTabsBridgedEngine.lower(this), - FfiConverterI64.lower(newTimestamp), - FfiConverterSequenceTypeTabsGuid.lower(uploadedIds), - ) - } - try { - return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); - } catch (error) { - return Promise.reject(error) - }} - syncFinished() { - const liftResult = (result) => undefined; - const liftError = (data) => FfiConverterTypeTabsError.lift(data); - const functionCall = () => { - return UniFFIScaffolding.callAsync( - 17, // tabs:tabs_af8e_TabsBridgedEngine_sync_finished - FfiConverterTypeTabsBridgedEngine.lower(this), - ) - } - try { - return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); - } catch (error) { - return Promise.reject(error) - }} - reset() { - const liftResult = (result) => undefined; - const liftError = (data) => FfiConverterTypeTabsError.lift(data); - const functionCall = () => { - return UniFFIScaffolding.callAsync( - 18, // tabs:tabs_af8e_TabsBridgedEngine_reset - FfiConverterTypeTabsBridgedEngine.lower(this), - ) - } - try { - return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); - } catch (error) { - return Promise.reject(error) - }} - wipe() { - const liftResult = (result) => undefined; - const liftError = (data) => FfiConverterTypeTabsError.lift(data); - const functionCall = () => { - return UniFFIScaffolding.callAsync( - 19, // tabs:tabs_af8e_TabsBridgedEngine_wipe - FfiConverterTypeTabsBridgedEngine.lower(this), - ) - } - try { - return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); - } catch (error) { - return Promise.reject(error) - }} - -} - -class FfiConverterTypeTabsBridgedEngine extends FfiConverter { - static lift(value) { - const opts = {}; - opts[constructUniffiObject] = value; - return new TabsBridgedEngine(opts); - } - - static lower(value) { - return value[uniffiObjectPtr]; - } - - static read(dataStream) { - return this.lift(dataStream.readPointerTabsBridgedEngine()); - } - - static write(dataStream, value) { - dataStream.writePointerTabsBridgedEngine(value[uniffiObjectPtr]); - } - - static computeSize(value) { - return 8; - } -} - -EXPORTED_SYMBOLS.push("TabsBridgedEngine"); - -// Export the FFIConverter object to make external types work. -EXPORTED_SYMBOLS.push("FfiConverterTypeTabsBridgedEngine"); - -class TabsStore { - // Use `init` to instantiate this class. - // DO NOT USE THIS CONSTRUCTOR DIRECTLY - constructor(opts) { - if (!Object.prototype.hasOwnProperty.call(opts, constructUniffiObject)) { - throw new UniFFIError("Attempting to construct an object using the JavaScript constructor directly" + - "Please use a UDL defined constructor, or the init function for the primary constructor") - } - if (!opts[constructUniffiObject] instanceof UniFFIPointer) { - throw new UniFFIError("Attempting to create a UniFFI object with a pointer that is not an instance of UniFFIPointer") - } - this[uniffiObjectPtr] = opts[constructUniffiObject]; - } - /** - * An async constructor for TabsStore. - * - * @returns {Promise}: A promise that resolves - * to a newly constructed TabsStore - */ - static init(path) { - const liftResult = (result) => FfiConverterTypeTabsStore.lift(result); - const liftError = null; - const functionCall = () => { - FfiConverterString.checkType("path", path); - return UniFFIScaffolding.callAsync( - 0, // tabs:tabs_af8e_TabsStore_new - FfiConverterString.lower(path), - ) - } - try { - return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); - } catch (error) { - return Promise.reject(error) - }} - getAll() { - const liftResult = (result) => FfiConverterSequenceTypeClientRemoteTabs.lift(result); - const liftError = null; - const functionCall = () => { - return UniFFIScaffolding.callAsync( - 1, // tabs:tabs_af8e_TabsStore_get_all - FfiConverterTypeTabsStore.lower(this), - ) - } - try { - return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); - } catch (error) { - return Promise.reject(error) - }} - setLocalTabs(remoteTabs) { - const liftResult = (result) => undefined; - const liftError = null; - const functionCall = () => { - FfiConverterSequenceTypeRemoteTabRecord.checkType("remoteTabs", remoteTabs); - return UniFFIScaffolding.callAsync( - 2, // tabs:tabs_af8e_TabsStore_set_local_tabs - FfiConverterTypeTabsStore.lower(this), - FfiConverterSequenceTypeRemoteTabRecord.lower(remoteTabs), - ) - } - try { - return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); - } catch (error) { - return Promise.reject(error) - }} - registerWithSyncManager() { - const liftResult = (result) => undefined; - const liftError = null; - const functionCall = () => { - return UniFFIScaffolding.callAsync( - 3, // tabs:tabs_af8e_TabsStore_register_with_sync_manager - FfiConverterTypeTabsStore.lower(this), - ) - } - try { - return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); - } catch (error) { - return Promise.reject(error) - }} - reset() { - const liftResult = (result) => undefined; - const liftError = (data) => FfiConverterTypeTabsError.lift(data); - const functionCall = () => { - return UniFFIScaffolding.callAsync( - 4, // tabs:tabs_af8e_TabsStore_reset - FfiConverterTypeTabsStore.lower(this), - ) - } - try { - return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); - } catch (error) { - return Promise.reject(error) - }} - sync(keyId,accessToken,syncKey,tokenserverUrl,localId) { - const liftResult = (result) => FfiConverterString.lift(result); - const liftError = (data) => FfiConverterTypeTabsError.lift(data); - const functionCall = () => { - FfiConverterString.checkType("keyId", keyId); - FfiConverterString.checkType("accessToken", accessToken); - FfiConverterString.checkType("syncKey", syncKey); - FfiConverterString.checkType("tokenserverUrl", tokenserverUrl); - FfiConverterString.checkType("localId", localId); - return UniFFIScaffolding.callAsync( - 5, // tabs:tabs_af8e_TabsStore_sync - FfiConverterTypeTabsStore.lower(this), - FfiConverterString.lower(keyId), - FfiConverterString.lower(accessToken), - FfiConverterString.lower(syncKey), - FfiConverterString.lower(tokenserverUrl), - FfiConverterString.lower(localId), - ) - } - try { - return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); - } catch (error) { - return Promise.reject(error) - }} - bridgedEngine() { - const liftResult = (result) => FfiConverterTypeTabsBridgedEngine.lift(result); - const liftError = null; - const functionCall = () => { - return UniFFIScaffolding.callAsync( - 6, // tabs:tabs_af8e_TabsStore_bridged_engine - FfiConverterTypeTabsStore.lower(this), - ) - } - try { - return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); - } catch (error) { - return Promise.reject(error) - }} - -} - -class FfiConverterTypeTabsStore extends FfiConverter { - static lift(value) { - const opts = {}; - opts[constructUniffiObject] = value; - return new TabsStore(opts); - } - - static lower(value) { - return value[uniffiObjectPtr]; - } - - static read(dataStream) { - return this.lift(dataStream.readPointerTabsStore()); - } - - static write(dataStream, value) { - dataStream.writePointerTabsStore(value[uniffiObjectPtr]); - } - - static computeSize(value) { - return 8; - } -} - -EXPORTED_SYMBOLS.push("TabsStore"); - -// Export the FFIConverter object to make external types work. -EXPORTED_SYMBOLS.push("FfiConverterTypeTabsStore"); - -class ClientRemoteTabs { - constructor(clientId,clientName,deviceType,remoteTabs) { - FfiConverterString.checkType("clientId", clientId); - FfiConverterString.checkType("clientName", clientName); - FfiConverterTypeTabsDeviceType.checkType("deviceType", deviceType); - FfiConverterSequenceTypeRemoteTabRecord.checkType("remoteTabs", remoteTabs); - this.clientId = clientId; - this.clientName = clientName; - this.deviceType = deviceType; - this.remoteTabs = remoteTabs; - } - equals(other) { - return ( - this.clientId == other.clientId && - this.clientName == other.clientName && - this.deviceType == other.deviceType && - this.remoteTabs == other.remoteTabs - ) - } -} - -class FfiConverterTypeClientRemoteTabs extends FfiConverter { - static lift(buf) { - return this.read(new ArrayBufferDataStream(buf)); - } - static lower(value) { - const buf = new ArrayBuffer(this.computeSize(value)); - const dataStream = new ArrayBufferDataStream(buf); - this.write(dataStream, value); - return buf; - } - static read(dataStream) { - return new ClientRemoteTabs( - FfiConverterString.read(dataStream), - FfiConverterString.read(dataStream), - FfiConverterTypeTabsDeviceType.read(dataStream), - FfiConverterSequenceTypeRemoteTabRecord.read(dataStream) - ); - } - static write(dataStream, value) { - FfiConverterString.write(dataStream, value.clientId); - FfiConverterString.write(dataStream, value.clientName); - FfiConverterTypeTabsDeviceType.write(dataStream, value.deviceType); - FfiConverterSequenceTypeRemoteTabRecord.write(dataStream, value.remoteTabs); - } - - static computeSize(value) { - let totalSize = 0; - totalSize += FfiConverterString.computeSize(value.clientId); - totalSize += FfiConverterString.computeSize(value.clientName); - totalSize += FfiConverterTypeTabsDeviceType.computeSize(value.deviceType); - totalSize += FfiConverterSequenceTypeRemoteTabRecord.computeSize(value.remoteTabs); - return totalSize - } -} - -EXPORTED_SYMBOLS.push("ClientRemoteTabs"); - -// Export the FFIConverter object to make external types work. -EXPORTED_SYMBOLS.push("FfiConverterTypeClientRemoteTabs"); - -class RemoteTabRecord { - constructor(title,urlHistory,icon,lastUsed) { - FfiConverterString.checkType("title", title); - FfiConverterSequencestring.checkType("urlHistory", urlHistory); - FfiConverterOptionalstring.checkType("icon", icon); - FfiConverterI64.checkType("lastUsed", lastUsed); - this.title = title; - this.urlHistory = urlHistory; - this.icon = icon; - this.lastUsed = lastUsed; - } - equals(other) { - return ( - this.title == other.title && - this.urlHistory == other.urlHistory && - this.icon == other.icon && - this.lastUsed == other.lastUsed - ) - } -} - -class FfiConverterTypeRemoteTabRecord extends FfiConverter { - static lift(buf) { - return this.read(new ArrayBufferDataStream(buf)); - } - static lower(value) { - const buf = new ArrayBuffer(this.computeSize(value)); - const dataStream = new ArrayBufferDataStream(buf); - this.write(dataStream, value); - return buf; - } - static read(dataStream) { - return new RemoteTabRecord( - FfiConverterString.read(dataStream), - FfiConverterSequencestring.read(dataStream), - FfiConverterOptionalstring.read(dataStream), - FfiConverterI64.read(dataStream) - ); - } - static write(dataStream, value) { - FfiConverterString.write(dataStream, value.title); - FfiConverterSequencestring.write(dataStream, value.urlHistory); - FfiConverterOptionalstring.write(dataStream, value.icon); - FfiConverterI64.write(dataStream, value.lastUsed); - } - - static computeSize(value) { - let totalSize = 0; - totalSize += FfiConverterString.computeSize(value.title); - totalSize += FfiConverterSequencestring.computeSize(value.urlHistory); - totalSize += FfiConverterOptionalstring.computeSize(value.icon); - totalSize += FfiConverterI64.computeSize(value.lastUsed); - return totalSize - } -} - -EXPORTED_SYMBOLS.push("RemoteTabRecord"); - -// Export the FFIConverter object to make external types work. -EXPORTED_SYMBOLS.push("FfiConverterTypeRemoteTabRecord"); - -const TabsDeviceType = { - DESKTOP: 1, - MOBILE: 2, - TABLET: 3, - VR: 4, - TV: 5, - UNKNOWN: 6, -}; - -Object.freeze(TabsDeviceType); -class FfiConverterTypeTabsDeviceType extends FfiConverterArrayBuffer { - static read(dataStream) { - switch (dataStream.readInt32()) { - case 1: - return TabsDeviceType.DESKTOP - case 2: - return TabsDeviceType.MOBILE - case 3: - return TabsDeviceType.TABLET - case 4: - return TabsDeviceType.VR - case 5: - return TabsDeviceType.TV - case 6: - return TabsDeviceType.UNKNOWN - default: - return new Error("Unknown TabsDeviceType variant"); - } - } - - static write(dataStream, value) { - if (value === TabsDeviceType.DESKTOP) { - dataStream.writeInt32(1); - return; - } - if (value === TabsDeviceType.MOBILE) { - dataStream.writeInt32(2); - return; - } - if (value === TabsDeviceType.TABLET) { - dataStream.writeInt32(3); - return; - } - if (value === TabsDeviceType.VR) { - dataStream.writeInt32(4); - return; - } - if (value === TabsDeviceType.TV) { - dataStream.writeInt32(5); - return; - } - if (value === TabsDeviceType.UNKNOWN) { - dataStream.writeInt32(6); - return; - } - return new Error("Unknown TabsDeviceType variant"); - } - - static computeSize(value) { - return 4; - } -} - -EXPORTED_SYMBOLS.push("TabsDeviceType"); - -// Export the FFIConverter object to make external types work. -EXPORTED_SYMBOLS.push("FfiConverterTypeTabsDeviceType"); - - - -class TabsError extends Error {} -EXPORTED_SYMBOLS.push("TabsError"); - - -class SyncAdapterError extends TabsError { - - constructor(message, ...params) { - super(...params); - this.message = message; - } -} -EXPORTED_SYMBOLS.push("SyncAdapterError"); -class SyncResetError extends TabsError { - - constructor(message, ...params) { - super(...params); - this.message = message; - } -} -EXPORTED_SYMBOLS.push("SyncResetError"); -class JsonError extends TabsError { - - constructor(message, ...params) { - super(...params); - this.message = message; - } -} -EXPORTED_SYMBOLS.push("JsonError"); -class MissingLocalIdError extends TabsError { - - constructor(message, ...params) { - super(...params); - this.message = message; - } -} -EXPORTED_SYMBOLS.push("MissingLocalIdError"); -class UrlParseError extends TabsError { - - constructor(message, ...params) { - super(...params); - this.message = message; - } -} -EXPORTED_SYMBOLS.push("UrlParseError"); *** 521 LINES SKIPPED ***