[Feature Request] Implement script isolation · Issue #749 · quoid/userscripts · GitHub
Skip to content

[Feature Request] Implement script isolation #749

Description

@esterTion

Step to reproduce

test1.user.js

// ==UserScript==
// @name        Test collision 1
// @namespace   userscript
// @license     MIT
// @match       https://example.com/*
// @version     1.0
// @author      esterTion
// @run-at      document-end
// @description 
// ==/UserScript==

function collideName() {
	alert('script 1')
}

setTimeout(() => {
collideName()
}, 1000)

test2.user.js

// ==UserScript==
// @name        Test collision 2
// @namespace   userscript
// @license     MIT
// @match       https://example.com/*
// @version     1.0
// @author      esterTion
// @run-at      document-end
// @description 
// ==/UserScript==

function collideName() {
	alert('script 2')
}

setTimeout(() => {
collideName()
}, 1000)

Navigate to https://example.com

Expected behaviour

Two alert boxs with script 1 and script 2 respectively pops up

Current behaviour

Two alert boxs with either script 1 or script 2 pops up twice, which one exactly is random

Side note

This can be prevented by wrapping all code inside (async function() { ... })(), but it is definitely frustrating
when code works in other user script manager randomly stops working half the time here

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions