brave / brave-browser

Brave browser for Android, iOS, Linux, macOS, Windows.
https://brave.com
Mozilla Public License 2.0
17.8k stars 2.33k forks source link

Greaselion script doesn't run when browser is launched with open tabs #11825

Open emerick opened 4 years ago

emerick commented 4 years ago

Create a Greaselion.json file like the following and a simple script that just prints Hello, world! to the console:

  {
    "urls": [
      "https://twitter.com/*",
      "https://*.twitter.com/*"
    ],
    "scripts": [
      "myscript.js"
    ]
  }

If you launch the browser clean (with no open pages) and then navigate to https://twitter.com/emerick, it will correctly run the content script and display Hello, world! on the console.

If you close the browser and relaunch it (such that it now opens https://twitter.com/emerick automatically on startup), the content script will not run and nothing will be shown on the console. If you refresh the page, the content script will finally load and run as expected.

emerick commented 3 years ago

Note: This only happens for the active tab, not all tabs.

emerick commented 3 years ago

Might need to rethink our approach here, based on comments in other issues like these:

https://bugs.chromium.org/p/chromium/issues/detail?id=70256#c4 https://bugs.chromium.org/p/chromium/issues/detail?id=708354#c7

Those comments imply that extensions must be fully loaded before attempting any page loads.

Miyayes commented 2 years ago

Workaround: You can refresh the page and it should work. (Please give a few seconds for the Tip buttons to show up.)