Skip to content

如何把字符串通过dart代码转成quickjs bytecode #102

Closed
@zjt123

Description

@zjt123

Affected version

main

No same issues found.

  • Yes, I search all issues but not found.

Steps to Reproduce

字符串是动态的,需要把这个字符串通过dart代码转成quickjs bytecode追加到test.kbc1文件的内容里面。

Code example

字符串是动态的,需要把这个字符串转成quickjs bytecode追加到test.kbc1文件的内容里面。

String myStr = "window.a = 'hello'"// test.kbc1会读取这个window.a值
WebfBundle entrypoint = _entrypoint!;
Uint8List data = entrypoint.data!;
List targetData = data as List;
List myStrList = utf8.encode(myStr);
data = Uint8List.fromList(myStrList + targetData);

执行evaluateQuickjsByteCode是有问题的,执行异常。 如果test.kbc1是test.js的话 用evaluateScripts方法执行的话是没问题的。

是不是我的代码转换的不对?应该如何转换?

Expected results

如何把字符串通过正确的dart代码转成quickjs bytecode??

Actual results

如何把字符串通过正确的dart代码转成quickjs bytecode??

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions