Skip to content

[Bug]: When calling BrowserWindow.webContents.reload or BrowserWindow.loadURL, the execution order of the Chrome extension is incorrect. #43221

Closed as not planned

Description

@huangnana520

Preflight Checklist

Electron Version

28.3.3

What operating system(s) are you using?

Windows

Operating System Version

window10

What arch are you using?

x64

Last Known Working Electron version

No response

Expected Behavior

chrome extension manifest
{"content_scripts":[{"run_at":"document_start","matches":["<all_urls>"],"js":["content.js"],"all_frames":true}]}

HTML
`

<script src="chrome-extension://jcmaajlodmiihcimfpdmoacbnchchiif/dist/Vencord.js" id="vencord-script" data-extension-base-url="chrome-extension://jcmaajlodmiihcimfpdmoacbnchchiif/" data-version="1.9.5"></script> <title>xx</title>
<script src="/assets/web.7dd92f74c71ef3eed57a.js" defer=""></script><script src="/assets/sentry.2e0499c86d1c7e90d3e4.js" defer=""></script> `

app index.js
`
app.whenReady().then(async () => {
const mainWin = new BrowserWindow(/**/)

// loadExtension
const path_ = path.join(_dirname, '..', 'VencordExtension');
await session.defaultSession.loadExtension(path
);
})
`

The expectation is that the Chrome extension's execution timing, configured as document_start in the manifest, should precede other JS scripts in the HTML.

Actual Behavior

When the application loads for the first time, the Chrome extension always executes according to the timing defined in the manifest, preceding other JS scripts in the HTML. However, after calling BrowserWindow.webContents.reload or BrowserWindow.loadURL, the extension's execution timing is always behind that of the other JS scripts in the HTML.

Testcase Gist URL

No response

Additional Information

No response

Activity

  1. electron-issue-triage commented on Aug 6, 2024

    @electron-issue-triage

    Hello @huangnana520. Thanks for reporting this and helping to make Electron better!

    The version of Electron reported in this issue has reached end-of-life and is no longer supported. If you're still experiencing this issue on a supported version of Electron, please update this issue to reflect that version of Electron.

    Now adding the blocked/need-info ❌ Cannot proceed without more information label for this reason. This issue will be closed in 10 days if the above is not addressed.

  2. codebytere commented on Sep 9, 2024

    @codebytere
    Member

    We haven't gotten a response to our questions in our comment above. With only the information that is currently in the issue, we don't have enough information to take action. In this event, i'm going to go ahead and close this but can reopen should you follow up with more info!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    28-x-yblocked/need-info ❌bug 🪲platform/windows

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions