Skip to content

Plugin context excludes majority of global object variables/methods #606

@Yanrishatum

Description

@Yanrishatum

Describe the bug
Current plugin launcher omits most variables/methods from global object, for example queueMicrotask, setTimeout, setImmediate, setInterval, btoa, atob, structuredClone.

To reproduce
The following plugin would not work, due to setTimeout being undefined:

module.exports = function initPlugin() {
  setTimeout(() => console.log(""), 1000);
}

Additional context
This is likely an oversight when creating the context for Script.runInContext call to execute the plugin as it overrides global object.

Relevant code segment:
https://github.com/thepeacockproject/Peacock/blob/master/components/controller.ts#L1218-L1232

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions