Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple User Script Worlds proposal polish #691

Merged
merged 3 commits into from
Nov 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions proposals/multiple_user_script_worlds.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,25 @@ Relevant methods and types:

+ /**
+ * If specified, specifies a specific user script world ID to execute in.
+ * Only valid if `world` is omitted or is `USER_SCRIPT`. If omitted, the
+ * script will execute in the default user script world.
+ * Only valid if `world` is omitted or is `USER_SCRIPT`. If `worldId` is
+ * omitted, the script will execute in the default user script world.
+ * Values with leading underscores (`_`) are reserved.
+ */
+ worldId?: string;
}

...

export function configureWorld(config: WorldProperties): Promise<void>;

export function getScripts(filter?: UserScriptFilter[]): Promise<RegisteredUserScript[]>;

export function register(scripts: RegisteredUserScript): Promise<void>;

export function unregister(filter?: UserScriptFilter[]): Promise<void>;

export function update(scripts: RegisteredUserScript[]): Promise<void>;

+ /**
+ * Resets the configuration for a given world. Any scripts that inject into
+ * the world with the specified ID will use the default world configuration.
Expand All @@ -165,8 +175,9 @@ Relevant methods and types:
}
```

Note that the signatures of the related functions, including `configureWorld()`,
`register()`, and others are left unchanged.
Note that save for the introduction of `worldId` on these interfaces,
the signatures of the related functions - `configureWorld()`,
`register()`, and others – are left unchanged.

When the developer specifies a `RegisteredUserScript`, the browser will use a
separate user script world when injecting the scripts into a document. If
Expand Down